Skip to content

Commit

Permalink
canary tests to use a fork
Browse files Browse the repository at this point in the history
  • Loading branch information
rahul-kothari committed Oct 9, 2023
1 parent a7710f0 commit 7080abc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions yarn-project/canary/src/dumps/uniswap_state.json

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion yarn-project/canary/src/uniswap_trade_on_l1_from_l2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
AccountWallet,
AztecAddress,
EthAddress,
EthCheatCodes,
Fr,
NotePreimage,
TxHash,
Expand Down Expand Up @@ -43,7 +44,10 @@ export const MNEMONIC = 'test test test test test test test test test test test
const WETH9_ADDRESS = EthAddress.fromString('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2');
const DAI_ADDRESS = EthAddress.fromString('0x6B175474E89094C44Da98b954EedeAC495271d0F');

const EXPECTED_FORKED_BLOCK = 17514288;
// This test runs against a fork of mainnet. We dump the state of the mainnet and laod it via the cheatcodes to avoid a infura RPC request
const dumpedState = 'src/dumps/uniswap_state';
// When taking a fork, use expected block number to improve speed. 0 if using dumped state
const EXPECTED_FORKED_BLOCK = 0; //17514288;

const pxeRpcUrl = PXE_URL;
const ethRpcUrl = ETHEREUM_HOST;
Expand Down Expand Up @@ -226,6 +230,8 @@ describe('uniswap_trade_on_l1_from_l2', () => {

beforeAll(async () => {
await waitForSandbox(pxe);
const ethCheatCodes = new EthCheatCodes(ethRpcUrl);
await ethCheatCodes.loadChainState(dumpedState);

walletClient = createWalletClient({
account: hdAccount,
Expand Down

0 comments on commit 7080abc

Please sign in to comment.