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: Anvil start retry in case something bad. Fix colors. #5673

Merged
merged 7 commits into from
Apr 11, 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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ jobs:
- *setup_env
- run:
name: "Test"
command: cond_spot_run_container end-to-end 8 ./src/e2e_token_contract/
command: cond_spot_run_container end-to-end 16 ./src/e2e_token_contract/
aztec_manifest_key: end-to-end
<<: *defaults_e2e_test

Expand Down
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ e2e-lending-contract:
e2e-token-contract:
LOCALLY
WITH DOCKER --load end-to-end=../+end-to-end
RUN docker run --rm -e LOG_LEVEL=silent -e DEBUG=aztec:e2e_token_contract* end-to-end ./src/e2e_token_contract/
RUN docker run --rm -e LOG_LEVEL=silent -e DEBUG=aztec:e2e* end-to-end ./src/e2e_token_contract/
END

e2e-authwit-test:
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"clean": "rm -rf ./dest .tsbuildinfo",
"formatting": "run -T prettier --check ./src \"!src/web/main.js\" && run -T eslint ./src",
"formatting:fix": "run -T eslint --fix ./src && run -T prettier -w ./src",
"test": "LOG_LEVEL=${LOG_LEVEL:-verbose} NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=120000 --forceExit",
"test": "LOG_LEVEL=${LOG_LEVEL:-verbose} DEBUG_COLORS=1 NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=120000 --forceExit",
"test:integration": "concurrently -k -s first -c reset,dim -n test,anvil \"yarn test:integration:run\" \"anvil\"",
"test:integration:run": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --no-cache --runInBand --config jest.integration.config.json"
},
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/package.local.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"scripts": {
"build": "yarn clean && tsc -b && webpack",
"formatting": "run -T prettier --check ./src \"!src/web/main.js\" && run -T eslint ./src",
"test": "LOG_LEVEL=${LOG_LEVEL:-verbose} NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=120000 --forceExit"
"test": "LOG_LEVEL=${LOG_LEVEL:-verbose} DEBUG_COLORS=1 NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=120000 --forceExit"
}
}
16 changes: 12 additions & 4 deletions yarn-project/end-to-end/src/fixtures/snapshot_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
import { deployInstance, registerContractClass } from '@aztec/aztec.js/deployment';
import { asyncMap } from '@aztec/foundation/async-map';
import { createDebugLogger } from '@aztec/foundation/log';
import { makeBackoff, retry } from '@aztec/foundation/retry';
import { resolver, reviver } from '@aztec/foundation/serialize';
import { type PXEService, createPXEService, getPXEServiceConfig } from '@aztec/pxe';

Expand Down Expand Up @@ -175,10 +176,17 @@ export class SnapshotManager {

// Start anvil. We go via a wrapper script to ensure if the parent dies, anvil dies.
this.logger.verbose('Starting anvil...');
const ethereumHostPort = await getPort();
aztecNodeConfig.rpcUrl = `http://localhost:${ethereumHostPort}`;
const anvil = createAnvil({ anvilBinary: './scripts/anvil_kill_wrapper.sh', port: ethereumHostPort });
await anvil.start();
const anvil = await retry(
async () => {
const ethereumHostPort = await getPort();
aztecNodeConfig.rpcUrl = `http://localhost:${ethereumHostPort}`;
const anvil = createAnvil({ anvilBinary: './scripts/anvil_kill_wrapper.sh', port: ethereumHostPort });
await anvil.start();
return anvil;
},
'Start anvil',
makeBackoff([5, 5, 5]),
);

// Deploy our L1 contracts.
this.logger.verbose('Deploying L1 contracts...');
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/foundation/src/log/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function logWithDebug(debug: debug.Debugger, level: LogLevel, msg: string, data?
function getPrefix(debugLogger: debug.Debugger, level: LogLevel) {
const levelLabel = currentLevel !== level ? ` ${level.toUpperCase()}` : '';
const prefix = `${debugLogger.namespace.replace(/^aztec:/, '')}${levelLabel}`;
if (!isNode || !isatty(process.stderr.fd)) {
if ((!isNode || !isatty(process.stderr.fd)) && !process.env.DEBUG_COLORS) {
return prefix;
}
const colorIndex = debug.selectColor(debugLogger.namespace) as number;
Expand Down
Loading