Skip to content

Commit

Permalink
feat: Add side effect counter to logs (#5718)
Browse files Browse the repository at this point in the history
Closes #5017 

This PR adds side effect counters to logs, tracks them throughout the
kernels, sorts them (only in private kernel tail, public kernel tail is
todo), and hashes them to one value in the tail.

## Private path

Encrypted and unencrypted logs flow via a private call:

- A private fn calling `emit_(un)encrypted_log` now actually pushes the
hash of the log to the `PrivateContext` as a `SideEffect`
- These logs hashes are maintained through `PrivateCircuitPublicInputs`
- They are collected in `init` and `inner` kernels
- Like note hashes, we now provide index hints in the `tail` and sort
the logs hashes
- In the final step of `tail`, we either run `to_public`, keeping
individual logs hashes, or `finish_tail` (converting `.end` to
`CombinedAccumulatedData`), where logs are hashed to a single value
- As before, the single value is rolled up and recalculated in L1


## Public path

Unencrypted logs flow via a public call:

- A private fn calling `emit_unencrypted_log` now actually pushes the
hash of the log to the `PublicContext` as a `SideEffect`
- These logs hashes are maintained through `PublicCircuitPublicInputs`
- They are collected in `init` and `inner` kernels
- Like note hashes, we currently don't sort in the public tail (I've
added a ts hack like the note hash one)
- In the final step of `tail`, we hash logs to a single value
- As before, the single value is rolled up and recalculated in L1

## TODOs

- Since individual logs are not hashed by the circuits (this is part of
#1165 which should be done once #1641 is finished), instead a hash is
passed via the oracles, the context circuits can't calculate the length
of each log. So the length is still passed in.
- In the kernels, logs currently sit as `SideEffects` but should be some
special counted logs struct. It makes sense to me to first separate logs
which are linked to note preimages (no issue, but part of kernel epic),
then assign each type of logs its own struct.
 - I added some hacks/qs (see comments below).

---------

Co-authored-by: Leila Wang <leizciw@gmail.com>
  • Loading branch information
MirandaWood and LeilaWang authored Apr 17, 2024
1 parent 84c930a commit d7486a6
Show file tree
Hide file tree
Showing 90 changed files with 1,117 additions and 514 deletions.
14 changes: 9 additions & 5 deletions l1-contracts/src/core/libraries/ConstantsGen.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ library Constants {
uint256 internal constant MAX_NULLIFIER_READ_REQUESTS_PER_CALL = 2;
uint256 internal constant MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL = 2;
uint256 internal constant MAX_NULLIFIER_KEY_VALIDATION_REQUESTS_PER_CALL = 1;
uint256 internal constant MAX_ENCRYPTED_LOGS_PER_CALL = 4;
uint256 internal constant MAX_UNENCRYPTED_LOGS_PER_CALL = 4;
uint256 internal constant MAX_NEW_NOTE_HASHES_PER_TX = 64;
uint256 internal constant MAX_NEW_NULLIFIERS_PER_TX = 64;
uint256 internal constant MAX_PRIVATE_CALL_STACK_LENGTH_PER_TX = 8;
Expand All @@ -37,6 +39,8 @@ library Constants {
uint256 internal constant MAX_NULLIFIER_READ_REQUESTS_PER_TX = 8;
uint256 internal constant MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX = 8;
uint256 internal constant MAX_NULLIFIER_KEY_VALIDATION_REQUESTS_PER_TX = 4;
uint256 internal constant MAX_ENCRYPTED_LOGS_PER_TX = 8;
uint256 internal constant MAX_UNENCRYPTED_LOGS_PER_TX = 8;
uint256 internal constant NUM_ENCRYPTED_LOGS_HASHES_PER_TX = 1;
uint256 internal constant NUM_UNENCRYPTED_LOGS_HASHES_PER_TX = 1;
uint256 internal constant MAX_PUBLIC_DATA_HINTS = 64;
Expand Down Expand Up @@ -70,7 +74,7 @@ library Constants {
uint256 internal constant INITIAL_L2_BLOCK_NUM = 1;
uint256 internal constant BLOB_SIZE_IN_BYTES = 126976;
uint256 internal constant NESTED_CALL_L2_GAS_BUFFER = 20000;
uint256 internal constant MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS = 16000;
uint256 internal constant MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS = 16200;
uint256 internal constant MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS = 3000;
uint256 internal constant MAX_PACKED_BYTECODE_SIZE_PER_UNCONSTRAINED_FUNCTION_IN_FIELDS = 3000;
uint256 internal constant REGISTERER_PRIVATE_FUNCTION_BROADCASTED_ADDITIONAL_FIELDS = 19;
Expand All @@ -84,7 +88,7 @@ library Constants {
uint256 internal constant DEPLOYER_CONTRACT_INSTANCE_DEPLOYED_MAGIC_VALUE =
0x85864497636cf755ae7bde03f267ce01a520981c21c3682aaf82a631;
uint256 internal constant DEPLOYER_CONTRACT_ADDRESS =
0x0b98aeb0111208b95d8d71f484f849d7ab44b3e34c545d13736a707ce3cb0839;
0x1b5ecf3d26907648cf737f4304759b8c5850478e839e72f8ce1f5791b286e8f2;
uint256 internal constant L1_TO_L2_MESSAGE_ORACLE_CALL_LENGTH = 17;
uint256 internal constant MAX_NOTE_FIELDS_LENGTH = 20;
uint256 internal constant GET_NOTE_ORACLE_RETURN_LENGTH = 23;
Expand All @@ -111,9 +115,9 @@ library Constants {
uint256 internal constant NULLIFIER_KEY_VALIDATION_REQUEST_LENGTH = 4;
uint256 internal constant NULLIFIER_KEY_VALIDATION_REQUEST_CONTEXT_LENGTH = 5;
uint256 internal constant PARTIAL_STATE_REFERENCE_LENGTH = 6;
uint256 internal constant PRIVATE_CALL_STACK_ITEM_LENGTH = 224;
uint256 internal constant PRIVATE_CIRCUIT_PUBLIC_INPUTS_LENGTH = 221;
uint256 internal constant PUBLIC_CIRCUIT_PUBLIC_INPUTS_LENGTH = 215;
uint256 internal constant PRIVATE_CALL_STACK_ITEM_LENGTH = 238;
uint256 internal constant PRIVATE_CIRCUIT_PUBLIC_INPUTS_LENGTH = 235;
uint256 internal constant PUBLIC_CIRCUIT_PUBLIC_INPUTS_LENGTH = 222;
uint256 internal constant STATE_REFERENCE_LENGTH = 8;
uint256 internal constant TX_CONTEXT_DATA_LENGTH = 4;
uint256 internal constant TX_REQUEST_LENGTH = 18;
Expand Down
20 changes: 12 additions & 8 deletions l1-contracts/src/core/libraries/decoders/TxsDecoder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -239,17 +239,21 @@ library TxsDecoder {
uint256 privateCircuitPublicInputLogsLength = read4(_body, offset);
offset += 0x4;

// Hash the logs of this iteration's function call
bytes32 privateCircuitPublicInputsLogsHash =
Hash.sha256ToField(slice(_body, offset, privateCircuitPublicInputLogsLength));
offset += privateCircuitPublicInputLogsLength;

// Decrease remaining logs length by this privateCircuitPublicInputsLogs's length (len(I?_LOGS)) and 4 bytes for I?_LOGS_LEN
remainingLogsLength -= (privateCircuitPublicInputLogsLength + 0x4);

kernelPublicInputsLogsHash = Hash.sha256ToField(
bytes.concat(kernelPublicInputsLogsHash, privateCircuitPublicInputsLogsHash)
);
while (privateCircuitPublicInputLogsLength > 0) {
uint256 singleCallLogsLength = read4(_body, offset);
offset += 0x4;

bytes32 singleLogHash = Hash.sha256ToField(slice(_body, offset, singleCallLogsLength));
offset += singleCallLogsLength;

kernelPublicInputsLogsHash =
Hash.sha256ToField(bytes.concat(kernelPublicInputsLogsHash, singleLogHash));

privateCircuitPublicInputLogsLength -= (singleCallLogsLength + 0x4);
}
}

return (kernelPublicInputsLogsHash, offset);
Expand Down
46 changes: 21 additions & 25 deletions l1-contracts/test/decoders/Decoders.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -180,25 +180,20 @@ contract DecodersTest is DecoderBase {

(bytes32 logsHash, uint256 bytesAdvanced) = txsHelper.computeKernelLogsHash(encodedLogs);

bytes32 kernelPublicInputsLogsHash = bytes32(0);
bytes32 privateCircuitPublicInputsLogsHash = Hash.sha256ToField(new bytes(0));

bytes32 referenceLogsHash = Hash.sha256ToField(
abi.encodePacked(kernelPublicInputsLogsHash, privateCircuitPublicInputsLogsHash)
);

assertEq(bytesAdvanced, encodedLogs.length, "Advanced by an incorrect number of bytes");
assertEq(logsHash, referenceLogsHash, "Incorrect logs hash");
assertEq(logsHash, bytes32(0), "Incorrect logs hash");
}

function testComputeKernelLogs1Iteration() public {
// || K_LOGS_LEN | I1_LOGS_LEN | I1_LOGS ||
// K_LOGS_LEN = 4 + 8 = 12 (hex"0000000c")
// I1_LOGS_LEN = 8 (hex"00000008")
// I1_LOGS = 8 bytes (hex"0000000493e78a70") // Note: 00000004 is the length of 1 log within function logs
bytes memory firstFunctionCallLogs = hex"0000000493e78a70";
// I1_LOGS = 8 bytes (hex"0000000493e78a70")
bytes memory firstFunctionCallLogs = hex"93e78a70";
// Prefix logs with length of kernel logs (12) and length of iteration 1 logs (8)
bytes memory encodedLogs = abi.encodePacked(hex"0000000c00000008", firstFunctionCallLogs);
// Note: 00000004 is the length of 1 log within function logs
bytes memory encodedLogs =
abi.encodePacked(hex"0000000c00000008", hex"00000004", firstFunctionCallLogs);
(bytes32 logsHash, uint256 bytesAdvanced) = txsHelper.computeKernelLogsHash(encodedLogs);

// Zero because this is the first iteration
Expand All @@ -222,10 +217,15 @@ contract DecodersTest is DecoderBase {
// I1_LOGS = 8 random bytes (hex"0000000493e78a70")
// I2_LOGS_LEN = 20 (hex"00000014")
// I2_LOGS = 20 bytes (hex"0000001006a86173c86c6d3f108eefc36e7fb014")
bytes memory firstFunctionCallLogs = hex"0000000493e78a70";
bytes memory secondFunctionCallLogs = hex"0000001006a86173c86c6d3f108eefc36e7fb014";
bytes memory firstFunctionCallLogs = hex"93e78a70";
bytes memory secondFunctionCallLogs = hex"06a86173c86c6d3f108eefc36e7fb014";
bytes memory encodedLogs = abi.encodePacked(
hex"0000002400000008", firstFunctionCallLogs, hex"00000014", secondFunctionCallLogs
hex"0000002400000008",
hex"00000004",
firstFunctionCallLogs,
hex"00000014",
hex"00000010",
secondFunctionCallLogs
);
(bytes32 logsHash, uint256 bytesAdvanced) = txsHelper.computeKernelLogsHash(encodedLogs);

Expand Down Expand Up @@ -254,35 +254,31 @@ contract DecodersTest is DecoderBase {
// I2_LOGS = 0 bytes (hex"")
// I3_LOGS_LEN = 20 (hex"00000014")
// I3_LOGS = 20 random bytes (hex"0000001006a86173c86c6d3f108eefc36e7fb014")
bytes memory firstFunctionCallLogs = hex"0000000493e78a70";
bytes memory firstFunctionCallLogs = hex"93e78a70";
bytes memory secondFunctionCallLogs = hex"";
bytes memory thirdFunctionCallLogs = hex"0000001006a86173c86c6d3f108eefc36e7fb014";
bytes memory thirdFunctionCallLogs = hex"06a86173c86c6d3f108eefc36e7fb014";
bytes memory encodedLogs = abi.encodePacked(
hex"0000002800000008",
hex"00000004",
firstFunctionCallLogs,
hex"00000000",
secondFunctionCallLogs,
hex"00000014",
hex"00000010",
thirdFunctionCallLogs
);
(bytes32 logsHash, uint256 bytesAdvanced) = txsHelper.computeKernelLogsHash(encodedLogs);

bytes32 referenceLogsHashFromIteration1 =
Hash.sha256ToField(abi.encodePacked(bytes32(0), Hash.sha256ToField(firstFunctionCallLogs)));

bytes32 privateCircuitPublicInputsLogsHashSecondCall =
Hash.sha256ToField(secondFunctionCallLogs);

bytes32 referenceLogsHashFromIteration2 = Hash.sha256ToField(
abi.encodePacked(
referenceLogsHashFromIteration1, privateCircuitPublicInputsLogsHashSecondCall
)
);
// Note: as of resolving #5017, we now hash logs inside the circuits
// Following the YP, we skip any zero length logs, hence no use of secondFunctionCallLogs here

bytes32 privateCircuitPublicInputsLogsHashThirdCall = Hash.sha256ToField(thirdFunctionCallLogs);

bytes32 referenceLogsHashFromIteration3 = Hash.sha256ToField(
abi.encodePacked(referenceLogsHashFromIteration2, privateCircuitPublicInputsLogsHashThirdCall)
abi.encodePacked(referenceLogsHashFromIteration1, privateCircuitPublicInputsLogsHashThirdCall)
);

assertEq(bytesAdvanced, encodedLogs.length, "Advanced by an incorrect number of bytes");
Expand Down
10 changes: 5 additions & 5 deletions l1-contracts/test/fixtures/empty_block_0.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"l2ToL1Messages": []
},
"block": {
"archive": "0x2ea0c3d3ffef649532de4fb75c9135681ef65b926876b5ff37a4bacfb679f558",
"archive": "0x2683d379c0ad62e225372f35b74366d8c3cd145a12dbbb2028456da89f889be1",
"body": "0x00000000",
"txsEffectsHash": "0x00df6b1c97b9e01113fa0363d9ff71c85addc74e92b22d433b2fb082d2493896",
"decodedHeader": {
Expand All @@ -23,8 +23,8 @@
"chainId": 31337,
"timestamp": 0,
"version": 1,
"coinbase": "0xf6a7844f33ced45fbfeaa9ba463a706b30d4c454",
"feeRecipient": "0x115f6d9664fe6497dec1741573007fcd96fc24124e05b2d415fe4e43e0de4d6e",
"coinbase": "0xd70b960abd35f82aac6df2d1ca6617b5bcd95ba5",
"feeRecipient": "0x0c67b9f94de6beccefc03b63ba448b53464348836ef20b3e6183c5d4f85653ee",
"gasFees": {
"feePerDaGas": 0,
"feePerL1Gas": 0,
Expand Down Expand Up @@ -56,8 +56,8 @@
}
}
},
"header": "0x05b0b6df52f1d47d0406318558052c89a174fbc9d615def82b3cc9ccc1937db800000001000000000000000000000000000000000000000000000000000000000000000100df6b1c97b9e01113fa0363d9ff71c85addc74e92b22d433b2fb082d249389600089a9d421a82c4a25f7acbebe69e638d5b064fa8a60e018793dcb0be53752c0007638bb56b6dda2b64b8f76841114ac3a87a1820030e2e16772c4d294879c31864fcdaa80ff2719154fa7c8a9050662972707168d69eac9db6fd3110829f800000001016642d9ccd8346c403aa4c3fa451178b22534a27035cdaa6ec34ae53b29c50cb000000800bcfa3e9f1a8922ee92c6dc964d6595907c1804a86753774322b468f69d4f278000001000572c8db882674dd026b8877fbba1b700a4407da3ae9ce5fa43215a28163362b000000800000000000000000000000000000000000000000000000000000000000007a69000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000f6a7844f33ced45fbfeaa9ba463a706b30d4c454115f6d9664fe6497dec1741573007fcd96fc24124e05b2d415fe4e43e0de4d6e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"publicInputsHash": "0x000150a504a83df5a4a24f26081fb7397809f2ef5976b687fbdeefb5d42da7f3",
"header": "0x05b0b6df52f1d47d0406318558052c89a174fbc9d615def82b3cc9ccc1937db800000001000000000000000000000000000000000000000000000000000000000000000100df6b1c97b9e01113fa0363d9ff71c85addc74e92b22d433b2fb082d249389600089a9d421a82c4a25f7acbebe69e638d5b064fa8a60e018793dcb0be53752c0007638bb56b6dda2b64b8f76841114ac3a87a1820030e2e16772c4d294879c31864fcdaa80ff2719154fa7c8a9050662972707168d69eac9db6fd3110829f800000001016642d9ccd8346c403aa4c3fa451178b22534a27035cdaa6ec34ae53b29c50cb000000800bcfa3e9f1a8922ee92c6dc964d6595907c1804a86753774322b468f69d4f278000001000572c8db882674dd026b8877fbba1b700a4407da3ae9ce5fa43215a28163362b000000800000000000000000000000000000000000000000000000000000000000007a69000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000d70b960abd35f82aac6df2d1ca6617b5bcd95ba50c67b9f94de6beccefc03b63ba448b53464348836ef20b3e6183c5d4f85653ee000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"publicInputsHash": "0x00ee6ce1f8afb6a9d9da7165bbff8d03d3f2e4ae6a65a9265ecbb7c600244a9c",
"numTxs": 0
}
}
14 changes: 7 additions & 7 deletions l1-contracts/test/fixtures/empty_block_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"l2ToL1Messages": []
},
"block": {
"archive": "0x20411bada543bf4a76e1e2b96c15059c7c81b81b4dec36b15102bcc72dfdebff",
"archive": "0x0be67a10fc9ab9372e7fdfa4fcce95a3ed24d42fb6694ffcd3d418d504d8fef4",
"body": "0x00000000",
"txsEffectsHash": "0x00df6b1c97b9e01113fa0363d9ff71c85addc74e92b22d433b2fb082d2493896",
"decodedHeader": {
Expand All @@ -21,10 +21,10 @@
"globalVariables": {
"blockNumber": 2,
"chainId": 31337,
"timestamp": 1712782698,
"timestamp": 1712912168,
"version": 1,
"coinbase": "0xf6a7844f33ced45fbfeaa9ba463a706b30d4c454",
"feeRecipient": "0x115f6d9664fe6497dec1741573007fcd96fc24124e05b2d415fe4e43e0de4d6e",
"coinbase": "0xd70b960abd35f82aac6df2d1ca6617b5bcd95ba5",
"feeRecipient": "0x0c67b9f94de6beccefc03b63ba448b53464348836ef20b3e6183c5d4f85653ee",
"gasFees": {
"feePerDaGas": 0,
"feePerL1Gas": 0,
Expand All @@ -33,7 +33,7 @@
},
"lastArchive": {
"nextAvailableLeafIndex": 2,
"root": "0x2ea0c3d3ffef649532de4fb75c9135681ef65b926876b5ff37a4bacfb679f558"
"root": "0x2683d379c0ad62e225372f35b74366d8c3cd145a12dbbb2028456da89f889be1"
},
"stateReference": {
"l1ToL2MessageTree": {
Expand All @@ -56,8 +56,8 @@
}
}
},
"header": "0x2ea0c3d3ffef649532de4fb75c9135681ef65b926876b5ff37a4bacfb679f55800000002000000000000000000000000000000000000000000000000000000000000000100df6b1c97b9e01113fa0363d9ff71c85addc74e92b22d433b2fb082d249389600089a9d421a82c4a25f7acbebe69e638d5b064fa8a60e018793dcb0be53752c0007638bb56b6dda2b64b8f76841114ac3a87a1820030e2e16772c4d294879c31864fcdaa80ff2719154fa7c8a9050662972707168d69eac9db6fd3110829f800000002016642d9ccd8346c403aa4c3fa451178b22534a27035cdaa6ec34ae53b29c50cb000001000bcfa3e9f1a8922ee92c6dc964d6595907c1804a86753774322b468f69d4f278000001800572c8db882674dd026b8877fbba1b700a4407da3ae9ce5fa43215a28163362b000000c00000000000000000000000000000000000000000000000000000000000007a6900000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000006616fd6af6a7844f33ced45fbfeaa9ba463a706b30d4c454115f6d9664fe6497dec1741573007fcd96fc24124e05b2d415fe4e43e0de4d6e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"publicInputsHash": "0x00da6d809b78297d6f97202d0679da5a45cfbc2c6594eaeb3f0ac4deba7c6b2e",
"header": "0x2683d379c0ad62e225372f35b74366d8c3cd145a12dbbb2028456da89f889be100000002000000000000000000000000000000000000000000000000000000000000000100df6b1c97b9e01113fa0363d9ff71c85addc74e92b22d433b2fb082d249389600089a9d421a82c4a25f7acbebe69e638d5b064fa8a60e018793dcb0be53752c0007638bb56b6dda2b64b8f76841114ac3a87a1820030e2e16772c4d294879c31864fcdaa80ff2719154fa7c8a9050662972707168d69eac9db6fd3110829f800000002016642d9ccd8346c403aa4c3fa451178b22534a27035cdaa6ec34ae53b29c50cb000001000bcfa3e9f1a8922ee92c6dc964d6595907c1804a86753774322b468f69d4f278000001800572c8db882674dd026b8877fbba1b700a4407da3ae9ce5fa43215a28163362b000000c00000000000000000000000000000000000000000000000000000000000007a6900000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000006618f728d70b960abd35f82aac6df2d1ca6617b5bcd95ba50c67b9f94de6beccefc03b63ba448b53464348836ef20b3e6183c5d4f85653ee000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"publicInputsHash": "0x00bb8af4db44612602143f2507b6f07f4dc5fdede045494a1467c4bea354bcae",
"numTxs": 0
}
}
10 changes: 5 additions & 5 deletions l1-contracts/test/fixtures/mixed_block_0.json

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions l1-contracts/test/fixtures/mixed_block_1.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions noir-projects/aztec-nr/aztec/src/context/avm_context.nr
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl AvmContext {
* Should be automatically convertible to [Field; N]. For example str<N> works with
* one char per field. Otherwise you can use CompressedString.
*/
pub fn accumulate_unencrypted_logs<T>(&mut self, event_selector: Field, log: T) {
pub fn emit_unencrypted_log<T>(&mut self, event_selector: Field, log: T) {
emit_unencrypted_log(event_selector, log);
}
pub fn note_hash_exists(self, note_hash: Field, leaf_index: Field) -> bool {
Expand Down Expand Up @@ -119,13 +119,13 @@ impl PublicContextInterface for AvmContext {
nullifier_exists(unsiloed_nullifier, address.to_field()) == 1
}

fn accumulate_encrypted_logs<N>(&mut self, log: [Field; N]) {
assert(false, "'accumulate_encrypted_logs' not implemented!");
fn emit_unencrypted_log<T>(&mut self, log: T) {
let event_selector = 0;
self.emit_unencrypted_log(event_selector, log);
}

fn accumulate_unencrypted_logs<T>(&mut self, log: T) {
let event_selector = 0;
self.accumulate_unencrypted_logs(event_selector, log);
fn push_unencrypted_log(&mut self, log_hash: Field) {
assert(false, "'push_unencrypted_log' not required for avm - use emit_unencrypted_log!");
}

fn consume_l1_to_l2_message(&mut self, content: Field, secret: Field, sender: EthAddress) {
Expand Down
6 changes: 4 additions & 2 deletions noir-projects/aztec-nr/aztec/src/context/interface.nr
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ trait PublicContextInterface {
fn fee_per_l2_gas(self) -> Field;
fn message_portal(&mut self, recipient: EthAddress, content: Field);
fn consume_l1_to_l2_message(&mut self, content: Field, secret: Field, sender: EthAddress);
fn accumulate_encrypted_logs<N>(&mut self, log: [Field; N]);
fn accumulate_unencrypted_logs<T>(&mut self, log: T);
fn emit_unencrypted_log<T>(&mut self, log: T);
// TODO(1165) Merge push_unencrypted_log into emit_unencrypted_log, since oracle call
// in PublicContext will no longer be needed for extracting log hash
fn push_unencrypted_log(&mut self, log_hash: Field);
fn call_public_function<RETURNS_COUNT>(
self: &mut Self,
contract_address: AztecAddress,
Expand Down
Loading

0 comments on commit d7486a6

Please sign in to comment.