Skip to content

Commit

Permalink
feat: add CI
Browse files Browse the repository at this point in the history
  • Loading branch information
QEDK committed Dec 18, 2023
1 parent f6fa543 commit ca0a3a2
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 10 deletions.
57 changes: 53 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
name: test
name: Solidity CI

on: workflow_dispatch
on:
push:
branches: [main]
pull_request:
branches: [main]

env:
FOUNDRY_PROFILE: ci

jobs:
check:
test:
strategy:
fail-fast: true

name: Foundry project
name: Foundry
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -32,3 +36,48 @@ jobs:
run: |
forge test -vvv
id: test

slither:
strategy:
fail-fast: true

name: Slither
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- uses: crytic/slither-action@v0.3.0

coverage:
strategy:
fail-fast: true

name: Foundry coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Run Forge build
run: |
forge --version
forge build --sizes
id: build

- name: Run Forge tests
run: |
forge coverage
id: coverage
13 changes: 7 additions & 6 deletions src/AvailBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ contract AvailBridge is Initializable, Ownable2StepUpgradeable, ReentrancyGuardU
using Merkle for bytes32[];
using SafeERC20 for IERC20;

uint32 public constant AVAIL_DOMAIN = 1;
uint32 public constant ETH_DOMAIN = 2;
uint32 private constant AVAIL_DOMAIN = 1;
uint32 private constant ETH_DOMAIN = 2;
// slither-disable-next-line too-many-digits
bytes32 public constant ETH_ASSET_ID = 0x4554480000000000000000000000000000000000000000000000000000000000;
bytes32 private constant ETH_ASSET_ID = 0x4554480000000000000000000000000000000000000000000000000000000000;
bytes1 private constant TOKEN_TRANSFER_MESSAGE_TYPE = 0x02;
IVectorX public vectorx;
IWrappedAvail public avail;
uint256 public messageId;
Expand Down Expand Up @@ -216,7 +217,7 @@ contract AvailBridge is Initializable, Ownable2StepUpgradeable, ReentrancyGuardU
function sendAVL(bytes32 recipient, uint256 amount) external checkDestAmt(recipient, amount) {
uint256 id = messageId++;
Message memory message = Message(
0x02,
TOKEN_TRANSFER_MESSAGE_TYPE,
bytes32(bytes20(msg.sender)),
recipient,
ETH_DOMAIN,
Expand All @@ -234,7 +235,7 @@ contract AvailBridge is Initializable, Ownable2StepUpgradeable, ReentrancyGuardU
function sendETH(bytes32 recipient) external payable checkDestAmt(recipient, msg.value) {
uint256 id = messageId++;
Message memory message = Message(
0x02,
TOKEN_TRANSFER_MESSAGE_TYPE,
bytes32(bytes20(msg.sender)),
recipient,
ETH_DOMAIN,
Expand All @@ -254,7 +255,7 @@ contract AvailBridge is Initializable, Ownable2StepUpgradeable, ReentrancyGuardU
}
uint256 id = messageId++;
Message memory message = Message(
0x02,
TOKEN_TRANSFER_MESSAGE_TYPE,
bytes32(bytes20(msg.sender)),
recipient,
ETH_DOMAIN,
Expand Down

0 comments on commit ca0a3a2

Please sign in to comment.