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

chore: Sandbox logging tweaks #1797

Merged
merged 1 commit into from
Aug 24, 2023
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
Expand Up @@ -97,9 +97,10 @@ export class AztecRPCServer implements AztecRPC {
if (wasAdded) {
const pubKey = this.keyStore.addAccount(privKey);
this.synchroniser.addAccount(pubKey, this.keyStore);
this.log.info(`Added account: ${completeAddress.toReadableString()}`);
this.log.info(`Registered account ${completeAddress.address.toString()}`);
this.log.debug(`Registered ${completeAddress.toReadableString()}`);
} else {
this.log.info(`Account "${completeAddress.toReadableString()}" already registered.`);
this.log.info(`Account "${completeAddress.address.toString()}" already registered.`);
}
}

Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec-sandbox/docker-compose-fork.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
ports:
- '8080:8080'
environment:
DEBUG: 'aztec:*,wasm'
DEBUG: 'aztec:*'
ETHEREUM_HOST: http://fork:8545
CHAIN_ID: 31337
ARCHIVER_POLLING_INTERVAL_MS: 50
Expand Down
12 changes: 6 additions & 6 deletions yarn-project/aztec-sandbox/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
version: '3'
services:
fork:
image: ghcr.io/foundry-rs/foundry:nightly-a44aa13cfc23491ba32aaedc093e9488c1a6db43
entrypoint: 'anvil -p 8545 --host 0.0.0.0 --chain-id 31337'
ethereum:
image: ghcr.io/foundry-rs/foundry:v1.0.0
command: '"anvil --silent -p 8545 --host 0.0.0.0 --chain-id 31337"'
Copy link
Collaborator Author

@spalladino spalladino Aug 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fun fact: since Docker is evil and foundry's docker image entrypoint was set to /bin/sh -c, all arguments after anvil were being passed to /bin/sh and not to anvil itself. So the whole -p 8545 --host 0.0.0.0 --chain-id 31337 was being completely ignored and worked by chance just because it happened to match the defaults.

Putting everyting between quotes fixes this, but it needs to be two sets of quotes since the first set is swallowed by yaml.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this just an interaction of bash and yaml? :P

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point, maybe it's not Docker's fault after all!

ports:
- '8545:8545'

rpc-server:
aztec:
image: aztecprotocol/aztec-sandbox:latest
ports:
- '8080:8080'
environment:
DEBUG: 'aztec:*,wasm'
ETHEREUM_HOST: http://fork:8545
DEBUG: # DEBUG is loaded from the user shell running compose
ETHEREUM_HOST: http://ethereum:8545
CHAIN_ID: 31337
ARCHIVER_POLLING_INTERVAL_MS: 50
P2P_BLOCK_CHECK_INTERVAL_MS: 50
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec-sandbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"scripts": {
"prepare": "node ../yarn-project-base/scripts/update_build_manifest.mjs package.json",
"build": "yarn clean && tsc -b",
"start": "node ./dest",
"start": "node --no-warnings ./dest",
"clean": "rm -rf ./dest .tsbuildinfo",
"formatting": "run -T prettier --check ./src && run -T eslint ./src",
"formatting:fix": "run -T prettier -w ./src",
Expand Down
6 changes: 4 additions & 2 deletions yarn-project/aztec-sandbox/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ async function main() {
const hdAccount = mnemonicToAccount(MNEMONIC);
const privKey = hdAccount.getHdKey().privateKey;

logger.info('Setting up Aztec Sandbox, please stand by...');
logger.info('Deploying rollup contracts to L1...');
const deployedL1Contracts = await waitThenDeploy(aztecNodeConfig.rpcUrl, hdAccount);
aztecNodeConfig.publisherPrivateKey = new PrivateKey(Buffer.from(privKey!));
aztecNodeConfig.rollupContract = deployedL1Contracts.rollupAddress;
Expand All @@ -71,11 +73,11 @@ async function main() {
const aztecNode = await AztecNodeService.createAndSync(aztecNodeConfig);
const aztecRpcServer = await createAztecRPCServer(aztecNode, rpcConfig);

logger('Deploying initial accounts...');
logger.info('Setting up test accounts...');
const accounts = await deployInitialSandboxAccounts(aztecRpcServer);

const shutdown = async () => {
logger('Shutting down...');
logger.info('Shutting down...');
await aztecRpcServer.stop();
await aztecNode.stop();
process.exit(0);
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/canary/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"clean": "rm -rf ./dest .tsbuildinfo",
"formatting": "run -T prettier --check ./src && run -T eslint ./src",
"formatting:fix": "run -T prettier -w ./src",
"test": "DEBUG='aztec:*,wasm' NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --runInBand --passWithNoTests --testTimeout=15000"
"test": "DEBUG='aztec:*' NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --runInBand --passWithNoTests --testTimeout=15000"
},
"jest": {
"preset": "ts-jest/presets/default-esm",
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/canary/scripts/docker-compose-e2e-sandbox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
sandbox:
image: $ECR_URL/aztec-sandbox:cache-$COMMIT_HASH
environment:
DEBUG: 'aztec:*,wasm'
DEBUG: 'aztec:*'
ETHEREUM_HOST: http://fork:8545
CHAIN_ID: 31337
ARCHIVER_POLLING_INTERVAL_MS: 50
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/canary/scripts/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
sandbox:
image: aztecprotocol/aztec-sandbox:latest
environment:
DEBUG: 'aztec:*,wasm'
DEBUG: 'aztec:*'
ETHEREUM_HOST: http://fork:8545
CHAIN_ID: 31337
ARCHIVER_POLLING_INTERVAL_MS: 50
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/circuits.js/src/wasm/circuits_wasm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class CircuitsWasm implements IWasmModule {
* @param loggerName - The logger name.
* @returns The wrapper.
*/
private static async new(initial = 30, maximum = 8192, loggerName = 'wasm'): Promise<CircuitsWasm> {
private static async new(initial = 30, maximum = 8192, loggerName = 'aztec:wasm'): Promise<CircuitsWasm> {
const wasm = new WasmModule(
await fetchBinary(CODE_PATH),
module => ({
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 @@ -11,7 +11,7 @@
"clean": "rm -rf ./dest .tsbuildinfo",
"formatting": "run -T prettier --check ./src \"!src/web/main.js\" && run -T eslint ./src",
"formatting:fix": "run -T prettier -w ./src",
"test": "DEBUG='aztec:*,wasm' NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --runInBand --passWithNoTests --testTimeout=15000",
"test": "DEBUG='aztec:*' NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --runInBand --passWithNoTests --testTimeout=15000",
"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 $(yarn bin jest) --no-cache --runInBand --config jest.integration.config.json"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
sandbox:
image: aztecprotocol/aztec-sandbox:latest
environment:
DEBUG: 'aztec:*,wasm'
DEBUG: 'aztec:*'
ETHEREUM_HOST: http://fork:8545
CHAIN_ID: 31337
ARCHIVER_POLLING_INTERVAL_MS: 50
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/foundation/src/wasm/wasm_module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class WasmModule implements IWasmModule {
constructor(
private module: WebAssembly.Module | Buffer,
private importFn: (module: WasmModule) => any,
loggerName = 'wasm',
loggerName = 'aztec:wasm',
) {
this.debug = createDebugOnlyLogger(loggerName);
this.mutexQ.put(true);
Expand Down