Skip to content

Commit

Permalink
chore: Create fixtures folder in E2E (#1419)
Browse files Browse the repository at this point in the history
Creates a folder for fixtures in E2E and moves:
- dumps
- fixtures.ts
- utils
- cross_chain_test_harness.ts

Not moving the `cheat_codes.ts` as @rahul-kothari was in progress of
moving that to another location already.

# Checklist:
Remove the checklist to signal you've completed it. Enable auto-merge if
the PR is ready to merge.
- [ ] If the pull request requires a cryptography review (e.g.
cryptographic algorithm implementations) I have added the 'crypto' tag.
- [ ] I have reviewed my diff in github, line by line and removed
unexpected formatting changes, testing logs, or commented-out code.
- [ ] Every change is related to the PR description.
- [ ] I have
[linked](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue)
this pull request to relevant issues (if any exist).
  • Loading branch information
LHerskind authored Aug 4, 2023
1 parent c8e7d53 commit b8972b4
Show file tree
Hide file tree
Showing 24 changed files with 32 additions and 27 deletions.
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/src/e2e_2_rpc_servers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
expectsNumOfEncryptedLogsInTheLastBlockToBe,
setup,
setupAztecRPCServer,
} from './utils.js';
} from './fixtures/utils.js';

const { SANDBOX_URL = '' } = process.env;

Expand Down
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/src/e2e_account_contracts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from '@aztec/noir-contracts/artifacts';
import { ChildContract } from '@aztec/noir-contracts/types';

import { CreateAccountImplFn, createNewAccount, deployContract, setup } from './utils.js';
import { CreateAccountImplFn, createNewAccount, deployContract, setup } from './fixtures/utils.js';

function itShouldBehaveLikeAnAccountContract(
abi: ContractAbi,
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/src/e2e_block_building.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { AztecRPC, TxStatus } from '@aztec/types';

import times from 'lodash.times';

import { setup } from './utils.js';
import { setup } from './fixtures/utils.js';

describe('e2e_block_building', () => {
let aztecNode: AztecNodeService | undefined;
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/src/e2e_cheat_codes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { AztecRPCServer } from '@aztec/aztec-rpc';
import { AztecRPC } from '@aztec/types';

import { CheatCodes } from './cheat_codes.js';
import { setup } from './utils.js';
import { setup } from './fixtures/utils.js';

describe('e2e_cheat_codes', () => {
let aztecNode: AztecNodeService | undefined;
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/end-to-end/src/e2e_cross_chain_messaging.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { DebugLogger } from '@aztec/foundation/log';
import { NonNativeTokenContract } from '@aztec/noir-contracts/types';
import { AztecRPC, TxStatus } from '@aztec/types';

import { CrossChainTestHarness } from './cross_chain/test_harness.js';
import { delay, setup } from './utils.js';
import { CrossChainTestHarness } from './fixtures/cross_chain_test_harness.js';
import { delay, setup } from './fixtures/utils.js';

describe('e2e_cross_chain_messaging', () => {
let aztecNode: AztecNodeService;
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/src/e2e_deploy_contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { DebugLogger } from '@aztec/foundation/log';
import { TestContractAbi } from '@aztec/noir-contracts/artifacts';
import { AztecRPC, TxStatus } from '@aztec/types';

import { setup } from './utils.js';
import { setup } from './fixtures/utils.js';

describe('e2e_deploy_contract', () => {
let aztecNode: AztecNodeService | undefined;
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/src/e2e_escrow_contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { EscrowContractAbi, ZkTokenContractAbi } from '@aztec/noir-contracts/art
import { EscrowContract, ZkTokenContract } from '@aztec/noir-contracts/types';
import { AztecRPC, PublicKey } from '@aztec/types';

import { setup } from './utils.js';
import { setup } from './fixtures/utils.js';

describe('e2e_escrow_contract', () => {
let aztecNode: AztecNodeService | undefined;
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/src/e2e_lending_contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { LendingContract } from '@aztec/noir-contracts/types';
import { AztecRPC, TxStatus } from '@aztec/types';

import { CheatCodes } from './cheat_codes.js';
import { setup } from './utils.js';
import { setup } from './fixtures/utils.js';

describe('e2e_lending_contract', () => {
let aztecNode: AztecNodeService | undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
expectUnencryptedLogsFromLastBlockToBe,
expectsNumOfEncryptedLogsInTheLastBlockToBe,
setup,
} from './utils.js';
} from './fixtures/utils.js';

describe('e2e_multiple_accounts_1_enc_key', () => {
let aztecNode: AztecNodeService | undefined;
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/src/e2e_nested_contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ChildContractAbi, ParentContractAbi } from '@aztec/noir-contracts/artif
import { ChildContract, ParentContract } from '@aztec/noir-contracts/types';
import { AztecRPC, TxStatus } from '@aztec/types';

import { setup } from './utils.js';
import { setup } from './fixtures/utils.js';

describe('e2e_nested_contract', () => {
let aztecNode: AztecNodeService | undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { retryUntil } from '@aztec/foundation/retry';
import { PokeableTokenContract } from '@aztec/noir-contracts/types';
import { AztecRPC, FunctionCall, PackedArguments, TxExecutionRequest, TxStatus } from '@aztec/types';

import { expectsNumOfEncryptedLogsInTheLastBlockToBe, setup } from './utils.js';
import { expectsNumOfEncryptedLogsInTheLastBlockToBe, setup } from './fixtures/utils.js';

/**
* Wallet implementation which creates a simple transaction request without any signing.
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/src/e2e_p2p_network.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { TestContractAbi } from '@aztec/noir-contracts/artifacts';
import { BootstrapNode, P2PConfig, createLibP2PPeerId, exportLibP2PPeerIdToString } from '@aztec/p2p';
import { AztecRPC, TxStatus } from '@aztec/types';

import { setup } from './utils.js';
import { setup } from './fixtures/utils.js';

const NUM_NODES = 4;
const NUM_TXS_PER_BLOCK = 4;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { DebugLogger } from '@aztec/foundation/log';
import { PendingCommitmentsContract } from '@aztec/noir-contracts/types';
import { AztecRPC, TxStatus } from '@aztec/types';

import { setup } from './utils.js';
import { setup } from './fixtures/utils.js';

describe('e2e_pending_commitments_contract', () => {
let aztecNode: AztecNodeService | undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { DebugLogger } from '@aztec/foundation/log';
import { NonNativeTokenContract } from '@aztec/noir-contracts/types';
import { AztecRPC, TxStatus } from '@aztec/types';

import { CrossChainTestHarness } from './cross_chain/test_harness.js';
import { delay, setup } from './utils.js';
import { CrossChainTestHarness } from './fixtures/cross_chain_test_harness.js';
import { delay, setup } from './fixtures/utils.js';

describe('e2e_public_cross_chain_messaging', () => {
let aztecNode: AztecNodeService | undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { AztecAddress, AztecRPC } from '@aztec/aztec.js';
import { EthAddress } from '@aztec/circuits.js';
import { DebugLogger } from '@aztec/foundation/log';

import { CrossChainTestHarness } from './cross_chain/test_harness.js';
import { delay, setup } from './utils.js';
import { CrossChainTestHarness } from './fixtures/cross_chain_test_harness.js';
import { delay, setup } from './fixtures/utils.js';

describe('e2e_public_to_private_messaging', () => {
let aztecNode: AztecNodeService | undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { AztecRPC, L2BlockL2Logs, TxStatus } from '@aztec/types';
import times from 'lodash.times';

import { CheatCodes } from './cheat_codes.js';
import { setup } from './utils.js';
import { setup } from './fixtures/utils.js';

describe('e2e_public_token_contract', () => {
let aztecNode: AztecNodeService | undefined;
Expand Down
6 changes: 5 additions & 1 deletion yarn-project/end-to-end/src/e2e_zk_token_contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import { DebugLogger } from '@aztec/foundation/log';
import { ZkTokenContract } from '@aztec/noir-contracts/types';
import { AztecRPC, TxStatus } from '@aztec/types';

import { expectUnencryptedLogsFromLastBlockToBe, expectsNumOfEncryptedLogsInTheLastBlockToBe, setup } from './utils.js';
import {
expectUnencryptedLogsFromLastBlockToBe,
expectsNumOfEncryptedLogsInTheLastBlockToBe,
setup,
} from './fixtures/utils.js';

describe('e2e_zk_token_contract', () => {
let aztecNode: AztecNodeService | undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { AztecRPC, TxStatus } from '@aztec/types';
import { Chain, HttpTransport, PublicClient, getContract } from 'viem';

import { CheatCodes } from '../cheat_codes.js';
import { deployAndInitializeNonNativeL2TokenContracts } from '../utils.js';
import { deployAndInitializeNonNativeL2TokenContracts } from './utils.js';

/**
* A Class for testing cross chain interactions, contains common interactions
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import {
} from 'viem';
import { mnemonicToAccount } from 'viem/accounts';

import { CheatCodes, L1CheatCodes } from './cheat_codes.js';
import { CheatCodes, L1CheatCodes } from '../cheat_codes.js';
import { MNEMONIC, localAnvil } from './fixtures.js';

const { SANDBOX_URL = '' } = process.env;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { NonNativeTokenContract } from '@aztec/noir-contracts/types';

import { Chain, HttpTransport, PublicClient } from 'viem';

import { delay, deployAndInitializeNonNativeL2TokenContracts, setNextBlockTimestamp, setup } from './utils.js';
import { delay, deployAndInitializeNonNativeL2TokenContracts, setNextBlockTimestamp, setup } from './fixtures/utils.js';

describe('archiver integration with l1 to l2 messages', () => {
let aztecNode: AztecNodeService | undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ import {
} from 'viem';
import { PrivateKeyAccount, privateKeyToAccount } from 'viem/accounts';

import { localAnvil } from './fixtures.js';
import { localAnvil } from './fixtures/fixtures.js';

// Accounts 4 and 5 of Anvil default startup with mnemonic: 'test test test test test test test test test test test junk'
const sequencerPK = '0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import { AztecRPC, TxStatus } from '@aztec/types';
import { getContract, parseEther } from 'viem';

import { CheatCodes } from './cheat_codes.js';
import { CrossChainTestHarness } from './cross_chain/test_harness.js';
import { delay, deployAndInitializeNonNativeL2TokenContracts, setup } from './utils.js';
import { CrossChainTestHarness } from './fixtures/cross_chain_test_harness.js';
import { delay, deployAndInitializeNonNativeL2TokenContracts, setup } from './fixtures/utils.js';

// PSA: This tests works on forked mainnet. There is a dump of the data in `dumpedState` such that we
// don't need to burn through RPC requests.
Expand All @@ -21,7 +21,8 @@ import { delay, deployAndInitializeNonNativeL2TokenContracts, setup } from './ut
// anvil --fork-url https://mainnet.infura.io/v3/9928b52099854248b3a096be07a6b23c --fork-block-number 17514288 --chain-id 31337
// For CI, this is configured in `run_tests.sh` and `docker-compose.yml`

const dumpedState = 'src/dumps/uniswap_state';
const dumpedState = 'src/fixtures/dumps/uniswap_state';
// When taking a dump use the block number of the fork to improve speed.
const EXPECTED_FORKED_BLOCK = 0; //17514288;
// We tell the archiver to only sync from this block.
process.env.SEARCH_START_BLOCK = EXPECTED_FORKED_BLOCK.toString();
Expand Down

0 comments on commit b8972b4

Please sign in to comment.