From 5cd3a31d7614d8dc4249451a326c33ef128e5c1b Mon Sep 17 00:00:00 2001 From: Santiago Palladino Date: Tue, 15 Aug 2023 12:50:13 -0300 Subject: [PATCH 1/2] Fix CLI get-logs and deploy cmds --- yarn-project/aztec-cli/src/index.ts | 10 +++++++--- yarn-project/foundation/src/abi/encoder.ts | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/yarn-project/aztec-cli/src/index.ts b/yarn-project/aztec-cli/src/index.ts index d2eaff4653d..9fcb642d68a 100644 --- a/yarn-project/aztec-cli/src/index.ts +++ b/yarn-project/aztec-cli/src/index.ts @@ -165,8 +165,11 @@ async function main() { ); } + debugLogger(`Input arguments: ${options.args.map((x: any) => `"${x}"`).join(', ')}`); const args = encodeArgs(options.args, constructorAbi!.parameters); - const tx = deployer.deploy(args).send({ contractAddressSalt: salt }); + debugLogger(`Encoded arguments: ${args.join(', ')}`); + const tx = deployer.deploy(...args).send({ contractAddressSalt: salt }); + debugLogger(`Deploy tx sent with hash ${await tx.getTxHash()}`); const deployed = await tx.wait(); log(`\nContract deployed at ${deployed.contractAddress!.toString()}\n`); }); @@ -240,7 +243,7 @@ async function main() { .option('-u, --rpc-url ', 'URL of the Aztec RPC', AZTEC_RPC_HOST || 'http://localhost:8080') .action(async options => { const { from, limit } = options; - const fromBlock = from ? parseInt(from) : 0; + const fromBlock = from ? parseInt(from) : 1; const limitCount = limit ? parseInt(limit) : 100; const client = createAztecRpcClient(options.rpcUrl); @@ -472,6 +475,7 @@ async function main() { } main().catch(err => { - log(`Error thrown: ${err}`); + log(`Error in command execution`); + log(err); process.exit(1); }); diff --git a/yarn-project/foundation/src/abi/encoder.ts b/yarn-project/foundation/src/abi/encoder.ts index e7e3b684fa8..08048a6a484 100644 --- a/yarn-project/foundation/src/abi/encoder.ts +++ b/yarn-project/foundation/src/abi/encoder.ts @@ -32,7 +32,7 @@ class ArgumentEncoder { } else if (arg instanceof Fr) { this.flattened.push(arg); } else { - throw new Error('Argument cannot be serialised to a field'); + throw new Error(`Argument "${arg}" for ${name} cannot be serialised to a field`); } } else { throw new Error(`Invalid argument "${arg}" of type ${abiType.kind}`); From f620661e57cb94b3469b872ce83dc25cb5399349 Mon Sep 17 00:00:00 2001 From: Santiago Palladino Date: Tue, 15 Aug 2023 13:04:29 -0300 Subject: [PATCH 2/2] Fix foundation test --- yarn-project/foundation/src/abi/encoder.test.ts | 6 ++++-- yarn-project/foundation/src/abi/encoder.ts | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/yarn-project/foundation/src/abi/encoder.test.ts b/yarn-project/foundation/src/abi/encoder.test.ts index 4261f9b91c6..8922d1e7c94 100644 --- a/yarn-project/foundation/src/abi/encoder.test.ts +++ b/yarn-project/foundation/src/abi/encoder.test.ts @@ -49,7 +49,7 @@ describe('abi/encoder', () => { expect(() => encodeArguments(testFunctionAbi, args)).toThrowError('Cannot convert garbage to a BigInt'); }); - it.only('throws when passing object argument as field', () => { + it('throws when passing object argument as field', () => { const testFunctionAbi: FunctionAbi = { name: 'constructor', functionType: FunctionType.SECRET, @@ -73,6 +73,8 @@ describe('abi/encoder', () => { }, ]; - expect(() => encodeArguments(testFunctionAbi, args)).toThrowError('Argument cannot be serialised to a field'); + expect(() => encodeArguments(testFunctionAbi, args)).toThrowError( + 'Argument for owner cannot be serialised to a field', + ); }); }); diff --git a/yarn-project/foundation/src/abi/encoder.ts b/yarn-project/foundation/src/abi/encoder.ts index 08048a6a484..acf0a41aad1 100644 --- a/yarn-project/foundation/src/abi/encoder.ts +++ b/yarn-project/foundation/src/abi/encoder.ts @@ -32,7 +32,7 @@ class ArgumentEncoder { } else if (arg instanceof Fr) { this.flattened.push(arg); } else { - throw new Error(`Argument "${arg}" for ${name} cannot be serialised to a field`); + throw new Error(`Argument for ${name} cannot be serialised to a field`); } } else { throw new Error(`Invalid argument "${arg}" of type ${abiType.kind}`);