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

fix: Uniswap e2e test "nonce too low" #7633

Merged
merged 1 commit into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { setup as e2eSetup } from '../fixtures/utils.js';
import { setup as e2eSetup, getL1WalletClient } from '../fixtures/utils.js';
import { type UniswapSetupContext, uniswapL1L2TestSuite } from '../shared/uniswap_l1_l2.js';

// This tests works on forked mainnet. There is a dump of the data in `dumpedState` such that we
Expand All @@ -18,9 +18,10 @@ const testSetup = async (): Promise<UniswapSetupContext> => {
deployL1ContractsValues,
wallets,
logger,
config,
} = await e2eSetup(2, { stateLoad: dumpedState });

const walletClient = deployL1ContractsValues.walletClient;
const walletClient = getL1WalletClient(config.rpcUrl, 1);
const publicClient = deployL1ContractsValues.publicClient;

const ownerWallet = wallets[0];
Expand Down
10 changes: 10 additions & 0 deletions yarn-project/end-to-end/src/fixtures/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,16 @@ export async function setup(
};
}

/** Returns an L1 wallet client for anvil using a well-known private key based on the index. */
export function getL1WalletClient(rpcUrl: string, index: number) {
const hdAccount = mnemonicToAccount(MNEMONIC, { addressIndex: index });
return createWalletClient({
account: hdAccount,
chain: foundry,
transport: http(rpcUrl),
});
}

/**
* Ensures there's a running Anvil instance and returns the RPC URL.
* @returns
Expand Down
Loading