diff --git a/l1-contracts/src/core/libraries/ConstantsGen.sol b/l1-contracts/src/core/libraries/ConstantsGen.sol index c86086125bd9..12f1de725f4d 100644 --- a/l1-contracts/src/core/libraries/ConstantsGen.sol +++ b/l1-contracts/src/core/libraries/ConstantsGen.sol @@ -83,7 +83,7 @@ library Constants { uint256 internal constant DEPLOYER_CONTRACT_INSTANCE_DEPLOYED_MAGIC_VALUE = 0x85864497636cf755ae7bde03f267ce01a520981c21c3682aaf82a631; uint256 internal constant DEPLOYER_CONTRACT_ADDRESS = - 0x12bcd3e09e8d8559c75d59552db47471f63c72fbbc9decb59c517b4e58634a72; + 0x23fb38e0a3ddf4840e582ee7a9eb0ccbc858d415c140bd0bac26bb0c761c83fc; uint256 internal constant L1_TO_L2_MESSAGE_ORACLE_CALL_LENGTH = 17; uint256 internal constant MAX_NOTE_FIELDS_LENGTH = 20; uint256 internal constant GET_NOTE_ORACLE_RETURN_LENGTH = 23; diff --git a/noir-projects/aztec-nr/aztec/src/context/private_context.nr b/noir-projects/aztec-nr/aztec/src/context/private_context.nr index c3ec9a756044..be9c0bdc9178 100644 --- a/noir-projects/aztec-nr/aztec/src/context/private_context.nr +++ b/noir-projects/aztec-nr/aztec/src/context/private_context.nr @@ -185,6 +185,12 @@ impl PrivateContext { chain_id: self.inputs.private_global_variables.chain_id, version: self.inputs.private_global_variables.version }; + + crate::oracle::debug_log::debug_log_format( + "Finished private context with {0} note hash read requests", + [self.note_hash_read_requests.len() as Field] + ); + priv_circuit_pub_inputs } @@ -199,6 +205,12 @@ impl PrivateContext { } pub fn push_note_hash_read_request(&mut self, note_hash: Field) { + crate::oracle::debug_log::debug_log_format( + "Pushing note hash read request for note_hash={0} counter={1} len={2}", + [ + note_hash, self.side_effect_counter as Field, (self.note_hash_read_requests.len() as Field) + 1 + ] + ); let side_effect = SideEffect { value: note_hash, counter: self.side_effect_counter }; self.note_hash_read_requests.push(side_effect); self.side_effect_counter = self.side_effect_counter + 1; @@ -343,6 +355,25 @@ impl PrivateContext { is_delegate_call ); + let mut note_hash_read_req_count = 0; + for i in 0..MAX_NOTE_HASH_READ_REQUESTS_PER_CALL { + if !is_empty(item.public_inputs.note_hash_read_requests[i]) { + note_hash_read_req_count = note_hash_read_req_count + 1; + } + } + + crate::oracle::debug_log::debug_log_format( + "Called private function got back contract_address={0} function_data={1} public_inputs={2} note_hash_read_reqs={3}", + [ + item.contract_address.to_field(), item.function_data.hash(), item.public_inputs.hash(), note_hash_read_req_count + ] + ); + + // crate::oracle::debug_log::debug_log_array_with_prefix( + // "Called private function public inputs", + // item.public_inputs.serialize() + // ); + assert_eq(item.public_inputs.call_context.side_effect_counter, self.side_effect_counter); assert_eq(item.public_inputs.start_side_effect_counter, self.side_effect_counter); self.side_effect_counter = item.public_inputs.end_side_effect_counter + 1; diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr b/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr index f89bbe8dfb03..ff15dfff0ee0 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr @@ -117,7 +117,7 @@ global REGISTERER_UNCONSTRAINED_FUNCTION_BROADCASTED_MAGIC_VALUE = 0xe7af8166354 // CONTRACT INSTANCE CONSTANTS // sha224sum 'struct ContractInstanceDeployed' global DEPLOYER_CONTRACT_INSTANCE_DEPLOYED_MAGIC_VALUE = 0x85864497636cf755ae7bde03f267ce01a520981c21c3682aaf82a631; -global DEPLOYER_CONTRACT_ADDRESS = 0x12bcd3e09e8d8559c75d59552db47471f63c72fbbc9decb59c517b4e58634a72; +global DEPLOYER_CONTRACT_ADDRESS = 0x23fb38e0a3ddf4840e582ee7a9eb0ccbc858d415c140bd0bac26bb0c761c83fc; // NOIR CONSTANTS - constants used only in yarn-packages/noir-contracts // Some are defined here because Noir doesn't yet support globals referencing other globals yet. diff --git a/yarn-project/aztec.js/src/account_manager/deploy_account_method.ts b/yarn-project/aztec.js/src/account_manager/deploy_account_method.ts index 1c3c441d487b..c48f67bb1d00 100644 --- a/yarn-project/aztec.js/src/account_manager/deploy_account_method.ts +++ b/yarn-project/aztec.js/src/account_manager/deploy_account_method.ts @@ -51,18 +51,21 @@ export class DeployAccountMethod extends DeployMethod { if (options.fee && this.#feePaymentArtifact) { const { address } = this.getInstance(); + const emptyAppPayload = EntrypointPayload.fromAppExecution([]); const feePayload = await EntrypointPayload.fromFeeOptions(options?.fee); exec.calls.push({ to: address, - args: encodeArguments(this.#feePaymentArtifact, [feePayload]), + args: encodeArguments(this.#feePaymentArtifact, [emptyAppPayload, feePayload]), functionData: FunctionData.fromAbi(this.#feePaymentArtifact), }); exec.authWitnesses ??= []; exec.packedArguments ??= []; + exec.authWitnesses.push(await this.#authWitnessProvider.createAuthWit(emptyAppPayload.hash())); exec.authWitnesses.push(await this.#authWitnessProvider.createAuthWit(feePayload.hash())); + exec.packedArguments.push(...emptyAppPayload.packedArguments); exec.packedArguments.push(...feePayload.packedArguments); options.fee = undefined; diff --git a/yarn-project/aztec.js/src/account_manager/index.ts b/yarn-project/aztec.js/src/account_manager/index.ts index 6e19a67ffdc5..4aff349643e6 100644 --- a/yarn-project/aztec.js/src/account_manager/index.ts +++ b/yarn-project/aztec.js/src/account_manager/index.ts @@ -150,7 +150,7 @@ export class AccountManager { this.accountContract.getContractArtifact(), args, 'constructor', - 'pay_init_fee', + 'entrypoint', ); } return this.deployMethod; diff --git a/yarn-project/circuits.js/src/constants.gen.ts b/yarn-project/circuits.js/src/constants.gen.ts index 77e588276edf..5fb7e0f554da 100644 --- a/yarn-project/circuits.js/src/constants.gen.ts +++ b/yarn-project/circuits.js/src/constants.gen.ts @@ -68,7 +68,7 @@ export const REGISTERER_UNCONSTRAINED_FUNCTION_BROADCASTED_MAGIC_VALUE = 0xe7af816635466f128568edb04c9fa024f6c87fb9010fdbffa68b3d99n; export const DEPLOYER_CONTRACT_INSTANCE_DEPLOYED_MAGIC_VALUE = 0x85864497636cf755ae7bde03f267ce01a520981c21c3682aaf82a631n; -export const DEPLOYER_CONTRACT_ADDRESS = 0x12bcd3e09e8d8559c75d59552db47471f63c72fbbc9decb59c517b4e58634a72n; +export const DEPLOYER_CONTRACT_ADDRESS = 0x23fb38e0a3ddf4840e582ee7a9eb0ccbc858d415c140bd0bac26bb0c761c83fcn; export const L1_TO_L2_MESSAGE_ORACLE_CALL_LENGTH = 17; export const MAX_NOTE_FIELDS_LENGTH = 20; export const GET_NOTE_ORACLE_RETURN_LENGTH = 23; diff --git a/yarn-project/simulator/src/client/client_execution_context.ts b/yarn-project/simulator/src/client/client_execution_context.ts index 3f6262931219..f4ee5876f485 100644 --- a/yarn-project/simulator/src/client/client_execution_context.ts +++ b/yarn-project/simulator/src/client/client_execution_context.ts @@ -396,6 +396,16 @@ export class ClientExecutionContext extends ViewDataOracle { this.nestedExecutions.push(childExecutionResult); + const ci = childExecutionResult.callStackItem; + this.log(`Called private function and got back call stack item with hashes: + Contract address=${ci.contractAddress.toString()} + Function data=${ci.functionData.hash().toString()} + Public inputs=${ci.publicInputs.hash().toString()} + Count of note hash read requests=${ci.publicInputs.noteHashReadRequests.filter(x => !x.isEmpty()).length} + `); + + // this.log(`Called private function public inputs: ${ci.publicInputs.toFields().map(f => f.toString())}`); + return childExecutionResult.callStackItem; }