diff --git a/barretenberg/cpp/pil/vm2/opcodes/external_call.pil b/barretenberg/cpp/pil/vm2/opcodes/external_call.pil index 2dc12fbd5f56..c468b37161a3 100644 --- a/barretenberg/cpp/pil/vm2/opcodes/external_call.pil +++ b/barretenberg/cpp/pil/vm2/opcodes/external_call.pil @@ -9,8 +9,8 @@ include "../gt.pil"; // - l2_gas: allocated L2 gas (register[0]) // - da_gas: allocated DA gas (register[1]) // - contract_address: address of the contract to call (register[2]) -// - cd_size: size of the calldata to copy (register[3]) -// - cd_offset: offset of the calldata to copy (rop[4]) +// - args_size: size of the args to pass (register[3]) +// - args_offset: offset of the args to pass (rop[4]) // // We only use register[0] and register[1] here. // diff --git a/barretenberg/cpp/src/barretenberg/vm2/common/instruction_spec.cpp b/barretenberg/cpp/src/barretenberg/vm2/common/instruction_spec.cpp index b160abe8fe07..72abb4d74344 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/common/instruction_spec.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/common/instruction_spec.cpp @@ -706,14 +706,14 @@ const std::unordered_map& get_exec_instruc .register_info = RegisterInfo().add_inputs({ /*l2_gas*/ ValueTag::U32, /*da_gas*/ ValueTag::U32, /*contract_address*/ ValueTag::FF, - /*cd_size*/ ValueTag::U32 }) } }, + /*args_size*/ ValueTag::U32 }) } }, { ExecutionOpCode::STATICCALL, { .num_addresses = 5, .gas_cost = { .opcode_gas = AVM_STATICCALL_BASE_L2_GAS, .base_da = 0, .dyn_l2 = 0, .dyn_da = 0 }, .register_info = RegisterInfo().add_inputs({ /*l2_gas*/ ValueTag::U32, /*da_gas*/ ValueTag::U32, /*contract_address*/ ValueTag::FF, - /*cd_size*/ ValueTag::U32 }) } }, + /*args_size*/ ValueTag::U32 }) } }, { ExecutionOpCode::RETURN, { .num_addresses = 2, .gas_cost = { .opcode_gas = AVM_RETURN_BASE_L2_GAS, .base_da = 0, .dyn_l2 = 0, .dyn_da = 0 }, diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.cpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.cpp index fc7154860795..1f78dcc30aa6 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.cpp @@ -561,22 +561,22 @@ void Execution::mov(ContextInterface& context, MemoryAddress src_addr, MemoryAdd * @param l2_gas_offset The resolved address of the allocated L2 gas value. * @param da_gas_offset The resolved address of the allocated DA gas value. * @param addr The resolved address of the contract address. - * @param cd_size_offset The resolved address of the calldata size value. - * @param cd_offset The resolved address of the calldata offset value. + * @param args_size_offset The resolved address of the args size value. + * @param args_offset The resolved address of the args offset value. * * @throws RegisterValidationException if the tags of the input values do not match the expected tags: * - l2_gas_offset memory value tag: U32 * - da_gas_offset memory value tag: U32 * - addr memory value tag: FF - * - cd_size_offset memory value tag: U32 + * - args_size_offset memory value tag: U32 * @throws OutOfGasException if the gas limit is exceeded. */ void Execution::call(ContextInterface& context, MemoryAddress l2_gas_offset, MemoryAddress da_gas_offset, MemoryAddress addr, - MemoryAddress cd_size_offset, - MemoryAddress cd_offset) + MemoryAddress args_size_offset, + MemoryAddress args_offset) { BB_BENCH_NAME("Execution::call"); constexpr auto opcode = ExecutionOpCode::CALL; @@ -586,22 +586,22 @@ void Execution::call(ContextInterface& context, const auto& allocated_l2_gas_read = memory.get(l2_gas_offset); const auto& allocated_da_gas_read = memory.get(da_gas_offset); const auto& contract_address = memory.get(addr); - // Cd offset loads are deferred to calldatacopy - const auto& cd_size = memory.get(cd_size_offset); + // Args offset load is deferred to calldatacopy + const auto& args_size = memory.get(args_size_offset); - set_and_validate_inputs(opcode, { allocated_l2_gas_read, allocated_da_gas_read, contract_address, cd_size }); + set_and_validate_inputs(opcode, { allocated_l2_gas_read, allocated_da_gas_read, contract_address, args_size }); get_gas_tracker().consume_gas(); // Base gas. Gas gas_limit = get_gas_tracker().compute_gas_limit_for_call( Gas{ .l2_gas = allocated_l2_gas_read.as(), .da_gas = allocated_da_gas_read.as() }); - // Tag check contract address + cd_size + // Tag check contract address + args_size auto nested_context = context_provider.make_nested_context(contract_address, /*msg_sender=*/context.get_address(), /*transaction_fee=*/context.get_transaction_fee(), /*parent_context=*/context, - /*cd_offset_address=*/cd_offset, - /*cd_size=*/cd_size.as(), + /*cd_offset_address=*/args_offset, + /*cd_size=*/args_size.as(), /*is_static=*/context.get_is_static(), /*gas_limit=*/gas_limit, /*phase=*/context.get_phase()); @@ -621,22 +621,22 @@ void Execution::call(ContextInterface& context, * @param l2_gas_offset The resolved address of the allocated L2 gas value. * @param da_gas_offset The resolved address of the allocated DA gas value. * @param addr The resolved address of the contract address. - * @param cd_size_offset The resolved address of the calldata size value. - * @param cd_offset The resolved address of the calldata offset value. + * @param args_size_offset The resolved address of the args size value. + * @param args_offset The resolved address of the args offset value. * * @throws RegisterValidationException if the tags of the input values do not match the expected tags: * - l2_gas_offset memory value tag: U32 * - da_gas_offset memory value tag: U32 * - addr memory value tag: FF - * - cd_size_offset memory value tag: U32 + * - args_size_offset memory value tag: U32 * @throws OutOfGasException if the gas limit is exceeded. */ void Execution::static_call(ContextInterface& context, MemoryAddress l2_gas_offset, MemoryAddress da_gas_offset, MemoryAddress addr, - MemoryAddress cd_size_offset, - MemoryAddress cd_offset) + MemoryAddress args_size_offset, + MemoryAddress args_offset) { BB_BENCH_NAME("Execution::static_call"); constexpr auto opcode = ExecutionOpCode::STATICCALL; @@ -646,22 +646,22 @@ void Execution::static_call(ContextInterface& context, const auto& allocated_l2_gas_read = memory.get(l2_gas_offset); const auto& allocated_da_gas_read = memory.get(da_gas_offset); const auto& contract_address = memory.get(addr); - // Cd offset loads are deferred to calldatacopy - const auto& cd_size = memory.get(cd_size_offset); + // Args offset load is deferred to calldatacopy + const auto& args_size = memory.get(args_size_offset); - set_and_validate_inputs(opcode, { allocated_l2_gas_read, allocated_da_gas_read, contract_address, cd_size }); + set_and_validate_inputs(opcode, { allocated_l2_gas_read, allocated_da_gas_read, contract_address, args_size }); get_gas_tracker().consume_gas(); // Base gas. Gas gas_limit = get_gas_tracker().compute_gas_limit_for_call( Gas{ .l2_gas = allocated_l2_gas_read.as(), .da_gas = allocated_da_gas_read.as() }); - // Tag check contract address + cd_size + // Tag check contract address + args_size auto nested_context = context_provider.make_nested_context(contract_address, /*msg_sender=*/context.get_address(), /*transaction_fee=*/context.get_transaction_fee(), /*parent_context=*/context, - /*cd_offset_address=*/cd_offset, - /*cd_size=*/cd_size.as(), + /*cd_offset_address=*/args_offset, + /*cd_size=*/args_size.as(), /*is_static=*/true, /*gas_limit=*/gas_limit, /*phase=*/context.get_phase()); diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.hpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.hpp index fe79d2c71baf..b2a764059c34 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.hpp @@ -128,14 +128,14 @@ class Execution : public ExecutionInterface { MemoryAddress l2_gas_offset, MemoryAddress da_gas_offset, MemoryAddress addr, - MemoryAddress cd_size_offset, - MemoryAddress cd_offset); + MemoryAddress args_size_offset, + MemoryAddress args_offset); void static_call(ContextInterface& context, MemoryAddress l2_gas_offset, MemoryAddress da_gas_offset, MemoryAddress addr, - MemoryAddress cd_size_offset, - MemoryAddress cd_offset); + MemoryAddress args_size_offset, + MemoryAddress args_offset); void ret(ContextInterface& context, MemoryAddress ret_size_offset, MemoryAddress ret_offset); void revert(ContextInterface& context, MemoryAddress rev_size_offset, MemoryAddress rev_offset); void cd_copy(ContextInterface& context, diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/lib/serialization.cpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/lib/serialization.cpp index 56d9da216f4c..e91adffdd284 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/lib/serialization.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/lib/serialization.cpp @@ -52,8 +52,8 @@ const std::vector external_call_format = { OperandType::INDIRECT16, /*l2GasOffset=*/OperandType::UINT16, /*daGasOffset=*/OperandType::UINT16, /*addrOffset=*/OperandType::UINT16, - /*argsOffset=*/OperandType::UINT16, - /*argsSizeOffset=*/OperandType::UINT16 }; + /*argsSizeOffset=*/OperandType::UINT16, + /*argsOffset=*/OperandType::UINT16 }; namespace { // Contrary to TS, the format does not contain the WireOpCode byte which prefixes any instruction. diff --git a/yarn-project/simulator/src/public/avm/opcodes/external_calls.ts b/yarn-project/simulator/src/public/avm/opcodes/external_calls.ts index 725912f2b57f..7e79bf772b88 100644 --- a/yarn-project/simulator/src/public/avm/opcodes/external_calls.ts +++ b/yarn-project/simulator/src/public/avm/opcodes/external_calls.ts @@ -14,8 +14,8 @@ abstract class ExternalCall extends Instruction { OperandType.UINT16, // L2 gas offset OperandType.UINT16, // DA gas offset OperandType.UINT16, // Address offset - OperandType.UINT16, // Args offset OperandType.UINT16, // Args size offset + OperandType.UINT16, // Args offset ]; constructor(