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

test: run all e2e tests against sandbox #2891

Merged
merged 12 commits into from
Oct 24, 2023
33 changes: 10 additions & 23 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ jobs:
- *setup_env
- run:
name: "Test"
command: cond_run_script end-to-end ./scripts/run_tests_local e2e_sandbox_example.test.ts ./scripts/docker-compose-e2e-sandbox.yml
command: cond_run_script end-to-end ./scripts/run_tests_local e2e_sandbox_example.test.ts
environment: { DEBUG: "aztec:*" }

e2e-block-building:
Expand Down Expand Up @@ -819,7 +819,7 @@ jobs:
- *setup_env
- run:
name: "Test"
command: cond_run_script end-to-end ./scripts/run_tests_local e2e_p2p_network.test.ts
command: cond_run_script end-to-end ./scripts/run_tests_local e2e_p2p_network.test.ts ./scripts/docker-compose-no-sandbox.yml
environment: { DEBUG: "aztec:*" }

e2e-browser-sandbox:
Expand All @@ -831,7 +831,7 @@ jobs:
- *setup_env
- run:
name: "Test"
command: cond_run_script end-to-end ./scripts/run_tests_local e2e_aztec_js_browser.test.ts ./scripts/docker-compose-e2e-sandbox-browser.yml
command: cond_run_script end-to-end ./scripts/run_tests_local e2e_aztec_js_browser.test.ts ./scripts/docker-compose-browser.yml
environment: { DEBUG: "aztec:*" }

e2e-card-game:
Expand All @@ -855,7 +855,7 @@ jobs:
- *setup_env
- run:
name: "Test"
command: cond_run_script end-to-end ./scripts/run_tests_local pxe_sandbox.test.ts ./scripts/docker-compose-e2e-sandbox.yml
command: cond_run_script end-to-end ./scripts/run_tests_local pxe_sandbox.test.ts
environment: { DEBUG: "aztec:*" }

cli-docs-sandbox:
Expand All @@ -867,7 +867,7 @@ jobs:
- *setup_env
- run:
name: "Test"
command: cond_run_script end-to-end ./scripts/run_tests_local cli_docs_sandbox.test.ts ./scripts/docker-compose-e2e-sandbox.yml
command: cond_run_script end-to-end ./scripts/run_tests_local cli_docs_sandbox.test.ts
environment: { DEBUG: "aztec:*" }

guides-writing-an-account-contract:
Expand All @@ -891,7 +891,7 @@ jobs:
- *setup_env
- run:
name: "Test"
command: cond_run_script end-to-end ./scripts/run_tests_local guides/dapp_testing.test.ts ./scripts/docker-compose-e2e-sandbox.yml
command: cond_run_script end-to-end ./scripts/run_tests_local guides/dapp_testing.test.ts
environment: { DEBUG: "aztec:*" }

guides-sample-dapp:
Expand All @@ -903,7 +903,7 @@ jobs:
- *setup_env
- run:
name: "Test"
command: cond_run_script end-to-end ./scripts/run_tests_local sample-dapp ./scripts/docker-compose-e2e-sandbox.yml
command: cond_run_script end-to-end ./scripts/run_tests_local sample-dapp
environment: { DEBUG: "aztec:*" }

guides-up-quick-start:
Expand All @@ -915,20 +915,9 @@ jobs:
- *setup_env
- run:
name: "Test"
command: cond_run_script end-to-end ./scripts/run_tests_local guides/up_quick_start.test.ts ./scripts/docker-compose-e2e-sandbox.yml
command: cond_run_script end-to-end ./scripts/run_tests_local guides/up_quick_start.test.ts
environment: { DEBUG: "aztec:*" }

e2e-canary-test:
machine:
image: ubuntu-2204:2023.07.2
resource_class: large
steps:
- *checkout
- *setup_env
- run:
name: "Test"
command: cond_run_script canary-build ./scripts/run_tests uniswap_trade_on_l1_from_l2.test.ts canary-build ./scripts/docker-compose-e2e-sandbox.yml

bench-publish-rollup:
machine:
image: ubuntu-2204:2023.07.2
Expand All @@ -938,7 +927,7 @@ jobs:
- *setup_env
- run:
name: "Benchmark"
command: cond_run_script end-to-end ./scripts/run_tests_local benchmarks/bench_publish_rollup.test.ts
command: cond_run_script end-to-end ./scripts/run_tests_local benchmarks/bench_publish_rollup.test.ts ./scripts/docker-compose-no-sandbox.yml
environment:
DEBUG: "aztec:benchmarks:*,aztec:sequencer,aztec:sequencer:*,aztec:world_state,aztec:merkle_trees"

Expand All @@ -951,7 +940,7 @@ jobs:
- *setup_env
- run:
name: "Benchmark"
command: cond_run_script end-to-end ./scripts/run_tests_local benchmarks/bench_process_history.test.ts
command: cond_run_script end-to-end ./scripts/run_tests_local benchmarks/bench_process_history.test.ts ./scripts/docker-compose-no-sandbox.yml
environment:
DEBUG: "aztec:benchmarks:*,aztec:sequencer,aztec:sequencer:*,aztec:world_state,aztec:merkle_trees"

Expand Down Expand Up @@ -1339,7 +1328,6 @@ workflows:
- integration-l1-publisher: *e2e_test
- integration-archiver-l1-to-l2: *e2e_test
- e2e-p2p: *e2e_test
- e2e-canary-test: *e2e_test
- e2e-browser-sandbox: *e2e_test
- e2e-card-game: *e2e_test
- pxe-sandbox: *e2e_test
Expand Down Expand Up @@ -1375,7 +1363,6 @@ workflows:
- integration-archiver-l1-to-l2
- e2e-p2p
- e2e-browser-sandbox
- e2e-canary-test
- e2e-card-game
- pxe-sandbox
- cli-docs-sandbox
Expand Down
7 changes: 6 additions & 1 deletion yarn-project/aztec-sandbox/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ From the `aztec-sandbox` directory, you can run the two existing examples:
- `yarn run:example:token`
- An L1 / L2 uniswap token trade.
- `yarn run:example:uniswap`
- To run this example, you need to use the `docker-compose-fork.yml` configuration.
- To run this example, you need to set the following vars:

```
export FORK_BLOCK_NUMBER=17514288
export FORK_URL=<YOUR_RPC_URL e.g. https://mainnet.infura.io/v3/API_KEY>
```

## Publishing

Expand Down
21 changes: 0 additions & 21 deletions yarn-project/aztec-sandbox/docker-compose-fork.yml

This file was deleted.

31 changes: 2 additions & 29 deletions yarn-project/canary/scripts/docker-compose-browser.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,9 @@
version: '3'
services:
fork:
image: ghcr.io/foundry-rs/foundry:nightly-a44aa13cfc23491ba32aaedc093e9488c1a6db43
entrypoint: >
sh -c '
if [ -n "$FORK_BLOCK_NUMBER" ] && [ -n "$FORK_URL" ]; then
exec anvil -p 8545 --host 0.0.0.0 --chain-id 31337 --fork-url "$FORK_URL" --fork-block-number "$FORK_BLOCK_NUMBER"
else
exec anvil -p 8545 --host 0.0.0.0 --chain-id 31337
fi'
ports:
- '8545:8545'

sandbox:
image: aztecprotocol/aztec-sandbox:canary
environment:
DEBUG: 'aztec:*'
ETHEREUM_HOST: http://fork:8545
CHAIN_ID: 31337
ARCHIVER_POLLING_INTERVAL_MS: 50
P2P_BLOCK_CHECK_INTERVAL_MS: 50
SEQ_TX_POLLING_INTERVAL_MS: 50
WS_BLOCK_CHECK_INTERVAL_MS: 50
PXE_BLOCK_POLLING_INTERVAL_MS: 50
ARCHIVER_VIEM_POLLING_INTERVAL_MS: 500
ports:
- '8080:8080'

canary:
image: aztecprotocol/canary:latest
environment:
ETHEREUM_HOST: http://fork:8545
ETHEREUM_HOST: http://ethereum:8545
CHAIN_ID: 31337
PXE_URL: http://sandbox:8080
PXE_URL: http://aztec:8080
command: ['./scripts/start_e2e_ci_browser.sh', './src/aztec_js_browser.test.ts']
36 changes: 0 additions & 36 deletions yarn-project/canary/scripts/docker-compose-e2e-sandbox.yml

This file was deleted.

33 changes: 3 additions & 30 deletions yarn-project/canary/scripts/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,9 @@
version: '3'
services:
fork:
image: ghcr.io/foundry-rs/foundry:nightly-a44aa13cfc23491ba32aaedc093e9488c1a6db43
entrypoint: >
sh -c '
if [ -n "$FORK_BLOCK_NUMBER" ] && [ -n "$FORK_URL" ]; then
exec anvil -p 8545 --host 0.0.0.0 --chain-id 31337 --fork-url "$FORK_URL" --fork-block-number "$FORK_BLOCK_NUMBER"
else
exec anvil -p 8545 --host 0.0.0.0 --chain-id 31337
fi'
ports:
- '8545:8545'

sandbox:
image: aztecprotocol/aztec-sandbox:canary
environment:
DEBUG: 'aztec:*'
ETHEREUM_HOST: http://fork:8545
CHAIN_ID: 31337
ARCHIVER_POLLING_INTERVAL_MS: 50
P2P_BLOCK_CHECK_INTERVAL_MS: 50
SEQ_TX_POLLING_INTERVAL_MS: 50
WS_BLOCK_CHECK_INTERVAL_MS: 50
PXE_BLOCK_POLLING_INTERVAL_MS: 50
ARCHIVER_VIEM_POLLING_INTERVAL_MS: 500
ports:
- '8080:8080'

canary:
image: aztecprotocol/canary:latest
environment:
ETHEREUM_HOST: http://fork:8545
ETHEREUM_HOST: http://ethereum:8545
CHAIN_ID: 31337
PXE_URL: http://sandbox:8080
command: ${TEST:-./src/uniswap_trade_on_l1_from_l2.test.ts}
PXE_URL: http://aztec:8080
command: ${TEST:-./src/cli.test.ts}
9 changes: 3 additions & 6 deletions yarn-project/canary/scripts/run_tests
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ IMAGE_URI=$(calculate_image_uri $IMAGE)
retry docker pull $IMAGE_URI
retry docker tag $IMAGE_URI aztecprotocol/canary:latest

SANDBOX_IMAGE_URI=$(calculate_image_uri aztec-sandbox)
retry docker pull $SANDBOX_IMAGE_URI
retry docker tag $SANDBOX_IMAGE_URI aztecprotocol/sandbox:latest

docker-compose -f $COMPOSE_FILE rm -f
docker-compose -f $COMPOSE_FILE up --exit-code-from canary
export SANDBOX_VERSION=canary
docker-compose -f ../../aztec-sandbox/docker-compose.yml -f $COMPOSE_FILE rm -f
docker-compose -f ../../aztec-sandbox/docker-compose.yml -f $COMPOSE_FILE up --exit-code-from canary
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ services:
ports:
- '8545:8545'

sandbox:
image: aztecprotocol/aztec-sandbox:latest
end-to-end:
image: aztecprotocol/end-to-end:latest
environment:
DEBUG: 'aztec:*'
BENCHMARK: true
DEBUG: ${DEBUG:-'aztec:*'}
ETHEREUM_HOST: http://fork:8545
CHAIN_ID: 31337
ARCHIVER_POLLING_INTERVAL_MS: 50
Expand All @@ -24,17 +25,6 @@ services:
WS_BLOCK_CHECK_INTERVAL_MS: 50
PXE_BLOCK_POLLING_INTERVAL_MS: 50
ARCHIVER_VIEM_POLLING_INTERVAL_MS: 500
ports:
- '8080:8080'

end-to-end:
image: aztecprotocol/end-to-end:latest
environment:
BENCHMARK: true
DEBUG: ${DEBUG:-'aztec:*'}
ETHEREUM_HOST: http://fork:8545
CHAIN_ID: 31337
PXE_URL: http://sandbox:8080
command: ${TEST:-./src/e2e_deploy_contract.test.ts}
volumes:
- ../log:/usr/src/yarn-project/end-to-end/log:rw
19 changes: 15 additions & 4 deletions yarn-project/end-to-end/scripts/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ services:
ports:
- '8545:8545'

end-to-end:
image: aztecprotocol/end-to-end:latest
sandbox:
image: aztecprotocol/aztec-sandbox:latest
environment:
BENCHMARK: true
DEBUG: ${DEBUG:-'aztec:*'}
DEBUG: 'aztec:*'
ETHEREUM_HOST: http://fork:8545
CHAIN_ID: 31337
ARCHIVER_POLLING_INTERVAL_MS: 50
Expand All @@ -25,6 +24,18 @@ services:
WS_BLOCK_CHECK_INTERVAL_MS: 50
PXE_BLOCK_POLLING_INTERVAL_MS: 50
ARCHIVER_VIEM_POLLING_INTERVAL_MS: 500
ports:
- '8080:8080'

end-to-end:
image: aztecprotocol/end-to-end:latest
environment:
BENCHMARK: true
LOG_LEVL: 'debug'
DEBUG: ${DEBUG:-'aztec:*'}
ETHEREUM_HOST: http://fork:8545
CHAIN_ID: 31337
PXE_URL: http://sandbox:8080
command: ${TEST:-./src/e2e_deploy_contract.test.ts}
volumes:
- ../log:/usr/src/yarn-project/end-to-end/log:rw
19 changes: 17 additions & 2 deletions yarn-project/end-to-end/src/e2e_card_game.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { AccountWallet, AztecAddress, Wallet, deployInitialSandboxAccounts } from '@aztec/aztec.js';
import {
AccountWallet,
AztecAddress,
Wallet,
deployInitialSandboxAccounts,
getSandboxAccountsWallets,
} from '@aztec/aztec.js';
import { DebugLogger } from '@aztec/foundation/log';
import { CardGameContract } from '@aztec/noir-contracts/types';
import { PXE } from '@aztec/types';
Expand All @@ -7,6 +13,8 @@ import { setup } from './fixtures/utils.js';

/* eslint-disable camelcase */

const { PXE_URL } = process.env;

interface Card {
points: bigint;
strength: bigint;
Expand Down Expand Up @@ -65,7 +73,14 @@ describe('e2e_card_game', () => {
// Card stats are derived from the users' private keys, so to get consistent values, we set up the
// initial sandbox accounts that always use the same private keys, instead of random ones.
({ pxe, logger, teardown } = await setup(0));
wallets = await Promise.all((await deployInitialSandboxAccounts(pxe)).map(a => a.account.getWallet()));

// Get pre-deployed account wallets if we're running against sandbox.
if (PXE_URL) {
wallets = await getSandboxAccountsWallets(pxe);
} else {
// Deploy initial wallets if we're NOT running against sandbox.
wallets = await Promise.all((await deployInitialSandboxAccounts(pxe)).map(a => a.account.getWallet()));
}
[firstPlayerWallet, secondPlayerWallet, thirdPlayerWallet] = wallets;
[firstPlayer, secondPlayer, thirdPlayer] = wallets.map(a => a.getAddress());
await deployContract();
Expand Down
Loading