Skip to content

Commit

Permalink
Merge pull request #89 from immutable/SMR-2459-invariant-testing-3
Browse files Browse the repository at this point in the history
Smr 2459 invariant testing
  • Loading branch information
wcgcyx authored Mar 6, 2024
2 parents 8dd60ae + d731c78 commit 562270d
Show file tree
Hide file tree
Showing 10 changed files with 1,367 additions and 3 deletions.
37 changes: 34 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ jobs:
with:
submodules: recursive

- name: Set Node.js 18.18.x
uses: actions/setup-node@v3
with:
node-version: 18.18.x

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
Expand All @@ -35,12 +40,38 @@ jobs:
forge build --sizes
id: build

- name: Run unit and integration tests
- name: Run install
uses: borales/actions-yarn@v4
with:
cmd: install

- name: Run build
uses: borales/actions-yarn@v4
with:
cmd: build

- name: Run Unit Tests
run: |
forge test --no-match-path "test/fork/**" -vvv
id: unit_integration_test
forge test --match-path "test/unit/**" -vvv
id: unit_test

- name: Run Integration Tests
run: |
forge test --match-path "test/integration/**" -vvv
id: integration_test

- name: Run Fuzz Tests
run: |
forge test --match-path "test/fuzz/**" -vvv
id: fuzz_test

- name: Run Fork Tests
run: |
forge test --match-path "test/fork/**" -vvvvv
id: fork_test

- name: Run Invariant Tests
run: |
yarn local:testchain
forge test --match-path "test/invariant/**" -vvvvv
id: invariant_test
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"local:ci": "cd scripts/localdev; rm -rf .child.bridge.contracts.json .root.bridge.contracts.json; ./ci.sh && ./deploy.sh && AXELAR_API_URL=skip npx mocha --require mocha-suppress-logs ../e2e/e2e.ts && ./stop.sh",
"local:chainonly": "cd scripts/localdev; LOCAL_CHAIN_ONLY=true ./start.sh",
"local:axelaronly": "cd scripts/localdev; npx ts-node axelar_setup.ts",
"local:testchain": "cd scripts/localdev; ./chains.sh",
"stop": "cd scripts/localdev; ./stop.sh"
},
"author": "",
Expand Down
10 changes: 10 additions & 0 deletions scripts/localdev/chains.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
set -ex
set -o pipefail

# Stop previous deployment.
./stop.sh

# Start root & child chain.
npx hardhat node --config ./rootchain.config.ts --port 8500 > /dev/null 2>&1 &
sleep 10
21 changes: 21 additions & 0 deletions scripts/localdev/resetchain.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";

const config: HardhatUserConfig = {
networks: {
hardhat: {
hardfork: "shanghai",
mining: {
auto: false,
interval: 1200
},
chainId: 2502,
accounts: [],
},
localhost: {
url: "http://127.0.0.1:8502/",
}
},
solidity: "0.8.19",
};
export default config;
Loading

0 comments on commit 562270d

Please sign in to comment.