From 5e1809c13cf2748a0a2bc90e9308ecd254d7f258 Mon Sep 17 00:00:00 2001 From: jeanmon Date: Mon, 28 Aug 2023 15:26:08 +0000 Subject: [PATCH] 1074 - remove public read and update requests from public inputs of final ordering private kernel circuit --- .../circuits/abis/final_accumulated_data.hpp | 33 +--- .../circuits.js/src/cbind/circuits.gen.ts | 20 --- .../kernel/__snapshots__/index.test.ts.snap | 164 ------------------ .../kernel/combined_accumulated_data.ts | 16 -- .../circuits.js/src/tests/factories.ts | 4 - 5 files changed, 2 insertions(+), 235 deletions(-) diff --git a/circuits/cpp/src/aztec3/circuits/abis/final_accumulated_data.hpp b/circuits/cpp/src/aztec3/circuits/abis/final_accumulated_data.hpp index 800a1279ea26..7616ebc78502 100644 --- a/circuits/cpp/src/aztec3/circuits/abis/final_accumulated_data.hpp +++ b/circuits/cpp/src/aztec3/circuits/abis/final_accumulated_data.hpp @@ -52,9 +52,6 @@ template struct FinalAccumulatedData { std::array, MAX_OPTIONALLY_REVEALED_DATA_LENGTH_PER_TX> optionally_revealed_data{}; - std::array, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX> public_data_update_requests{}; - std::array, MAX_PUBLIC_DATA_READS_PER_TX> public_data_reads{}; - // for serialization, update with new fields MSGPACK_FIELDS(aggregation_object, new_commitments, @@ -68,9 +65,7 @@ template struct FinalAccumulatedData { encrypted_log_preimages_length, unencrypted_log_preimages_length, new_contracts, - optionally_revealed_data, - public_data_update_requests, - public_data_reads); + optionally_revealed_data); boolean operator==(FinalAccumulatedData const& other) const { return aggregation_object == other.aggregation_object && new_commitments == other.new_commitments && @@ -80,9 +75,7 @@ template struct FinalAccumulatedData { unencrypted_logs_hash == other.unencrypted_logs_hash && encrypted_log_preimages_length == other.encrypted_log_preimages_length && unencrypted_log_preimages_length == other.unencrypted_log_preimages_length && - new_contracts == other.new_contracts && optionally_revealed_data == other.optionally_revealed_data && - public_data_update_requests == other.public_data_update_requests && - public_data_reads == other.public_data_reads; + new_contracts == other.new_contracts && optionally_revealed_data == other.optionally_revealed_data; }; template FinalAccumulatedData> to_circuit_type(Builder& builder) const @@ -119,8 +112,6 @@ template struct FinalAccumulatedData { map(new_contracts, to_circuit_type), map(optionally_revealed_data, to_circuit_type), - map(public_data_update_requests, to_circuit_type), - map(public_data_reads, to_circuit_type), }; return acc_data; @@ -157,8 +148,6 @@ template struct FinalAccumulatedData { map(new_contracts, to_native_type), map(optionally_revealed_data, to_native_type), - map(public_data_update_requests, to_native_type), - map(public_data_reads, to_native_type), }; return acc_data; } @@ -182,8 +171,6 @@ template struct FinalAccumulatedData { set_array_public(new_contracts); set_array_public(optionally_revealed_data); - set_array_public(public_data_update_requests); - set_array_public(public_data_reads); } template void set_array_public(std::array& arr) @@ -209,22 +196,6 @@ template struct FinalAccumulatedData { e.set_public(); } } - - template void set_array_public(std::array, SIZE>& arr) - { - static_assert(!(std::is_same::value)); - for (auto& e : arr) { - e.set_public(); - } - } - - template void set_array_public(std::array, SIZE>& arr) - { - static_assert(!(std::is_same::value)); - for (auto& e : arr) { - e.set_public(); - } - } }; } // namespace aztec3::circuits::abis diff --git a/yarn-project/circuits.js/src/cbind/circuits.gen.ts b/yarn-project/circuits.js/src/cbind/circuits.gen.ts index ae12e2a124f8..25b21e0df040 100644 --- a/yarn-project/circuits.js/src/cbind/circuits.gen.ts +++ b/yarn-project/circuits.js/src/cbind/circuits.gen.ts @@ -1133,8 +1133,6 @@ interface MsgpackFinalAccumulatedData { unencrypted_log_preimages_length: Buffer; new_contracts: Tuple; optionally_revealed_data: Tuple; - public_data_update_requests: Tuple; - public_data_reads: Tuple; } export function toFinalAccumulatedData(o: MsgpackFinalAccumulatedData): FinalAccumulatedData { @@ -1177,12 +1175,6 @@ export function toFinalAccumulatedData(o: MsgpackFinalAccumulatedData): FinalAcc if (o.optionally_revealed_data === undefined) { throw new Error('Expected optionally_revealed_data in FinalAccumulatedData deserialization'); } - if (o.public_data_update_requests === undefined) { - throw new Error('Expected public_data_update_requests in FinalAccumulatedData deserialization'); - } - if (o.public_data_reads === undefined) { - throw new Error('Expected public_data_reads in FinalAccumulatedData deserialization'); - } return new FinalAccumulatedData( toNativeAggregationState(o.aggregation_object), mapTuple(o.new_commitments, (v: Buffer) => Fr.fromBuffer(v)), @@ -1197,8 +1189,6 @@ export function toFinalAccumulatedData(o: MsgpackFinalAccumulatedData): FinalAcc Fr.fromBuffer(o.unencrypted_log_preimages_length), mapTuple(o.new_contracts, (v: MsgpackNewContractData) => toNewContractData(v)), mapTuple(o.optionally_revealed_data, (v: MsgpackOptionallyRevealedData) => toOptionallyRevealedData(v)), - mapTuple(o.public_data_update_requests, (v: MsgpackPublicDataUpdateRequest) => toPublicDataUpdateRequest(v)), - mapTuple(o.public_data_reads, (v: MsgpackPublicDataRead) => toPublicDataRead(v)), ); } @@ -1242,12 +1232,6 @@ export function fromFinalAccumulatedData(o: FinalAccumulatedData): MsgpackFinalA if (o.optionallyRevealedData === undefined) { throw new Error('Expected optionallyRevealedData in FinalAccumulatedData serialization'); } - if (o.publicDataUpdateRequests === undefined) { - throw new Error('Expected publicDataUpdateRequests in FinalAccumulatedData serialization'); - } - if (o.publicDataReads === undefined) { - throw new Error('Expected publicDataReads in FinalAccumulatedData serialization'); - } return { aggregation_object: fromNativeAggregationState(o.aggregationObject), new_commitments: mapTuple(o.newCommitments, (v: Fr) => toBuffer(v)), @@ -1264,10 +1248,6 @@ export function fromFinalAccumulatedData(o: FinalAccumulatedData): MsgpackFinalA optionally_revealed_data: mapTuple(o.optionallyRevealedData, (v: OptionallyRevealedData) => fromOptionallyRevealedData(v), ), - public_data_update_requests: mapTuple(o.publicDataUpdateRequests, (v: PublicDataUpdateRequest) => - fromPublicDataUpdateRequest(v), - ), - public_data_reads: mapTuple(o.publicDataReads, (v: PublicDataRead) => fromPublicDataRead(v)), }; } 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 fbc3af168c02..6791a7073b4a 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 @@ -321,88 +321,6 @@ pay_fee_from_public_l2: 0 called_from_l1: 1 called_from_public_l2: 0 ] -public_data_update_requests: [ leaf_index: 0xd01 -old_value: 0xd02 -new_value: 0xd03 - leaf_index: 0xd02 -old_value: 0xd03 -new_value: 0xd04 - leaf_index: 0xd03 -old_value: 0xd04 -new_value: 0xd05 - leaf_index: 0xd04 -old_value: 0xd05 -new_value: 0xd06 - leaf_index: 0xd05 -old_value: 0xd06 -new_value: 0xd07 - leaf_index: 0xd06 -old_value: 0xd07 -new_value: 0xd08 - leaf_index: 0xd07 -old_value: 0xd08 -new_value: 0xd09 - leaf_index: 0xd08 -old_value: 0xd09 -new_value: 0xd0a - leaf_index: 0xd09 -old_value: 0xd0a -new_value: 0xd0b - leaf_index: 0xd0a -old_value: 0xd0b -new_value: 0xd0c - leaf_index: 0xd0b -old_value: 0xd0c -new_value: 0xd0d - leaf_index: 0xd0c -old_value: 0xd0d -new_value: 0xd0e - leaf_index: 0xd0d -old_value: 0xd0e -new_value: 0xd0f - leaf_index: 0xd0e -old_value: 0xd0f -new_value: 0xd10 - leaf_index: 0xd0f -old_value: 0xd10 -new_value: 0xd11 - leaf_index: 0xd10 -old_value: 0xd11 -new_value: 0xd12 - ] -public_data_reads: [ leaf_index: 0xe01 -value: 0xe02 - leaf_index: 0xe02 -value: 0xe03 - leaf_index: 0xe03 -value: 0xe04 - leaf_index: 0xe04 -value: 0xe05 - leaf_index: 0xe05 -value: 0xe06 - leaf_index: 0xe06 -value: 0xe07 - leaf_index: 0xe07 -value: 0xe08 - leaf_index: 0xe08 -value: 0xe09 - leaf_index: 0xe09 -value: 0xe0a - leaf_index: 0xe0a -value: 0xe0b - leaf_index: 0xe0b -value: 0xe0c - leaf_index: 0xe0c -value: 0xe0d - leaf_index: 0xe0d -value: 0xe0e - leaf_index: 0xe0e -value: 0xe0f - leaf_index: 0xe0f -value: 0xe10 - leaf_index: 0xe10 -value: 0xe11 - ] " `; @@ -1940,88 +1858,6 @@ pay_fee_from_public_l2: 0 called_from_l1: 1 called_from_public_l2: 0 ] -public_data_update_requests: [ leaf_index: 0xd01 -old_value: 0xd02 -new_value: 0xd03 - leaf_index: 0xd02 -old_value: 0xd03 -new_value: 0xd04 - leaf_index: 0xd03 -old_value: 0xd04 -new_value: 0xd05 - leaf_index: 0xd04 -old_value: 0xd05 -new_value: 0xd06 - leaf_index: 0xd05 -old_value: 0xd06 -new_value: 0xd07 - leaf_index: 0xd06 -old_value: 0xd07 -new_value: 0xd08 - leaf_index: 0xd07 -old_value: 0xd08 -new_value: 0xd09 - leaf_index: 0xd08 -old_value: 0xd09 -new_value: 0xd0a - leaf_index: 0xd09 -old_value: 0xd0a -new_value: 0xd0b - leaf_index: 0xd0a -old_value: 0xd0b -new_value: 0xd0c - leaf_index: 0xd0b -old_value: 0xd0c -new_value: 0xd0d - leaf_index: 0xd0c -old_value: 0xd0d -new_value: 0xd0e - leaf_index: 0xd0d -old_value: 0xd0e -new_value: 0xd0f - leaf_index: 0xd0e -old_value: 0xd0f -new_value: 0xd10 - leaf_index: 0xd0f -old_value: 0xd10 -new_value: 0xd11 - leaf_index: 0xd10 -old_value: 0xd11 -new_value: 0xd12 - ] -public_data_reads: [ leaf_index: 0xe01 -value: 0xe02 - leaf_index: 0xe02 -value: 0xe03 - leaf_index: 0xe03 -value: 0xe04 - leaf_index: 0xe04 -value: 0xe05 - leaf_index: 0xe05 -value: 0xe06 - leaf_index: 0xe06 -value: 0xe07 - leaf_index: 0xe07 -value: 0xe08 - leaf_index: 0xe08 -value: 0xe09 - leaf_index: 0xe09 -value: 0xe0a - leaf_index: 0xe0a -value: 0xe0b - leaf_index: 0xe0b -value: 0xe0c - leaf_index: 0xe0c -value: 0xe0d - leaf_index: 0xe0d -value: 0xe0e - leaf_index: 0xe0e -value: 0xe0f - leaf_index: 0xe0f -value: 0xe10 - leaf_index: 0xe10 -value: 0xe11 - ] constants: block_data: 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 3f2bd9f6c023..d3dedcd7db7e 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 @@ -521,14 +521,6 @@ export class FinalAccumulatedData { * All the optionally revealed data in this transaction. */ public optionallyRevealedData: Tuple, - /** - * All the public data update requests made in this transaction. - */ - public publicDataUpdateRequests: Tuple, - /** - * All the public data reads made in this transaction. - */ - public publicDataReads: Tuple, ) { assertMemberLength(this, 'newCommitments', MAX_NEW_COMMITMENTS_PER_TX); assertMemberLength(this, 'newNullifiers', MAX_NEW_NULLIFIERS_PER_TX); @@ -540,8 +532,6 @@ export class FinalAccumulatedData { assertMemberLength(this, 'unencryptedLogsHash', NUM_FIELDS_PER_SHA256); assertMemberLength(this, 'newContracts', MAX_NEW_CONTRACTS_PER_TX); assertMemberLength(this, 'optionallyRevealedData', MAX_OPTIONALLY_REVEALED_DATA_LENGTH_PER_TX); - assertMemberLength(this, 'publicDataUpdateRequests', MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX); - assertMemberLength(this, 'publicDataReads', MAX_PUBLIC_DATA_READS_PER_TX); } toBuffer() { @@ -559,8 +549,6 @@ export class FinalAccumulatedData { this.unencryptedLogPreimagesLength, this.newContracts, this.optionallyRevealedData, - this.publicDataUpdateRequests, - this.publicDataReads, ); } @@ -589,8 +577,6 @@ export class FinalAccumulatedData { reader.readFr(), reader.readArray(MAX_NEW_CONTRACTS_PER_TX, NewContractData), reader.readArray(MAX_OPTIONALLY_REVEALED_DATA_LENGTH_PER_TX, OptionallyRevealedData), - reader.readArray(MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, PublicDataUpdateRequest), - reader.readArray(MAX_PUBLIC_DATA_READS_PER_TX, PublicDataRead), ); } @@ -618,8 +604,6 @@ export class FinalAccumulatedData { Fr.zero(), makeTuple(MAX_NEW_CONTRACTS_PER_TX, NewContractData.empty), makeTuple(MAX_OPTIONALLY_REVEALED_DATA_LENGTH_PER_TX, OptionallyRevealedData.empty), - makeTuple(MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, PublicDataUpdateRequest.empty), - makeTuple(MAX_PUBLIC_DATA_READS_PER_TX, PublicDataRead.empty), ); } } diff --git a/yarn-project/circuits.js/src/tests/factories.ts b/yarn-project/circuits.js/src/tests/factories.ts index 7ab54ee4ecf4..835210bccf52 100644 --- a/yarn-project/circuits.js/src/tests/factories.ts +++ b/yarn-project/circuits.js/src/tests/factories.ts @@ -273,8 +273,6 @@ export function makeEmptyFinalAccumulatedData(seed = 1, full = false): FinalAccu fr(seed + 0xa00), // unencrypted_log_preimages_length tupleGenerator(MAX_NEW_CONTRACTS_PER_TX, makeNewContractData, seed + 0xb00), tupleGenerator(MAX_OPTIONALLY_REVEALED_DATA_LENGTH_PER_TX, makeOptionallyRevealedData, seed + 0xc00), - tupleGenerator(MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, makeEmptyPublicDataUpdateRequest, seed + 0xd00), - tupleGenerator(MAX_PUBLIC_DATA_READS_PER_TX, makeEmptyPublicDataRead, seed + 0xe00), ); } @@ -300,8 +298,6 @@ export function makeFinalAccumulatedData(seed = 1, full = false): FinalAccumulat fr(seed + 0xa00), // unencrypted_log_preimages_length tupleGenerator(MAX_NEW_CONTRACTS_PER_TX, makeNewContractData, seed + 0xb00), tupleGenerator(MAX_OPTIONALLY_REVEALED_DATA_LENGTH_PER_TX, makeOptionallyRevealedData, seed + 0xc00), - tupleGenerator(MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, makePublicDataUpdateRequest, seed + 0xd00), - tupleGenerator(MAX_PUBLIC_DATA_READS_PER_TX, makePublicDataRead, seed + 0xe00), ); }