Skip to content

Commit

Permalink
1074 - remove public read and update requests from public inputs of
Browse files Browse the repository at this point in the history
final ordering private kernel circuit
  • Loading branch information
jeanmon committed Aug 29, 2023
1 parent 93550f4 commit 5e1809c
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 235 deletions.
33 changes: 2 additions & 31 deletions circuits/cpp/src/aztec3/circuits/abis/final_accumulated_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ template <typename NCT> struct FinalAccumulatedData {

std::array<OptionallyRevealedData<NCT>, MAX_OPTIONALLY_REVEALED_DATA_LENGTH_PER_TX> optionally_revealed_data{};

std::array<PublicDataUpdateRequest<NCT>, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX> public_data_update_requests{};
std::array<PublicDataRead<NCT>, MAX_PUBLIC_DATA_READS_PER_TX> public_data_reads{};

// for serialization, update with new fields
MSGPACK_FIELDS(aggregation_object,
new_commitments,
Expand All @@ -68,9 +65,7 @@ template <typename NCT> 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<NCT> const& other) const
{
return aggregation_object == other.aggregation_object && new_commitments == other.new_commitments &&
Expand All @@ -80,9 +75,7 @@ template <typename NCT> 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 <typename Builder> FinalAccumulatedData<CircuitTypes<Builder>> to_circuit_type(Builder& builder) const
Expand Down Expand Up @@ -119,8 +112,6 @@ template <typename NCT> 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;
Expand Down Expand Up @@ -157,8 +148,6 @@ template <typename NCT> 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;
}
Expand All @@ -182,8 +171,6 @@ template <typename NCT> 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 <typename T, size_t SIZE> void set_array_public(std::array<T, SIZE>& arr)
Expand All @@ -209,22 +196,6 @@ template <typename NCT> struct FinalAccumulatedData {
e.set_public();
}
}

template <size_t SIZE> void set_array_public(std::array<PublicDataUpdateRequest<NCT>, SIZE>& arr)
{
static_assert(!(std::is_same<NativeTypes, NCT>::value));
for (auto& e : arr) {
e.set_public();
}
}

template <size_t SIZE> void set_array_public(std::array<PublicDataRead<NCT>, SIZE>& arr)
{
static_assert(!(std::is_same<NativeTypes, NCT>::value));
for (auto& e : arr) {
e.set_public();
}
}
};

} // namespace aztec3::circuits::abis
20 changes: 0 additions & 20 deletions yarn-project/circuits.js/src/cbind/circuits.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1133,8 +1133,6 @@ interface MsgpackFinalAccumulatedData {
unencrypted_log_preimages_length: Buffer;
new_contracts: Tuple<MsgpackNewContractData, 1>;
optionally_revealed_data: Tuple<MsgpackOptionallyRevealedData, 4>;
public_data_update_requests: Tuple<MsgpackPublicDataUpdateRequest, 16>;
public_data_reads: Tuple<MsgpackPublicDataRead, 16>;
}

export function toFinalAccumulatedData(o: MsgpackFinalAccumulatedData): FinalAccumulatedData {
Expand Down Expand Up @@ -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)),
Expand All @@ -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)),
);
}

Expand Down Expand Up @@ -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)),
Expand All @@ -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)),
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
]
"
`;

Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -521,14 +521,6 @@ export class FinalAccumulatedData {
* All the optionally revealed data in this transaction.
*/
public optionallyRevealedData: Tuple<OptionallyRevealedData, typeof MAX_OPTIONALLY_REVEALED_DATA_LENGTH_PER_TX>,
/**
* All the public data update requests made in this transaction.
*/
public publicDataUpdateRequests: Tuple<PublicDataUpdateRequest, typeof MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX>,
/**
* All the public data reads made in this transaction.
*/
public publicDataReads: Tuple<PublicDataRead, typeof MAX_PUBLIC_DATA_READS_PER_TX>,
) {
assertMemberLength(this, 'newCommitments', MAX_NEW_COMMITMENTS_PER_TX);
assertMemberLength(this, 'newNullifiers', MAX_NEW_NULLIFIERS_PER_TX);
Expand All @@ -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() {
Expand All @@ -559,8 +549,6 @@ export class FinalAccumulatedData {
this.unencryptedLogPreimagesLength,
this.newContracts,
this.optionallyRevealedData,
this.publicDataUpdateRequests,
this.publicDataReads,
);
}

Expand Down Expand Up @@ -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),
);
}

Expand Down Expand Up @@ -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),
);
}
}
4 changes: 0 additions & 4 deletions yarn-project/circuits.js/src/tests/factories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
);
}

Expand All @@ -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),
);
}

Expand Down

0 comments on commit 5e1809c

Please sign in to comment.