diff --git a/circuits/cpp/src/aztec3/circuits/abis/combined_accumulated_data.hpp b/circuits/cpp/src/aztec3/circuits/abis/combined_accumulated_data.hpp index 91f148576504..2fa0e5a3f4ad 100644 --- a/circuits/cpp/src/aztec3/circuits/abis/combined_accumulated_data.hpp +++ b/circuits/cpp/src/aztec3/circuits/abis/combined_accumulated_data.hpp @@ -38,7 +38,8 @@ template struct CombinedAccumulatedData { zero_array(); std::array public_call_stack = zero_array(); - std::array l1_msg_stack = zero_array(); + std::array new_l2_to_l1_msgs = + zero_array(); std::array, KERNEL_NEW_CONTRACTS_LENGTH> new_contracts{}; @@ -52,7 +53,7 @@ template struct CombinedAccumulatedData { return aggregation_object == other.aggregation_object && private_call_count == other.private_call_count && public_call_count == other.public_call_count && new_commitments == other.new_commitments && new_nullifiers == other.new_nullifiers && private_call_stack == other.private_call_stack && - public_call_stack == other.public_call_stack && l1_msg_stack == other.l1_msg_stack && + public_call_stack == other.public_call_stack && new_l2_to_l1_msgs == other.new_l2_to_l1_msgs && new_contracts == other.new_contracts && optionally_revealed_data == other.optionally_revealed_data && state_transitions == other.state_transitions && state_reads == other.state_reads; }; @@ -84,7 +85,7 @@ template struct CombinedAccumulatedData { to_ct(private_call_stack), to_ct(public_call_stack), - to_ct(l1_msg_stack), + to_ct(new_l2_to_l1_msgs), map(new_contracts, to_circuit_type), map(optionally_revealed_data, to_circuit_type), @@ -118,7 +119,7 @@ template struct CombinedAccumulatedData { to_nt(private_call_stack), to_nt(public_call_stack), - to_nt(l1_msg_stack), + to_nt(new_l2_to_l1_msgs), map(new_contracts, to_native_type), map(optionally_revealed_data, to_native_type), @@ -142,7 +143,7 @@ template struct CombinedAccumulatedData { set_array_public(private_call_stack); set_array_public(public_call_stack); - set_array_public(l1_msg_stack); + set_array_public(new_l2_to_l1_msgs); set_array_public(new_contracts); set_array_public(optionally_revealed_data); @@ -202,7 +203,7 @@ template void read(uint8_t const*& it, CombinedAccumulatedData void write(std::vector& buf, CombinedAccumulate write(buf, accum_data.new_nullifiers); write(buf, accum_data.private_call_stack); write(buf, accum_data.public_call_stack); - write(buf, accum_data.l1_msg_stack); + write(buf, accum_data.new_l2_to_l1_msgs); write(buf, accum_data.new_contracts); write(buf, accum_data.optionally_revealed_data); write(buf, accum_data.state_transitions); @@ -241,8 +242,8 @@ template std::ostream& operator<<(std::ostream& os, CombinedAccum << accum_data.private_call_stack << "\n" << "public_call_stack:\n" << accum_data.public_call_stack << "\n" - << "l1_msg_stack:\n" - << accum_data.l1_msg_stack << "\n" + << "new_l2_to_l1_msgs:\n" + << accum_data.new_l2_to_l1_msgs << "\n" << "new_contracts:\n" << accum_data.new_contracts << "\n" << "optionally_revealed_data:\n" diff --git a/circuits/cpp/src/aztec3/circuits/abis/private_circuit_public_inputs.hpp b/circuits/cpp/src/aztec3/circuits/abis/private_circuit_public_inputs.hpp index bd2be5c0dbb0..87e49149c1fa 100644 --- a/circuits/cpp/src/aztec3/circuits/abis/private_circuit_public_inputs.hpp +++ b/circuits/cpp/src/aztec3/circuits/abis/private_circuit_public_inputs.hpp @@ -37,7 +37,7 @@ template class PrivateCircuitPublicInputs { std::array private_call_stack = zero_array(); std::array public_call_stack = zero_array(); - std::array l1_msg_stack = zero_array(); + std::array new_l2_to_l1_msgs = zero_array(); fr historic_private_data_tree_root = 0; fr historic_nullifier_tree_root = 0; @@ -50,7 +50,7 @@ template class PrivateCircuitPublicInputs { return call_context == other.call_context && args == other.args && return_values == other.return_values && emitted_events == other.emitted_events && new_commitments == other.new_commitments && new_nullifiers == other.new_nullifiers && private_call_stack == other.private_call_stack && - public_call_stack == other.public_call_stack && l1_msg_stack == other.l1_msg_stack && + public_call_stack == other.public_call_stack && new_l2_to_l1_msgs == other.new_l2_to_l1_msgs && historic_private_data_tree_root == other.historic_private_data_tree_root && historic_nullifier_tree_root == other.historic_nullifier_tree_root && historic_contract_tree_root == other.historic_contract_tree_root && @@ -79,7 +79,7 @@ template class PrivateCircuitPublicInputs { to_ct(private_call_stack), to_ct(public_call_stack), - to_ct(l1_msg_stack), + to_ct(new_l2_to_l1_msgs), to_ct(historic_private_data_tree_root), to_ct(historic_nullifier_tree_root), @@ -110,7 +110,7 @@ template class PrivateCircuitPublicInputs { to_nt(private_call_stack), to_nt(public_call_stack), - to_nt(l1_msg_stack), + to_nt(new_l2_to_l1_msgs), to_nt(historic_private_data_tree_root), to_nt(historic_nullifier_tree_root), @@ -140,7 +140,7 @@ template class PrivateCircuitPublicInputs { spread_arr_into_vec(private_call_stack, inputs); spread_arr_into_vec(public_call_stack, inputs); - spread_arr_into_vec(l1_msg_stack, inputs); + spread_arr_into_vec(new_l2_to_l1_msgs, inputs); inputs.push_back(historic_private_data_tree_root); inputs.push_back(historic_nullifier_tree_root); @@ -171,7 +171,7 @@ template void read(uint8_t const*& it, PrivateCircuitPublicInputs read(it, pis.new_nullifiers); read(it, pis.private_call_stack); read(it, pis.public_call_stack); - read(it, pis.l1_msg_stack); + read(it, pis.new_l2_to_l1_msgs); read(it, pis.historic_private_data_tree_root); read(it, pis.historic_nullifier_tree_root); read(it, pis.historic_contract_tree_root); @@ -193,7 +193,7 @@ void write(std::vector& buf, PrivateCircuitPublicInputs const& pri write(buf, pis.new_nullifiers); write(buf, pis.private_call_stack); write(buf, pis.public_call_stack); - write(buf, pis.l1_msg_stack); + write(buf, pis.new_l2_to_l1_msgs); write(buf, pis.historic_private_data_tree_root); write(buf, pis.historic_nullifier_tree_root); write(buf, pis.historic_contract_tree_root); @@ -214,7 +214,7 @@ std::ostream& operator<<(std::ostream& os, PrivateCircuitPublicInputs const << "new_nullifiers: " << pis.new_nullifiers << "\n" << "private_call_stack: " << pis.private_call_stack << "\n" << "public_call_stack: " << pis.public_call_stack << "\n" - << "l1_msg_stack: " << pis.l1_msg_stack << "\n" + << "new_l2_to_l1_msgs: " << pis.new_l2_to_l1_msgs << "\n" << "historic_private_data_tree_root: " << pis.historic_private_data_tree_root << "\n" << "historic_nullifier_tree_root: " << pis.historic_nullifier_tree_root << "\n" << "contract_deployment_data: " << pis.contract_deployment_data << "\n" @@ -242,7 +242,7 @@ template class OptionalPrivateCircuitPublicInputs { std::array private_call_stack; std::array public_call_stack; - std::array l1_msg_stack; + std::array new_l2_to_l1_msgs; opt_fr historic_private_data_tree_root; opt_fr historic_nullifier_tree_root; @@ -264,7 +264,7 @@ template class OptionalPrivateCircuitPublicInputs { std::array const& private_call_stack, std::array const& public_call_stack, - std::array const& l1_msg_stack, + std::array const& new_l2_to_l1_msgs, opt_fr const& historic_private_data_tree_root, opt_fr const& historic_nullifier_tree_root, @@ -279,7 +279,7 @@ template class OptionalPrivateCircuitPublicInputs { , new_nullifiers(new_nullifiers) , private_call_stack(private_call_stack) , public_call_stack(public_call_stack) - , l1_msg_stack(l1_msg_stack) + , new_l2_to_l1_msgs(new_l2_to_l1_msgs) , historic_private_data_tree_root(historic_private_data_tree_root) , historic_nullifier_tree_root(historic_nullifier_tree_root) , historic_contract_tree_root(historic_contract_tree_root) @@ -303,7 +303,7 @@ template class OptionalPrivateCircuitPublicInputs { new_inputs.private_call_stack.fill(std::nullopt); new_inputs.public_call_stack.fill(std::nullopt); - new_inputs.l1_msg_stack.fill(std::nullopt); + new_inputs.new_l2_to_l1_msgs.fill(std::nullopt); new_inputs.historic_private_data_tree_root = std::nullopt; new_inputs.historic_nullifier_tree_root = std::nullopt; @@ -350,7 +350,7 @@ template class OptionalPrivateCircuitPublicInputs { make_unused_array_elements_zero(composer, private_call_stack); make_unused_array_elements_zero(composer, public_call_stack); - make_unused_array_elements_zero(composer, l1_msg_stack); + make_unused_array_elements_zero(composer, new_l2_to_l1_msgs); make_unused_element_zero(composer, historic_private_data_tree_root); make_unused_element_zero(composer, historic_nullifier_tree_root); @@ -381,7 +381,7 @@ template class OptionalPrivateCircuitPublicInputs { set_array_public(private_call_stack); set_array_public(public_call_stack); - set_array_public(l1_msg_stack); + set_array_public(new_l2_to_l1_msgs); (*historic_private_data_tree_root).set_public(); (*historic_nullifier_tree_root).set_public(); @@ -414,7 +414,7 @@ template class OptionalPrivateCircuitPublicInputs { to_ct(private_call_stack), to_ct(public_call_stack), - to_ct(l1_msg_stack), + to_ct(new_l2_to_l1_msgs), to_ct(historic_private_data_tree_root), to_ct(historic_nullifier_tree_root), @@ -448,7 +448,7 @@ template class OptionalPrivateCircuitPublicInputs { to_nt(private_call_stack), to_nt(public_call_stack), - to_nt(l1_msg_stack), + to_nt(new_l2_to_l1_msgs), to_nt(historic_private_data_tree_root), to_nt(historic_nullifier_tree_root), @@ -483,7 +483,7 @@ template class OptionalPrivateCircuitPublicInputs { spread_arr_opt_into_vec(private_call_stack, inputs); spread_arr_opt_into_vec(public_call_stack, inputs); - spread_arr_opt_into_vec(l1_msg_stack, inputs); + spread_arr_opt_into_vec(new_l2_to_l1_msgs, inputs); inputs.push_back(*historic_private_data_tree_root); inputs.push_back(*historic_nullifier_tree_root); @@ -512,7 +512,7 @@ template class OptionalPrivateCircuitPublicInputs { .private_call_stack = map(private_call_stack, get_value), .public_call_stack = map(public_call_stack, get_value), - .l1_msg_stack = map(l1_msg_stack, get_value), + .new_l2_to_l1_msgs = map(new_l2_to_l1_msgs, get_value), .historic_private_data_tree_root = historic_private_data_tree_root.value(), .historic_nullifier_tree_root = historic_nullifier_tree_root.value(), @@ -604,7 +604,7 @@ void read(uint8_t const*& it, OptionalPrivateCircuitPublicInputs& private_c read(it, pis.new_nullifiers); read(it, pis.private_call_stack); read(it, pis.public_call_stack); - read(it, pis.l1_msg_stack); + read(it, pis.new_l2_to_l1_msgs); read(it, pis.historic_private_data_tree_root); read(it, pis.historic_nullifier_tree_root); read(it, pis.historic_contract_tree_root); @@ -626,7 +626,7 @@ void write(std::vector& buf, OptionalPrivateCircuitPublicInputs co write(buf, pis.new_nullifiers); write(buf, pis.private_call_stack); write(buf, pis.public_call_stack); - write(buf, pis.l1_msg_stack); + write(buf, pis.new_l2_to_l1_msgs); write(buf, pis.historic_private_data_tree_root); write(buf, pis.historic_nullifier_tree_root); write(buf, pis.historic_contract_tree_root); @@ -646,7 +646,7 @@ std::ostream& operator<<(std::ostream& os, OptionalPrivateCircuitPublicInputs contract_deployment_call_stack; -// std::array, L1_MSG_STACK_LENGTH> l1_call_contexts; -// std::array l1_counterparts; // TODO: this is probably wrong. +// std::array, NEW_L2_TO_L1_MSGS_LENGTH> l1_call_contexts; +// std::array l1_counterparts; // TODO: this is probably wrong. // template // CallContextReconciliationData> to_circuit_type(Composer& composer) const diff --git a/circuits/cpp/src/aztec3/circuits/abis/public_circuit_public_inputs.hpp b/circuits/cpp/src/aztec3/circuits/abis/public_circuit_public_inputs.hpp index 574cbd037f39..4cfa27ab38d8 100644 --- a/circuits/cpp/src/aztec3/circuits/abis/public_circuit_public_inputs.hpp +++ b/circuits/cpp/src/aztec3/circuits/abis/public_circuit_public_inputs.hpp @@ -34,7 +34,7 @@ template struct PublicCircuitPublicInputs { std::array, STATE_READS_LENGTH> state_reads{}; std::array public_call_stack = zero_array(); - std::array l1_msg_stack = zero_array(); + std::array new_l2_to_l1_msgs = zero_array(); fr historic_public_data_tree_root = 0; @@ -45,7 +45,7 @@ template struct PublicCircuitPublicInputs { return call_context == other.call_context && args == other.args && return_values == other.return_values && emitted_events == other.emitted_events && state_transitions == other.state_transitions && state_reads == other.state_reads && public_call_stack == other.public_call_stack && - l1_msg_stack == other.l1_msg_stack && + new_l2_to_l1_msgs == other.new_l2_to_l1_msgs && historic_public_data_tree_root == other.historic_public_data_tree_root && prover_address == other.prover_address; }; @@ -71,7 +71,7 @@ template struct PublicCircuitPublicInputs { .state_reads = map(state_reads, to_circuit_type), .public_call_stack = to_ct(public_call_stack), - .l1_msg_stack = to_ct(l1_msg_stack), + .new_l2_to_l1_msgs = to_ct(new_l2_to_l1_msgs), .historic_public_data_tree_root = to_ct(historic_public_data_tree_root), @@ -100,7 +100,7 @@ template struct PublicCircuitPublicInputs { spread_arr_into_vec(map(state_reads, to_hashes), inputs); spread_arr_into_vec(public_call_stack, inputs); - spread_arr_into_vec(l1_msg_stack, inputs); + spread_arr_into_vec(new_l2_to_l1_msgs, inputs); inputs.push_back(historic_public_data_tree_root); @@ -128,7 +128,7 @@ template void read(uint8_t const*& it, PublicCircuitPublicInputs< read(it, pis.state_reads); read(it, pis.public_call_stack); - read(it, pis.l1_msg_stack); + read(it, pis.new_l2_to_l1_msgs); read(it, pis.historic_public_data_tree_root); @@ -151,7 +151,7 @@ void write(std::vector& buf, PublicCircuitPublicInputs const& publ write(buf, pis.state_reads); write(buf, pis.public_call_stack); - write(buf, pis.l1_msg_stack); + write(buf, pis.new_l2_to_l1_msgs); write(buf, pis.historic_public_data_tree_root); @@ -172,7 +172,7 @@ std::ostream& operator<<(std::ostream& os, PublicCircuitPublicInputs const& << "state_reads: " << pis.state_reads << "\n" << "public_call_stack: " << pis.public_call_stack << "\n" - << "l1_msg_stack: " << pis.l1_msg_stack << "\n" + << "new_l2_to_l1_msgs: " << pis.new_l2_to_l1_msgs << "\n" << "historic_public_data_tree_root: " << pis.historic_public_data_tree_root << "\n" diff --git a/circuits/cpp/src/aztec3/circuits/apps/contract.hpp b/circuits/cpp/src/aztec3/circuits/apps/contract.hpp index f5cfdecb8515..eeb8d3b169a2 100644 --- a/circuits/cpp/src/aztec3/circuits/apps/contract.hpp +++ b/circuits/cpp/src/aztec3/circuits/apps/contract.hpp @@ -1,7 +1,6 @@ #pragma once #include "function_declaration.hpp" -#include "l1_function_interface.hpp" #include @@ -32,8 +31,6 @@ template class Contract { std::map> function_datas; - std::map> l1_functions; - std::map> imported_contracts; explicit Contract(std::string const& contract_name) : contract_name(contract_name) @@ -58,10 +55,6 @@ template class Contract { FunctionData get_function_data_by_name(std::string const& name); - void import_l1_function(L1FunctionInterfaceStruct const& l1_function_struct); - - L1FunctionInterface& get_l1_function(std::string const& name); - // TODO: maybe also declare a type at this stage, so the correct type can be checked-for when the StateVar type is // created within the function. /** diff --git a/circuits/cpp/src/aztec3/circuits/apps/contract.tpp b/circuits/cpp/src/aztec3/circuits/apps/contract.tpp index c752f0014ca2..2e2745494250 100644 --- a/circuits/cpp/src/aztec3/circuits/apps/contract.tpp +++ b/circuits/cpp/src/aztec3/circuits/apps/contract.tpp @@ -1,7 +1,6 @@ #pragma once #include "function_execution_context.hpp" #include "function_declaration.hpp" -#include "l1_function_interface.hpp" #include @@ -63,18 +62,4 @@ template FunctionData Contract::get_function_data_by_na return function_datas[name]; } -template void Contract::import_l1_function(L1FunctionInterfaceStruct const& l1_function_struct) -{ - L1FunctionInterface const l1_function = L1FunctionInterface(this, l1_function_struct); - l1_functions.insert(std::make_pair(l1_function_struct.function_name, l1_function)); -}; - -template L1FunctionInterface& Contract::get_l1_function(std::string const& name) -{ - if (!l1_functions.contains(name)) { - throw_or_abort("L1 function not found. Make sure to import_l1_function()"); - } - return l1_functions[name]; -} - } // namespace aztec3::circuits::apps \ No newline at end of file diff --git a/circuits/cpp/src/aztec3/circuits/apps/l1_call.hpp b/circuits/cpp/src/aztec3/circuits/apps/l1_call.hpp deleted file mode 100644 index 808a224f82fe..000000000000 --- a/circuits/cpp/src/aztec3/circuits/apps/l1_call.hpp +++ /dev/null @@ -1,83 +0,0 @@ -#pragma once - -#include "l1_function_interface.hpp" - -#include -#include -#include - -#include - -namespace aztec3::circuits::apps { - -using aztec3::utils::types::CircuitTypes; -using aztec3::utils::types::NativeTypes; -using plonk::stdlib::witness_t; - -template class L1Call { - typedef typename CircuitTypes::fr fr; - - public: - L1FunctionInterface& l1_function; - std::vector args; - fr hash_of_argument_encodings = 0; - fr partial_l1_call_stack_item = 0; // keccak(function_selector, hash_of_argument_encodings) - - L1Call(L1FunctionInterface const& l1_function, std::vector const& args) : l1_function(l1_function), args(args) - { - /// TODO: in reality, we'll need to use keccak hash here, as this will need to be replecated on-chain. - if (args.size() == 0) { - hash_of_argument_encodings = 0; - } else { - hash_of_argument_encodings = args[0]; // lazy stub for a hash! - } - partial_l1_call_stack_item = function_selector; // lazy stub for a hash! - } - - bool operator==(L1Call const&) const = default; - - template L1Call> to_circuit_type(Composer& composer) const - { - static_assert((std::is_same::value)); - - // Capture the composer: - auto to_ct = [&](auto& e) { return aztec3::utils::types::to_ct(composer, e); }; - - L1Call> l1_call = { l1_function.to_circuit_type(composer), - to_ct(args), - to_ct(hash_of_argument_encodings), - to_ct(partial_l1_call_stack_item) }; - - return l1_call; - }; -}; - -template void read(uint8_t const*& it, L1Call& l1_call) -{ - using serialize::read; - - read(it, l1_call.l1_function); - read(it, l1_call.args); - read(it, l1_call.hash_of_argument_encodings); - read(it, l1_call.partial_l1_call_stack_item); -}; - -template void write(std::vector& buf, L1Call const& l1_call) -{ - using serialize::write; - - write(buf, l1_call.l1_function); - write(buf, l1_call.args); - write(buf, l1_call.hash_of_argument_encodings); - write(buf, l1_call.partial_l1_call_stack_item); -}; - -template std::ostream& operator<<(std::ostream& os, L1Call const& l1_call) -{ - return os << "l1_function: " << l1_call.l1_function << "\n" - << "args: " << l1_call.args << "\n" - << "hash_of_argument_encodings: " << l1_call.hash_of_argument_encodings << "\n" - << "partial_l1_call_stack_item: " << l1_call.partial_l1_call_stack_item << "\n"; -} - -} // namespace aztec3::circuits::apps \ No newline at end of file diff --git a/circuits/cpp/src/aztec3/circuits/apps/l1_function_interface.hpp b/circuits/cpp/src/aztec3/circuits/apps/l1_function_interface.hpp deleted file mode 100644 index b67693cb3fa4..000000000000 --- a/circuits/cpp/src/aztec3/circuits/apps/l1_function_interface.hpp +++ /dev/null @@ -1,59 +0,0 @@ -#pragma once -#include -#include -#include - -#include - -namespace aztec3::circuits::apps { - -using aztec3::utils::types::CircuitTypes; -using aztec3::utils::types::NativeTypes; -using plonk::stdlib::witness_t; - -template class Contract; - -// We use the struct to retain designated initialisation, to make contract creation more readable. -template struct L1FunctionInterfaceStruct { - using fr = typename NCT::fr; - - std::string function_name; - fr function_selector = 0; - size_t num_params = 0; -}; - -template class L1FunctionInterface { - using fr = typename NCT::fr; - - public: - Contract* contract; - std::string function_name; - fr function_selector = 0; - size_t num_params = 0; - - L1FunctionInterface() = default; - - L1FunctionInterface(Contract* contract, L1FunctionInterfaceStruct const& l1_fn_struct) - : contract(contract) - , function_name(l1_fn_struct.function_name) - , function_selector(l1_fn_struct.function_selector) - , num_params(l1_fn_struct.num_params) - {} - - // L1FunctionInterface(L1FunctionInterface const& l1_function) - // : contract(l1_function.contract) - // , function_name(l1_function.function_name) - // , function_selector(l1_function.function_selector) - // , num_params(l1_function.num_params) - // {} - - void call(std::vector args) - { - // TODO: implement this function. - (void)args; // So the compiler doesn't complain about an unused var. - } -}; - -} // namespace aztec3::circuits::apps - -// #include "l1_function_interface.tpp" \ No newline at end of file diff --git a/circuits/cpp/src/aztec3/circuits/apps/l1_function_interface.tpp b/circuits/cpp/src/aztec3/circuits/apps/l1_function_interface.tpp deleted file mode 100644 index 81f3a5ec34ea..000000000000 --- a/circuits/cpp/src/aztec3/circuits/apps/l1_function_interface.tpp +++ /dev/null @@ -1,27 +0,0 @@ -// #include -// #include -// #include -// #include -// #include "contract.hpp" -// #include "l1_promise.hpp" -// #include "l1_result.hpp" - -// namespace aztec3::circuits::apps { - -// using plonk::stdlib::witness_t; -// using aztec3::utils::types::CircuitTypes; -// using aztec3::utils::types::NativeTypes; - -// template -// std::pair, L1Result> L1FunctionInterface::call(std::vector args) -// { -// if (args.size() != num_params) { -// throw_or_abort("Incorrect number of args"); -// } - -// auto promise = L1Promise(*contract); -// L1Result result; -// return std::make_pair(promise, result); -// } - -// } // namespace aztec3::circuits::apps \ No newline at end of file diff --git a/circuits/cpp/src/aztec3/circuits/apps/test_apps/escrow/contract.hpp b/circuits/cpp/src/aztec3/circuits/apps/test_apps/escrow/contract.hpp index 6490d533c7d8..f26f52b92d59 100644 --- a/circuits/cpp/src/aztec3/circuits/apps/test_apps/escrow/contract.hpp +++ b/circuits/cpp/src/aztec3/circuits/apps/test_apps/escrow/contract.hpp @@ -20,13 +20,6 @@ inline Contract init_contract() { .name = "withdraw", .is_private = true }, }); - // TODO: this L1 declaration interface is just to get something working. - contract.import_l1_function({ - .function_name = "withdraw", - .function_selector = 12345, - .num_params = 3, - }); - return contract; } diff --git a/circuits/cpp/src/aztec3/circuits/kernel/private/native_private_kernel_circuit.cpp b/circuits/cpp/src/aztec3/circuits/kernel/private/native_private_kernel_circuit.cpp index 5a7fffdbe8f7..808fb1342177 100644 --- a/circuits/cpp/src/aztec3/circuits/kernel/private/native_private_kernel_circuit.cpp +++ b/circuits/cpp/src/aztec3/circuits/kernel/private/native_private_kernel_circuit.cpp @@ -67,7 +67,7 @@ void initialise_end_values(PrivateInputs const& private_inputs, KernelCircui end.private_call_stack = start.private_call_stack; end.public_call_stack = start.public_call_stack; - end.l1_msg_stack = start.l1_msg_stack; + end.new_l2_to_l1_msgs = start.new_l2_to_l1_msgs; end.optionally_revealed_data = start.optionally_revealed_data; } @@ -236,14 +236,14 @@ void update_end_values(DummyComposer& composer, // const auto& portal_contract_address = private_inputs.private_call.portal_contract_address; // { - // const auto& l1_msg_stack = private_call_public_inputs.l1_msg_stack; - // std::array l1_call_stack; + // const auto& new_l2_to_l1_msgs = private_call_public_inputs.new_l2_to_l1_msgs; + // std::array l1_call_stack; - // for (size_t i = 0; i < l1_msg_stack.size(); ++i) { + // for (size_t i = 0; i < new_l2_to_l1_msgs.size(); ++i) { // l1_call_stack[i] = CT::fr::conditional_assign( - // l1_msg_stack[i] == 0, + // new_l2_to_l1_msgs[i] == 0, // 0, - // CT::compress({ portal_contract_address, l1_msg_stack[i] }, GeneratorIndex::L1_MSG_STACK_ITEM)); + // CT::compress({ portal_contract_address, new_l2_to_l1_msgs[i] }, GeneratorIndex::L2_TO_L1_MSG)); // } // } } @@ -297,7 +297,7 @@ void validate_inputs(DummyComposer& composer, PrivateInputs const& private_i NT::fr const start_private_call_stack_length = array_length(start.private_call_stack); NT::fr const start_public_call_stack_length = array_length(start.public_call_stack); - NT::fr const start_l1_msg_stack_length = array_length(start.l1_msg_stack); + NT::fr const start_new_l2_to_l1_msgs_length = array_length(start.new_l2_to_l1_msgs); // Base Case if (is_base_case) { @@ -311,8 +311,8 @@ void validate_inputs(DummyComposer& composer, PrivateInputs const& private_i composer.do_assert(start_public_call_stack_length == 0, "Public call stack must be empty", CircuitErrorCode::PRIVATE_KERNEL__UNSUPPORTED_OP); - composer.do_assert(start_l1_msg_stack_length == 0, - "L1 msg stack must be empty", + composer.do_assert(start_new_l2_to_l1_msgs_length == 0, + "L2 to L1 msgs must be empty", CircuitErrorCode::PRIVATE_KERNEL__UNSUPPORTED_OP); composer.do_assert(this_call_stack_item.public_inputs.call_context.is_delegate_call == false, diff --git a/circuits/cpp/src/aztec3/circuits/kernel/private/private_kernel_circuit.cpp b/circuits/cpp/src/aztec3/circuits/kernel/private/private_kernel_circuit.cpp index 75d4b487ffd5..b71c2c1de8c1 100644 --- a/circuits/cpp/src/aztec3/circuits/kernel/private/private_kernel_circuit.cpp +++ b/circuits/cpp/src/aztec3/circuits/kernel/private/private_kernel_circuit.cpp @@ -76,7 +76,7 @@ void initialise_end_values(PrivateInputs const& private_inputs, KernelCircui end.private_call_stack = start.private_call_stack; end.public_call_stack = start.public_call_stack; - end.l1_msg_stack = start.l1_msg_stack; + end.new_l2_to_l1_msgs = start.new_l2_to_l1_msgs; // TODO end.new_contracts = start.new_contracts; @@ -186,14 +186,14 @@ void update_end_values(PrivateInputs const& private_inputs, KernelCircuitPub } // { - // const auto& l1_msg_stack = private_call_public_inputs.l1_msg_stack; - // std::array l1_call_stack; + // const auto& new_l2_to_l1_msgs = private_call_public_inputs.new_l2_to_l1_msgs; + // std::array l1_call_stack; - // for (size_t i = 0; i < l1_msg_stack.size(); ++i) { + // for (size_t i = 0; i < new_l2_to_l1_msgs.size(); ++i) { // l1_call_stack[i] = CT::fr::conditional_assign( - // l1_msg_stack[i] == 0, + // new_l2_to_l1_msgs[i] == 0, // 0, - // CT::compress({ portal_contract_address, l1_msg_stack[i] }, GeneratorIndex::L1_MSG_STACK_ITEM)); + // CT::compress({ portal_contract_address, new_l2_to_l1_msgs[i] }, GeneratorIndex::L2_TO_L1_MSG)); // } // } } @@ -259,7 +259,7 @@ void validate_inputs(PrivateInputs const& private_inputs) // but we want to know "length" in terms of how many nonzero entries have been inserted CT::fr const start_private_call_stack_length = array_length(start.private_call_stack); CT::fr const start_public_call_stack_length = array_length(start.public_call_stack); - CT::fr const start_l1_msg_stack_length = array_length(start.l1_msg_stack); + CT::fr const start_new_l2_to_l1_msgs_length = array_length(start.new_l2_to_l1_msgs); // Recall: we can't do traditional `if` statements in a circuit; all code paths are always executed. The below is // some syntactic sugar, which seeks readability similar to an `if` statement. @@ -270,7 +270,7 @@ void validate_inputs(PrivateInputs const& private_inputs) // rebate can be paid. { start_private_call_stack_length == 1, "Private call stack must be length 1" }, { start_public_call_stack_length == 0, "Public call stack must be empty" }, - { start_l1_msg_stack_length == 0, "L1 msg stack must be empty" }, + { start_new_l2_to_l1_msgs_length == 0, "L2 to L1 msgs must be empty" }, { this_call_stack_item.public_inputs.call_context.is_delegate_call == false, "Users cannot make a delegatecall" }, diff --git a/circuits/cpp/src/aztec3/circuits/kernel/public/.test.cpp b/circuits/cpp/src/aztec3/circuits/kernel/public/.test.cpp index 0996622bfc8a..4b3e22f8970f 100644 --- a/circuits/cpp/src/aztec3/circuits/kernel/public/.test.cpp +++ b/circuits/cpp/src/aztec3/circuits/kernel/public/.test.cpp @@ -125,7 +125,8 @@ PublicCallStackItem generate_call_stack_item(NT::fr contract_address, std::array const emitted_events = array_of_values(count); std::array const public_call_stack = array_of_values(count); - std::array const l1_msg_stack = array_of_values(count); + std::array const new_l2_to_l1_msgs = + array_of_values(count); std::array, STATE_READS_LENGTH> const reads = generate_state_reads(count); std::array, STATE_TRANSITIONS_LENGTH> const transitions = generate_state_transitions(count); @@ -138,7 +139,7 @@ PublicCallStackItem generate_call_stack_item(NT::fr contract_address, .state_transitions = transitions, .state_reads = reads, .public_call_stack = public_call_stack, - .l1_msg_stack = l1_msg_stack, + .new_l2_to_l1_msgs = new_l2_to_l1_msgs, }; auto call_stack_item = PublicCallStackItem{ @@ -237,8 +238,8 @@ PublicKernelInputsNoPreviousKernel get_kernel_inputs_no_previous_kernel() generate_state_transitions(seed, STATE_TRANSITIONS_LENGTH / 2); std::array, STATE_READS_LENGTH> const state_reads = generate_state_reads(seed, STATE_READS_LENGTH / 2); - std::array const l1_msg_stack = - array_of_values(seed, L1_MSG_STACK_LENGTH / 2); + std::array const new_l2_to_l1_msgs = + array_of_values(seed, NEW_L2_TO_L1_MSGS_LENGTH / 2); fr const historic_public_data_tree_root = ++seed; // create the public circuit public inputs @@ -250,7 +251,7 @@ PublicKernelInputsNoPreviousKernel get_kernel_inputs_no_previous_kernel() .state_transitions = state_transitions, .state_reads = state_reads, .public_call_stack = call_stack_hashes, - .l1_msg_stack = l1_msg_stack, + .new_l2_to_l1_msgs = new_l2_to_l1_msgs, .historic_public_data_tree_root = historic_public_data_tree_root, }; @@ -362,7 +363,7 @@ PublicKernelInputs get_kernel_inputs_with_previous_kernel(NT::boolean privat .new_nullifiers = array_of_values(seed, private_previous ? 3 : 0), .private_call_stack = array_of_values(seed, 0), .public_call_stack = public_call_stack, - .l1_msg_stack = array_of_values(seed, 4), + .new_l2_to_l1_msgs = array_of_values(seed, 4), .new_contracts = std::array, KERNEL_NEW_CONTRACTS_LENGTH>(), .optionally_revealed_data = std::array, KERNEL_OPTIONALLY_REVEALED_DATA_LENGTH>(), .state_transitions = std::array, STATE_TRANSITIONS_LENGTH>(), @@ -433,9 +434,9 @@ void validate_private_data_propagation(const PublicKernelInputs& inputs, zero_array(), public_inputs.end.private_call_stack)); - ASSERT_TRUE(source_arrays_are_in_target(inputs.previous_kernel.public_inputs.end.l1_msg_stack, - zero_array(), - public_inputs.end.l1_msg_stack)); + ASSERT_TRUE(source_arrays_are_in_target(inputs.previous_kernel.public_inputs.end.new_l2_to_l1_msgs, + zero_array(), + public_inputs.end.new_l2_to_l1_msgs)); ASSERT_TRUE(source_arrays_are_in_target(inputs.previous_kernel.public_inputs.end.new_contracts, std::array, KERNEL_NEW_CONTRACTS_LENGTH>(), diff --git a/circuits/cpp/src/aztec3/circuits/kernel/public/common.cpp b/circuits/cpp/src/aztec3/circuits/kernel/public/common.cpp index b041bbc46178..c91093478828 100644 --- a/circuits/cpp/src/aztec3/circuits/kernel/public/common.cpp +++ b/circuits/cpp/src/aztec3/circuits/kernel/public/common.cpp @@ -20,7 +20,7 @@ void common_initialise_end_values(PublicKernelInputs const& public_kernel_in end.private_call_stack = start.private_call_stack; end.public_call_stack = start.public_call_stack; - end.l1_msg_stack = start.l1_msg_stack; + end.new_l2_to_l1_msgs = start.new_l2_to_l1_msgs; end.optionally_revealed_data = start.optionally_revealed_data; diff --git a/circuits/cpp/src/aztec3/constants.hpp b/circuits/cpp/src/aztec3/constants.hpp index f4f3674c9cfc..edcc1460dc1b 100644 --- a/circuits/cpp/src/aztec3/constants.hpp +++ b/circuits/cpp/src/aztec3/constants.hpp @@ -16,14 +16,14 @@ constexpr size_t STATE_READS_LENGTH = 4; constexpr size_t PRIVATE_CALL_STACK_LENGTH = 4; constexpr size_t PUBLIC_CALL_STACK_LENGTH = 4; -constexpr size_t L1_MSG_STACK_LENGTH = 2; +constexpr size_t NEW_L2_TO_L1_MSGS_LENGTH = 2; constexpr size_t KERNEL_NEW_COMMITMENTS_LENGTH = 4; constexpr size_t KERNEL_NEW_NULLIFIERS_LENGTH = 4; constexpr size_t KERNEL_NEW_CONTRACTS_LENGTH = 1; constexpr size_t KERNEL_PRIVATE_CALL_STACK_LENGTH = 8; constexpr size_t KERNEL_PUBLIC_CALL_STACK_LENGTH = 8; -constexpr size_t KERNEL_L1_MSG_STACK_LENGTH = 4; +constexpr size_t KERNEL_NEW_L2_TO_L1_MSGS_LENGTH = 4; constexpr size_t KERNEL_OPTIONALLY_REVEALED_DATA_LENGTH = 4; constexpr size_t VK_TREE_HEIGHT = 3; @@ -73,7 +73,7 @@ enum GeneratorIndex { CALL_CONTEXT, CALL_STACK_ITEM, CALL_STACK_ITEM_2, // see function where it's used for explanation - L1_MSG_STACK_ITEM, + L2_TO_L1_MSG, PRIVATE_CIRCUIT_PUBLIC_INPUTS, PUBLIC_CIRCUIT_PUBLIC_INPUTS, TX_CONTEXT, diff --git a/yarn-project/acir-simulator/src/acvm/deserialize.ts b/yarn-project/acir-simulator/src/acvm/deserialize.ts index db614d24236c..e1aa90e98bde 100644 --- a/yarn-project/acir-simulator/src/acvm/deserialize.ts +++ b/yarn-project/acir-simulator/src/acvm/deserialize.ts @@ -5,7 +5,7 @@ import { CallContext, ContractDeploymentData, EMITTED_EVENTS_LENGTH, - L1_MSG_STACK_LENGTH, + NEW_L2_TO_L1_MSGS_LENGTH, NEW_COMMITMENTS_LENGTH, NEW_NULLIFIERS_LENGTH, PrivateCircuitPublicInputs, @@ -80,7 +80,7 @@ export function extractPublicInputs(partialWitness: ACVMWitness, acir: Buffer): const newNullifiers = witnessReader.readFieldArray(NEW_NULLIFIERS_LENGTH); const privateCallStack = witnessReader.readFieldArray(PRIVATE_CALL_STACK_LENGTH); const publicCallStack = witnessReader.readFieldArray(PUBLIC_CALL_STACK_LENGTH); - const l1MsgStack = witnessReader.readFieldArray(L1_MSG_STACK_LENGTH); + const newL2ToL1Msgs = witnessReader.readFieldArray(NEW_L2_TO_L1_MSGS_LENGTH); const privateDataTreeRoot = witnessReader.readField(); const nullifierTreeRoot = witnessReader.readField(); @@ -102,7 +102,7 @@ export function extractPublicInputs(partialWitness: ACVMWitness, acir: Buffer): newNullifiers, privateCallStack, publicCallStack, - l1MsgStack, + newL2ToL1Msgs, privateDataTreeRoot, nullifierTreeRoot, contractTreeRoot, diff --git a/yarn-project/acir-simulator/src/acvm/serialize.ts b/yarn-project/acir-simulator/src/acvm/serialize.ts index 5b2b13958a12..7505f753851a 100644 --- a/yarn-project/acir-simulator/src/acvm/serialize.ts +++ b/yarn-project/acir-simulator/src/acvm/serialize.ts @@ -51,7 +51,7 @@ export function toACVMPublicInputs(publicInputs: PrivateCircuitPublicInputs): AC ...publicInputs.newNullifiers.map(toACVMField), ...publicInputs.privateCallStack.map(toACVMField), ...publicInputs.publicCallStack.map(toACVMField), - ...publicInputs.l1MsgStack.map(toACVMField), + ...publicInputs.newL2ToL1Msgs.map(toACVMField), toACVMField(publicInputs.historicPrivateDataTreeRoot), toACVMField(publicInputs.historicPrivateNullifierTreeRoot), diff --git a/yarn-project/circuits.js/src/structs/__snapshots__/private_circuit_public_inputs.test.ts.snap b/yarn-project/circuits.js/src/structs/__snapshots__/private_circuit_public_inputs.test.ts.snap index 7b79b0716a92..933310b2f98f 100644 --- a/yarn-project/circuits.js/src/structs/__snapshots__/private_circuit_public_inputs.test.ts.snap +++ b/yarn-project/circuits.js/src/structs/__snapshots__/private_circuit_public_inputs.test.ts.snap @@ -15,7 +15,7 @@ new_commitments: [ 0x400 0x401 0x402 0x403 ] new_nullifiers: [ 0x500 0x501 0x502 0x503 ] private_call_stack: [ 0x600 0x601 0x602 0x603 ] public_call_stack: [ 0x700 0x701 0x702 0x703 ] -l1_msg_stack: [ 0x800 0x801 ] +new_l2_to_l1_msgs: [ 0x800 0x801 ] historic_private_data_tree_root: 0x1000 historic_nullifier_tree_root: 0x1100 contract_deployment_data: constructor_vk_hash: 0x1 diff --git a/yarn-project/circuits.js/src/structs/constants.ts b/yarn-project/circuits.js/src/structs/constants.ts index be28df64a271..a4ba827ca060 100644 --- a/yarn-project/circuits.js/src/structs/constants.ts +++ b/yarn-project/circuits.js/src/structs/constants.ts @@ -7,20 +7,20 @@ export const EMITTED_EVENTS_LENGTH = 4; export const NEW_COMMITMENTS_LENGTH = 4; export const NEW_NULLIFIERS_LENGTH = 4; +export const NEW_L2_TO_L1_MSGS_LENGTH = 2; export const STATE_TRANSITIONS_LENGTH = 4; export const STATE_READS_LENGTH = 4; export const PRIVATE_CALL_STACK_LENGTH = 4; export const PUBLIC_CALL_STACK_LENGTH = 4; -export const L1_MSG_STACK_LENGTH = 2; export const KERNEL_NEW_COMMITMENTS_LENGTH = 4; export const KERNEL_NEW_NULLIFIERS_LENGTH = 4; export const KERNEL_NEW_CONTRACTS_LENGTH = 1; export const KERNEL_PRIVATE_CALL_STACK_LENGTH = 8; export const KERNEL_PUBLIC_CALL_STACK_LENGTH = 8; -export const KERNEL_L1_MSG_STACK_LENGTH = 4; +export const KERNEL_NEW_L2_TO_L1_MSGS_LENGTH = 4; export const KERNEL_OPTIONALLY_REVEALED_DATA_LENGTH = 4; export const VK_TREE_HEIGHT = 3; diff --git a/yarn-project/circuits.js/src/structs/generators.ts b/yarn-project/circuits.js/src/structs/generators.ts index a85dc49f35df..255c728d6338 100644 --- a/yarn-project/circuits.js/src/structs/generators.ts +++ b/yarn-project/circuits.js/src/structs/generators.ts @@ -23,7 +23,7 @@ export enum GeneratorIndex { CALL_CONTEXT, CALL_STACK_ITEM, CALL_STACK_ITEM_2, - L1_MSG_STACK_ITEM, + L2_TO_L1_MSG, PRIVATE_CIRCUIT_PUBLIC_INPUTS, PUBLIC_CIRCUIT_PUBLIC_INPUTS, TX_CONTEXT, diff --git a/yarn-project/circuits.js/src/structs/kernel/__snapshots__/index.test.ts.snap b/yarn-project/circuits.js/src/structs/kernel/__snapshots__/index.test.ts.snap index ddff9f823fa4..99e458bb043e 100644 --- a/yarn-project/circuits.js/src/structs/kernel/__snapshots__/index.test.ts.snap +++ b/yarn-project/circuits.js/src/structs/kernel/__snapshots__/index.test.ts.snap @@ -24,7 +24,7 @@ private_call_stack: [ 0x301 0x302 0x303 0x304 0x305 0x306 0x307 0x308 ] public_call_stack: [ 0x401 0x402 0x403 0x404 0x405 0x406 0x407 0x408 ] -l1_msg_stack: +new_l2_to_l1_msgs: [ 0x501 0x502 0x503 0x504 ] new_contracts: [ contract_address: 0x601 @@ -197,7 +197,7 @@ private_call_stack: [ 0x1301 0x1302 0x1303 0x1304 0x1305 0x1306 0x1307 0x1308 ] public_call_stack: [ 0x1401 0x1402 0x1403 0x1404 0x1405 0x1406 0x1407 0x1408 ] -l1_msg_stack: +new_l2_to_l1_msgs: [ 0x1501 0x1502 0x1503 0x1504 ] new_contracts: [ contract_address: 0x1601 @@ -341,7 +341,7 @@ new_commitments: [ 0x2411 0x2412 0x2413 0x2414 ] new_nullifiers: [ 0x2511 0x2512 0x2513 0x2514 ] private_call_stack: [ 0x2611 0x2612 0x2613 0x2614 ] public_call_stack: [ 0x2711 0x2712 0x2713 0x2714 ] -l1_msg_stack: [ 0x2811 0x2812 ] +new_l2_to_l1_msgs: [ 0x2811 0x2812 ] historic_private_data_tree_root: 0x3011 historic_nullifier_tree_root: 0x3111 contract_deployment_data: constructor_vk_hash: 0x1 @@ -376,7 +376,7 @@ new_commitments: [ 0x2421 0x2422 0x2423 0x2424 ] new_nullifiers: [ 0x2521 0x2522 0x2523 0x2524 ] private_call_stack: [ 0x2621 0x2622 0x2623 0x2624 ] public_call_stack: [ 0x2721 0x2722 0x2723 0x2724 ] -l1_msg_stack: [ 0x2821 0x2822 ] +new_l2_to_l1_msgs: [ 0x2821 0x2822 ] historic_private_data_tree_root: 0x3021 historic_nullifier_tree_root: 0x3121 contract_deployment_data: constructor_vk_hash: 0x1 @@ -409,7 +409,7 @@ new_commitments: [ 0x2422 0x2423 0x2424 0x2425 ] new_nullifiers: [ 0x2522 0x2523 0x2524 0x2525 ] private_call_stack: [ 0x2622 0x2623 0x2624 0x2625 ] public_call_stack: [ 0x2722 0x2723 0x2724 0x2725 ] -l1_msg_stack: [ 0x2822 0x2823 ] +new_l2_to_l1_msgs: [ 0x2822 0x2823 ] historic_private_data_tree_root: 0x3022 historic_nullifier_tree_root: 0x3122 contract_deployment_data: constructor_vk_hash: 0x1 @@ -442,7 +442,7 @@ new_commitments: [ 0x2423 0x2424 0x2425 0x2426 ] new_nullifiers: [ 0x2523 0x2524 0x2525 0x2526 ] private_call_stack: [ 0x2623 0x2624 0x2625 0x2626 ] public_call_stack: [ 0x2723 0x2724 0x2725 0x2726 ] -l1_msg_stack: [ 0x2823 0x2824 ] +new_l2_to_l1_msgs: [ 0x2823 0x2824 ] historic_private_data_tree_root: 0x3023 historic_nullifier_tree_root: 0x3123 contract_deployment_data: constructor_vk_hash: 0x1 @@ -475,7 +475,7 @@ new_commitments: [ 0x2424 0x2425 0x2426 0x2427 ] new_nullifiers: [ 0x2524 0x2525 0x2526 0x2527 ] private_call_stack: [ 0x2624 0x2625 0x2626 0x2627 ] public_call_stack: [ 0x2724 0x2725 0x2726 0x2727 ] -l1_msg_stack: [ 0x2824 0x2825 ] +new_l2_to_l1_msgs: [ 0x2824 0x2825 ] historic_private_data_tree_root: 0x3024 historic_nullifier_tree_root: 0x3124 contract_deployment_data: constructor_vk_hash: 0x1 @@ -540,7 +540,7 @@ private_call_stack: [ 0x301 0x302 0x303 0x304 0x305 0x306 0x307 0x308 ] public_call_stack: [ 0x401 0x402 0x403 0x404 0x405 0x406 0x407 0x408 ] -l1_msg_stack: +new_l2_to_l1_msgs: [ 0x501 0x502 0x503 0x504 ] new_contracts: [ contract_address: 0x601 @@ -676,7 +676,7 @@ private_call_stack: [ 0x301 0x302 0x303 0x304 0x305 0x306 0x307 0x308 ] public_call_stack: [ 0x401 0x402 0x403 0x404 0x405 0x406 0x407 0x408 ] -l1_msg_stack: +new_l2_to_l1_msgs: [ 0x501 0x502 0x503 0x504 ] new_contracts: [ contract_address: 0x601 @@ -839,7 +839,7 @@ current_value: 0x1514 current_value: 0x1515 ] public_call_stack: [ 0x1611 0x1612 0x1613 0x1614 ] -l1_msg_stack: [ 0x1711 0x1712 ] +new_l2_to_l1_msgs: [ 0x1711 0x1712 ] historic_public_data_tree_root: 0x1811 prover_address: 0x1812 @@ -883,7 +883,7 @@ current_value: 0x1814 current_value: 0x1815 ] public_call_stack: [ 0x1911 0x1912 0x1913 0x1914 ] -l1_msg_stack: [ 0x1a11 0x1a12 ] +new_l2_to_l1_msgs: [ 0x1a11 0x1a12 ] historic_public_data_tree_root: 0x1b11 prover_address: 0x1b12 @@ -925,7 +925,7 @@ current_value: 0x1815 current_value: 0x1816 ] public_call_stack: [ 0x1912 0x1913 0x1914 0x1915 ] -l1_msg_stack: [ 0x1a12 0x1a13 ] +new_l2_to_l1_msgs: [ 0x1a12 0x1a13 ] historic_public_data_tree_root: 0x1b12 prover_address: 0x1b13 @@ -967,7 +967,7 @@ current_value: 0x1816 current_value: 0x1817 ] public_call_stack: [ 0x1913 0x1914 0x1915 0x1916 ] -l1_msg_stack: [ 0x1a13 0x1a14 ] +new_l2_to_l1_msgs: [ 0x1a13 0x1a14 ] historic_public_data_tree_root: 0x1b13 prover_address: 0x1b14 @@ -1009,7 +1009,7 @@ current_value: 0x1817 current_value: 0x1818 ] public_call_stack: [ 0x1914 0x1915 0x1916 0x1917 ] -l1_msg_stack: [ 0x1a14 0x1a15 ] +new_l2_to_l1_msgs: [ 0x1a14 0x1a15 ] historic_public_data_tree_root: 0x1b14 prover_address: 0x1b15 @@ -1086,7 +1086,7 @@ current_value: 0x614 current_value: 0x615 ] public_call_stack: [ 0x711 0x712 0x713 0x714 ] -l1_msg_stack: [ 0x811 0x812 ] +new_l2_to_l1_msgs: [ 0x811 0x812 ] historic_public_data_tree_root: 0x911 prover_address: 0x912 @@ -1130,7 +1130,7 @@ current_value: 0x914 current_value: 0x915 ] public_call_stack: [ 0xa11 0xa12 0xa13 0xa14 ] -l1_msg_stack: [ 0xb11 0xb12 ] +new_l2_to_l1_msgs: [ 0xb11 0xb12 ] historic_public_data_tree_root: 0xc11 prover_address: 0xc12 @@ -1172,7 +1172,7 @@ current_value: 0x915 current_value: 0x916 ] public_call_stack: [ 0xa12 0xa13 0xa14 0xa15 ] -l1_msg_stack: [ 0xb12 0xb13 ] +new_l2_to_l1_msgs: [ 0xb12 0xb13 ] historic_public_data_tree_root: 0xc12 prover_address: 0xc13 @@ -1214,7 +1214,7 @@ current_value: 0x916 current_value: 0x917 ] public_call_stack: [ 0xa13 0xa14 0xa15 0xa16 ] -l1_msg_stack: [ 0xb13 0xb14 ] +new_l2_to_l1_msgs: [ 0xb13 0xb14 ] historic_public_data_tree_root: 0xc13 prover_address: 0xc14 @@ -1256,7 +1256,7 @@ current_value: 0x917 current_value: 0x918 ] public_call_stack: [ 0xa14 0xa15 0xa16 0xa17 ] -l1_msg_stack: [ 0xb14 0xb15 ] +new_l2_to_l1_msgs: [ 0xb14 0xb15 ] historic_public_data_tree_root: 0xc14 prover_address: 0xc15 diff --git a/yarn-project/circuits.js/src/structs/kernel/combined_accumulated_data.ts b/yarn-project/circuits.js/src/structs/kernel/combined_accumulated_data.ts index d94017445e50..31e06d9d79bf 100644 --- a/yarn-project/circuits.js/src/structs/kernel/combined_accumulated_data.ts +++ b/yarn-project/circuits.js/src/structs/kernel/combined_accumulated_data.ts @@ -5,7 +5,7 @@ import { serializeToBuffer } from '../../utils/serialize.js'; import { AggregationObject } from '../aggregation_object.js'; import { EMITTED_EVENTS_LENGTH, - KERNEL_L1_MSG_STACK_LENGTH, + KERNEL_NEW_L2_TO_L1_MSGS_LENGTH, KERNEL_NEW_COMMITMENTS_LENGTH, KERNEL_NEW_CONTRACTS_LENGTH, KERNEL_NEW_NULLIFIERS_LENGTH, @@ -167,7 +167,7 @@ export class CombinedAccumulatedData { public privateCallStack: Fr[], public publicCallStack: Fr[], - public l1MsgStack: Fr[], + public newL2ToL1Msgs: Fr[], public newContracts: NewContractData[], @@ -180,7 +180,7 @@ export class CombinedAccumulatedData { assertLength(this, 'newNullifiers', KERNEL_NEW_NULLIFIERS_LENGTH); assertLength(this, 'privateCallStack', KERNEL_PRIVATE_CALL_STACK_LENGTH); assertLength(this, 'publicCallStack', KERNEL_PUBLIC_CALL_STACK_LENGTH); - assertLength(this, 'l1MsgStack', KERNEL_L1_MSG_STACK_LENGTH); + assertLength(this, 'newL2ToL1Msgs', KERNEL_NEW_L2_TO_L1_MSGS_LENGTH); assertLength(this, 'newContracts', KERNEL_NEW_CONTRACTS_LENGTH); assertLength(this, 'optionallyRevealedData', KERNEL_OPTIONALLY_REVEALED_DATA_LENGTH); assertLength(this, 'stateTransitions', STATE_TRANSITIONS_LENGTH); @@ -196,7 +196,7 @@ export class CombinedAccumulatedData { this.newNullifiers, this.privateCallStack, this.publicCallStack, - this.l1MsgStack, + this.newL2ToL1Msgs, this.newContracts, this.optionallyRevealedData, this.stateTransitions, @@ -218,7 +218,7 @@ export class CombinedAccumulatedData { reader.readArray(KERNEL_NEW_NULLIFIERS_LENGTH, Fr), reader.readArray(KERNEL_PRIVATE_CALL_STACK_LENGTH, Fr), reader.readArray(KERNEL_PUBLIC_CALL_STACK_LENGTH, Fr), - reader.readArray(KERNEL_L1_MSG_STACK_LENGTH, Fr), + reader.readArray(KERNEL_NEW_L2_TO_L1_MSGS_LENGTH, Fr), reader.readArray(KERNEL_NEW_CONTRACTS_LENGTH, NewContractData), reader.readArray(KERNEL_OPTIONALLY_REVEALED_DATA_LENGTH, OptionallyRevealedData), reader.readArray(STATE_TRANSITIONS_LENGTH, PublicDataTransition), @@ -235,7 +235,7 @@ export class CombinedAccumulatedData { times(KERNEL_NEW_NULLIFIERS_LENGTH, Fr.zero), times(KERNEL_PRIVATE_CALL_STACK_LENGTH, Fr.zero), times(KERNEL_PUBLIC_CALL_STACK_LENGTH, Fr.zero), - times(KERNEL_L1_MSG_STACK_LENGTH, Fr.zero), + times(KERNEL_NEW_L2_TO_L1_MSGS_LENGTH, Fr.zero), times(KERNEL_NEW_CONTRACTS_LENGTH, NewContractData.empty), times(KERNEL_OPTIONALLY_REVEALED_DATA_LENGTH, OptionallyRevealedData.empty), times(STATE_TRANSITIONS_LENGTH, PublicDataTransition.empty), diff --git a/yarn-project/circuits.js/src/structs/private_circuit_public_inputs.ts b/yarn-project/circuits.js/src/structs/private_circuit_public_inputs.ts index a8acd64909fd..5d296db4419c 100644 --- a/yarn-project/circuits.js/src/structs/private_circuit_public_inputs.ts +++ b/yarn-project/circuits.js/src/structs/private_circuit_public_inputs.ts @@ -5,7 +5,7 @@ import { CallContext } from './call_context.js'; import { ARGS_LENGTH, EMITTED_EVENTS_LENGTH, - L1_MSG_STACK_LENGTH, + NEW_L2_TO_L1_MSGS_LENGTH, NEW_COMMITMENTS_LENGTH, NEW_NULLIFIERS_LENGTH, PRIVATE_CALL_STACK_LENGTH, @@ -29,7 +29,7 @@ export class PrivateCircuitPublicInputs { public newNullifiers: Fr[], public privateCallStack: Fr[], public publicCallStack: Fr[], - public l1MsgStack: Fr[], + public newL2ToL1Msgs: Fr[], public historicPrivateDataTreeRoot: Fr, public historicPrivateNullifierTreeRoot: Fr, public historicContractTreeRoot: Fr, @@ -42,7 +42,7 @@ export class PrivateCircuitPublicInputs { assertLength(this, 'newNullifiers', NEW_NULLIFIERS_LENGTH); assertLength(this, 'privateCallStack', PRIVATE_CALL_STACK_LENGTH); assertLength(this, 'publicCallStack', PUBLIC_CALL_STACK_LENGTH); - assertLength(this, 'l1MsgStack', L1_MSG_STACK_LENGTH); + assertLength(this, 'newL2ToL1Msgs', NEW_L2_TO_L1_MSGS_LENGTH); } /** * Create PrivateCircuitPublicInputs from a fields dictionary. @@ -67,7 +67,7 @@ export class PrivateCircuitPublicInputs { frArray(NEW_NULLIFIERS_LENGTH), frArray(PRIVATE_CALL_STACK_LENGTH), frArray(PUBLIC_CALL_STACK_LENGTH), - frArray(L1_MSG_STACK_LENGTH), + frArray(NEW_L2_TO_L1_MSGS_LENGTH), Fr.ZERO, Fr.ZERO, Fr.ZERO, @@ -90,7 +90,7 @@ export class PrivateCircuitPublicInputs { fields.newNullifiers, fields.privateCallStack, fields.publicCallStack, - fields.l1MsgStack, + fields.newL2ToL1Msgs, fields.historicPrivateDataTreeRoot, fields.historicPrivateNullifierTreeRoot, fields.historicContractTreeRoot, diff --git a/yarn-project/circuits.js/src/structs/public_circuit_public_inputs.ts b/yarn-project/circuits.js/src/structs/public_circuit_public_inputs.ts index 46da4d2bd438..64893ffff197 100644 --- a/yarn-project/circuits.js/src/structs/public_circuit_public_inputs.ts +++ b/yarn-project/circuits.js/src/structs/public_circuit_public_inputs.ts @@ -5,7 +5,7 @@ import { CallContext } from './call_context.js'; import { ARGS_LENGTH, EMITTED_EVENTS_LENGTH, - L1_MSG_STACK_LENGTH, + NEW_L2_TO_L1_MSGS_LENGTH, PUBLIC_CALL_STACK_LENGTH, RETURN_VALUES_LENGTH, STATE_READS_LENGTH, @@ -73,7 +73,7 @@ export class PublicCircuitPublicInputs { public stateTransitions: StateTransition[], public stateReads: StateRead[], public publicCallStack: Fr[], - public l1MsgStack: Fr[], + public newL2ToL1Msgs: Fr[], public historicPublicDataTreeRoot: Fr, public proverAddress: AztecAddress, ) { @@ -81,7 +81,7 @@ export class PublicCircuitPublicInputs { assertLength(this, 'returnValues', RETURN_VALUES_LENGTH); assertLength(this, 'emittedEvents', EMITTED_EVENTS_LENGTH); assertLength(this, 'publicCallStack', PUBLIC_CALL_STACK_LENGTH); - assertLength(this, 'l1MsgStack', L1_MSG_STACK_LENGTH); + assertLength(this, 'newL2ToL1Msgs', NEW_L2_TO_L1_MSGS_LENGTH); assertLength(this, 'stateTransitions', STATE_TRANSITIONS_LENGTH); assertLength(this, 'stateReads', STATE_READS_LENGTH); } @@ -109,7 +109,7 @@ export class PublicCircuitPublicInputs { times(STATE_TRANSITIONS_LENGTH, StateTransition.empty), times(STATE_READS_LENGTH, StateRead.empty), frArray(PUBLIC_CALL_STACK_LENGTH), - frArray(L1_MSG_STACK_LENGTH), + frArray(NEW_L2_TO_L1_MSGS_LENGTH), Fr.ZERO, AztecAddress.ZERO, ); @@ -128,7 +128,7 @@ export class PublicCircuitPublicInputs { fields.stateTransitions, fields.stateReads, fields.publicCallStack, - fields.l1MsgStack, + fields.newL2ToL1Msgs, fields.historicPublicDataTreeRoot, fields.proverAddress, ] as const; diff --git a/yarn-project/circuits.js/src/structs/rollup/__snapshots__/base_rollup.test.ts.snap b/yarn-project/circuits.js/src/structs/rollup/__snapshots__/base_rollup.test.ts.snap index fce9ae6fba4e..389baab97a59 100644 --- a/yarn-project/circuits.js/src/structs/rollup/__snapshots__/base_rollup.test.ts.snap +++ b/yarn-project/circuits.js/src/structs/rollup/__snapshots__/base_rollup.test.ts.snap @@ -25,7 +25,7 @@ private_call_stack: [ 0x400 0x401 0x402 0x403 0x404 0x405 0x406 0x407 ] public_call_stack: [ 0x500 0x501 0x502 0x503 0x504 0x505 0x506 0x507 ] -l1_msg_stack: +new_l2_to_l1_msgs: [ 0x600 0x601 0x602 0x603 ] new_contracts: [ contract_address: 0x700 @@ -170,7 +170,7 @@ private_call_stack: [ 0x500 0x501 0x502 0x503 0x504 0x505 0x506 0x507 ] public_call_stack: [ 0x600 0x601 0x602 0x603 0x604 0x605 0x606 0x607 ] -l1_msg_stack: +new_l2_to_l1_msgs: [ 0x700 0x701 0x702 0x703 ] new_contracts: [ contract_address: 0x800 diff --git a/yarn-project/circuits.js/src/tests/factories.ts b/yarn-project/circuits.js/src/tests/factories.ts index 6c67c7d870dd..8052374eff6a 100644 --- a/yarn-project/circuits.js/src/tests/factories.ts +++ b/yarn-project/circuits.js/src/tests/factories.ts @@ -38,14 +38,14 @@ import { CONTRACT_TREE_ROOTS_TREE_HEIGHT, EMITTED_EVENTS_LENGTH, FUNCTION_TREE_HEIGHT, - KERNEL_L1_MSG_STACK_LENGTH, + KERNEL_NEW_L2_TO_L1_MSGS_LENGTH, KERNEL_NEW_COMMITMENTS_LENGTH, KERNEL_NEW_CONTRACTS_LENGTH, KERNEL_NEW_NULLIFIERS_LENGTH, KERNEL_OPTIONALLY_REVEALED_DATA_LENGTH, KERNEL_PRIVATE_CALL_STACK_LENGTH, KERNEL_PUBLIC_CALL_STACK_LENGTH, - L1_MSG_STACK_LENGTH, + NEW_L2_TO_L1_MSGS_LENGTH, NEW_COMMITMENTS_LENGTH, NEW_NULLIFIERS_LENGTH, NULLIFIER_TREE_HEIGHT, @@ -126,7 +126,7 @@ export function makeEmptyAccumulatedData(seed = 1): CombinedAccumulatedData { range(KERNEL_NEW_NULLIFIERS_LENGTH, seed + 0x200).map(fr), range(KERNEL_PRIVATE_CALL_STACK_LENGTH, seed + 0x300).map(fr), range(KERNEL_PUBLIC_CALL_STACK_LENGTH, seed + 0x400).map(fr), - range(KERNEL_L1_MSG_STACK_LENGTH, seed + 0x500).map(fr), + range(KERNEL_NEW_L2_TO_L1_MSGS_LENGTH, seed + 0x500).map(fr), range(KERNEL_NEW_CONTRACTS_LENGTH, seed + 0x600).map(makeNewContractData), range(KERNEL_OPTIONALLY_REVEALED_DATA_LENGTH, seed + 0x700).map(makeOptionallyRevealedData), range(STATE_TRANSITIONS_LENGTH, seed + 0x800).map(makeEmptyPublicDataTransition), @@ -143,7 +143,7 @@ export function makeAccumulatedData(seed = 1): CombinedAccumulatedData { range(KERNEL_NEW_NULLIFIERS_LENGTH, seed + 0x200).map(fr), range(KERNEL_PRIVATE_CALL_STACK_LENGTH, seed + 0x300).map(fr), range(KERNEL_PUBLIC_CALL_STACK_LENGTH, seed + 0x400).map(fr), - range(KERNEL_L1_MSG_STACK_LENGTH, seed + 0x500).map(fr), + range(KERNEL_NEW_L2_TO_L1_MSGS_LENGTH, seed + 0x500).map(fr), range(KERNEL_NEW_CONTRACTS_LENGTH, seed + 0x600).map(makeNewContractData), range(KERNEL_OPTIONALLY_REVEALED_DATA_LENGTH, seed + 0x700).map(makeOptionallyRevealedData), range(STATE_TRANSITIONS_LENGTH, seed + 0x800).map(makePublicDataTransition), @@ -199,7 +199,7 @@ export function makePublicCircuitPublicInputs(seed = 0): PublicCircuitPublicInpu range(STATE_TRANSITIONS_LENGTH, seed + 0x400).map(makeStateTransition), range(STATE_READS_LENGTH, seed + 0x500).map(makeStateRead), frArray(PUBLIC_CALL_STACK_LENGTH, seed + 0x600), - frArray(L1_MSG_STACK_LENGTH, seed + 0x700), + frArray(NEW_L2_TO_L1_MSGS_LENGTH, seed + 0x700), fr(seed + 0x800), makeAztecAddress(seed + 0x801), ); @@ -353,7 +353,7 @@ export function makePrivateCircuitPublicInputs(seed = 0): PrivateCircuitPublicIn newNullifiers: range(NEW_NULLIFIERS_LENGTH, seed + 0x500).map(fr), privateCallStack: range(PRIVATE_CALL_STACK_LENGTH, seed + 0x600).map(fr), publicCallStack: range(PUBLIC_CALL_STACK_LENGTH, seed + 0x700).map(fr), - l1MsgStack: range(L1_MSG_STACK_LENGTH, seed + 0x800).map(fr), + newL2ToL1Msgs: range(NEW_L2_TO_L1_MSGS_LENGTH, seed + 0x800).map(fr), historicContractTreeRoot: fr(seed + 0x900), // TODO not in spec historicPrivateDataTreeRoot: fr(seed + 0x1000), historicPrivateNullifierTreeRoot: fr(seed + 0x1100), // TODO not in spec diff --git a/yarn-project/noir-contracts/src/contracts/noir-aztec3/src/abi.nr b/yarn-project/noir-contracts/src/contracts/noir-aztec3/src/abi.nr index 3413bd0f9f57..f66d7484d305 100644 --- a/yarn-project/noir-contracts/src/contracts/noir-aztec3/src/abi.nr +++ b/yarn-project/noir-contracts/src/contracts/noir-aztec3/src/abi.nr @@ -72,7 +72,7 @@ struct PrivateCircuitPublicInputs { new_nullifiers: [Field; crate::abi::MAX_NEW_NULLIFIERS], private_call_stack: [Field; crate::abi::MAX_PRIVATE_CALL_STACK], public_call_stack: [Field; crate::abi::MAX_PUBLIC_CALL_STACK], - l1_msg_stack: [Field; crate::abi::MAX_L1_MSG_STACK], + new_l2_to_l1_msgs: [Field; crate::abi::MAX_L1_MSG_STACK], historic_private_data_tree_root: Field, historic_private_nullifier_tree_root: Field, historic_contract_tree_root: Field, @@ -95,7 +95,7 @@ impl PrivateCircuitPublicInputs { fields = fields.push_array(self.new_nullifiers); fields = fields.push_array(self.private_call_stack); fields = fields.push_array(self.public_call_stack); - fields = fields.push_array(self.l1_msg_stack); + fields = fields.push_array(self.new_l2_to_l1_msgs); fields = fields.push(self.historic_private_data_tree_root); fields = fields.push(self.historic_private_nullifier_tree_root); fields = fields.push(self.historic_contract_tree_root); diff --git a/yarn-project/noir-contracts/src/contracts/noir-aztec3/src/context.nr b/yarn-project/noir-contracts/src/contracts/noir-aztec3/src/context.nr index 550fe494ed3b..fbef0569b154 100644 --- a/yarn-project/noir-contracts/src/contracts/noir-aztec3/src/context.nr +++ b/yarn-project/noir-contracts/src/contracts/noir-aztec3/src/context.nr @@ -40,7 +40,7 @@ impl PrivateFunctionContext { new_nullifiers: self.new_nullifiers.storage, private_call_stack: self.private_call_stack.storage, public_call_stack: self.public_call_stack.storage, - l1_msg_stack: self.l1_message_stack.storage, + new_l2_to_l1_msgs: self.l1_message_stack.storage, historic_private_data_tree_root: inputs.old_private_data_tree_root, historic_private_nullifier_tree_root: inputs.old_nullifier_tree_root, historic_contract_tree_root: inputs.old_contract_tree_root, diff --git a/yarn-project/noir-contracts/src/contracts/noir-aztec3/src/private_call_stack_item.nr b/yarn-project/noir-contracts/src/contracts/noir-aztec3/src/private_call_stack_item.nr index b06c05b4b913..b882f91b4707 100644 --- a/yarn-project/noir-contracts/src/contracts/noir-aztec3/src/private_call_stack_item.nr +++ b/yarn-project/noir-contracts/src/contracts/noir-aztec3/src/private_call_stack_item.nr @@ -79,7 +79,7 @@ impl PrivateCallStackItem { new_nullifiers: arr_copy_slice(fields, [0; crate::abi::MAX_NEW_NULLIFIERS], 30), private_call_stack: arr_copy_slice(fields, [0; crate::abi::MAX_PRIVATE_CALL_STACK], 34), public_call_stack: arr_copy_slice(fields, [0; crate::abi::MAX_PUBLIC_CALL_STACK], 38), - l1_msg_stack:arr_copy_slice(fields, [0; crate::abi::MAX_L1_MSG_STACK], 42), + new_l2_to_l1_msgs:arr_copy_slice(fields, [0; crate::abi::MAX_L1_MSG_STACK], 42), historic_private_data_tree_root: fields[44], historic_private_nullifier_tree_root: fields[45], historic_contract_tree_root: fields[46], diff --git a/yarn-project/sequencer-client/src/simulator/fake_public.ts b/yarn-project/sequencer-client/src/simulator/fake_public.ts index 51b008fe009a..408ce4fa90db 100644 --- a/yarn-project/sequencer-client/src/simulator/fake_public.ts +++ b/yarn-project/sequencer-client/src/simulator/fake_public.ts @@ -25,7 +25,7 @@ export class FakePublicCircuitSimulator implements PublicCircuitSimulator { args: tx.args, callContext: execution.callContext, emittedEvents: [], - l1MsgStack: [], + newL2ToL1Msgs: [], proverAddress: AztecAddress.random(), publicCallStack: [], returnValues: result.returnValues,