Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing hardhat to anvil client in tests; #103

Merged
merged 31 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
1fbd05e
Changing hardhat to anvil client in tests;
Oct 11, 2023
d8ae99b
Installing foundry and running anvil in the github actions;
Oct 17, 2023
c27a526
Fixing script to install foundry
Oct 17, 2023
78be59e
Fixing commands to install foundry (2);
Oct 17, 2023
ee49610
Another try to install foundry;
Oct 17, 2023
b8777fd
using custom bash to install foundry;
Oct 17, 2023
741e78b
no message
Oct 17, 2023
0621250
refreshing bash before running anvil;
Oct 17, 2023
876e9a6
adding foundry to test needs property;
Oct 17, 2023
6a960ca
Yet Another Try to recognize anvil command;
Oct 17, 2023
547984c
Running the Anvil Client in the Foundry tab, hopefully it will recogn…
Oct 17, 2023
3d68f79
replacing wrongly removed environment variables;
Oct 17, 2023
a4981ca
Putting the Foundry in github setup action;
Oct 17, 2023
746dd3f
Fixing foundry setup action;
Oct 17, 2023
13b92f8
fixing wrong parameter "test > needs", foundry no longer exists;
Oct 17, 2023
ac375de
secrets.ETHEREUM_RPC_URL is not available in setup/action.yml, trying…
Oct 17, 2023
cb58df9
Setup @viem/anvil for automatic fork setup
agualis Oct 18, 2023
9d6f0ac
mend
agualis Oct 18, 2023
3119a49
Fix lint
agualis Oct 18, 2023
457c50c
Refactor .env vars
agualis Oct 18, 2023
1a7d990
Fix VITE envs in checks.yml
agualis Oct 18, 2023
357d8be
Debug: exclude weighted integration tests
agualis Oct 19, 2023
be6bf80
add threads false to test setup
agualis Oct 19, 2023
1ff65fd
Avoid viem prefix in CI envs
agualis Oct 19, 2023
1e7c494
Clean integration tests
agualis Oct 19, 2023
18151a8
Add weighted tests back
agualis Oct 19, 2023
89ded1b
Bump viem and vitest
agualis Oct 19, 2023
8b7744a
Keep old viem version
agualis Oct 19, 2023
eaa0218
Merge pull request #109 from balancer/viem-anvil
johngrantuk Oct 20, 2023
d2c181f
Merge branch 'join' into anvil-tests
agualis Oct 20, 2023
a5bc0da
Fix pnpm loclkfile
agualis Oct 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ jobs:
uses: ./.github/actions/setup
- name: Lint & format code
run: pnpm format & pnpm lint

test:
name: Test
needs: install
Expand All @@ -42,14 +41,15 @@ jobs:
- uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
- name: Run local fork in background for integration tests
run: npx hardhat --tsconfig tsconfig.testing.json node --hostname 127.0.0.1 --fork ${{ secrets.ETHEREUM_RPC_URL }} &
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Run Anvil Node
run: anvil --fork-url ${{ secrets.ETHEREUM_RPC_URL }} &
- name: Test
run: pnpm test:ci
env:
ETHEREUM_RPC_URL: ${{ secrets.ETHEREUM_RPC_URL }}
POLYGON_RPC_URL: ${{ secrets.POLYGON_RPC_URL }}

build:
name: Build
needs: install
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,6 @@ typechain-types
cache
artifacts

#IDE
.idea

10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,13 @@ If your platform does not support one of the required features, it is also possi
Testing requires access to an archive node for onchain quote comparisons. This can be done using Infura.

`pnpm test`

## Anvil client
To download and install the anvil client, run the following commands (MacOS):
- `curl -L https://foundry.paradigm.xyz | bash`
- `brew install libusb`
- `source /Users/$(whoami)/.zshenv`
- `foundryup`

For other SO's check https://book.getfoundry.sh/getting-started/installation
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"test:ci": "vitest run",
"changeset": "changeset",
"changeset:release": "pnpm build && changeset publish",
"node": "npx hardhat node --tsconfig tsconfig.testing.json --fork $(. ./.env && echo $ETHEREUM_RPC_URL)"
"node": "anvil --fork-url $(. ./.env && echo $ETHEREUM_RPC_URL)"
},
"dependencies": {
"async-retry": "^1.3.3",
Expand Down
4 changes: 2 additions & 2 deletions test/lib/utils/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const approveToken = async (
args: [BALANCER_VAULT, amount],
});

const txReceipt = await client.getTransactionReceipt({
const txReceipt = await client.waitForTransactionReceipt({
hash,
});
return txReceipt.status === 'success';
Expand Down Expand Up @@ -107,7 +107,7 @@ export async function sendTransactionGetBalances(
to,
value,
});
const transactionReceipt = await client.getTransactionReceipt({
const transactionReceipt = await client.waitForTransactionReceipt({
hash,
});
const { gasUsed, effectiveGasPrice } = transactionReceipt;
Expand Down
4 changes: 2 additions & 2 deletions test/weightedExit.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ describe('weighted exit test', () => {

// get pool state from api
const poolInput = await api.getPool(poolId);

const client = createTestClient({
mode: 'hardhat',
mode: 'anvil',
chain: CHAINS[chainId],
transport: http(rpcUrl),
})
Expand Down
2 changes: 1 addition & 1 deletion test/weightedJoin.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe('weighted join test', () => {
const poolInput = await api.getPool(poolId);

const client = createTestClient({
mode: 'hardhat',
mode: 'anvil',
chain: CHAINS[chainId],
transport: http(rpcUrl),
})
Expand Down
Loading