diff --git a/docs/docs-developers/docs/aztec-nr/framework-description/functions/context.md b/docs/docs-developers/docs/aztec-nr/framework-description/functions/context.md index cf36e2a2b656..bd8e6a22dac8 100644 --- a/docs/docs-developers/docs/aztec-nr/framework-description/functions/context.md +++ b/docs/docs-developers/docs/aztec-nr/framework-description/functions/context.md @@ -95,11 +95,11 @@ The return values are a set of values that are returned from an applications exe ```rust return_values : BoundedVec\, ``` -## Include By Timestamp +## Expiration Timestamp -Some data structures impose time constraints, e.g. they may make it so that a value can only be changed after a certain delay. Interacting with these in private involves creating proofs that are only valid as long as they are included before a certain future point in time. To achieve this, the `set_include_by_timestamp` function can be used to set this property: +Some data structures impose time constraints, e.g. they may make it so that a value can only be changed after a certain delay. Interacting with these in private involves creating proofs that are only valid as long as they are included before a certain future point in time. To achieve this, the `set_expiration_timestamp` function can be used to set this property: -#include_code include-by-timestamp /noir-projects/aztec-nr/aztec/src/context/private_context.nr rust +#include_code expiration-timestamp /noir-projects/aztec-nr/aztec/src/context/private_context.nr rust A transaction that sets this value will never be included in a block with a timestamp larger than the requested value, since it would be considered invalid. This can also be used to make transactions automatically expire after some time if not included. diff --git a/docs/docs-developers/docs/aztec-nr/framework-description/state_variables.md b/docs/docs-developers/docs/aztec-nr/framework-description/state_variables.md index 60846bc6aabe..2a30b43ab134 100644 --- a/docs/docs-developers/docs/aztec-nr/framework-description/state_variables.md +++ b/docs/docs-developers/docs/aztec-nr/framework-description/state_variables.md @@ -170,7 +170,7 @@ It is sometimes necessary to read public mutable state in private. For example, `DelayedPublicMutable` is the same as a `PublicMutable` in that it is a public value that can be read and written, but with a caveat: writes only take effect _after some time delay_. These delays are configurable, but they're typically on the order of a couple hours, if not days, making this state variable unsuitable for actions that must be executed immediately - such as an emergency shutdown. It is these very delays that enable private contract functions to _read the current value of a public state variable_, which is otherwise typically impossible. -The existence of minimum delays means that a private function that reads a public value at an anchor block has a guarantee that said historical value will remain the current value until _at least_ some time in the future - before the delay elapses. As long as the transaction gets included in a block before that time (by using the `include_by_timestamp` tx property), the read value is valid. +The existence of minimum delays means that a private function that reads a public value at an anchor block has a guarantee that said historical value will remain the current value until _at least_ some time in the future - before the delay elapses. As long as the transaction gets included in a block before that time (by using the `expiration_timestamp` tx property), the read value is valid. #### Declaration @@ -191,7 +191,7 @@ Returns the current value in a public, private or utility execution context. #include_code get_current_value /noir-projects/noir-contracts/contracts/app/auth_contract/src/main.nr rust :::warning Privacy Consideration -Reading `DelayedPublicMutable` in private sets the `include_by_timestamp` property, which may reveal timing information. Choose delays that align with common values to maximize privacy sets. +Reading `DelayedPublicMutable` in private sets the `expiration_timestamp` property, which may reveal timing information. Choose delays that align with common values to maximize privacy sets. ::: #### `get_scheduled_value` diff --git a/docs/docs-developers/docs/resources/migration_notes.md b/docs/docs-developers/docs/resources/migration_notes.md index ea2afbf175da..f7ab60e20c53 100644 --- a/docs/docs-developers/docs/resources/migration_notes.md +++ b/docs/docs-developers/docs/resources/migration_notes.md @@ -9,6 +9,16 @@ Aztec is in active development. Each version may introduce breaking changes that ## TBD +### [Protocol] `include_by_timestamp` renamed to `expiration_timestamp` + +The `include_by_timestamp` field has been renamed to `expiration_timestamp` across the protocol to better convey its meaning. +**Noir:** + +```diff +- context.set_tx_include_by_timestamp(123456789); ++ context.set_expiration_timestamp(123456789); +``` + ### [CLI] Dockerless CLI Installation The Aztec CLI is now installed without Docker. The installation command has changed: diff --git a/noir-projects/aztec-nr/aztec/src/context/private_context.nr b/noir-projects/aztec-nr/aztec/src/context/private_context.nr index 8c2e788367a8..0b19e6f608b7 100644 --- a/noir-projects/aztec-nr/aztec/src/context/private_context.nr +++ b/noir-projects/aztec-nr/aztec/src/context/private_context.nr @@ -35,9 +35,9 @@ use crate::protocol::{ address::{AztecAddress, EthAddress}, constants::{ CONTRACT_CLASS_LOG_SIZE_IN_FIELDS, MAX_CONTRACT_CLASS_LOGS_PER_CALL, MAX_ENQUEUED_CALLS_PER_CALL, - MAX_INCLUDE_BY_TIMESTAMP_DURATION, MAX_KEY_VALIDATION_REQUESTS_PER_CALL, MAX_L2_TO_L1_MSGS_PER_CALL, - MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, MAX_NOTE_HASHES_PER_CALL, MAX_NULLIFIER_READ_REQUESTS_PER_CALL, - MAX_NULLIFIERS_PER_CALL, MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL, MAX_PRIVATE_LOGS_PER_CALL, + MAX_KEY_VALIDATION_REQUESTS_PER_CALL, MAX_L2_TO_L1_MSGS_PER_CALL, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, + MAX_NOTE_HASHES_PER_CALL, MAX_NULLIFIER_READ_REQUESTS_PER_CALL, MAX_NULLIFIERS_PER_CALL, + MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL, MAX_PRIVATE_LOGS_PER_CALL, MAX_TX_LIFETIME, NULL_MSG_SENDER_CONTRACT_ADDRESS, PRIVATE_LOG_SIZE_IN_FIELDS, }, hash::poseidon2_hash, @@ -148,7 +148,7 @@ pub struct PrivateContext { pub args_hash: Field, pub return_hash: Field, - pub include_by_timestamp: u64, + pub expiration_timestamp: u64, pub(crate) note_hash_read_requests: BoundedVec>, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL>, pub(crate) nullifier_read_requests: BoundedVec>, MAX_NULLIFIER_READ_REQUESTS_PER_CALL>, @@ -180,8 +180,6 @@ pub struct PrivateContext { impl PrivateContext { pub fn new(inputs: PrivateContextInputs, args_hash: Field) -> PrivateContext { - let max_allowed_include_by_timestamp = - inputs.anchor_block_header.global_variables.timestamp + MAX_INCLUDE_BY_TIMESTAMP_DURATION; PrivateContext { inputs, side_effect_counter: inputs.start_side_effect_counter + 1, @@ -189,7 +187,7 @@ impl PrivateContext { is_fee_payer: false, args_hash, return_hash: 0, - include_by_timestamp: max_allowed_include_by_timestamp, + expiration_timestamp: inputs.anchor_block_header.global_variables.timestamp + MAX_TX_LIFETIME, note_hash_read_requests: BoundedVec::new(), nullifier_read_requests: BoundedVec::new(), key_validation_requests_and_generators: BoundedVec::new(), @@ -430,7 +428,7 @@ impl PrivateContext { /// /// # Advanced /// * All private functions of a tx read from the same anchor block header. - /// * The protocol asserts that the `include_by_timestamp` of every tx is at most 24 hours beyond the timestamp of + /// * The protocol asserts that the `expiration_timestamp` of every tx is at most 24 hours beyond the timestamp of /// the tx's chosen anchor block header. This enables the network's nodes to safely prune old txs from the mempool. /// Therefore, the chosen block header _must_ be one from within the last 24 hours. /// @@ -496,7 +494,7 @@ impl PrivateContext { returns_hash: self.return_hash, min_revertible_side_effect_counter: self.min_revertible_side_effect_counter, is_fee_payer: self.is_fee_payer, - include_by_timestamp: self.include_by_timestamp, + expiration_timestamp: self.expiration_timestamp, note_hash_read_requests: ClaimedLengthArray::from_bounded_vec(self.note_hash_read_requests), nullifier_read_requests: ClaimedLengthArray::from_bounded_vec(self.nullifier_read_requests), key_validation_requests_and_generators: ClaimedLengthArray::from_bounded_vec( @@ -598,11 +596,11 @@ impl PrivateContext { /// This expiry timestamp is publicly visible. See the "Advanced" section for privacy concerns. /// /// # Arguments - /// * `include_by_timestamp` - Unix timestamp (seconds) deadline for inclusion. The include-by timestamp of this tx + /// * `expiration_timestamp` - Unix timestamp (seconds) deadline for inclusion. The include-by timestamp of this tx /// will be _at most_ the timestamp specified. /// /// # Advanced - /// * If multiple functions set differing `include_by_timestamp`s, the kernel circuits will set it to be the + /// * If multiple functions set differing `expiration_timestamp`s, the kernel circuits will set it to be the /// _minimum_ of the two. This ensures the tx expiry requirements of all functions in the tx are met. /// * Rollup circuits will reject expired txs. /// * The protocol enforces that all transactions must be included within 24 hours of their chosen anchor block's @@ -617,10 +615,10 @@ impl PrivateContext { /// will need to be discussed. Wallets that deviate from a standard might accidentally reveal which wallet each /// transaction originates from. /// - // docs:start:include-by-timestamp - pub fn set_include_by_timestamp(&mut self, include_by_timestamp: u64) { - // docs:end:include-by-timestamp - self.include_by_timestamp = std::cmp::min(self.include_by_timestamp, include_by_timestamp); + // docs:start:expiration-timestamp + pub fn set_expiration_timestamp(&mut self, expiration_timestamp: u64) { + // docs:end:expiration-timestamp + self.expiration_timestamp = std::cmp::min(self.expiration_timestamp, expiration_timestamp); } /// Asserts that a note has been created. @@ -1460,7 +1458,7 @@ impl Empty for PrivateContext { is_fee_payer: false, args_hash: 0, return_hash: 0, - include_by_timestamp: 0, + expiration_timestamp: 0, note_hash_read_requests: BoundedVec::new(), nullifier_read_requests: BoundedVec::new(), key_validation_requests_and_generators: BoundedVec::new(), diff --git a/noir-projects/aztec-nr/aztec/src/state_vars/delayed_public_mutable.nr b/noir-projects/aztec-nr/aztec/src/state_vars/delayed_public_mutable.nr index 49edadd565f9..9c470c9f7c27 100644 --- a/noir-projects/aztec-nr/aztec/src/state_vars/delayed_public_mutable.nr +++ b/noir-projects/aztec-nr/aztec/src/state_vars/delayed_public_mutable.nr @@ -189,7 +189,7 @@ where // We prevent this transaction from being included in any timestamp after the time horizon, ensuring that the // historical public value matches the current one, since it can only change after the horizon. - self.context.set_include_by_timestamp(time_horizon); + self.context.set_expiration_timestamp(time_horizon); value_change.get_current_at(anchor_timestamp) } diff --git a/noir-projects/aztec-nr/aztec/src/state_vars/delayed_public_mutable/test.nr b/noir-projects/aztec-nr/aztec/src/state_vars/delayed_public_mutable/test.nr index 46623b2db15f..10768c87dd1e 100644 --- a/noir-projects/aztec-nr/aztec/src/state_vars/delayed_public_mutable/test.nr +++ b/noir-projects/aztec-nr/aztec/src/state_vars/delayed_public_mutable/test.nr @@ -229,7 +229,7 @@ unconstrained fn get_current_value_in_private_initial() { assert_eq(state_var.get_current_value(), zeroed()); assert_eq( - context.include_by_timestamp, + context.expiration_timestamp, context.get_anchor_block_header().global_variables.timestamp + TEST_INITIAL_DELAY, ); }); @@ -251,7 +251,7 @@ unconstrained fn get_current_value_in_private_before_change() { let state_var = in_private(context); assert_eq(state_var.get_current_value(), MockStruct::empty()); - assert_eq(context.include_by_timestamp, timestamp_of_change - 1); + assert_eq(context.expiration_timestamp, timestamp_of_change - 1); }); } @@ -275,10 +275,10 @@ unconstrained fn get_current_value_in_private_immediately_before_change() { let state_var = in_private(context); - // Note that this transaction would never be valid since the include_by_timestamp is the same as the anchor + // Note that this transaction would never be valid since the expiration_timestamp is the same as the anchor // block's timestamp, i.e. in the past. assert_eq(state_var.get_current_value(), MockStruct::empty()); - assert_eq(context.include_by_timestamp, timestamp_of_change - 1); + assert_eq(context.expiration_timestamp, timestamp_of_change - 1); }); } @@ -304,7 +304,7 @@ unconstrained fn get_current_value_in_private_at_change() { assert_eq(state_var.get_current_value(), new_value); assert_eq( - context.include_by_timestamp, + context.expiration_timestamp, context.get_anchor_block_header().global_variables.timestamp + TEST_INITIAL_DELAY, ); }); @@ -332,7 +332,7 @@ unconstrained fn get_current_value_in_private_after_change() { assert_eq(state_var.get_current_value(), new_value); assert_eq( - context.include_by_timestamp, + context.expiration_timestamp, context.get_anchor_block_header().global_variables.timestamp + TEST_INITIAL_DELAY, ); }); @@ -361,7 +361,7 @@ unconstrained fn get_current_value_in_private_with_non_initial_delay() { let state_var = in_private(context); assert_eq(state_var.get_current_value(), new_value); - assert_eq(context.include_by_timestamp, historical_timestamp + new_delay); + assert_eq(context.expiration_timestamp, historical_timestamp + new_delay); }); } diff --git a/noir-projects/noir-contracts/contracts/protocol/aztec_sublib/src/context/private_context.nr b/noir-projects/noir-contracts/contracts/protocol/aztec_sublib/src/context/private_context.nr index e4f6a34792ea..271c6f28104e 100644 --- a/noir-projects/noir-contracts/contracts/protocol/aztec_sublib/src/context/private_context.nr +++ b/noir-projects/noir-contracts/contracts/protocol/aztec_sublib/src/context/private_context.nr @@ -29,7 +29,7 @@ use crate::protocol::{ address::{AztecAddress, EthAddress}, constants::{ CONTRACT_CLASS_LOG_SIZE_IN_FIELDS, MAX_CONTRACT_CLASS_LOGS_PER_CALL, - MAX_ENQUEUED_CALLS_PER_CALL, MAX_INCLUDE_BY_TIMESTAMP_DURATION, MAX_L2_TO_L1_MSGS_PER_CALL, + MAX_ENQUEUED_CALLS_PER_CALL, MAX_TX_LIFETIME, MAX_L2_TO_L1_MSGS_PER_CALL, MAX_NULLIFIER_READ_REQUESTS_PER_CALL, MAX_NULLIFIERS_PER_CALL, MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL, MAX_PRIVATE_LOGS_PER_CALL, NULL_MSG_SENDER_CONTRACT_ADDRESS, PRIVATE_LOG_SIZE_IN_FIELDS, @@ -54,7 +54,7 @@ pub struct PrivateContext { pub args_hash: Field, pub return_hash: Field, - pub include_by_timestamp: u64, + pub expiration_timestamp: u64, pub nullifier_read_requests: BoundedVec>, MAX_NULLIFIER_READ_REQUESTS_PER_CALL>, @@ -77,8 +77,6 @@ pub struct PrivateContext { impl PrivateContext { pub fn new(inputs: PrivateContextInputs, args_hash: Field) -> PrivateContext { - let max_allowed_include_by_timestamp = inputs.anchor_block_header.global_variables.timestamp - + MAX_INCLUDE_BY_TIMESTAMP_DURATION; PrivateContext { inputs, side_effect_counter: inputs.start_side_effect_counter + 1, @@ -86,7 +84,8 @@ impl PrivateContext { is_fee_payer: false, args_hash, return_hash: 0, - include_by_timestamp: max_allowed_include_by_timestamp, + expiration_timestamp: inputs.anchor_block_header.global_variables.timestamp + + MAX_TX_LIFETIME, nullifier_read_requests: BoundedVec::new(), nullifiers: BoundedVec::new(), anchor_block_header: inputs.anchor_block_header, @@ -161,7 +160,7 @@ impl PrivateContext { returns_hash: self.return_hash, min_revertible_side_effect_counter: self.min_revertible_side_effect_counter, is_fee_payer: self.is_fee_payer, - include_by_timestamp: self.include_by_timestamp, + expiration_timestamp: self.expiration_timestamp, note_hash_read_requests: ClaimedLengthArray::empty(), // Not used by protocol contracts nullifier_read_requests: ClaimedLengthArray::from_bounded_vec( self.nullifier_read_requests, @@ -214,8 +213,8 @@ impl PrivateContext { } /// Sets a deadline for when this transaction must be included in a block. - pub fn set_include_by_timestamp(&mut self, include_by_timestamp: u64) { - self.include_by_timestamp = std::cmp::min(self.include_by_timestamp, include_by_timestamp); + pub fn set_expiration_timestamp(&mut self, expiration_timestamp: u64) { + self.expiration_timestamp = std::cmp::min(self.expiration_timestamp, expiration_timestamp); } /// Pushes a new nullifier. Used by class_registry and instance_registry. @@ -402,7 +401,7 @@ impl Empty for PrivateContext { is_fee_payer: false, args_hash: 0, return_hash: 0, - include_by_timestamp: 0, + expiration_timestamp: 0, nullifier_read_requests: BoundedVec::new(), nullifiers: BoundedVec::new(), private_call_requests: BoundedVec::new(), diff --git a/noir-projects/noir-contracts/contracts/protocol/aztec_sublib/src/state_vars/delayed_public_mutable.nr b/noir-projects/noir-contracts/contracts/protocol/aztec_sublib/src/state_vars/delayed_public_mutable.nr index 2899c229e661..f12ae2e959ec 100644 --- a/noir-projects/noir-contracts/contracts/protocol/aztec_sublib/src/state_vars/delayed_public_mutable.nr +++ b/noir-projects/noir-contracts/contracts/protocol/aztec_sublib/src/state_vars/delayed_public_mutable.nr @@ -164,7 +164,7 @@ where let time_horizon = value_change.get_time_horizon(anchor_timestamp, effective_minimum_delay); // We prevent this transaction from being included in any timestamp after the time horizon. - self.context.set_include_by_timestamp(time_horizon); + self.context.set_expiration_timestamp(time_horizon); value_change.get_current_at(anchor_timestamp) } diff --git a/noir-projects/noir-contracts/contracts/test/test_contract/src/main.nr b/noir-projects/noir-contracts/contracts/test/test_contract/src/main.nr index 8580ad5d1f0d..6493eadcbe0f 100644 --- a/noir-projects/noir-contracts/contracts/test/test_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/test/test_contract/src/main.nr @@ -121,8 +121,8 @@ pub contract Test { } #[external("private")] - fn set_include_by_timestamp(include_by_timestamp: u64, make_tx_hybrid: bool) { - self.context.set_include_by_timestamp(include_by_timestamp); + fn set_expiration_timestamp(expiration_timestamp: u64, make_tx_hybrid: bool) { + self.context.set_expiration_timestamp(expiration_timestamp); if make_tx_hybrid { self.enqueue_self.dummy_public_call() diff --git a/noir-projects/noir-protocol-circuits/ABOUT.md b/noir-projects/noir-protocol-circuits/ABOUT.md index e6c487001110..1775761c5aa6 100644 --- a/noir-projects/noir-protocol-circuits/ABOUT.md +++ b/noir-projects/noir-protocol-circuits/ABOUT.md @@ -96,7 +96,7 @@ Validator: - Asserts equality (between the tx and current chain) of the chain_id, version, vk_tree_root, protocol_contracts_hash. - Asserts that the tx's chosen gas prices are sufficiently high, relative to the block's minimum requirements. - Asserts that the tx doesn't exceed the L2 gas limit. - - Asserts that the tx's `include_by_timestamp` hasn't already passed, relative to the block's timestamp. + - Asserts that the tx's `expiration_timestamp` hasn't already passed, relative to the block's timestamp. - Hashes the `contract_class_log_fields` and compares them against the tx's claimed contract class log hash. Composer: @@ -177,7 +177,7 @@ Validator: - Asserts equality (between the tx and current chain) of the chain_id, version, vk_tree_root, protocol_contracts_hash. - Asserts that the tx's chosen gas prices are sufficiently high, relative to the block's minimum requirements. - Asserts that the tx doesn't exceed the L2 gas limit. - - Asserts that the tx's `include_by_timestamp` hasn't already passed, relative to the block's timestamp. + - Asserts that the tx's `expiration_timestamp` hasn't already passed, relative to the block's timestamp. Composer `.finish()`: - **Appends the tx effects to the next available position of a blob.** diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-init/Prover.toml b/noir-projects/noir-protocol-circuits/crates/private-kernel-init/Prover.toml index 13d383522a6a..114c00c68680 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-init/Prover.toml +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-init/Prover.toml @@ -305,7 +305,7 @@ expected_non_revertible_side_effect_counter = "0x0000000000000000000000000000000 expected_revertible_side_effect_counter = "0x0000000000000000000000000000000000000000000000000000000000000000" min_revertible_side_effect_counter = "0x0000000000000000000000000000000000000000000000000000000000000005" is_fee_payer = true -include_by_timestamp = "0x0000000000000000000000000000000000000000000000000000000069904e3d" +expiration_timestamp = "0x0000000000000000000000000000000000000000000000000000000069904e3d" [app_public_inputs.call_context] is_static_call = false diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-inner/Prover.toml b/noir-projects/noir-protocol-circuits/crates/private-kernel-inner/Prover.toml index c5241eb67b24..8067ca6c4084 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-inner/Prover.toml +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-inner/Prover.toml @@ -144,7 +144,7 @@ sibling_path = [ [previous_kernel_public_inputs] min_revertible_side_effect_counter = "0x0000000000000000000000000000000000000000000000000000000000000005" -include_by_timestamp = "0x0000000000000000000000000000000000000000000000000000000069904e3d" +expiration_timestamp = "0x0000000000000000000000000000000000000000000000000000000069904e3d" is_private_only = true claimed_first_nullifier = "0x2024835fd8b74a764c77337cdecd852f4412858e32f7be5c0207f01b5da068b5" claimed_revertible_counter = "0x0000000000000000000000000000000000000000000000000000000000000005" @@ -6657,7 +6657,7 @@ expected_non_revertible_side_effect_counter = "0x0000000000000000000000000000000 expected_revertible_side_effect_counter = "0x0000000000000000000000000000000000000000000000000000000000000007" min_revertible_side_effect_counter = "0x0000000000000000000000000000000000000000000000000000000000000000" is_fee_payer = false -include_by_timestamp = "0x0000000000000000000000000000000000000000000000000000000069904e3d" +expiration_timestamp = "0x0000000000000000000000000000000000000000000000000000000069904e3d" [app_public_inputs.call_context] is_static_call = false diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/previous_kernel_for_tail_validator.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/previous_kernel_for_tail_validator.nr index 498cce9cd9c7..38ddd7de1d74 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/previous_kernel_for_tail_validator.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/previous_kernel_for_tail_validator.nr @@ -67,7 +67,7 @@ pub fn validate_previous_kernel_for_tail( // TODO: use assert_not_empty after Noir #9002. assert(!fee_payer.is_empty(), "Fee payer can't be empty"); - // --- include_by_timestamp --- + // --- expiration_timestamp --- // It's checked against the given upper bound and the output value in the output validator. // --- is_private_only --- diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/private_kernel_circuit_output_composer.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/private_kernel_circuit_output_composer.nr index b825d6f6abfc..c54bd502bb3d 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/private_kernel_circuit_output_composer.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/private_kernel_circuit_output_composer.nr @@ -8,9 +8,9 @@ /// The output generated here is validated by `PrivateKernelCircuitOutputValidator` to ensure correctness. /// See the README.md in this directory for more details on the composer/validator pattern. -pub(crate) mod get_include_by_timestamp_for_contract_updates; +pub(crate) mod get_expiration_timestamp_for_contract_updates; -pub(crate) use get_include_by_timestamp_for_contract_updates::get_include_by_timestamp_for_contract_updates; +pub(crate) use get_expiration_timestamp_for_contract_updates::get_expiration_timestamp_for_contract_updates; use crate::{ accumulated_data::{ @@ -161,17 +161,17 @@ impl PrivateKernelCircuitOutputComposer { AztecAddress::zero() }; - // `include_by_timestamp` - The timestamp at which the transaction expires. + // `expiration_timestamp` - The timestamp at which the transaction expires. // This value can only decrease with each kernel iteration. // Here we take the minimum of: - // - The timestamp set by this private call (via `context.set_include_by_timestamp()`) + // - The timestamp set by this private call (via `context.set_expiration_timestamp()`) // - The timestamp before which our earlier read of the contract instance registry would // become stale. // Recall: for the contract address of the private_call, we read whether the contract's // class have ever been upgraded, and if so we read the current class_id, // from a mapping in the ContractInstanceRegistry. Such reads (of DelayedPublicMutable state) // are only valid for a short period of time, after which the class_id might have been - // overwritten. Hence, the include_by_timestamp of this entire tx must be at most the + // overwritten. Hence, the expiration_timestamp of this entire tx must be at most the // timestamp at which our read becomes stale. // Note: even if the contract has never upgraded its class_id, we must still read (and // derive) an inclusion timestamp from its default INITIAL_DELAY in case an upgrade has @@ -179,15 +179,15 @@ impl PrivateKernelCircuitOutputComposer { // can go stale. // // Note: by default, at the time of writing, aztecnr sets the private_call.public_inputs. - // include_by_timestamp to be 24 hours after the anchor block's timestamp. + // expiration_timestamp to be 24 hours after the anchor block's timestamp. // Smart contract frameworks are responsible for setting such sensible values. If they were // to set a value of `0`, this `min` would be `0` and the tx would be out of date before it's // been submitted! let timestamp_before_registry_read_goes_stale = - get_include_by_timestamp_for_contract_updates(inputs.private_call); + get_expiration_timestamp_for_contract_updates(inputs.private_call); - let include_by_timestamp = std::cmp::min( - inputs.private_call.public_inputs.include_by_timestamp, + let expiration_timestamp = std::cmp::min( + inputs.private_call.public_inputs.expiration_timestamp, timestamp_before_registry_read_goes_stale, ); @@ -198,7 +198,7 @@ impl PrivateKernelCircuitOutputComposer { end, public_teardown_call_request, fee_payer, - include_by_timestamp, + expiration_timestamp, is_private_only: inputs.is_private_only, claimed_first_nullifier: inputs.first_nullifier_hint, claimed_revertible_counter: inputs.revertible_counter_hint, @@ -221,7 +221,7 @@ impl PrivateKernelCircuitOutputComposer { end: previous_kernel.end, public_teardown_call_request: previous_kernel.public_teardown_call_request, fee_payer: previous_kernel.fee_payer, - include_by_timestamp: previous_kernel.include_by_timestamp, + expiration_timestamp: previous_kernel.expiration_timestamp, is_private_only: previous_kernel.is_private_only, claimed_first_nullifier: previous_kernel.claimed_first_nullifier, claimed_revertible_counter: previous_kernel.claimed_revertible_counter, @@ -275,7 +275,7 @@ impl PrivateKernelCircuitOutputComposer { &mut self, private_call: PrivateCallData, ) { - self.propagate_include_by_timestamp(private_call); + self.propagate_expiration_timestamp(private_call); self.propagate_note_hash_read_requests(private_call.public_inputs); self.propagate_nullifier_read_requests(private_call.public_inputs); @@ -307,17 +307,17 @@ impl PrivateKernelCircuitOutputComposer { }; } - /// Updates include_by_timestamp by taking the minimum of all constraints. + /// Updates expiration_timestamp by taking the minimum of all constraints. /// Sources of timestamp constraints: - /// - Explicit: `context.set_include_by_timestamp()` called by the private function + /// - Explicit: `context.set_expiration_timestamp()` called by the private function /// - Implicit: Contract updates via delayed public mutable have time horizons /// - Initial: The initial value when this composer is constructed, which is from the previous kernel iteration. - unconstrained fn propagate_include_by_timestamp(&mut self, private_call: PrivateCallData) { - self.public_inputs.include_by_timestamp = std::cmp::min( - self.public_inputs.include_by_timestamp, + unconstrained fn propagate_expiration_timestamp(&mut self, private_call: PrivateCallData) { + self.public_inputs.expiration_timestamp = std::cmp::min( + self.public_inputs.expiration_timestamp, std::cmp::min( - private_call.public_inputs.include_by_timestamp, - get_include_by_timestamp_for_contract_updates(private_call), + private_call.public_inputs.expiration_timestamp, + get_expiration_timestamp_for_contract_updates(private_call), ), ); } diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/private_kernel_circuit_output_composer/get_include_by_timestamp_for_contract_updates.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/private_kernel_circuit_output_composer/get_expiration_timestamp_for_contract_updates.nr similarity index 89% rename from noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/private_kernel_circuit_output_composer/get_include_by_timestamp_for_contract_updates.nr rename to noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/private_kernel_circuit_output_composer/get_expiration_timestamp_for_contract_updates.nr index 76cc1316936e..7a9fc50c4a7b 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/private_kernel_circuit_output_composer/get_include_by_timestamp_for_contract_updates.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/private_kernel_circuit_output_composer/get_expiration_timestamp_for_contract_updates.nr @@ -8,12 +8,12 @@ use types::{ traits::Packable, }; -/// Computes the include_by_timestamp value for contract updates based on the delayed public mutable values stored inside +/// Computes the expiration_timestamp value for contract updates based on the delayed public mutable values stored inside /// the `private_call`. The timestamp is set to the time horizon value of the given `DelayedPublicMutable`. /// See documentation of the `get_time_horizon` function in /// `noir-projects/noir-protocol-circuits/crates/types/src/delayed_public_mutable/scheduled_value_change.nr` for more details /// on what is a time horizon. -pub fn get_include_by_timestamp_for_contract_updates(private_call: PrivateCallData) -> u64 { +pub fn get_expiration_timestamp_for_contract_updates(private_call: PrivateCallData) -> u64 { let delayed_public_mutable_values: DelayedPublicMutableValues = Packable::unpack( private_call.verification_key_hints.updated_class_id_delayed_public_mutable_values, ); diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/private_kernel_circuit_output_validator.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/private_kernel_circuit_output_validator.nr index d05ff313a6eb..47e91c5b43b3 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/private_kernel_circuit_output_validator.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/private_kernel_circuit_output_validator.nr @@ -3,7 +3,7 @@ use crate::{ assert_array_appended, assert_array_appended_and_scoped, assert_array_appended_reversed, assert_array_prepended, assert_array_prepended_up_to_some_length, }, - components::private_kernel_circuit_output_composer::get_include_by_timestamp_for_contract_updates::get_include_by_timestamp_for_contract_updates, + components::private_kernel_circuit_output_composer::get_expiration_timestamp_for_contract_updates::get_expiration_timestamp_for_contract_updates, }; use types::{ abis::{ @@ -21,7 +21,7 @@ use types::{ /// - Initial values are correctly set (constants, tx_context, protocol contracts) /// - Arrays from previous kernel are correctly prepended to output arrays /// - Arrays from the private call are correctly appended and scoped to the calling contract -/// - Aggregated values (fee_payer, min_revertible_counter, include_by_timestamp) are correct +/// - Aggregated values (fee_payer, min_revertible_counter, expiration_timestamp) are correct /// /// See the README.md in this directory for more details on the composer/validator pattern. @@ -70,23 +70,23 @@ impl PrivateKernelCircuitOutputValidator { "incorrect output min_revertible_side_effect_counter", ); - // `include_by_timestamp` - The timestamp at which the transaction expires. + // `expiration_timestamp` - The timestamp at which the transaction expires. // This value can only decrease with each iteration. Here we take the minimum of: // - The value from the previous kernel iteration - // - The value set by the private call (via `context.set_include_by_timestamp()`) + // - The value set by the private call (via `context.set_expiration_timestamp()`) // - The timestamp before which our earlier read of the contract instance registry would // become stale. - let include_by_timestamp = std::cmp::min( - previous_kernel.include_by_timestamp, + let expiration_timestamp = std::cmp::min( + previous_kernel.expiration_timestamp, std::cmp::min( - private_call.public_inputs.include_by_timestamp, - get_include_by_timestamp_for_contract_updates(private_call), + private_call.public_inputs.expiration_timestamp, + get_expiration_timestamp_for_contract_updates(private_call), ), ); assert_eq( - self.output.include_by_timestamp, - include_by_timestamp, - "incorrect output include_by_timestamp", + self.output.expiration_timestamp, + expiration_timestamp, + "incorrect output expiration_timestamp", ); // public_teardown_call_request can only be set once. diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/reset_output_validator.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/reset_output_validator.nr index a0c2899322fd..85969ea24222 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/reset_output_validator.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/reset_output_validator.nr @@ -221,8 +221,8 @@ impl Self { - TailOutputComposer { previous_kernel, include_by_timestamp_upper_bound } + TailOutputComposer { previous_kernel, expiration_timestamp_upper_bound } } pub unconstrained fn finish(self) -> PrivateToRollupKernelCircuitPublicInputs { @@ -38,9 +38,9 @@ impl TailOutputComposer { let gas_used = meter_gas_used(self.previous_kernel, false /* is_for_public */); - let include_by_timestamp = std::cmp::min( - source.include_by_timestamp, - self.include_by_timestamp_upper_bound, + let expiration_timestamp = std::cmp::min( + source.expiration_timestamp, + self.expiration_timestamp_upper_bound, ); PrivateToRollupKernelCircuitPublicInputs { @@ -48,7 +48,7 @@ impl TailOutputComposer { end, gas_used, fee_payer: source.fee_payer, - include_by_timestamp, + expiration_timestamp, } } diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_output_validator.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_output_validator.nr index 4414afe351c0..77e21a72d1b6 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_output_validator.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_output_validator.nr @@ -1,6 +1,6 @@ -mod validate_include_by_timestamp_duration; +mod validate_expiration_timestamp; -pub(crate) use validate_include_by_timestamp_duration::validate_include_by_timestamp_duration; +pub(crate) use validate_expiration_timestamp::validate_expiration_timestamp; use crate::{ accumulated_data::{assert_sorted_transformed_array, assert_transformed_array}, @@ -14,16 +14,16 @@ use types::abis::kernel_circuit_public_inputs::{ pub struct TailOutputValidator { output: PrivateToRollupKernelCircuitPublicInputs, previous_kernel: PrivateKernelCircuitPublicInputs, - include_by_timestamp_upper_bound: u64, + expiration_timestamp_upper_bound: u64, } impl TailOutputValidator { pub fn new( output: PrivateToRollupKernelCircuitPublicInputs, previous_kernel: PrivateKernelCircuitPublicInputs, - include_by_timestamp_upper_bound: u64, + expiration_timestamp_upper_bound: u64, ) -> Self { - TailOutputValidator { output, previous_kernel, include_by_timestamp_upper_bound } + TailOutputValidator { output, previous_kernel, expiration_timestamp_upper_bound } } pub fn validate(self) { @@ -58,22 +58,22 @@ impl TailOutputValidator { assert_eq(self.output.fee_payer, self.previous_kernel.fee_payer, "mismatch fee_payer"); - // `include_by_timestamp` - The timestamp at which the transaction expires. + // `expiration_timestamp` - The timestamp at which the transaction expires. // This value can only decrease with each iteration. Here we take the minimum of: // - The value from the previous kernel iteration // - An upper bound value set by the user - let include_by_timestamp = std::cmp::min( - self.previous_kernel.include_by_timestamp, - self.include_by_timestamp_upper_bound, + let expiration_timestamp = std::cmp::min( + self.previous_kernel.expiration_timestamp, + self.expiration_timestamp_upper_bound, ); - validate_include_by_timestamp_duration( - include_by_timestamp, + validate_expiration_timestamp( + expiration_timestamp, self.previous_kernel.constants.anchor_block_header.global_variables, ); assert_eq( - self.output.include_by_timestamp, - include_by_timestamp, - "incorrect include_by_timestamp", + self.output.expiration_timestamp, + expiration_timestamp, + "incorrect expiration_timestamp", ); // note_hashes diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_output_validator/validate_expiration_timestamp.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_output_validator/validate_expiration_timestamp.nr new file mode 100644 index 000000000000..2fad0f599b8d --- /dev/null +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_output_validator/validate_expiration_timestamp.nr @@ -0,0 +1,6 @@ +use types::{abis::global_variables::GlobalVariables, constants::MAX_TX_LIFETIME}; + +pub fn validate_expiration_timestamp(expiration_timestamp: u64, global_variables: GlobalVariables) { + let max_timestamp = global_variables.timestamp + MAX_TX_LIFETIME; + assert(expiration_timestamp <= max_timestamp, "expiration_timestamp exceeds max tx lifetime"); +} diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_output_validator/validate_include_by_timestamp_duration.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_output_validator/validate_include_by_timestamp_duration.nr deleted file mode 100644 index c2a36bf23722..000000000000 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_output_validator/validate_include_by_timestamp_duration.nr +++ /dev/null @@ -1,12 +0,0 @@ -use types::{abis::global_variables::GlobalVariables, constants::MAX_INCLUDE_BY_TIMESTAMP_DURATION}; - -pub fn validate_include_by_timestamp_duration( - include_by_timestamp: u64, - global_variables: GlobalVariables, -) { - let max_timestamp = global_variables.timestamp + MAX_INCLUDE_BY_TIMESTAMP_DURATION; - assert( - include_by_timestamp <= max_timestamp, - "include_by_timestamp exceeds the maximum duration", - ); -} diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_to_public_output_composer.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_to_public_output_composer.nr index 7fa0a04e7e97..672c98e02f5f 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_to_public_output_composer.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_to_public_output_composer.nr @@ -16,19 +16,19 @@ use types::abis::kernel_circuit_public_inputs::{ pub struct TailToPublicOutputComposer { previous_kernel: PrivateKernelCircuitPublicInputs, padded_side_effect_amounts: PaddedSideEffectAmounts, - include_by_timestamp_upper_bound: u64, + expiration_timestamp_upper_bound: u64, } impl TailToPublicOutputComposer { pub unconstrained fn new( previous_kernel: PrivateKernelCircuitPublicInputs, padded_side_effect_amounts: PaddedSideEffectAmounts, - include_by_timestamp_upper_bound: u64, + expiration_timestamp_upper_bound: u64, ) -> Self { TailToPublicOutputComposer { previous_kernel, padded_side_effect_amounts, - include_by_timestamp_upper_bound, + expiration_timestamp_upper_bound, } } @@ -46,9 +46,9 @@ impl TailToPublicOutputComposer { let gas_used = meter_gas_used(self.previous_kernel, true /* is_for_public */); - let include_by_timestamp = std::cmp::min( - source.include_by_timestamp, - self.include_by_timestamp_upper_bound, + let expiration_timestamp = std::cmp::min( + source.expiration_timestamp, + self.expiration_timestamp_upper_bound, ); let mut output = PrivateToPublicKernelCircuitPublicInputs { @@ -58,7 +58,7 @@ impl TailToPublicOutputComposer { public_teardown_call_request: source.public_teardown_call_request, gas_used, fee_payer: source.fee_payer, - include_by_timestamp, + expiration_timestamp, }; output diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_to_public_output_validator.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_to_public_output_validator.nr index 075d15f3b76b..f11ad814a0b2 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_to_public_output_validator.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/tail_to_public_output_validator.nr @@ -4,9 +4,7 @@ use crate::{ assert_split_sorted_transformed_arrays, assert_split_transformed_arrays_from_sorted_padded_array, }, - components::{ - gas_meter::meter_gas_used, tail_output_validator::validate_include_by_timestamp_duration, - }, + components::{gas_meter::meter_gas_used, tail_output_validator::validate_expiration_timestamp}, }; use types::abis::kernel_circuit_public_inputs::{ PrivateKernelCircuitPublicInputs, PrivateToPublicKernelCircuitPublicInputs, @@ -16,7 +14,7 @@ pub struct TailToPublicOutputValidator { pub(crate) output: PrivateToPublicKernelCircuitPublicInputs, pub(crate) previous_kernel: PrivateKernelCircuitPublicInputs, pub(crate) padded_side_effect_amounts: PaddedSideEffectAmounts, - pub(crate) include_by_timestamp_upper_bound: u64, + pub(crate) expiration_timestamp_upper_bound: u64, } impl TailToPublicOutputValidator { @@ -24,13 +22,13 @@ impl TailToPublicOutputValidator { output: PrivateToPublicKernelCircuitPublicInputs, previous_kernel: PrivateKernelCircuitPublicInputs, padded_side_effect_amounts: PaddedSideEffectAmounts, - include_by_timestamp_upper_bound: u64, + expiration_timestamp_upper_bound: u64, ) -> Self { TailToPublicOutputValidator { output, previous_kernel, padded_side_effect_amounts, - include_by_timestamp_upper_bound, + expiration_timestamp_upper_bound, } } @@ -50,22 +48,22 @@ impl TailToPublicOutputValidator { assert_eq(self.output.fee_payer, self.previous_kernel.fee_payer, "mismatch fee_payer"); - // `include_by_timestamp` - The timestamp at which the transaction expires. + // `expiration_timestamp` - The timestamp at which the transaction expires. // This value can only decrease with each iteration. Here we take the minimum of: // - The value from the previous kernel iteration // - An upper bound value set by the user - let include_by_timestamp = std::cmp::min( - self.previous_kernel.include_by_timestamp, - self.include_by_timestamp_upper_bound, + let expiration_timestamp = std::cmp::min( + self.previous_kernel.expiration_timestamp, + self.expiration_timestamp_upper_bound, ); - validate_include_by_timestamp_duration( - include_by_timestamp, + validate_expiration_timestamp( + expiration_timestamp, self.previous_kernel.constants.anchor_block_header.global_variables, ); assert_eq( - self.output.include_by_timestamp, - include_by_timestamp, - "incorrect include_by_timestamp", + self.output.expiration_timestamp, + expiration_timestamp, + "incorrect expiration_timestamp", ); // public_teardown_call_request diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/private_kernel_tail.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/private_kernel_tail.nr index 98c1a655d430..e6e275822045 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/private_kernel_tail.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/private_kernel_tail.nr @@ -17,11 +17,11 @@ global ALLOWED_PREVIOUS_CIRCUITS: [u32; 3] = pub struct PrivateKernelTailCircuitPrivateInputs { pub previous_kernel: PrivateKernelData, - // The `include_by_timestamp` set by the wallet. The wallet should take the value aggregated during the transaction + // The `expiration_timestamp` set by the wallet. The wallet should take the value aggregated during the transaction // and decide whether to keep it or lower it. // For example, it may round the value down to the nearest hour to improve privacy. - // This value will be ignored if it's larger than the `include_by_timestamp` requested during private execution. - pub include_by_timestamp_upper_bound: u64, + // This value will be ignored if it's larger than the `expiration_timestamp` requested during private execution. + pub expiration_timestamp_upper_bound: u64, } unconstrained fn generate_output( @@ -29,7 +29,7 @@ unconstrained fn generate_output( ) -> PrivateToRollupKernelCircuitPublicInputs { TailOutputComposer::new( inputs.previous_kernel.public_inputs, - inputs.include_by_timestamp_upper_bound, + inputs.expiration_timestamp_upper_bound, ) .finish() } @@ -47,7 +47,7 @@ unconstrained fn generate_output( /// - Ensures accumulated data arrays are properly formatted (dense, trimmed) /// - Validates the hints `is_private_only`, `claimed_first_nullifier`, `claimed_revertible_counter` against the values /// in the last kernel -/// - Applies the `include_by_timestamp_upper_bound` for privacy (allows rounding timestamps) +/// - Applies the `expiration_timestamp_upper_bound` for privacy (allows rounding timestamps) /// /// The output contains the final siloed note hashes, nullifiers, logs, and L2-to-L1 messages that will be included in /// the block. @@ -76,7 +76,7 @@ pub fn execute( TailOutputValidator::new( output, inputs.previous_kernel.public_inputs, - inputs.include_by_timestamp_upper_bound, + inputs.expiration_timestamp_upper_bound, ) .validate(); } diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/private_kernel_tail_to_public.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/private_kernel_tail_to_public.nr index b5b9991dda92..81da22498683 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/private_kernel_tail_to_public.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/private_kernel_tail_to_public.nr @@ -22,11 +22,11 @@ global ALLOWED_PREVIOUS_CIRCUITS: [u32; 3] = pub struct PrivateKernelTailToPublicCircuitPrivateInputs { pub previous_kernel: PrivateKernelData, pub padded_side_effect_amounts: PaddedSideEffectAmounts, - // The `include_by_timestamp` set by the wallet. The wallet should take the value aggregated during the transaction + // The `expiration_timestamp` set by the wallet. The wallet should take the value aggregated during the transaction // and decide whether to keep it or lower it. // For example, it may round the value down to the nearest hour to improve privacy. - // This value will be ignored if it's larger than the `include_by_timestamp` requested during private execution. - pub include_by_timestamp_upper_bound: u64, + // This value will be ignored if it's larger than the `expiration_timestamp` requested during private execution. + pub expiration_timestamp_upper_bound: u64, } unconstrained fn generate_output( @@ -35,7 +35,7 @@ unconstrained fn generate_output( TailToPublicOutputComposer::new( inputs.previous_kernel.public_inputs, inputs.padded_side_effect_amounts, - inputs.include_by_timestamp_upper_bound, + inputs.expiration_timestamp_upper_bound, ) .finish() } @@ -55,7 +55,7 @@ unconstrained fn generate_output( /// in the last kernel /// - Splits accumulated data into non-revertible and revertible sets for public execution /// - Sorts public call requests by counter and splits them into non-revertible and revertible sets -/// - Applies the `include_by_timestamp_upper_bound` for privacy (allows rounding timestamps) +/// - Applies the `expiration_timestamp_upper_bound` for privacy (allows rounding timestamps) /// /// The output separates non-revertible effects (that persist even if public execution fails) from revertible effects, /// and includes the sorted public call requests for the AVM. @@ -84,7 +84,7 @@ pub fn execute( output, inputs.previous_kernel.public_inputs, inputs.padded_side_effect_amounts, - inputs.include_by_timestamp_upper_bound, + inputs.expiration_timestamp_upper_bound, ) .validate(); } diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_circuit_output_validator_builder/validate_aggregated_values.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_circuit_output_validator_builder/validate_aggregated_values.nr index 39b9d6e812c7..2e471c7c845f 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_circuit_output_validator_builder/validate_aggregated_values.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_circuit_output_validator_builder/validate_aggregated_values.nr @@ -71,73 +71,73 @@ fn validate_aggregated_values_min_revertible_side_effect_counter_random_output_f } /** - * include_by_timestamp + * expiration_timestamp */ #[test] -fn validate_aggregated_values_include_by_timestamp_from_both_succeeds() { +fn validate_aggregated_values_expiration_timestamp_from_both_succeeds() { let mut builder = PrivateKernelCircuitOutputValidatorBuilder::new(); - builder.previous_kernel.include_by_timestamp = 3; - builder.private_call.include_by_timestamp = 3; - builder.output.include_by_timestamp = 3; + builder.previous_kernel.expiration_timestamp = 3; + builder.private_call.expiration_timestamp = 3; + builder.output.expiration_timestamp = 3; builder.validate_as_inner_call(); } #[test] -fn validate_aggregated_values_include_by_timestamp_from_both_pick_previous_succeeds() { +fn validate_aggregated_values_expiration_timestamp_from_both_pick_previous_succeeds() { let mut builder = PrivateKernelCircuitOutputValidatorBuilder::new(); - builder.previous_kernel.include_by_timestamp = 3; - builder.private_call.include_by_timestamp = 4; - builder.output.include_by_timestamp = 3; + builder.previous_kernel.expiration_timestamp = 3; + builder.private_call.expiration_timestamp = 4; + builder.output.expiration_timestamp = 3; builder.validate_as_inner_call(); } #[test] -fn validate_aggregated_values_include_by_timestamp_from_both_pick_private_call_succeeds() { +fn validate_aggregated_values_expiration_timestamp_from_both_pick_private_call_succeeds() { let mut builder = PrivateKernelCircuitOutputValidatorBuilder::new(); - builder.previous_kernel.include_by_timestamp = 4; - builder.private_call.include_by_timestamp = 3; - builder.output.include_by_timestamp = 3; + builder.previous_kernel.expiration_timestamp = 4; + builder.private_call.expiration_timestamp = 3; + builder.output.expiration_timestamp = 3; builder.validate_as_inner_call(); } -#[test(should_fail_with = "incorrect output include_by_timestamp")] -fn validate_aggregated_values_include_by_timestamp_from_both_pick_larger_previous_fails() { +#[test(should_fail_with = "incorrect output expiration_timestamp")] +fn validate_aggregated_values_expiration_timestamp_from_both_pick_larger_previous_fails() { let mut builder = PrivateKernelCircuitOutputValidatorBuilder::new(); - builder.previous_kernel.include_by_timestamp = 4; - builder.private_call.include_by_timestamp = 3; - builder.output.include_by_timestamp = 4; + builder.previous_kernel.expiration_timestamp = 4; + builder.private_call.expiration_timestamp = 3; + builder.output.expiration_timestamp = 4; builder.validate_as_inner_call(); } -#[test(should_fail_with = "incorrect output include_by_timestamp")] -fn validate_aggregated_values_include_by_timestamp_from_both_pick_larger_private_call_fails() { +#[test(should_fail_with = "incorrect output expiration_timestamp")] +fn validate_aggregated_values_expiration_timestamp_from_both_pick_larger_private_call_fails() { let mut builder = PrivateKernelCircuitOutputValidatorBuilder::new(); - builder.previous_kernel.include_by_timestamp = 3; - builder.private_call.include_by_timestamp = 4; - builder.output.include_by_timestamp = 4; + builder.previous_kernel.expiration_timestamp = 3; + builder.private_call.expiration_timestamp = 4; + builder.output.expiration_timestamp = 4; builder.validate_as_inner_call(); } #[test] -fn validate_aggregated_values_include_by_timestamp_pick_for_contract_updates_succeeds() { +fn validate_aggregated_values_expiration_timestamp_pick_for_contract_updates_succeeds() { let mut builder = PrivateKernelCircuitOutputValidatorBuilder::new(); - let include_by_timestamp_for_contract_updates = + let expiration_timestamp_for_contract_updates = builder.private_call.anchor_block_header.global_variables.timestamp + DEFAULT_UPDATE_DELAY; - builder.previous_kernel.include_by_timestamp = include_by_timestamp_for_contract_updates + 1; - builder.private_call.include_by_timestamp = include_by_timestamp_for_contract_updates + 1; - builder.output.include_by_timestamp = include_by_timestamp_for_contract_updates; + builder.previous_kernel.expiration_timestamp = expiration_timestamp_for_contract_updates + 1; + builder.private_call.expiration_timestamp = expiration_timestamp_for_contract_updates + 1; + builder.output.expiration_timestamp = expiration_timestamp_for_contract_updates; builder.validate_as_inner_call(); } diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_init/mod.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_init/mod.nr index 49abb06ae386..9c1e8f5fcaef 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_init/mod.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_init/mod.nr @@ -2,7 +2,7 @@ mod private_call_data; mod output_composition_tests; use crate::{ - components::private_kernel_circuit_output_composer::get_include_by_timestamp_for_contract_updates, + components::private_kernel_circuit_output_composer::get_expiration_timestamp_for_contract_updates, private_kernel_init::{self, PrivateKernelInitCircuitPrivateInputs}, }; use types::{ @@ -106,11 +106,11 @@ impl TestBuilder { }; assert_eq(pi.fee_payer, expected_fee_payer); - let expected_include_by_timestamp = std::cmp::min( - self.private_call.include_by_timestamp, - get_include_by_timestamp_for_contract_updates(self.private_call.to_private_call_data()), + let expected_expiration_timestamp = std::cmp::min( + self.private_call.expiration_timestamp, + get_expiration_timestamp_for_contract_updates(self.private_call.to_private_call_data()), ); - assert_eq(pi.include_by_timestamp, expected_include_by_timestamp); + assert_eq(pi.expiration_timestamp, expected_expiration_timestamp); assert_eq(pi.is_private_only, self.is_private_only); diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_init/output_composition_tests.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_init/output_composition_tests.nr index d2c520e97123..e306713e04f2 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_init/output_composition_tests.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_init/output_composition_tests.nr @@ -11,7 +11,7 @@ use types::{ fn with_everything_empty_except_for_first_nullifier_hint() { let mut builder = TestBuilder::new(); - builder.private_call.include_by_timestamp = 0; + builder.private_call.expiration_timestamp = 0; builder.first_nullifier_hint = 1234; let pi = builder.execute(); @@ -19,7 +19,7 @@ fn with_everything_empty_except_for_first_nullifier_hint() { assert_eq(pi.min_revertible_side_effect_counter, 0); assert_eq(pi.fee_payer, AztecAddress::empty()); - assert_eq(pi.include_by_timestamp, 0); + assert_eq(pi.expiration_timestamp, 0); assert_eq(pi.is_private_only, false); assert_eq(pi.claimed_first_nullifier, 1234); assert_eq(pi.claimed_revertible_counter, 0); @@ -89,21 +89,21 @@ fn with_nullifiers_emitted_and_protocol_nullifier_injected() { } #[test] -fn include_by_timestamp_constrained_by_contract_updates() { +fn expiration_timestamp_constrained_by_contract_updates() { let mut builder = TestBuilder::new(); - // Set the private call's include_by_timestamp to a large value + // Set the private call's expiration_timestamp to a large value // that exceeds the contract update time horizon let anchor_timestamp = builder.private_call.anchor_block_header.global_variables.timestamp; let contract_update_horizon = anchor_timestamp + DEFAULT_UPDATE_DELAY; - // Set include_by_timestamp larger than the contract update horizon - builder.private_call.include_by_timestamp = contract_update_horizon + 1000; + // Set expiration_timestamp larger than the contract update horizon + builder.private_call.expiration_timestamp = contract_update_horizon + 1000; let pi = builder.execute(); // Verify the output uses the smaller contract update timestamp, not the private call's value - assert_eq(pi.include_by_timestamp, contract_update_horizon); + assert_eq(pi.expiration_timestamp, contract_update_horizon); } #[test] @@ -113,7 +113,7 @@ fn with_everything_non_empty() { builder.is_private_only = true; builder.first_nullifier_hint = 1234; builder.revertible_counter_hint = 567; - builder.private_call.include_by_timestamp = 7890; + builder.private_call.expiration_timestamp = 7890; builder.private_call.is_fee_payer = true; builder.private_call.append_note_hashes(2); @@ -137,7 +137,7 @@ fn with_everything_non_empty() { assert_eq(pi.min_revertible_side_effect_counter, 98765); assert_eq(pi.fee_payer, builder.private_call.contract_address); - assert_eq(pi.include_by_timestamp, 7890); + assert_eq(pi.expiration_timestamp, 7890); assert_eq(pi.is_private_only, true); assert_eq(pi.claimed_first_nullifier, 1234); assert_eq(pi.claimed_revertible_counter, 567); diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_inner/output_composition_tests.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_inner/output_composition_tests.nr index c752748bb533..a3c6c1707a7b 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_inner/output_composition_tests.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_inner/output_composition_tests.nr @@ -250,35 +250,35 @@ fn with_both_non_empty_fee_payer() { } #[test] -fn include_by_timestamp_pick_previous() { +fn expiration_timestamp_pick_previous() { let mut builder = TestBuilder::new(); - builder.previous_kernel.include_by_timestamp = 45; - builder.private_call.include_by_timestamp = 678; + builder.previous_kernel.expiration_timestamp = 45; + builder.private_call.expiration_timestamp = 678; let pi = builder.execute(); - assert_eq(pi.include_by_timestamp, 45); + assert_eq(pi.expiration_timestamp, 45); } #[test] -fn include_by_timestamp_pick_private_call() { +fn expiration_timestamp_pick_private_call() { let mut builder = TestBuilder::new(); - builder.previous_kernel.include_by_timestamp = 456; - builder.private_call.include_by_timestamp = 78; + builder.previous_kernel.expiration_timestamp = 456; + builder.private_call.expiration_timestamp = 78; let pi = builder.execute(); - assert_eq(pi.include_by_timestamp, 78); + assert_eq(pi.expiration_timestamp, 78); } #[test] fn with_everything_non_empty() { let mut builder = TestBuilder::new(); - builder.previous_kernel.include_by_timestamp = 45; - builder.private_call.include_by_timestamp = 45; + builder.previous_kernel.expiration_timestamp = 45; + builder.private_call.expiration_timestamp = 45; builder.previous_kernel.is_private_only = true; builder.previous_kernel.claimed_revertible_counter = 123; @@ -352,7 +352,7 @@ fn with_everything_non_empty() { let pi = builder.execute(); - assert_eq(pi.include_by_timestamp, 45); + assert_eq(pi.expiration_timestamp, 45); assert_eq(pi.is_private_only, true); assert_eq(pi.claimed_revertible_counter, 123); diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_reset/propagated_value_tests.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_reset/propagated_value_tests.nr index 6952f28e5b61..103660674f68 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_reset/propagated_value_tests.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_reset/propagated_value_tests.nr @@ -14,7 +14,7 @@ fn correct_output_propagated_values() { builder.previous_kernel.append_public_call_requests(2); builder.previous_kernel.set_public_teardown_call_request(); builder.previous_kernel.fee_payer = AztecAddress::from_field(62); - builder.previous_kernel.include_by_timestamp = 13; + builder.previous_kernel.expiration_timestamp = 13; builder.previous_kernel.is_private_only = true; builder.previous_kernel.claimed_first_nullifier = 7788; builder.previous_kernel.claimed_revertible_counter = 42; @@ -52,7 +52,7 @@ fn correct_output_propagated_values() { ); assert_eq(pi.public_teardown_call_request, previous_kernel.public_teardown_call_request); assert_eq(pi.fee_payer, AztecAddress::from_field(62)); - assert_eq(pi.include_by_timestamp, 13); + assert_eq(pi.expiration_timestamp, 13); assert_eq(pi.is_private_only, true); assert_eq(pi.claimed_first_nullifier, 7788); assert_eq(pi.claimed_revertible_counter, 42); diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_tail/mod.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_tail/mod.nr index 2043cff42d8c..fd511f9cbf03 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_tail/mod.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_tail/mod.nr @@ -14,7 +14,7 @@ use types::{ struct TestBuilder { pub previous_kernel: FixtureBuilder, - pub include_by_timestamp_upper_bound: u64, + pub expiration_timestamp_upper_bound: u64, pub output: FixtureBuilder, } @@ -32,7 +32,7 @@ impl TestBuilder { TestBuilder { previous_kernel, - include_by_timestamp_upper_bound: previous_kernel.include_by_timestamp, + expiration_timestamp_upper_bound: previous_kernel.expiration_timestamp, output, } } @@ -42,7 +42,7 @@ impl TestBuilder { let inputs = PrivateKernelTailCircuitPrivateInputs { previous_kernel, - include_by_timestamp_upper_bound: self.include_by_timestamp_upper_bound, + expiration_timestamp_upper_bound: self.expiration_timestamp_upper_bound, }; private_kernel_tail::execute(inputs) diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_tail/output_composition_tests.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_tail/output_composition_tests.nr index a4a1625d95fc..972962ff1db2 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_tail/output_composition_tests.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_tail/output_composition_tests.nr @@ -7,8 +7,8 @@ fn correct_private_kernel_tail_output_propagated_values() { let constants = builder.previous_kernel.to_tx_constant_data(); builder.previous_kernel.fee_payer = AztecAddress::from_field(90); - builder.include_by_timestamp_upper_bound = 999; - builder.previous_kernel.include_by_timestamp = 13; + builder.expiration_timestamp_upper_bound = 999; + builder.previous_kernel.expiration_timestamp = 13; builder.previous_kernel.append_siloed_note_hashes(2); builder.previous_kernel.append_siloed_nullifiers(2); builder.previous_kernel.append_siloed_private_logs(1); @@ -17,8 +17,8 @@ fn correct_private_kernel_tail_output_propagated_values() { assert_eq(public_inputs.constants, constants); assert_eq(public_inputs.fee_payer, AztecAddress::from_field(90)); - assert_eq(public_inputs.include_by_timestamp, 13); - // More scenarios for the `include_by_timestamp` value are tested in `validate_propagated_values_tests.nr`. + assert_eq(public_inputs.expiration_timestamp, 13); + // More scenarios for the `expiration_timestamp` value are tested in `validate_propagated_values_tests.nr`. // The exact values for the `gas_used` are tested in `meter_gas_used_tests.nr`. diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_tail/tail_output_validator/mod.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_tail/tail_output_validator/mod.nr index 6b0ffa0e5f55..496104a1eec4 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_tail/tail_output_validator/mod.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_tail/tail_output_validator/mod.nr @@ -24,7 +24,7 @@ impl TestBuilder { TailOutputValidator::new( output, previous_kernel, - self.include_by_timestamp_upper_bound, + self.expiration_timestamp_upper_bound, ) .validate(); } diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_tail/tail_output_validator/validate_propagated_values_tests.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_tail/tail_output_validator/validate_propagated_values_tests.nr index a3b1f9e0466d..6a0f906b7a33 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_tail/tail_output_validator/validate_propagated_values_tests.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_tail/tail_output_validator/validate_propagated_values_tests.nr @@ -2,7 +2,7 @@ use crate::tests::private_kernel_tail::TestBuilder; use types::{ abis::protocol_contracts::ProtocolContracts, address::AztecAddress, - constants::{MAX_INCLUDE_BY_TIMESTAMP_DURATION, MAX_PROTOCOL_CONTRACTS}, + constants::{MAX_PROTOCOL_CONTRACTS, MAX_TX_LIFETIME}, traits::FromField, }; @@ -63,115 +63,115 @@ fn fee_payer_mismatch() { builder.validate(); } -// --- include_by_timestamp --- +// --- expiration_timestamp --- #[test] -fn include_by_timestamp_use_previous() { +fn expiration_timestamp_use_previous() { let mut builder = TestBuilder::new(); - builder.include_by_timestamp_upper_bound = 9999; - builder.previous_kernel.include_by_timestamp = 123; - builder.output.include_by_timestamp = 123; + builder.expiration_timestamp_upper_bound = 9999; + builder.previous_kernel.expiration_timestamp = 123; + builder.output.expiration_timestamp = 123; builder.validate(); } #[test] -fn include_by_timestamp_use_custom() { +fn expiration_timestamp_use_custom() { let mut builder = TestBuilder::new(); - builder.include_by_timestamp_upper_bound = 99; - builder.previous_kernel.include_by_timestamp = 123; - builder.output.include_by_timestamp = 99; + builder.expiration_timestamp_upper_bound = 99; + builder.previous_kernel.expiration_timestamp = 123; + builder.output.expiration_timestamp = 99; builder.validate(); } -#[test(should_fail_with = "incorrect include_by_timestamp")] -fn include_by_timestamp_use_larger_custom() { +#[test(should_fail_with = "incorrect expiration_timestamp")] +fn expiration_timestamp_use_larger_custom() { let mut builder = TestBuilder::new(); - builder.include_by_timestamp_upper_bound = 9999; - builder.previous_kernel.include_by_timestamp = 123; + builder.expiration_timestamp_upper_bound = 9999; + builder.previous_kernel.expiration_timestamp = 123; // Output should be the previous kernel value. - builder.output.include_by_timestamp = 9999; + builder.output.expiration_timestamp = 9999; builder.validate(); } -#[test(should_fail_with = "incorrect include_by_timestamp")] -fn include_by_timestamp_use_larger_previous() { +#[test(should_fail_with = "incorrect expiration_timestamp")] +fn expiration_timestamp_use_larger_previous() { let mut builder = TestBuilder::new(); - builder.include_by_timestamp_upper_bound = 99; - builder.previous_kernel.include_by_timestamp = 123; + builder.expiration_timestamp_upper_bound = 99; + builder.previous_kernel.expiration_timestamp = 123; // Output should be the upper bound value. - builder.output.include_by_timestamp = 123; + builder.output.expiration_timestamp = 123; builder.validate(); } #[test] -fn include_by_timestamp_custom_equals_max_duration() { +fn expiration_timestamp_custom_equals_max_duration() { let mut builder = TestBuilder::new(); let block_timestamp = 99; builder.previous_kernel.anchor_block_header.global_variables.timestamp = block_timestamp; builder.output.anchor_block_header.global_variables.timestamp = block_timestamp; - let max_timestamp = block_timestamp + MAX_INCLUDE_BY_TIMESTAMP_DURATION; - builder.include_by_timestamp_upper_bound = max_timestamp; - builder.previous_kernel.include_by_timestamp = max_timestamp; - builder.output.include_by_timestamp = max_timestamp; + let max_timestamp = block_timestamp + MAX_TX_LIFETIME; + builder.expiration_timestamp_upper_bound = max_timestamp; + builder.previous_kernel.expiration_timestamp = max_timestamp; + builder.output.expiration_timestamp = max_timestamp; builder.validate(); } -#[test(should_fail_with = "include_by_timestamp exceeds the maximum duration")] -fn include_by_timestamp_custom_exceeds_max_duration() { +#[test(should_fail_with = "expiration_timestamp exceeds max tx lifetime")] +fn expiration_timestamp_custom_exceeds_max_tx_lifetime() { let mut builder = TestBuilder::new(); let block_timestamp = 99; builder.previous_kernel.anchor_block_header.global_variables.timestamp = block_timestamp; builder.output.anchor_block_header.global_variables.timestamp = block_timestamp; - let max_timestamp = block_timestamp + MAX_INCLUDE_BY_TIMESTAMP_DURATION; - builder.include_by_timestamp_upper_bound = max_timestamp + 1; - builder.previous_kernel.include_by_timestamp = max_timestamp + 1; + let max_timestamp = block_timestamp + MAX_TX_LIFETIME; + builder.expiration_timestamp_upper_bound = max_timestamp + 1; + builder.previous_kernel.expiration_timestamp = max_timestamp + 1; // Output should be the max timestamp. - builder.output.include_by_timestamp = max_timestamp + 1; + builder.output.expiration_timestamp = max_timestamp + 1; builder.validate(); } #[test] -fn include_by_timestamp_custom_exceeds_max_pick_previous() { +fn expiration_timestamp_custom_exceeds_max_pick_previous() { let mut builder = TestBuilder::new(); let block_timestamp = 99; builder.previous_kernel.anchor_block_header.global_variables.timestamp = block_timestamp; builder.output.anchor_block_header.global_variables.timestamp = block_timestamp; - let max_timestamp = block_timestamp + MAX_INCLUDE_BY_TIMESTAMP_DURATION; - builder.include_by_timestamp_upper_bound = max_timestamp + 1; - builder.previous_kernel.include_by_timestamp = max_timestamp; - builder.output.include_by_timestamp = max_timestamp; + let max_timestamp = block_timestamp + MAX_TX_LIFETIME; + builder.expiration_timestamp_upper_bound = max_timestamp + 1; + builder.previous_kernel.expiration_timestamp = max_timestamp; + builder.output.expiration_timestamp = max_timestamp; builder.validate(); } #[test] -fn include_by_timestamp_previous_exceeds_max_pick_custom() { +fn expiration_timestamp_previous_exceeds_max_pick_custom() { let mut builder = TestBuilder::new(); let block_timestamp = 99; builder.previous_kernel.anchor_block_header.global_variables.timestamp = block_timestamp; builder.output.anchor_block_header.global_variables.timestamp = block_timestamp; - let max_timestamp = block_timestamp + MAX_INCLUDE_BY_TIMESTAMP_DURATION; - builder.include_by_timestamp_upper_bound = max_timestamp; - builder.previous_kernel.include_by_timestamp = max_timestamp + 1; - builder.output.include_by_timestamp = max_timestamp; + let max_timestamp = block_timestamp + MAX_TX_LIFETIME; + builder.expiration_timestamp_upper_bound = max_timestamp; + builder.previous_kernel.expiration_timestamp = max_timestamp + 1; + builder.output.expiration_timestamp = max_timestamp; builder.validate(); } diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_tail_to_public/mod.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_tail_to_public/mod.nr index 535ac8312c6c..39cbccb14acf 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_tail_to_public/mod.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_tail_to_public/mod.nr @@ -18,7 +18,7 @@ use types::{ struct TestBuilder { pub previous_kernel: FixtureBuilder, pub padded_side_effect_amounts: PaddedSideEffectAmounts, - pub include_by_timestamp_upper_bound: u64, + pub expiration_timestamp_upper_bound: u64, // `output` is used in tests for TailToPublicOutputValidator. pub output: FixtureBuilder, } @@ -41,7 +41,7 @@ impl TestBuilder { TestBuilder { previous_kernel, padded_side_effect_amounts, - include_by_timestamp_upper_bound: previous_kernel.include_by_timestamp, + expiration_timestamp_upper_bound: previous_kernel.expiration_timestamp, output, } } @@ -52,7 +52,7 @@ impl TestBuilder { let inputs = PrivateKernelTailToPublicCircuitPrivateInputs { previous_kernel, padded_side_effect_amounts: self.padded_side_effect_amounts, - include_by_timestamp_upper_bound: self.include_by_timestamp_upper_bound, + expiration_timestamp_upper_bound: self.expiration_timestamp_upper_bound, }; private_kernel_tail_to_public::execute(inputs) diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_tail_to_public/tail_to_public_output_validator/mod.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_tail_to_public/tail_to_public_output_validator/mod.nr index 42f9a4533716..afc961565974 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_tail_to_public/tail_to_public_output_validator/mod.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_tail_to_public/tail_to_public_output_validator/mod.nr @@ -28,7 +28,7 @@ impl TestBuilder { output, previous_kernel, self.padded_side_effect_amounts, - self.include_by_timestamp_upper_bound, + self.expiration_timestamp_upper_bound, ) .validate(); } diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_tail_to_public/tail_to_public_output_validator/validate_propagated_values_tests.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_tail_to_public/tail_to_public_output_validator/validate_propagated_values_tests.nr index 544602dc9190..a6c3cfcf0046 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_tail_to_public/tail_to_public_output_validator/validate_propagated_values_tests.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_kernel_tail_to_public/tail_to_public_output_validator/validate_propagated_values_tests.nr @@ -2,7 +2,7 @@ use crate::tests::private_kernel_tail_to_public::TestBuilder; use types::{ abis::protocol_contracts::ProtocolContracts, address::AztecAddress, - constants::{MAX_INCLUDE_BY_TIMESTAMP_DURATION, MAX_PROTOCOL_CONTRACTS}, + constants::{MAX_PROTOCOL_CONTRACTS, MAX_TX_LIFETIME}, traits::FromField, }; @@ -63,115 +63,115 @@ fn fee_payer_mismatch() { builder.validate(); } -// --- include_by_timestamp --- +// --- expiration_timestamp --- #[test] -fn include_by_timestamp_use_previous() { +fn expiration_timestamp_use_previous() { let mut builder = TestBuilder::new(); - builder.include_by_timestamp_upper_bound = 9999; - builder.previous_kernel.include_by_timestamp = 123; - builder.output.include_by_timestamp = 123; + builder.expiration_timestamp_upper_bound = 9999; + builder.previous_kernel.expiration_timestamp = 123; + builder.output.expiration_timestamp = 123; builder.validate(); } #[test] -fn include_by_timestamp_use_custom() { +fn expiration_timestamp_use_custom() { let mut builder = TestBuilder::new(); - builder.include_by_timestamp_upper_bound = 99; - builder.previous_kernel.include_by_timestamp = 123; - builder.output.include_by_timestamp = 99; + builder.expiration_timestamp_upper_bound = 99; + builder.previous_kernel.expiration_timestamp = 123; + builder.output.expiration_timestamp = 99; builder.validate(); } -#[test(should_fail_with = "incorrect include_by_timestamp")] -fn include_by_timestamp_use_larger_custom() { +#[test(should_fail_with = "incorrect expiration_timestamp")] +fn expiration_timestamp_use_larger_custom() { let mut builder = TestBuilder::new(); - builder.include_by_timestamp_upper_bound = 9999; - builder.previous_kernel.include_by_timestamp = 123; + builder.expiration_timestamp_upper_bound = 9999; + builder.previous_kernel.expiration_timestamp = 123; // Output should be the previous kernel value. - builder.output.include_by_timestamp = 9999; + builder.output.expiration_timestamp = 9999; builder.validate(); } -#[test(should_fail_with = "incorrect include_by_timestamp")] -fn include_by_timestamp_use_larger_previous() { +#[test(should_fail_with = "incorrect expiration_timestamp")] +fn expiration_timestamp_use_larger_previous() { let mut builder = TestBuilder::new(); - builder.include_by_timestamp_upper_bound = 99; - builder.previous_kernel.include_by_timestamp = 123; + builder.expiration_timestamp_upper_bound = 99; + builder.previous_kernel.expiration_timestamp = 123; // Output should be the upper bound value. - builder.output.include_by_timestamp = 123; + builder.output.expiration_timestamp = 123; builder.validate(); } #[test] -fn include_by_timestamp_custom_equals_max_duration() { +fn expiration_timestamp_custom_equals_max_tx_lifetime() { let mut builder = TestBuilder::new(); let block_timestamp = 99; builder.previous_kernel.anchor_block_header.global_variables.timestamp = block_timestamp; builder.output.anchor_block_header.global_variables.timestamp = block_timestamp; - let max_timestamp = block_timestamp + MAX_INCLUDE_BY_TIMESTAMP_DURATION; - builder.include_by_timestamp_upper_bound = max_timestamp; - builder.previous_kernel.include_by_timestamp = max_timestamp; - builder.output.include_by_timestamp = max_timestamp; + let max_timestamp = block_timestamp + MAX_TX_LIFETIME; + builder.expiration_timestamp_upper_bound = max_timestamp; + builder.previous_kernel.expiration_timestamp = max_timestamp; + builder.output.expiration_timestamp = max_timestamp; builder.validate(); } -#[test(should_fail_with = "include_by_timestamp exceeds the maximum duration")] -fn include_by_timestamp_custom_exceeds_max_duration() { +#[test(should_fail_with = "expiration_timestamp exceeds max tx lifetime")] +fn expiration_timestamp_custom_exceeds_max_tx_lifetime() { let mut builder = TestBuilder::new(); let block_timestamp = 99; builder.previous_kernel.anchor_block_header.global_variables.timestamp = block_timestamp; builder.output.anchor_block_header.global_variables.timestamp = block_timestamp; - let max_timestamp = block_timestamp + MAX_INCLUDE_BY_TIMESTAMP_DURATION; - builder.include_by_timestamp_upper_bound = max_timestamp + 1; - builder.previous_kernel.include_by_timestamp = max_timestamp + 1; + let max_timestamp = block_timestamp + MAX_TX_LIFETIME; + builder.expiration_timestamp_upper_bound = max_timestamp + 1; + builder.previous_kernel.expiration_timestamp = max_timestamp + 1; // Output should be the max timestamp. - builder.output.include_by_timestamp = max_timestamp + 1; + builder.output.expiration_timestamp = max_timestamp + 1; builder.validate(); } #[test] -fn include_by_timestamp_custom_exceeds_max_pick_previous() { +fn expiration_timestamp_custom_exceeds_max_pick_previous() { let mut builder = TestBuilder::new(); let block_timestamp = 99; builder.previous_kernel.anchor_block_header.global_variables.timestamp = block_timestamp; builder.output.anchor_block_header.global_variables.timestamp = block_timestamp; - let max_timestamp = block_timestamp + MAX_INCLUDE_BY_TIMESTAMP_DURATION; - builder.include_by_timestamp_upper_bound = max_timestamp + 1; - builder.previous_kernel.include_by_timestamp = max_timestamp; - builder.output.include_by_timestamp = max_timestamp; + let max_timestamp = block_timestamp + MAX_TX_LIFETIME; + builder.expiration_timestamp_upper_bound = max_timestamp + 1; + builder.previous_kernel.expiration_timestamp = max_timestamp; + builder.output.expiration_timestamp = max_timestamp; builder.validate(); } #[test] -fn include_by_timestamp_previous_exceeds_max_pick_custom() { +fn expiration_timestamp_previous_exceeds_max_pick_custom() { let mut builder = TestBuilder::new(); let block_timestamp = 99; builder.previous_kernel.anchor_block_header.global_variables.timestamp = block_timestamp; builder.output.anchor_block_header.global_variables.timestamp = block_timestamp; - let max_timestamp = block_timestamp + MAX_INCLUDE_BY_TIMESTAMP_DURATION; - builder.include_by_timestamp_upper_bound = max_timestamp; - builder.previous_kernel.include_by_timestamp = max_timestamp + 1; - builder.output.include_by_timestamp = max_timestamp; + let max_timestamp = block_timestamp + MAX_TX_LIFETIME; + builder.expiration_timestamp_upper_bound = max_timestamp; + builder.previous_kernel.expiration_timestamp = max_timestamp + 1; + builder.output.expiration_timestamp = max_timestamp; builder.validate(); } diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-reset/Prover.toml b/noir-projects/noir-protocol-circuits/crates/private-kernel-reset/Prover.toml index a15722fc5c2e..fde167c7393d 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-reset/Prover.toml +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-reset/Prover.toml @@ -144,7 +144,7 @@ sibling_path = [ [previous_kernel_public_inputs] min_revertible_side_effect_counter = "0x0000000000000000000000000000000000000000000000000000000000000005" -include_by_timestamp = "0x0000000000000000000000000000000000000000000000000000000069904e3d" +expiration_timestamp = "0x0000000000000000000000000000000000000000000000000000000069904e3d" is_private_only = false claimed_first_nullifier = "0x1863cc67e6bb1910e59aa3c2daef77f8310f7def1b1cca6ba717d4d1cb88d3bc" claimed_revertible_counter = "0x0000000000000000000000000000000000000000000000000000000000000005" diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-tail-simulated/src/main.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-tail-simulated/src/main.nr index a39c60884e10..7b2366cca45b 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-tail-simulated/src/main.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-tail-simulated/src/main.nr @@ -10,11 +10,11 @@ use types::{ unconstrained fn main( previous_kernel: PrivateKernelDataWithoutPublicInputs, previous_kernel_public_inputs: PrivateKernelCircuitPublicInputs, - include_by_timestamp_upper_bound: u64, + expiration_timestamp_upper_bound: u64, ) -> pub PrivateToRollupKernelCircuitPublicInputs { let private_inputs = PrivateKernelTailCircuitPrivateInputs { previous_kernel: previous_kernel.to_private_kernel_data(previous_kernel_public_inputs), - include_by_timestamp_upper_bound, + expiration_timestamp_upper_bound, }; private_kernel_tail::execute(private_inputs) } diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-tail-to-public-simulated/src/main.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-tail-to-public-simulated/src/main.nr index 1f924dd44cc2..fd425422de1c 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-tail-to-public-simulated/src/main.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-tail-to-public-simulated/src/main.nr @@ -13,12 +13,12 @@ unconstrained fn main( previous_kernel: PrivateKernelDataWithoutPublicInputs, previous_kernel_public_inputs: PrivateKernelCircuitPublicInputs, padded_side_effect_amounts: PaddedSideEffectAmounts, - include_by_timestamp_upper_bound: u64, + expiration_timestamp_upper_bound: u64, ) -> pub PrivateToPublicKernelCircuitPublicInputs { let private_inputs = PrivateKernelTailToPublicCircuitPrivateInputs { previous_kernel: previous_kernel.to_private_kernel_data(previous_kernel_public_inputs), padded_side_effect_amounts, - include_by_timestamp_upper_bound, + expiration_timestamp_upper_bound, }; private_kernel_tail_to_public::execute(private_inputs) } diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-tail-to-public/Prover.toml b/noir-projects/noir-protocol-circuits/crates/private-kernel-tail-to-public/Prover.toml index 7aa9d51867ac..1fc3bf3a272f 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-tail-to-public/Prover.toml +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-tail-to-public/Prover.toml @@ -1,4 +1,4 @@ -include_by_timestamp_upper_bound = "0x0000000000000000000000000000000000000000000000000000000069904e3d" +expiration_timestamp_upper_bound = "0x0000000000000000000000000000000000000000000000000000000069904e3d" [previous_kernel.vk_data] leaf_index = "0x000000000000000000000000000000000000000000000000000000000000003d" @@ -146,7 +146,7 @@ sibling_path = [ [previous_kernel_public_inputs] min_revertible_side_effect_counter = "0x0000000000000000000000000000000000000000000000000000000000000005" -include_by_timestamp = "0x0000000000000000000000000000000000000000000000000000000069904e3d" +expiration_timestamp = "0x0000000000000000000000000000000000000000000000000000000069904e3d" is_private_only = false claimed_first_nullifier = "0x1863cc67e6bb1910e59aa3c2daef77f8310f7def1b1cca6ba717d4d1cb88d3bc" claimed_revertible_counter = "0x0000000000000000000000000000000000000000000000000000000000000005" diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-tail-to-public/src/main.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-tail-to-public/src/main.nr index 32175b95a859..9b0e8a59c18a 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-tail-to-public/src/main.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-tail-to-public/src/main.nr @@ -13,12 +13,12 @@ fn main( previous_kernel: PrivateKernelDataWithoutPublicInputs, previous_kernel_public_inputs: call_data(0) PrivateKernelCircuitPublicInputs, padded_side_effect_amounts: PaddedSideEffectAmounts, - include_by_timestamp_upper_bound: u64, + expiration_timestamp_upper_bound: u64, ) -> return_data PrivateToPublicKernelCircuitPublicInputs { let private_inputs = PrivateKernelTailToPublicCircuitPrivateInputs { previous_kernel: previous_kernel.to_private_kernel_data(previous_kernel_public_inputs), padded_side_effect_amounts, - include_by_timestamp_upper_bound, + expiration_timestamp_upper_bound, }; private_kernel_tail_to_public::execute(private_inputs) } diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-tail/Prover.toml b/noir-projects/noir-protocol-circuits/crates/private-kernel-tail/Prover.toml index 755bc4551a71..b3dd6fd8fa04 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-tail/Prover.toml +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-tail/Prover.toml @@ -1,4 +1,4 @@ -include_by_timestamp_upper_bound = "0x0000000000000000000000000000000000000000000000000000000069904e3d" +expiration_timestamp_upper_bound = "0x0000000000000000000000000000000000000000000000000000000069904e3d" [previous_kernel.vk_data] leaf_index = "0x000000000000000000000000000000000000000000000000000000000000003d" @@ -146,7 +146,7 @@ sibling_path = [ [previous_kernel_public_inputs] min_revertible_side_effect_counter = "0x0000000000000000000000000000000000000000000000000000000000000005" -include_by_timestamp = "0x0000000000000000000000000000000000000000000000000000000069904e3d" +expiration_timestamp = "0x0000000000000000000000000000000000000000000000000000000069904e3d" is_private_only = true claimed_first_nullifier = "0x2024835fd8b74a764c77337cdecd852f4412858e32f7be5c0207f01b5da068b5" claimed_revertible_counter = "0x0000000000000000000000000000000000000000000000000000000000000005" diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-tail/src/main.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-tail/src/main.nr index 0c0cdf22a559..b5fc56cd1814 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-tail/src/main.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-tail/src/main.nr @@ -10,11 +10,11 @@ use types::{ fn main( previous_kernel: PrivateKernelDataWithoutPublicInputs, previous_kernel_public_inputs: call_data(0) PrivateKernelCircuitPublicInputs, - include_by_timestamp_upper_bound: u64, + expiration_timestamp_upper_bound: u64, ) -> return_data PrivateToRollupKernelCircuitPublicInputs { let private_inputs = PrivateKernelTailCircuitPrivateInputs { previous_kernel: previous_kernel.to_private_kernel_data(previous_kernel_public_inputs), - include_by_timestamp_upper_bound, + expiration_timestamp_upper_bound, }; private_kernel_tail::execute(private_inputs) } diff --git a/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/tx_base/components/private_tail_validator.nr b/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/tx_base/components/private_tail_validator.nr index 9e126a4af237..f696642ceff4 100644 --- a/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/tx_base/components/private_tail_validator.nr +++ b/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/tx_base/components/private_tail_validator.nr @@ -141,26 +141,26 @@ pub fn validate_contract_class_logs( } } -/// Validate the `include_by_timestamp` of the tx against the block timestamp. -pub fn validate_include_by_timestamp( - include_by_timestamp: u64, +/// Validate the `expiration_timestamp` of the tx against the block timestamp. +pub fn validate_expiration_timestamp( + expiration_timestamp: u64, global_variables_of_block_being_built: GlobalVariables, ) { // Skip validation when building block 1, since the genesis block header has a zero timestamp. - // Without this skip, no txs could be included in block 1, because `include_by_timestamp` must be at most - // `MAX_INCLUDE_BY_TIMESTAMP_DURATION` from the anchor block's timestamp. This means that any tx anchored to the - // genesis block would almost certainly have an `include_by_timestamp` earlier than the first block's timestamp, + // Without this skip, no txs could be included in block 1, because `expiration_timestamp` must be at most + // `MAX_TX_LIFETIME` from the anchor block's timestamp. This means that any tx anchored to the + // genesis block would almost certainly have an `expiration_timestamp` earlier than the first block's timestamp, // making them impossible to be included. // - // Normally, `include_by_timestamp` may change when calling an updatable contract, and this check ensures that the + // Normally, `expiration_timestamp` may change when calling an updatable contract, and this check ensures that the // tx does not call an outdated contract that has already been upgraded. However, since no updatable contracts exist // in the genesis block, skipping this check here is safe. let is_building_block_1 = global_variables_of_block_being_built.block_number == 1; let block_timestamp = global_variables_of_block_being_built.timestamp; if !is_building_block_1 { assert( - include_by_timestamp >= block_timestamp, - "tx include_by_timestamp is smaller than block timestamp", + expiration_timestamp >= block_timestamp, + "tx expiration_timestamp is smaller than block timestamp", ); } } diff --git a/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/tx_base/components/private_tx_base_inputs_validator.nr b/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/tx_base/components/private_tx_base_inputs_validator.nr index 3b549735f332..d232b0bd43d5 100644 --- a/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/tx_base/components/private_tx_base_inputs_validator.nr +++ b/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/tx_base/components/private_tx_base_inputs_validator.nr @@ -87,8 +87,8 @@ impl PrivateTxBaseInputsValidator { self.anchor_block_archive_sibling_path, ); - private_tail_validator::validate_include_by_timestamp( - private_tail.include_by_timestamp, + private_tail_validator::validate_expiration_timestamp( + private_tail.expiration_timestamp, self.constants.global_variables, ); diff --git a/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/tx_base/components/public_tx_base_inputs_validator.nr b/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/tx_base/components/public_tx_base_inputs_validator.nr index 27e16767b71d..10aa3a5aa57a 100644 --- a/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/tx_base/components/public_tx_base_inputs_validator.nr +++ b/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/tx_base/components/public_tx_base_inputs_validator.nr @@ -92,8 +92,8 @@ impl PublicTxBaseInputsValidator { // revertible accumulated data are merged, or after the revertible data is discarded, depending on the revert // flag. - private_tail_validator::validate_include_by_timestamp( - private_tail.include_by_timestamp, + private_tail_validator::validate_expiration_timestamp( + private_tail.expiration_timestamp, self.constants.global_variables, ); } diff --git a/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/tx_base/tests/private_tx_base/validate_private_tail_tests.nr b/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/tx_base/tests/private_tx_base/validate_private_tail_tests.nr index b6f391ffcd6f..8c478c970435 100644 --- a/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/tx_base/tests/private_tx_base/validate_private_tail_tests.nr +++ b/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/tx_base/tests/private_tx_base/validate_private_tail_tests.nr @@ -112,30 +112,30 @@ unconstrained fn incorrect_contract_class_log_length() { builder.execute_and_fail(); } -#[test(should_fail_with = "tx include_by_timestamp is smaller than block timestamp")] -unconstrained fn include_by_timestamp_lower_than_block_timestamp() { +#[test(should_fail_with = "tx expiration_timestamp is smaller than block timestamp")] +unconstrained fn expiration_timestamp_lower_than_block_timestamp() { let mut builder = TestBuilder::new(); - builder.private_tail.include_by_timestamp = builder.constants.global_variables.timestamp - 1; + builder.private_tail.expiration_timestamp = builder.constants.global_variables.timestamp - 1; builder.execute_and_fail(); } #[test] -unconstrained fn include_by_timestamp_equal_to_block_timestamp() { +unconstrained fn expiration_timestamp_equal_to_block_timestamp() { let mut builder = TestBuilder::new(); - builder.private_tail.include_by_timestamp = builder.constants.global_variables.timestamp; + builder.private_tail.expiration_timestamp = builder.constants.global_variables.timestamp; let pi = builder.execute(); builder.assert_expected_public_inputs(pi); } #[test] -unconstrained fn include_by_timestamp_higher_than_block_timestamp() { +unconstrained fn expiration_timestamp_higher_than_block_timestamp() { let mut builder = TestBuilder::new(); - builder.private_tail.include_by_timestamp = builder.constants.global_variables.timestamp + 1; + builder.private_tail.expiration_timestamp = builder.constants.global_variables.timestamp + 1; let pi = builder.execute(); builder.assert_expected_public_inputs(pi); diff --git a/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/tx_base/tests/public_tx_base/validate_private_tail_to_public_tests.nr b/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/tx_base/tests/public_tx_base/validate_private_tail_to_public_tests.nr index 626bcfc4f37a..cf5c99f91b3d 100644 --- a/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/tx_base/tests/public_tx_base/validate_private_tail_to_public_tests.nr +++ b/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/tx_base/tests/public_tx_base/validate_private_tail_to_public_tests.nr @@ -123,30 +123,30 @@ unconstrained fn non_empty_contract_class_log_fields_for_reverted_log() { builder.execute_and_fail(); } -#[test(should_fail_with = "tx include_by_timestamp is smaller than block timestamp")] -unconstrained fn include_by_timestamp_lower_than_block_timestamp() { +#[test(should_fail_with = "tx expiration_timestamp is smaller than block timestamp")] +unconstrained fn expiration_timestamp_lower_than_block_timestamp() { let mut builder = TestBuilder::new(); - builder.private_tail.include_by_timestamp = builder.avm.global_variables.timestamp - 1; + builder.private_tail.expiration_timestamp = builder.avm.global_variables.timestamp - 1; builder.execute_and_fail(); } #[test] -unconstrained fn include_by_timestamp_equal_to_block_timestamp() { +unconstrained fn expiration_timestamp_equal_to_block_timestamp() { let mut builder = TestBuilder::new(); - builder.private_tail.include_by_timestamp = builder.avm.global_variables.timestamp; + builder.private_tail.expiration_timestamp = builder.avm.global_variables.timestamp; let pi = builder.execute(); builder.assert_expected_public_inputs(pi); } #[test] -unconstrained fn include_by_timestamp_higher_than_block_timestamp() { +unconstrained fn expiration_timestamp_higher_than_block_timestamp() { let mut builder = TestBuilder::new(); - builder.private_tail.include_by_timestamp = builder.avm.global_variables.timestamp + 1; + builder.private_tail.expiration_timestamp = builder.avm.global_variables.timestamp + 1; let pi = builder.execute(); builder.assert_expected_public_inputs(pi); diff --git a/noir-projects/noir-protocol-circuits/crates/rollup-tx-base-private/Prover.toml b/noir-projects/noir-protocol-circuits/crates/rollup-tx-base-private/Prover.toml index 35645ad1b9c1..d4a5957005f0 100644 --- a/noir-projects/noir-protocol-circuits/crates/rollup-tx-base-private/Prover.toml +++ b/noir-projects/noir-protocol-circuits/crates/rollup-tx-base-private/Prover.toml @@ -4999,7 +4999,7 @@ contract_class_log_fields = [ ] [inputs.hiding_kernel_proof_data.public_inputs] - include_by_timestamp = "0x0000000000000000000000000000000000000000000000000000000069904e3d" + expiration_timestamp = "0x0000000000000000000000000000000000000000000000000000000069904e3d" [inputs.hiding_kernel_proof_data.public_inputs.constants] vk_tree_root = "0x29e314ba0e28fedb7a164aa29b135723465cce28ca3a46534b13ebcefbf7851a" diff --git a/noir-projects/noir-protocol-circuits/crates/rollup-tx-base-public/Prover.toml b/noir-projects/noir-protocol-circuits/crates/rollup-tx-base-public/Prover.toml index 0bfe3c539a2f..aeb159c746db 100644 --- a/noir-projects/noir-protocol-circuits/crates/rollup-tx-base-public/Prover.toml +++ b/noir-projects/noir-protocol-circuits/crates/rollup-tx-base-public/Prover.toml @@ -3586,7 +3586,7 @@ contract_class_log_fields = [ prover_id = "0x0000000000000000000000003c44cdddb6a900fa2b585dd299e03d12fa4293bc" [inputs.public_chonk_verifier_proof_data.public_inputs.private_tail] - include_by_timestamp = "0x0000000000000000000000000000000000000000000000000000000069904e3d" + expiration_timestamp = "0x0000000000000000000000000000000000000000000000000000000069904e3d" [inputs.public_chonk_verifier_proof_data.public_inputs.private_tail.constants] vk_tree_root = "0x29e314ba0e28fedb7a164aa29b135723465cce28ca3a46534b13ebcefbf7851a" diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/abis/kernel_circuit_public_inputs/private_kernel_circuit_public_inputs.nr b/noir-projects/noir-protocol-circuits/crates/types/src/abis/kernel_circuit_public_inputs/private_kernel_circuit_public_inputs.nr index 533e3712a8b6..565111fbda10 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/abis/kernel_circuit_public_inputs/private_kernel_circuit_public_inputs.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/abis/kernel_circuit_public_inputs/private_kernel_circuit_public_inputs.nr @@ -24,7 +24,7 @@ pub struct PrivateKernelCircuitPublicInputs { // The timestamp at which the transaction expires. This value can only decrease with each iteration. // It's output from the Tail(-to-Public) circuit and checked in the TxBaseRollup circuit against the timestamp of // the block the transaction is included in. - pub include_by_timestamp: u64, + pub expiration_timestamp: u64, // Whether this tx only makes private calls. `false` if at least one public call will be made by any private call. // It remains constant throughout the private execution and is checked in the Tail(-to-Public) circuit. pub is_private_only: bool, diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/abis/kernel_circuit_public_inputs/private_to_public_kernel_circuit_public_inputs.nr b/noir-projects/noir-protocol-circuits/crates/types/src/abis/kernel_circuit_public_inputs/private_to_public_kernel_circuit_public_inputs.nr index 87dfc827c4b1..089907de4e9b 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/abis/kernel_circuit_public_inputs/private_to_public_kernel_circuit_public_inputs.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/abis/kernel_circuit_public_inputs/private_to_public_kernel_circuit_public_inputs.nr @@ -18,7 +18,7 @@ pub struct PrivateToPublicKernelCircuitPublicInputs { pub public_teardown_call_request: PublicCallRequest, pub gas_used: Gas, pub fee_payer: AztecAddress, - pub include_by_timestamp: u64, + pub expiration_timestamp: u64, } impl Empty for PrivateToPublicKernelCircuitPublicInputs { @@ -30,7 +30,7 @@ impl Empty for PrivateToPublicKernelCircuitPublicInputs { public_teardown_call_request: PublicCallRequest::empty(), gas_used: Gas::empty(), fee_payer: AztecAddress::empty(), - include_by_timestamp: 0, + expiration_timestamp: 0, } } } diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/abis/kernel_circuit_public_inputs/private_to_rollup_kernel_circuit_public_inputs.nr b/noir-projects/noir-protocol-circuits/crates/types/src/abis/kernel_circuit_public_inputs/private_to_rollup_kernel_circuit_public_inputs.nr index 40712981ffaf..23b935526f6b 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/abis/kernel_circuit_public_inputs/private_to_rollup_kernel_circuit_public_inputs.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/abis/kernel_circuit_public_inputs/private_to_rollup_kernel_circuit_public_inputs.nr @@ -16,7 +16,7 @@ pub struct PrivateToRollupKernelCircuitPublicInputs { pub end: PrivateToRollupAccumulatedData, pub gas_used: Gas, pub fee_payer: AztecAddress, - pub include_by_timestamp: u64, + pub expiration_timestamp: u64, } impl Empty for PrivateToRollupKernelCircuitPublicInputs { @@ -26,7 +26,7 @@ impl Empty for PrivateToRollupKernelCircuitPublicInputs { constants: TxConstantData::empty(), gas_used: Gas::empty(), fee_payer: AztecAddress::empty(), - include_by_timestamp: 0, + expiration_timestamp: 0, } } } diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/abis/private_circuit_public_inputs.nr b/noir-projects/noir-protocol-circuits/crates/types/src/abis/private_circuit_public_inputs.nr index b02bd78908a1..7e4d68e5259b 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/abis/private_circuit_public_inputs.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/abis/private_circuit_public_inputs.nr @@ -52,7 +52,7 @@ pub struct PrivateCircuitPublicInputs { pub is_fee_payer: bool, // The timestamp by which the tx must be included in a block. - pub include_by_timestamp: u64, + pub expiration_timestamp: u64, // The side effect counter at the start of this function call. // All counted items emitted from this function call must have a counter greater than this value. @@ -115,7 +115,7 @@ impl Empty for PrivateCircuitPublicInputs { returns_hash: 0, min_revertible_side_effect_counter: 0, is_fee_payer: false, - include_by_timestamp: 0, + expiration_timestamp: 0, note_hash_read_requests: ClaimedLengthArray::empty(), nullifier_read_requests: ClaimedLengthArray::empty(), key_validation_requests_and_generators: ClaimedLengthArray::empty(), diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr b/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr index 696e169a393d..2f4953ffdf22 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr @@ -163,7 +163,7 @@ pub global INITIAL_L2_BLOCK_NUM: Field = 1; pub global FIELDS_PER_BLOB: u32 = 4096; pub global BLOBS_PER_CHECKPOINT: u32 = 6; pub global MAX_CHECKPOINTS_PER_EPOCH: u32 = 32; -pub global MAX_INCLUDE_BY_TIMESTAMP_DURATION: u64 = 86400; // 1 day +pub global MAX_TX_LIFETIME: u64 = 86400; // 1 day // The genesis values are taken from world_state.test.cpp > WorldStateTest.GetInitialTreeInfoForAllTrees pub global GENESIS_BLOCK_HEADER_HASH: Field = 0x2ff681dd7730c7b9e5650c70afa57ee81377792dfc95d98c11817b8c761ff965; @@ -411,7 +411,7 @@ pub global PRIVATE_CIRCUIT_PUBLIC_INPUTS_LENGTH: u32 = CALL_CONTEXT_LENGTH + 1 /* returns_hash */ + 1 /* min_revertible_side_effect_counter */ + 1 /* is_fee_payer */ - + 1 /* include_by_timestamp */ + + 1 /* expiration_timestamp */ // The `(... + 1)` is because these arrays include a `length` field. + (SCOPED_READ_REQUEST_LEN * MAX_NOTE_HASH_READ_REQUESTS_PER_CALL + 1) + (SCOPED_READ_REQUEST_LEN * MAX_NULLIFIER_READ_REQUESTS_PER_CALL + 1) @@ -506,13 +506,13 @@ pub global PRIVATE_TO_PUBLIC_KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH: u32 = TX_CONST + PUBLIC_CALL_REQUEST_LENGTH /* public_teardown_call_request */ + GAS_LENGTH /* gas_used */ + AZTEC_ADDRESS_LENGTH /* fee_payer */ - + 1 /* include_by_timestamp */; + + 1 /* expiration_timestamp */; pub global PRIVATE_TO_ROLLUP_KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH: u32 = TX_CONSTANT_DATA_LENGTH + PRIVATE_TO_ROLLUP_ACCUMULATED_DATA_LENGTH + GAS_LENGTH /* gas_used */ + AZTEC_ADDRESS_LENGTH /* fee_payer */ - + 1 /* include_by_timestamp */; + + 1 /* expiration_timestamp */; pub global AVM_CIRCUIT_PUBLIC_INPUTS_LENGTH: u32 = GLOBAL_VARIABLES_LENGTH + MAX_PROTOCOL_CONTRACTS /* protocol_contracts */ @@ -1208,10 +1208,10 @@ pub global AVM_RETRIEVED_BYTECODES_TREE_INITIAL_SIZE: u32 = 1; pub global TIMESTAMP_OF_CHANGE_BIT_SIZE: u32 = 32; // The default update delay used when a contract does not explicitly specify one. -// Note: This value should match MAX_INCLUDE_BY_TIMESTAMP_DURATION, because if no custom update delay is set during tx -// execution, the `include_by_timestamp` for the contract updates will be computed using this value. And it should not +// Note: This value should match MAX_TX_LIFETIME, because if no custom update delay is set during tx +// execution, the `expiration_timestamp` for the contract updates will be computed using this value. And it should not // differ from the maximum allowed duration. -pub global DEFAULT_UPDATE_DELAY: u64 = MAX_INCLUDE_BY_TIMESTAMP_DURATION; +pub global DEFAULT_UPDATE_DELAY: u64 = MAX_TX_LIFETIME; // 10 minutes pub global MINIMUM_UPDATE_DELAY: u64 = 600; diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/delayed_public_mutable/scheduled_delay_change.nr b/noir-projects/noir-protocol-circuits/crates/types/src/delayed_public_mutable/scheduled_delay_change.nr index 024d2b6e404a..215a7c15f736 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/delayed_public_mutable/scheduled_delay_change.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/delayed_public_mutable/scheduled_delay_change.nr @@ -113,7 +113,7 @@ impl ScheduledDelayChange { /// Returns the minimum delay before a value might mutate due to a scheduled change, from the perspective of some /// historical timestamp. It only returns a meaningful value when called in private with historical timestamps. /// The output of this function can be passed into `ScheduledValueChange.get_time_horizon` to properly - /// constrain the `include_by_timestamp` when reading delayed mutable state. + /// constrain the `expiration_timestamp` when reading delayed mutable state. /// This value typically equals the current delay at the timestamp following the historical one (the earliest one in /// which a value change could be scheduled), but it also considers scenarios in which a delay reduction is /// scheduled to happen in the near future, resulting in a way to schedule a change with an overall delay lower than diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/delayed_public_mutable/scheduled_value_change.nr b/noir-projects/noir-protocol-circuits/crates/types/src/delayed_public_mutable/scheduled_value_change.nr index 1be7fa65fad7..8d4544c6785f 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/delayed_public_mutable/scheduled_value_change.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/delayed_public_mutable/scheduled_value_change.nr @@ -23,7 +23,7 @@ impl ScheduledValueChange { /// Returns the value stored in the data structure at a given timestamp. This function can be called both in public /// (where `timestamp` is simply the current timestamp, i.e. the timestamp at which the current transaction will be /// included) and in private (where `timestamp` is the anchor block's timestamp). Reading in private is only safe - /// if the transaction's `include_by_timestamp` property is set to a value lower or equal to the time horizon (see + /// if the transaction's `expiration_timestamp` property is set to a value lower or equal to the time horizon (see /// `get_time_horizon()`). pub fn get_current_at(self, timestamp: u64) -> T { // The post value becomes the current one at the timestamp of change. This means different things in each realm: @@ -59,7 +59,7 @@ impl ScheduledValueChange { /// `ScheduledDelayChange.get_effective_minimum_delay_at`), which equals the minimum time in seconds that needs to /// elapse from the next block's timestamp until the value changes, regardless of further delay changes. /// The value returned by `get_current_at` in private when called with a anchor block's timestamp is only safe to use - /// if the transaction's `include_by_timestamp` property is set to a value lower or equal to the time horizon + /// if the transaction's `expiration_timestamp` property is set to a value lower or equal to the time horizon /// computed using the same anchor timestamp. pub fn get_time_horizon(self, anchor_timestamp: u64, minimum_delay: u64) -> u64 { // The time horizon is the very last timestamp in which the current value is known. Any timestamp past the diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/delayed_public_mutable/scheduled_value_change/test.nr b/noir-projects/noir-protocol-circuits/crates/types/src/delayed_public_mutable/scheduled_value_change/test.nr index 62f8209aced1..d398f4c34d3d 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/delayed_public_mutable/scheduled_value_change/test.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/delayed_public_mutable/scheduled_value_change/test.nr @@ -122,7 +122,7 @@ unconstrained fn test_get_time_horizon_n0_delay() { let time_horizon = value_change.get_time_horizon(historical_timestamp, 0); // Since the time horizon equals the historical timestamp, it is not possible to read the current value in - // private since the transaction `include_by_timestamp` property would equal an already mined timestamp. + // private since the transaction `expiration_timestamp` property would equal an already mined timestamp. assert_eq(time_horizon, historical_timestamp); } diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/tests/fixture_builder.nr b/noir-projects/noir-protocol-circuits/crates/types/src/tests/fixture_builder.nr index 5bbe1c363cc3..fd8578367a79 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/tests/fixture_builder.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/tests/fixture_builder.nr @@ -47,14 +47,14 @@ use crate::{ CONTRACT_CLASS_LOG_SIZE_IN_FIELDS, CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS, DEFAULT_UPDATE_DELAY, FLAT_PUBLIC_LOGS_PAYLOAD_LENGTH, FUNCTION_TREE_HEIGHT, MAX_CONTRACT_CLASS_LOGS_PER_TX, MAX_ENQUEUED_CALLS_PER_TX, MAX_FIELD_VALUE, - MAX_INCLUDE_BY_TIMESTAMP_DURATION, MAX_KEY_VALIDATION_REQUESTS_PER_TX, - MAX_L2_TO_L1_MSGS_PER_TX, MAX_NOTE_HASH_READ_REQUESTS_PER_TX, MAX_NOTE_HASHES_PER_TX, + MAX_KEY_VALIDATION_REQUESTS_PER_TX, MAX_L2_TO_L1_MSGS_PER_TX, + MAX_NOTE_HASH_READ_REQUESTS_PER_TX, MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIER_READ_REQUESTS_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_PRIVATE_CALL_STACK_LENGTH_PER_TX, MAX_PRIVATE_LOGS_PER_TX, - MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, MAX_U32_VALUE, MEGA_VK_LENGTH_IN_FIELDS, - PRIVATE_CALL_REQUEST_LENGTH, PRIVATE_LOG_SIZE_IN_FIELDS, PUBLIC_CALL_REQUEST_LENGTH, - PUBLIC_DATA_TREE_HEIGHT, SIDE_EFFECT_MASKING_ADDRESS, UPDATED_CLASS_IDS_SLOT, - VK_TREE_HEIGHT, + MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, MAX_TX_LIFETIME, MAX_U32_VALUE, + MEGA_VK_LENGTH_IN_FIELDS, PRIVATE_CALL_REQUEST_LENGTH, PRIVATE_LOG_SIZE_IN_FIELDS, + PUBLIC_CALL_REQUEST_LENGTH, PUBLIC_DATA_TREE_HEIGHT, SIDE_EFFECT_MASKING_ADDRESS, + UPDATED_CLASS_IDS_SLOT, VK_TREE_HEIGHT, }, contract_class_id::ContractClassId, data::{ @@ -106,7 +106,7 @@ pub struct FixtureBuilder { pub is_private_only: bool, pub claimed_first_nullifier: Field, pub claimed_revertible_counter: u32, - pub include_by_timestamp: u64, + pub expiration_timestamp: u64, // Fees. pub is_fee_payer: bool, @@ -207,12 +207,8 @@ impl FixtureBuilder { builder.global_variables.version = fixtures::VERSION; builder.global_variables.timestamp = fixtures::GENESIS_TIMESTAMP + 135; - let max_allowed_include_by_timestamp = builder - .anchor_block_header - .global_variables - .timestamp - + MAX_INCLUDE_BY_TIMESTAMP_DURATION; - builder.include_by_timestamp = max_allowed_include_by_timestamp; + builder.expiration_timestamp = + builder.anchor_block_header.global_variables.timestamp + MAX_TX_LIFETIME; builder.vk_tree_root = vk_tree_root; @@ -374,7 +370,7 @@ impl FixtureBuilder { returns_hash: self.returns_hash, min_revertible_side_effect_counter: self.min_revertible_side_effect_counter, is_fee_payer: self.is_fee_payer, - include_by_timestamp: self.include_by_timestamp, + expiration_timestamp: self.expiration_timestamp, note_hash_read_requests: ClaimedLengthArray { array: subarray(self.note_hash_read_requests.storage(), 0), length: self.note_hash_read_requests.len(), @@ -619,7 +615,7 @@ impl FixtureBuilder { validation_requests, public_teardown_call_request, fee_payer: self.fee_payer, - include_by_timestamp: self.include_by_timestamp, + expiration_timestamp: self.expiration_timestamp, is_private_only: self.is_private_only, claimed_first_nullifier: self.claimed_first_nullifier, claimed_revertible_counter: self.claimed_revertible_counter, @@ -648,7 +644,7 @@ impl FixtureBuilder { public_teardown_call_request: self.public_teardown_call_request, gas_used: self.gas_used, fee_payer: self.fee_payer, - include_by_timestamp: self.include_by_timestamp, + expiration_timestamp: self.expiration_timestamp, } } @@ -663,7 +659,7 @@ impl FixtureBuilder { constants, gas_used: self.gas_used, fee_payer: self.fee_payer, - include_by_timestamp: self.include_by_timestamp, + expiration_timestamp: self.expiration_timestamp, } } diff --git a/yarn-project/aztec-node/src/aztec-node/server.test.ts b/yarn-project/aztec-node/src/aztec-node/server.test.ts index 11405b80c3c1..bb88a0873375 100644 --- a/yarn-project/aztec-node/src/aztec-node/server.test.ts +++ b/yarn-project/aztec-node/src/aztec-node/server.test.ts @@ -28,7 +28,7 @@ import { TX_ERROR_DUPLICATE_NULLIFIER_IN_TX, TX_ERROR_INCORRECT_L1_CHAIN_ID, TX_ERROR_INCORRECT_ROLLUP_VERSION, - TX_ERROR_INVALID_INCLUDE_BY_TIMESTAMP, + TX_ERROR_INVALID_EXPIRATION_TIMESTAMP, TX_ERROR_SIZE_ABOVE_LIMIT, Tx, } from '@aztec/stdlib/tx'; @@ -42,7 +42,7 @@ import { fileURLToPath } from 'url'; import { type AztecNodeConfig, getConfigEnvVars } from './config.js'; import { AztecNodeService } from './server.js'; -// Arbitrary fixed timestamp for the mock date provider. DateProvider.now() returns milliseconds but IncludeByTimestamp +// Arbitrary fixed timestamp for the mock date provider. DateProvider.now() returns milliseconds but ExpirationTimestamp // is denominated in seconds. const NOW_MS = 1718745600000; const NOW_S = NOW_MS / 1000; @@ -262,29 +262,29 @@ describe('aztec node', () => { it('tests that the node correctly validates expiration timestamps', async () => { const txs = await Promise.all([mockTxForRollup(0x10000), mockTxForRollup(0x20000)]); - const invalidIncludeByTimestampMetadata = txs[0]; - const validIncludeByTimestampMetadata = txs[1]; + const invalidExpirationTimestampMetadata = txs[0]; + const validExpirationTimestampMetadata = txs[1]; - invalidIncludeByTimestampMetadata.data.includeByTimestamp = BigInt(NOW_S); - await invalidIncludeByTimestampMetadata.recomputeHash(); + invalidExpirationTimestampMetadata.data.expirationTimestamp = BigInt(NOW_S); + await invalidExpirationTimestampMetadata.recomputeHash(); - validIncludeByTimestampMetadata.data.includeByTimestamp = BigInt(NOW_S + 1); - await validIncludeByTimestampMetadata.recomputeHash(); + validExpirationTimestampMetadata.data.expirationTimestamp = BigInt(NOW_S + 1); + await validExpirationTimestampMetadata.recomputeHash(); // We need to set the last block number to get this working properly because if it was set to 0, it would mean // that we are building block 1, and for block 1 the timestamp expiration check is skipped. For details on why - // see the `validate_include_by_timestamp` function in + // see the `validate_expiration_timestamp` function in // `noir-projects/noir-protocol-circuits/crates/rollup-lib/src/base/components/validation_requests.nr`. lastBlockNumber = BlockNumber(1); // Default tx with no should be valid - // Tx with include by timestamp < current block number should be invalid - expect(await node.isValidTx(invalidIncludeByTimestampMetadata)).toEqual({ + // Tx with expiration timestamp < current block number should be invalid + expect(await node.isValidTx(invalidExpirationTimestampMetadata)).toEqual({ result: 'invalid', - reason: [TX_ERROR_INVALID_INCLUDE_BY_TIMESTAMP], + reason: [TX_ERROR_INVALID_EXPIRATION_TIMESTAMP], }); - // Tx with include by timestamp >= current block number should be valid - expect(await node.isValidTx(validIncludeByTimestampMetadata)).toEqual({ result: 'valid' }); + // Tx with expiration timestamp >= current block number should be valid + expect(await node.isValidTx(validExpirationTimestampMetadata)).toEqual({ result: 'valid' }); }); }); diff --git a/yarn-project/aztec-node/src/aztec-node/server.ts b/yarn-project/aztec-node/src/aztec-node/server.ts index 02c55f4cbbb2..6d5979678fb9 100644 --- a/yarn-project/aztec-node/src/aztec-node/server.ts +++ b/yarn-project/aztec-node/src/aztec-node/server.ts @@ -1195,7 +1195,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable { const db = this.worldStateSynchronizer.getCommitted(); const verifier = isSimulation ? undefined : this.proofVerifier; - // We accept transactions if they are not expired by the next slot (checked based on the IncludeByTimestamp field) + // We accept transactions if they are not expired by the next slot (checked based on the ExpirationTimestamp field) const { ts: nextSlotTimestamp } = this.epochCache.getEpochAndSlotInNextL1Slot(); const blockNumber = BlockNumber((await this.blockSource.getBlockNumber()) + 1); const validator = createValidatorForAcceptingTxs( diff --git a/yarn-project/constants/src/constants.gen.ts b/yarn-project/constants/src/constants.gen.ts index 70083fc9dee5..9e4657b59aba 100644 --- a/yarn-project/constants/src/constants.gen.ts +++ b/yarn-project/constants/src/constants.gen.ts @@ -97,7 +97,7 @@ export const INITIAL_L2_BLOCK_NUM = 1; export const FIELDS_PER_BLOB = 4096; export const BLOBS_PER_CHECKPOINT = 6; export const MAX_CHECKPOINTS_PER_EPOCH = 32; -export const MAX_INCLUDE_BY_TIMESTAMP_DURATION = 86400; +export const MAX_TX_LIFETIME = 86400; export const GENESIS_BLOCK_HEADER_HASH = 21694244557328181932449230888455310614586084993178835904749768133365362325861n; export const GENESIS_ARCHIVE_ROOT = 9682850228538071369704502076456077473410427336083826595120404283897422804423n; export const EMPTY_EPOCH_OUT_HASH = 355785372471781095838790036702437931769306153278986832745847530947941691539n; @@ -540,4 +540,4 @@ export enum GeneratorIndex { SECRET_HASH = 4199652938, TX_NULLIFIER = 1025801951, SIGNATURE_PAYLOAD = 463525807, -} \ No newline at end of file +} diff --git a/yarn-project/end-to-end/src/e2e_include_by_timestamp.test.ts b/yarn-project/end-to-end/src/e2e_expiration_timestamp.test.ts similarity index 65% rename from yarn-project/end-to-end/src/e2e_include_by_timestamp.test.ts rename to yarn-project/end-to-end/src/e2e_expiration_timestamp.test.ts index 3f93af955d9e..78e3be77ee02 100644 --- a/yarn-project/end-to-end/src/e2e_include_by_timestamp.test.ts +++ b/yarn-project/end-to-end/src/e2e_expiration_timestamp.test.ts @@ -2,13 +2,13 @@ import { AztecAddress } from '@aztec/aztec.js/addresses'; import type { AztecNode } from '@aztec/aztec.js/node'; import { getL1ContractsConfigEnvVars } from '@aztec/ethereum/config'; import { TestContract } from '@aztec/noir-test-contracts.js/Test'; -import { TX_ERROR_INVALID_INCLUDE_BY_TIMESTAMP } from '@aztec/stdlib/tx'; +import { TX_ERROR_INVALID_EXPIRATION_TIMESTAMP } from '@aztec/stdlib/tx'; import { setup } from './fixtures/utils.js'; import type { TestWallet } from './test-wallet/test_wallet.js'; import { proveInteraction } from './test-wallet/utils.js'; -describe('e2e_include_by_timestamp', () => { +describe('e2e_expiration_timestamp', () => { let wallet: TestWallet; let defaultAccountAddress: AztecAddress; let aztecNode: AztecNode; @@ -31,34 +31,34 @@ describe('e2e_include_by_timestamp', () => { afterAll(() => teardown()); describe('when requesting expiration timestamp higher than the one of a mined block', () => { - let includeByTimestamp: bigint; + let expirationTimestamp: bigint; beforeEach(async () => { const header = await aztecNode.getBlockHeader(); if (!header) { - throw new Error('Block header not found in the setup of e2e_include_by_timestamp.test.ts'); + throw new Error('Block header not found in the setup of e2e_expiration_timestamp.test.ts'); } // The timestamp of the next slot. - includeByTimestamp = header.globalVariables.timestamp + aztecSlotDuration; + expirationTimestamp = header.globalVariables.timestamp + aztecSlotDuration; }); describe('with no enqueued public calls', () => { const enqueuePublicCall = false; - it('sets the include by timestamp', async () => { + it('sets the expiration timestamp', async () => { const tx = await proveInteraction( wallet, - contract.methods.set_include_by_timestamp(includeByTimestamp, enqueuePublicCall), + contract.methods.set_expiration_timestamp(expirationTimestamp, enqueuePublicCall), { from: defaultAccountAddress }, ); - expect(tx.data.includeByTimestamp).toEqual(includeByTimestamp); - // Note: If the expected value doesn't match, it might be because the includeByTimestamp is rounded down. - // See compute_tx_include_by_timestamp.ts for the rounding logic. + expect(tx.data.expirationTimestamp).toEqual(expirationTimestamp); + // Note: If the expected value doesn't match, it might be because the expirationTimestamp is rounded down. + // See compute_tx_expiration_timestamp.ts for the rounding logic. }); it('does not invalidate the transaction', async () => { await contract.methods - .set_include_by_timestamp(includeByTimestamp, enqueuePublicCall) + .set_expiration_timestamp(expirationTimestamp, enqueuePublicCall) .send({ from: defaultAccountAddress }); }); }); @@ -66,88 +66,88 @@ describe('e2e_include_by_timestamp', () => { describe('with an enqueued public call', () => { const enqueuePublicCall = true; - it('sets include by timestamp', async () => { + it('sets expiration timestamp', async () => { const tx = await proveInteraction( wallet, - contract.methods.set_include_by_timestamp(includeByTimestamp, enqueuePublicCall), + contract.methods.set_expiration_timestamp(expirationTimestamp, enqueuePublicCall), { from: defaultAccountAddress }, ); - expect(tx.data.includeByTimestamp).toEqual(includeByTimestamp); + expect(tx.data.expirationTimestamp).toEqual(expirationTimestamp); }); it('does not invalidate the transaction', async () => { await contract.methods - .set_include_by_timestamp(includeByTimestamp, enqueuePublicCall) + .set_expiration_timestamp(expirationTimestamp, enqueuePublicCall) .send({ from: defaultAccountAddress }); }); }); }); describe('when requesting expiration timestamp lower than the next block', () => { - let includeByTimestamp: bigint; + let expirationTimestamp: bigint; beforeEach(async () => { const header = await aztecNode.getBlockHeader(); if (!header) { - throw new Error('Block header not found in the setup of e2e_include_by_timestamp.test.ts'); + throw new Error('Block header not found in the setup of e2e_expiration_timestamp.test.ts'); } // 1n lower than the next slot. - includeByTimestamp = header.globalVariables.timestamp + aztecSlotDuration - 1n; + expirationTimestamp = header.globalVariables.timestamp + aztecSlotDuration - 1n; }); describe('with no enqueued public calls', () => { const enqueuePublicCall = false; - it('sets include by timestamp', async () => { + it('sets expiration timestamp', async () => { const tx = await proveInteraction( wallet, - contract.methods.set_include_by_timestamp(includeByTimestamp, enqueuePublicCall), + contract.methods.set_expiration_timestamp(expirationTimestamp, enqueuePublicCall), { from: defaultAccountAddress }, ); - expect(tx.data.includeByTimestamp).toEqual(includeByTimestamp); + expect(tx.data.expirationTimestamp).toEqual(expirationTimestamp); }); it('invalidates the transaction', async () => { await expect( contract.methods - .set_include_by_timestamp(includeByTimestamp, enqueuePublicCall) + .set_expiration_timestamp(expirationTimestamp, enqueuePublicCall) .send({ from: defaultAccountAddress }), - ).rejects.toThrow(TX_ERROR_INVALID_INCLUDE_BY_TIMESTAMP); + ).rejects.toThrow(TX_ERROR_INVALID_EXPIRATION_TIMESTAMP); }); }); describe('with an enqueued public call', () => { const enqueuePublicCall = true; - it('sets include by timestamp', async () => { + it('sets expiration timestamp', async () => { const tx = await proveInteraction( wallet, - contract.methods.set_include_by_timestamp(includeByTimestamp, enqueuePublicCall), + contract.methods.set_expiration_timestamp(expirationTimestamp, enqueuePublicCall), { from: defaultAccountAddress }, ); - expect(tx.data.includeByTimestamp).toEqual(includeByTimestamp); + expect(tx.data.expirationTimestamp).toEqual(expirationTimestamp); }); it('invalidates the transaction', async () => { await expect( contract.methods - .set_include_by_timestamp(includeByTimestamp, enqueuePublicCall) + .set_expiration_timestamp(expirationTimestamp, enqueuePublicCall) .send({ from: defaultAccountAddress }), - ).rejects.toThrow(TX_ERROR_INVALID_INCLUDE_BY_TIMESTAMP); + ).rejects.toThrow(TX_ERROR_INVALID_EXPIRATION_TIMESTAMP); }); }); }); describe('when requesting expiration timestamp lower than the one of a mined block', () => { - let includeByTimestamp: bigint; + let expirationTimestamp: bigint; beforeEach(async () => { const header = await aztecNode.getBlockHeader(); if (!header) { - throw new Error('Block header not found in the setup of e2e_include_by_timestamp.test.ts'); + throw new Error('Block header not found in the setup of e2e_expiration_timestamp.test.ts'); } // 1n lower than the mined block. - includeByTimestamp = header.globalVariables.timestamp - 1n; + expirationTimestamp = header.globalVariables.timestamp - 1n; }); describe('with no enqueued public calls', () => { @@ -156,7 +156,7 @@ describe('e2e_include_by_timestamp', () => { it('fails to prove the tx', async () => { await expect( contract.methods - .set_include_by_timestamp(includeByTimestamp, enqueuePublicCall) + .set_expiration_timestamp(expirationTimestamp, enqueuePublicCall) .send({ from: defaultAccountAddress }), ).rejects.toThrow(); }); @@ -168,7 +168,7 @@ describe('e2e_include_by_timestamp', () => { it('fails to prove the tx', async () => { await expect( contract.methods - .set_include_by_timestamp(includeByTimestamp, enqueuePublicCall) + .set_expiration_timestamp(expirationTimestamp, enqueuePublicCall) .send({ from: defaultAccountAddress }), ).rejects.toThrow(); }); diff --git a/yarn-project/end-to-end/src/e2e_prover/full.test.ts b/yarn-project/end-to-end/src/e2e_prover/full.test.ts index 75f257fb8a48..eb3dc3e82529 100644 --- a/yarn-project/end-to-end/src/e2e_prover/full.test.ts +++ b/yarn-project/end-to-end/src/e2e_prover/full.test.ts @@ -327,7 +327,7 @@ describe('full_prover', () => { data.constants, data.gasUsed.add(new Gas(i + 1, 0)), data.feePayer, - data.includeByTimestamp, + data.expirationTimestamp, data.forPublic, data.forRollup, ), diff --git a/yarn-project/end-to-end/src/e2e_state_vars.test.ts b/yarn-project/end-to-end/src/e2e_state_vars.test.ts index e0c7030fa18b..95eb3a8dd8e9 100644 --- a/yarn-project/end-to-end/src/e2e_state_vars.test.ts +++ b/yarn-project/end-to-end/src/e2e_state_vars.test.ts @@ -321,7 +321,7 @@ describe('e2e_state_vars', () => { } }); - it('sets the include by timestamp property', async () => { + it('sets the expiration timestamp property', async () => { const newDelay = BigInt(aztecSlotDuration * 2); // We change the DelayedPublicMutable authorized delay here to 2 slots, this means that a change to the "authorized" // value can only be applied 2 slots after it is initiated, and thus read requests on a historical state without @@ -333,15 +333,15 @@ describe('e2e_state_vars', () => { await delay(4); // The validity of our DelayedPublicMutable read request should be limited to the new delay - const expectedModifiedIncludeByTimestamp = + const expectedModifiedExpirationTimestamp = (await aztecNode.getBlockHeader('latest'))!.globalVariables.timestamp + newDelay; - // We now call our AuthContract to see if the change in include by timestamp has reflected our delay change + // We now call our AuthContract to see if the change in expiration timestamp has reflected our delay change const tx = await proveInteraction(wallet, authContract.methods.get_authorized_in_private(), { from: defaultAccountAddress, }); - expect(tx.data.includeByTimestamp).toEqual(expectedModifiedIncludeByTimestamp); + expect(tx.data.expirationTimestamp).toEqual(expectedModifiedExpirationTimestamp); }); }); }); diff --git a/yarn-project/noir-protocol-circuits-types/src/conversion/client.ts b/yarn-project/noir-protocol-circuits-types/src/conversion/client.ts index 82183f3a1fb5..d6918104d6cd 100644 --- a/yarn-project/noir-protocol-circuits-types/src/conversion/client.ts +++ b/yarn-project/noir-protocol-circuits-types/src/conversion/client.ts @@ -473,7 +473,7 @@ export function mapPrivateCircuitPublicInputsToNoir( tx_context: mapTxContextToNoir(privateCircuitPublicInputs.txContext), min_revertible_side_effect_counter: mapFieldToNoir(privateCircuitPublicInputs.minRevertibleSideEffectCounter), is_fee_payer: privateCircuitPublicInputs.isFeePayer, - include_by_timestamp: mapU64ToNoir(privateCircuitPublicInputs.includeByTimestamp), + expiration_timestamp: mapU64ToNoir(privateCircuitPublicInputs.expirationTimestamp), }; } @@ -556,7 +556,7 @@ export function mapPrivateKernelCircuitPublicInputsFromNoir( mapPrivateAccumulatedDataFromNoir(inputs.end), mapPublicCallRequestFromNoir(inputs.public_teardown_call_request), mapAztecAddressFromNoir(inputs.fee_payer), - mapU64FromNoir(inputs.include_by_timestamp), + mapU64FromNoir(inputs.expiration_timestamp), inputs.is_private_only, mapFieldFromNoir(inputs.claimed_first_nullifier), mapNumberFromNoir(inputs.claimed_revertible_counter), @@ -573,7 +573,7 @@ export function mapPrivateKernelCircuitPublicInputsToNoir( min_revertible_side_effect_counter: mapFieldToNoir(inputs.minRevertibleSideEffectCounter), public_teardown_call_request: mapPublicCallRequestToNoir(inputs.publicTeardownCallRequest), fee_payer: mapAztecAddressToNoir(inputs.feePayer), - include_by_timestamp: mapU64ToNoir(inputs.includeByTimestamp), + expiration_timestamp: mapU64ToNoir(inputs.expirationTimestamp), is_private_only: inputs.isPrivateOnly, claimed_first_nullifier: mapFieldToNoir(inputs.claimedFirstNullifier), claimed_revertible_counter: mapNumberToNoir(inputs.claimedRevertibleCounter), @@ -601,7 +601,7 @@ export function mapPrivateKernelTailCircuitPublicInputsForRollupFromNoir( mapTxConstantDataFromNoir(inputs.constants), mapGasFromNoir(inputs.gas_used), mapAztecAddressFromNoir(inputs.fee_payer), - mapBigIntFromNoir(inputs.include_by_timestamp), + mapBigIntFromNoir(inputs.expiration_timestamp), undefined, forRollup, ); @@ -619,7 +619,7 @@ export function mapPrivateKernelTailCircuitPublicInputsForPublicFromNoir( mapTxConstantDataFromNoir(inputs.constants), mapGasFromNoir(inputs.gas_used), mapAztecAddressFromNoir(inputs.fee_payer), - mapBigIntFromNoir(inputs.include_by_timestamp), + mapBigIntFromNoir(inputs.expiration_timestamp), forPublic, ); } diff --git a/yarn-project/noir-protocol-circuits-types/src/conversion/common.ts b/yarn-project/noir-protocol-circuits-types/src/conversion/common.ts index f568d5a4e4f9..2238fbff4d49 100644 --- a/yarn-project/noir-protocol-circuits-types/src/conversion/common.ts +++ b/yarn-project/noir-protocol-circuits-types/src/conversion/common.ts @@ -893,7 +893,7 @@ export function mapPrivateToRollupKernelCircuitPublicInputsToNoir( end: mapPrivateToRollupAccumulatedDataToNoir(inputs.end), gas_used: mapGasToNoir(inputs.gasUsed), fee_payer: mapAztecAddressToNoir(inputs.feePayer), - include_by_timestamp: mapU64ToNoir(inputs.includeByTimestamp), + expiration_timestamp: mapU64ToNoir(inputs.expirationTimestamp), }; } @@ -907,6 +907,6 @@ export function mapPrivateToPublicKernelCircuitPublicInputsToNoir( public_teardown_call_request: mapPublicCallRequestToNoir(inputs.publicTeardownCallRequest), gas_used: mapGasToNoir(inputs.gasUsed), fee_payer: mapAztecAddressToNoir(inputs.feePayer), - include_by_timestamp: mapU64ToNoir(inputs.includeByTimestamp), + expiration_timestamp: mapU64ToNoir(inputs.expirationTimestamp), }; } diff --git a/yarn-project/noir-protocol-circuits-types/src/conversion/server.ts b/yarn-project/noir-protocol-circuits-types/src/conversion/server.ts index 3bd8377c6648..cfaec0945d7c 100644 --- a/yarn-project/noir-protocol-circuits-types/src/conversion/server.ts +++ b/yarn-project/noir-protocol-circuits-types/src/conversion/server.ts @@ -673,7 +673,7 @@ export function mapPrivateToPublicKernelCircuitPublicInputsFromNoir( mapPublicCallRequestFromNoir(inputs.public_teardown_call_request), mapGasFromNoir(inputs.gas_used), mapAztecAddressFromNoir(inputs.fee_payer), - mapU64FromNoir(inputs.include_by_timestamp), + mapU64FromNoir(inputs.expiration_timestamp), ); } diff --git a/yarn-project/noir-protocol-circuits-types/src/execution/client.ts b/yarn-project/noir-protocol-circuits-types/src/execution/client.ts index 97cbbec8fa7b..affc6fe2d4e9 100644 --- a/yarn-project/noir-protocol-circuits-types/src/execution/client.ts +++ b/yarn-project/noir-protocol-circuits-types/src/execution/client.ts @@ -152,7 +152,7 @@ export function convertPrivateKernelTailInputsToWitnessMapWithAbi( previous_kernel_public_inputs: mapPrivateKernelCircuitPublicInputsToNoir( privateKernelTailCircuitPrivateInputs.previousKernel.publicInputs, ), - include_by_timestamp_upper_bound: mapU64ToNoir(privateKernelTailCircuitPrivateInputs.includeByTimestampUpperBound), + expiration_timestamp_upper_bound: mapU64ToNoir(privateKernelTailCircuitPrivateInputs.expirationTimestampUpperBound), }; pushTestData('private-kernel-tail', mapped); const initialWitnessMap = abiEncode(privateKernelTailAbi, mapped); @@ -176,8 +176,8 @@ export function convertPrivateKernelTailToPublicInputsToWitnessMapWithAbi( padded_side_effect_amounts: mapPaddedSideEffectAmountsToNoir( privateKernelTailToPublicCircuitPrivateInputs.paddedSideEffectAmounts, ), - include_by_timestamp_upper_bound: mapU64ToNoir( - privateKernelTailToPublicCircuitPrivateInputs.includeByTimestampUpperBound, + expiration_timestamp_upper_bound: mapU64ToNoir( + privateKernelTailToPublicCircuitPrivateInputs.expirationTimestampUpperBound, ), }; pushTestData('private-kernel-tail-to-public', mapped); diff --git a/yarn-project/p2p/src/mem_pools/tx_pool/README.md b/yarn-project/p2p/src/mem_pools/tx_pool/README.md index 52c70ccb6fa9..21fd5a68cbca 100644 --- a/yarn-project/p2p/src/mem_pools/tx_pool/README.md +++ b/yarn-project/p2p/src/mem_pools/tx_pool/README.md @@ -213,7 +213,7 @@ The [`EvictionManager`](eviction/eviction_manager.ts) coordinates eviction by: Evicts transactions that become invalid after a block is mined: - Duplicate nullifiers: Txs with nullifiers already included in the mined block -- Expired transactions: Txs with `includeByTimestamp` ≤ mined block timestamp +- Expired transactions: Txs with `expirationTimestamp` ≤ mined block timestamp #### 2. `InvalidTxsAfterReorgRule` diff --git a/yarn-project/p2p/src/mem_pools/tx_pool/aztec_kv_tx_pool.test.ts b/yarn-project/p2p/src/mem_pools/tx_pool/aztec_kv_tx_pool.test.ts index 0b7873a3b005..614c12c80d31 100644 --- a/yarn-project/p2p/src/mem_pools/tx_pool/aztec_kv_tx_pool.test.ts +++ b/yarn-project/p2p/src/mem_pools/tx_pool/aztec_kv_tx_pool.test.ts @@ -301,13 +301,13 @@ describe('KV TX pool', () => { expect(pendingTxHashes).toHaveLength(2); }); - it('Evicts txs with a max inclusion timestamp lower than or equal to the timestamp of the mined block', async () => { + it('Evicts txs with an expiration timestamp lower than or equal to the timestamp of the mined block', async () => { const tx1 = await mockTx(1); - tx1.data.includeByTimestamp = 0n; + tx1.data.expirationTimestamp = 0n; const tx2 = await mockTx(2); - tx2.data.includeByTimestamp = 32n; + tx2.data.expirationTimestamp = 32n; const tx3 = await mockTx(3); - tx3.data.includeByTimestamp = 64n; + tx3.data.expirationTimestamp = 64n; await txPool.addTxs([tx1, tx2, tx3]); await txPool.markAsMined([tx1.getTxHash()], block2Header); diff --git a/yarn-project/p2p/src/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.test.ts b/yarn-project/p2p/src/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.test.ts index cb3394f9424e..f832161a0a5b 100644 --- a/yarn-project/p2p/src/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.test.ts +++ b/yarn-project/p2p/src/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.test.ts @@ -122,8 +122,8 @@ describe('InvalidTxsAfterMiningRule', () => { numberOfRevertiblePublicCallRequests: 0, }); - mockTx1.data.includeByTimestamp = 500n; - mockTx2.data.includeByTimestamp = 1500n; + mockTx1.data.expirationTimestamp = 500n; + mockTx2.data.expirationTimestamp = 1500n; const pendingTxs: PendingTxInfo[] = [ { blockHash: Fr.ZERO, txHash: tx1, isEvictable: true }, diff --git a/yarn-project/p2p/src/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.ts b/yarn-project/p2p/src/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.ts index e688fd1ae069..cc8cf1efd5ba 100644 --- a/yarn-project/p2p/src/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.ts +++ b/yarn-project/p2p/src/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.ts @@ -68,10 +68,10 @@ export class InvalidTxsAfterMiningRule implements EvictionRule { } // Evict pending txs with an expiration timestamp less than or equal to the mined block timestamp - const includeByTimestamp = tx.data.includeByTimestamp; - if (includeByTimestamp <= timestamp) { + const expirationTimestamp = tx.data.expirationTimestamp; + if (expirationTimestamp <= timestamp) { this.log.verbose( - `Evicting tx ${txHash} from pool due to the tx being expired (includeByTimestamp: ${includeByTimestamp}, mined block timestamp: ${timestamp})`, + `Evicting tx ${txHash} from pool due to the tx being expired (expirationTimestamp: ${expirationTimestamp}, mined block timestamp: ${timestamp})`, ); txsToEvict.push(txHash); continue; diff --git a/yarn-project/p2p/src/mem_pools/tx_pool_v2/README.md b/yarn-project/p2p/src/mem_pools/tx_pool_v2/README.md index 3efd91ab7a3e..25dfc1d12435 100644 --- a/yarn-project/p2p/src/mem_pools/tx_pool_v2/README.md +++ b/yarn-project/p2p/src/mem_pools/tx_pool_v2/README.md @@ -79,7 +79,7 @@ Lightweight metadata stored alongside each transaction: - `claimAmount`: Fee payer's claim from bridging - `feeLimit`: Maximum fee the tx can pay - `nullifiers`: For conflict detection -- `includeByTimestamp`: Expiration timestamp +- `expirationTimestamp`: Expiration timestamp - `minedL2BlockId`: Set when mined (undefined otherwise) State is derived by TxPoolIndices: diff --git a/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/eviction_manager.test.ts b/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/eviction_manager.test.ts index bb134e70df2a..70cab64727c7 100644 --- a/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/eviction_manager.test.ts +++ b/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/eviction_manager.test.ts @@ -181,7 +181,7 @@ describe('EvictionManager', () => { claimAmount: 0n, feeLimit: 100n, nullifiers: [`0x${txHash.slice(2)}null1`], - includeByTimestamp: 0n, + expirationTimestamp: 0n, receivedAt: 0, data: stubTxMetaValidationData(), }); @@ -316,7 +316,7 @@ describe('EvictionManager', () => { claimAmount: 0n, feeLimit: 100n, nullifiers: [`0x${txHash.slice(2)}null1`], - includeByTimestamp: 0n, + expirationTimestamp: 0n, receivedAt: 0, data: stubTxMetaValidationData(), }); diff --git a/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.test.ts b/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.test.ts index de7c1d2bf76f..db41d206f772 100644 --- a/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.test.ts +++ b/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.test.ts @@ -41,7 +41,7 @@ describe('FeePayerBalanceEvictionRule', () => { claimAmount: opts.claimAmount ?? 0n, feeLimit: opts.feeLimit ?? 100n, nullifiers: [`0x${txHash.slice(2)}null1`], - includeByTimestamp: 0n, + expirationTimestamp: 0n, receivedAt: 0, data: stubTxMetaValidationData(), }); diff --git a/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.test.ts b/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.test.ts index 2a9ca2ea552e..8079390b9d0f 100644 --- a/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.test.ts +++ b/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.test.ts @@ -22,7 +22,7 @@ describe('FeePayerBalancePreAddRule', () => { claimAmount: opts.claimAmount ?? 0n, feeLimit: opts.feeLimit ?? 100n, nullifiers: [`0x${txHash.slice(2)}null1`], - includeByTimestamp: 0n, + expirationTimestamp: 0n, receivedAt: 0, data: stubTxMetaValidationData(), }); diff --git a/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.test.ts b/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.test.ts index 51fa1fd3b3cb..833028245ae3 100644 --- a/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.test.ts +++ b/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.test.ts @@ -15,18 +15,18 @@ describe('InvalidTxsAfterMiningRule', () => { let deleteTxsMock: jest.MockedFunction; // Default timestamp used in tests - must be > block timestamp (1000n) to avoid expiration - const DEFAULT_INCLUDE_BY_TIMESTAMP = 2000n; + const DEFAULT_EXPIRATION_TIMESTAMP = 2000n; // Helper to create TxMetaData for testing const createMeta = ( txHash: string, opts: { nullifiers?: string[]; - includeByTimestamp?: bigint; + expirationTimestamp?: bigint; } = {}, ): TxMetaData => { const nullifiers = opts.nullifiers ?? [`0x${txHash.slice(2)}null1`]; - const includeByTimestamp = opts.includeByTimestamp ?? DEFAULT_INCLUDE_BY_TIMESTAMP; + const expirationTimestamp = opts.expirationTimestamp ?? DEFAULT_EXPIRATION_TIMESTAMP; return { txHash, anchorBlockHeaderHash: '0x1234', @@ -35,9 +35,9 @@ describe('InvalidTxsAfterMiningRule', () => { claimAmount: 0n, feeLimit: 100n, nullifiers, - includeByTimestamp, + expirationTimestamp, receivedAt: 0, - data: stubTxMetaValidationData({ includeByTimestamp }), + data: stubTxMetaValidationData({ expirationTimestamp }), }; }; @@ -126,8 +126,8 @@ describe('InvalidTxsAfterMiningRule', () => { }); it('evicts transactions with expired timestamps', async () => { - const tx1 = createMeta('0x1111', { includeByTimestamp: 500n }); // Expired (500 <= 1000) - const tx2 = createMeta('0x2222', { includeByTimestamp: 1500n }); // Not expired (1500 > 1000) + const tx1 = createMeta('0x1111', { expirationTimestamp: 500n }); // Expired (500 <= 1000) + const tx2 = createMeta('0x2222', { expirationTimestamp: 1500n }); // Not expired (1500 > 1000) pool = createPoolOps([tx1, tx2]); @@ -146,8 +146,8 @@ describe('InvalidTxsAfterMiningRule', () => { }); it('evicts transactions with timestamp equal to block timestamp', async () => { - const tx1 = createMeta('0x1111', { includeByTimestamp: 1000n }); // Exactly at timestamp - const tx2 = createMeta('0x2222', { includeByTimestamp: 1001n }); // Just after + const tx1 = createMeta('0x1111', { expirationTimestamp: 1000n }); // Exactly at timestamp + const tx2 = createMeta('0x2222', { expirationTimestamp: 1001n }); // Just after pool = createPoolOps([tx1, tx2]); @@ -166,8 +166,8 @@ describe('InvalidTxsAfterMiningRule', () => { }); it('handles transactions with both duplicate nullifiers and expired timestamps', async () => { - const tx1 = createMeta('0x1111', { nullifiers: [newNullifiers[0]], includeByTimestamp: 500n }); // Both reasons - const tx2 = createMeta('0x2222', { nullifiers: ['0xunique'], includeByTimestamp: 1500n }); // Neither + const tx1 = createMeta('0x1111', { nullifiers: [newNullifiers[0]], expirationTimestamp: 500n }); // Both reasons + const tx2 = createMeta('0x2222', { nullifiers: ['0xunique'], expirationTimestamp: 1500n }); // Neither pool = createPoolOps([tx1, tx2]); diff --git a/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.ts b/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.ts index 8c39393f48af..dfecfc86524c 100644 --- a/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.ts +++ b/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.ts @@ -41,9 +41,9 @@ export class InvalidTxsAfterMiningRule implements EvictionRule { } // Evict pending txs with an expiration timestamp less than or equal to the mined block timestamp - if (meta.includeByTimestamp <= timestamp) { + if (meta.expirationTimestamp <= timestamp) { this.log.verbose( - `Evicting tx ${meta.txHash} from pool due to the tx being expired (includeByTimestamp: ${meta.includeByTimestamp}, mined block timestamp: ${timestamp})`, + `Evicting tx ${meta.txHash} from pool due to the tx being expired (expirationTimestamp: ${meta.expirationTimestamp}, mined block timestamp: ${timestamp})`, ); txsToEvict.push(meta.txHash); continue; diff --git a/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.test.ts b/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.test.ts index b07974d893b0..4d36d5a8be44 100644 --- a/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.test.ts +++ b/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.test.ts @@ -29,7 +29,7 @@ describe('InvalidTxsAfterReorgRule', () => { claimAmount: 0n, feeLimit: 100n, nullifiers: [`0x${txHash.slice(2)}null1`], - includeByTimestamp: 0n, + expirationTimestamp: 0n, receivedAt: 0, data: stubTxMetaValidationData(), }); diff --git a/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.test.ts b/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.test.ts index c4ff83c31aab..85c9eea11eff 100644 --- a/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.test.ts +++ b/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.test.ts @@ -14,7 +14,7 @@ describe('LowPriorityPreAddRule', () => { claimAmount: 0n, feeLimit: 100n, nullifiers: [`0x${txHash.slice(2)}null1`], - includeByTimestamp: 0n, + expirationTimestamp: 0n, receivedAt: 0, data: stubTxMetaValidationData(), }); diff --git a/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.test.ts b/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.test.ts index 507f2718c678..353231e0a807 100644 --- a/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.test.ts +++ b/yarn-project/p2p/src/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.test.ts @@ -19,7 +19,7 @@ describe('NullifierConflictRule', () => { claimAmount: 0n, feeLimit: 1000n, nullifiers, - includeByTimestamp: 0n, + expirationTimestamp: 0n, receivedAt: 0, data: stubTxMetaValidationData(), }); diff --git a/yarn-project/p2p/src/mem_pools/tx_pool_v2/tx_metadata.test.ts b/yarn-project/p2p/src/mem_pools/tx_pool_v2/tx_metadata.test.ts index 287883580a1b..bc384e8ba029 100644 --- a/yarn-project/p2p/src/mem_pools/tx_pool_v2/tx_metadata.test.ts +++ b/yarn-project/p2p/src/mem_pools/tx_pool_v2/tx_metadata.test.ts @@ -17,7 +17,7 @@ describe('TxMetaData', () => { expect(meta.txHash).toBe(tx.getTxHash().toString()); expect(meta.anchorBlockHeaderHash).toBe((await tx.data.constants.anchorBlockHeader.hash()).toString()); expect(meta.feePayer).toBe(tx.data.feePayer.toString()); - expect(meta.includeByTimestamp).toBe(tx.data.includeByTimestamp); + expect(meta.expirationTimestamp).toBe(tx.data.expirationTimestamp); expect(meta.minedL2BlockId).toBeUndefined(); // Nullifiers should match the non-empty nullifiers from the tx @@ -46,7 +46,7 @@ describe('TxMetaData', () => { claimAmount: 0n, feeLimit: 1000n, nullifiers: [], - includeByTimestamp: 0n, + expirationTimestamp: 0n, receivedAt: 0, data: stubTxMetaValidationData(), }); @@ -79,7 +79,7 @@ describe('TxMetaData', () => { claimAmount: 0n, feeLimit: 1000n, nullifiers, - includeByTimestamp: 0n, + expirationTimestamp: 0n, receivedAt: 0, data: stubTxMetaValidationData(), }); diff --git a/yarn-project/p2p/src/mem_pools/tx_pool_v2/tx_metadata.ts b/yarn-project/p2p/src/mem_pools/tx_pool_v2/tx_metadata.ts index 529484c84b6f..3bdf207167cf 100644 --- a/yarn-project/p2p/src/mem_pools/tx_pool_v2/tx_metadata.ts +++ b/yarn-project/p2p/src/mem_pools/tx_pool_v2/tx_metadata.ts @@ -11,7 +11,7 @@ import type { PreAddResult } from './eviction/interfaces.js'; /** Validator-compatible data interface, mirroring the subset of PrivateKernelTailCircuitPublicInputs used by validators. */ export type TxMetaValidationData = { getNonEmptyNullifiers(): Fr[]; - includeByTimestamp: bigint; + expirationTimestamp: bigint; constants: { anchorBlockHeader: { hash(): Promise; @@ -56,7 +56,7 @@ export type TxMetaData = { readonly nullifiers: readonly string[]; /** Timestamp by which the transaction must be included (for expiration checks) */ - readonly includeByTimestamp: bigint; + readonly expirationTimestamp: bigint; /** Validator-compatible data, providing the same access patterns as Tx.data */ readonly data: TxMetaValidationData; @@ -79,7 +79,7 @@ export async function buildTxMetaData(tx: Tx): Promise { const nullifiers = nullifierFrs.map(n => n.toString()); const anchorBlockHeaderHashFr = await tx.data.constants.anchorBlockHeader.hash(); const anchorBlockHeaderHash = anchorBlockHeaderHashFr.toString(); - const includeByTimestamp = tx.data.includeByTimestamp; + const expirationTimestamp = tx.data.expirationTimestamp; const anchorBlockNumber = tx.data.constants.anchorBlockHeader.globalVariables.blockNumber; const priorityFee = getTxPriorityFee(tx); const feePayer = tx.data.feePayer.toString(); @@ -94,11 +94,11 @@ export async function buildTxMetaData(tx: Tx): Promise { claimAmount, feeLimit, nullifiers, - includeByTimestamp, + expirationTimestamp, receivedAt: 0, data: { getNonEmptyNullifiers: () => nullifierFrs, - includeByTimestamp, + expirationTimestamp, constants: { anchorBlockHeader: { hash: () => Promise.resolve(anchorBlockHeaderHashFr), @@ -197,10 +197,10 @@ export function checkNullifierConflict( } /** Creates a stub TxMetaValidationData for tests that don't exercise validators. */ -export function stubTxMetaValidationData(overrides: { includeByTimestamp?: bigint } = {}): TxMetaValidationData { +export function stubTxMetaValidationData(overrides: { expirationTimestamp?: bigint } = {}): TxMetaValidationData { return { getNonEmptyNullifiers: () => [], - includeByTimestamp: overrides.includeByTimestamp ?? 0n, + expirationTimestamp: overrides.expirationTimestamp ?? 0n, constants: { anchorBlockHeader: { hash: () => Promise.resolve(new BlockHash(Fr.ZERO)), diff --git a/yarn-project/p2p/src/msg_validators/tx_validator/timestamp_validator.test.ts b/yarn-project/p2p/src/msg_validators/tx_validator/timestamp_validator.test.ts index bbce8df574e9..79d77c925fbc 100644 --- a/yarn-project/p2p/src/msg_validators/tx_validator/timestamp_validator.test.ts +++ b/yarn-project/p2p/src/msg_validators/tx_validator/timestamp_validator.test.ts @@ -1,6 +1,6 @@ import { BlockNumber } from '@aztec/foundation/branded-types'; import { mockTx, mockTxForRollup } from '@aztec/stdlib/testing'; -import { TX_ERROR_INVALID_INCLUDE_BY_TIMESTAMP, type Tx } from '@aztec/stdlib/tx'; +import { TX_ERROR_INVALID_EXPIRATION_TIMESTAMP, type Tx } from '@aztec/stdlib/tx'; import { TimestampTxValidator } from './timestamp_validator.js'; @@ -37,17 +37,17 @@ describe('TimestampTxValidator', () => { return [tx1, tx2]; }; - it.each([10n, 11n])('allows txs with valid expiration timestamp', async includeByTimestamp => { + it.each([10n, 11n])('allows txs with valid expiration timestamp', async expirationTimestamp => { const [goodTx] = await makeTxs(); - goodTx.data.includeByTimestamp = includeByTimestamp; + goodTx.data.expirationTimestamp = expirationTimestamp; await expectValid(goodTx); }); it('allows txs with equal or greater expiration timestamp', async () => { const [goodTx1, goodTx2] = await makeTxs(); - goodTx1.data.includeByTimestamp = timestamp; - goodTx2.data.includeByTimestamp = timestamp + 1n; + goodTx1.data.expirationTimestamp = timestamp; + goodTx2.data.expirationTimestamp = timestamp + 1n; await expectValid(goodTx1); await expectValid(goodTx2); @@ -55,20 +55,20 @@ describe('TimestampTxValidator', () => { it('rejects txs with lower expiration timestamp', async () => { const [badTx] = await makeTxs(); - badTx.data.includeByTimestamp = timestamp - 1n; + badTx.data.expirationTimestamp = timestamp - 1n; - await expectInvalid(badTx, TX_ERROR_INVALID_INCLUDE_BY_TIMESTAMP); + await expectInvalid(badTx, TX_ERROR_INVALID_EXPIRATION_TIMESTAMP); }); it('accept txs with lower expiration timestamp when building block 1', async () => { // Since at block 1, we skip the expiration check, we expect the tx to be valid even if the expiration timestamp // is lower than the current timestamp. For details on why the check is disable for block 1 see the - // `validate_include_by_timestamp` function in + // `validate_expiration_timestamp` function in // `noir-projects/noir-protocol-circuits/crates/rollup-lib/src/base/components/validation_requests.nr`. setValidatorAtBlock(BlockNumber(1)); const [badTx] = await makeTxs(); - badTx.data.includeByTimestamp = timestamp - 1n; + badTx.data.expirationTimestamp = timestamp - 1n; await expectValid(badTx); }); diff --git a/yarn-project/p2p/src/msg_validators/tx_validator/timestamp_validator.ts b/yarn-project/p2p/src/msg_validators/tx_validator/timestamp_validator.ts index 02b24aae0f96..a324676b9efb 100644 --- a/yarn-project/p2p/src/msg_validators/tx_validator/timestamp_validator.ts +++ b/yarn-project/p2p/src/msg_validators/tx_validator/timestamp_validator.ts @@ -1,13 +1,13 @@ import type { BlockNumber } from '@aztec/foundation/branded-types'; import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log'; -import { TX_ERROR_INVALID_INCLUDE_BY_TIMESTAMP, type TxValidationResult, type TxValidator } from '@aztec/stdlib/tx'; +import { TX_ERROR_INVALID_EXPIRATION_TIMESTAMP, type TxValidationResult, type TxValidator } from '@aztec/stdlib/tx'; import type { UInt64 } from '@aztec/stdlib/types'; /** Structural interface for timestamp validation. */ export interface HasTimestampData { txHash: { toString(): string }; data: { - includeByTimestamp: bigint; + expirationTimestamp: bigint; constants: { anchorBlockHeader: { globalVariables: { @@ -35,21 +35,21 @@ export class TimestampTxValidator implements TxValid } validateTx(tx: T): Promise { - const includeByTimestamp = tx.data.includeByTimestamp; - // If building block 1, we skip the expiration check. For details on why see the `validate_include_by_timestamp` + const expirationTimestamp = tx.data.expirationTimestamp; + // If building block 1, we skip the expiration check. For details on why see the `validate_expiration_timestamp` // function in `noir-projects/noir-protocol-circuits/crates/rollup-lib/src/base/components/validation_requests.nr`. const buildingBlock1 = this.values.blockNumber === 1; - if (!buildingBlock1 && includeByTimestamp < this.values.timestamp) { + if (!buildingBlock1 && expirationTimestamp < this.values.timestamp) { if (tx.data.constants.anchorBlockHeader.globalVariables.blockNumber === 0) { this.#log.warn( `A tx built against a genesis block failed to be included in block 1 which is the only block in which txs built against a genesis block are allowed to be included.`, ); } this.#log.verbose( - `Rejecting tx ${tx.txHash} for low expiration timestamp. Tx expiration timestamp: ${includeByTimestamp}, timestamp: ${this.values.timestamp}.`, + `Rejecting tx ${tx.txHash} for low expiration timestamp. Tx expiration timestamp: ${expirationTimestamp}, timestamp: ${this.values.timestamp}.`, ); - return Promise.resolve({ result: 'invalid', reason: [TX_ERROR_INVALID_INCLUDE_BY_TIMESTAMP] }); + return Promise.resolve({ result: 'invalid', reason: [TX_ERROR_INVALID_EXPIRATION_TIMESTAMP] }); } else { return Promise.resolve({ result: 'valid' }); } diff --git a/yarn-project/p2p/src/msg_validators/tx_validator/tx_validator_bench.test.ts b/yarn-project/p2p/src/msg_validators/tx_validator/tx_validator_bench.test.ts index 6bf8b7588215..de3a83a638b5 100644 --- a/yarn-project/p2p/src/msg_validators/tx_validator/tx_validator_bench.test.ts +++ b/yarn-project/p2p/src/msg_validators/tx_validator/tx_validator_bench.test.ts @@ -124,7 +124,7 @@ describe('TxValidator: Benchmarks', () => { // TimestampTxValidator timestampTx = await mockTx(5); - timestampTx.data.includeByTimestamp = BigInt(Math.floor(Date.now() / 1000)) + 3600n; + timestampTx.data.expirationTimestamp = BigInt(Math.floor(Date.now() / 1000)) + 3600n; timestampValidator = new TimestampTxValidator({ timestamp: BigInt(Math.floor(Date.now() / 1000)), blockNumber: BlockNumber(3), diff --git a/yarn-project/p2p/src/services/libp2p/libp2p_service.ts b/yarn-project/p2p/src/services/libp2p/libp2p_service.ts index 8988db51902e..b27818562789 100644 --- a/yarn-project/p2p/src/services/libp2p/libp2p_service.ts +++ b/yarn-project/p2p/src/services/libp2p/libp2p_service.ts @@ -1544,7 +1544,7 @@ export class LibP2PService extends protected async validatePropagatedTx(tx: Tx, peerId: PeerId): Promise { const currentBlockNumber = await this.archiver.getBlockNumber(); - // We accept transactions if they are not expired by the next slot (checked based on the IncludeByTimestamp field) + // We accept transactions if they are not expired by the next slot (checked based on the ExpirationTimestamp field) const { ts: nextSlotTimestamp } = this.epochCache.getEpochAndSlotInNextL1Slot(); const messageValidators = await this.createMessageValidators(currentBlockNumber, nextSlotTimestamp); @@ -1599,7 +1599,7 @@ export class LibP2PService extends public async validate(txs: Tx[]): Promise { const currentBlockNumber = await this.archiver.getBlockNumber(); - // We accept transactions if they are not expired by the next slot (checked based on the IncludeByTimestamp field) + // We accept transactions if they are not expired by the next slot (checked based on the ExpirationTimestamp field) const { ts: nextSlotTimestamp } = this.epochCache.getEpochAndSlotInNextL1Slot(); const messageValidators = await this.createMessageValidators(currentBlockNumber, nextSlotTimestamp); diff --git a/yarn-project/p2p/src/testbench/p2p_client_testbench_worker.ts b/yarn-project/p2p/src/testbench/p2p_client_testbench_worker.ts index 64971c783d56..4f563c4e8672 100644 --- a/yarn-project/p2p/src/testbench/p2p_client_testbench_worker.ts +++ b/yarn-project/p2p/src/testbench/p2p_client_testbench_worker.ts @@ -166,7 +166,7 @@ async function generateDeterministicTxs(txCount: number, seed: number, config: P return cached.slice(0, txCount); } - const includeByTimestampBase = BigInt(seed); + const expirationTimestampBase = BigInt(seed); for (let i = cached.length; i < txCount; i++) { const txSeed = seed * 10000 + i; const tx = await mockTx(txSeed, { @@ -182,7 +182,7 @@ async function generateDeterministicTxs(txCount: number, seed: number, config: P hasPublicTeardownCallRequest: false, publicCalldataSize: 0, }); - tx.data.includeByTimestamp = includeByTimestampBase + BigInt(i); + tx.data.expirationTimestamp = expirationTimestampBase + BigInt(i); await tx.recomputeHash(); cached.push(tx); } diff --git a/yarn-project/pxe/src/contract_function_simulator/contract_function_simulator.ts b/yarn-project/pxe/src/contract_function_simulator/contract_function_simulator.ts index 10a68b618741..219b459f7542 100644 --- a/yarn-project/pxe/src/contract_function_simulator/contract_function_simulator.ts +++ b/yarn-project/pxe/src/contract_function_simulator/contract_function_simulator.ts @@ -656,7 +656,7 @@ export async function generateSimulatedProvingResult( constantData, /*gasUsed=*/ gasUsed.add(Gas.from({ l2Gas: FIXED_L2_GAS, daGas: FIXED_DA_GAS })), /*feePayer=*/ AztecAddress.zero(), - /*includeByTimestamp=*/ 0n, + /*expirationTimestamp=*/ 0n, hasPublicCalls ? inputsForPublic : undefined, !hasPublicCalls ? inputsForRollup : undefined, ); diff --git a/yarn-project/pxe/src/private_kernel/hints/compute_tx_expiration_timestamp.test.ts b/yarn-project/pxe/src/private_kernel/hints/compute_tx_expiration_timestamp.test.ts new file mode 100644 index 000000000000..30e0aff349c2 --- /dev/null +++ b/yarn-project/pxe/src/private_kernel/hints/compute_tx_expiration_timestamp.test.ts @@ -0,0 +1,91 @@ +import { MAX_TX_LIFETIME } from '@aztec/constants'; +import { PrivateKernelCircuitPublicInputs } from '@aztec/stdlib/kernel'; + +import { computeTxExpirationTimestamp } from './compute_tx_expiration_timestamp.js'; + +describe('computeTxExpirationTimestamp', () => { + let previousKernel: PrivateKernelCircuitPublicInputs; + + const blockTimestamp = 99999n; + const maxTxLifetime = BigInt(MAX_TX_LIFETIME); + const secondsInHour = 3600n; + const secondsIn30Mins = 60n * 30n; + + const setExpirationTimestamp = (timestamp: bigint) => { + previousKernel.expirationTimestamp = timestamp; + }; + + beforeEach(() => { + previousKernel = PrivateKernelCircuitPublicInputs.empty(); + previousKernel.constants.anchorBlockHeader.globalVariables.timestamp = blockTimestamp; + }); + + it('rounds down to the max allowed duration', () => { + const maxTimestamp = blockTimestamp + maxTxLifetime; + + setExpirationTimestamp(maxTimestamp + 87654n); + expect(computeTxExpirationTimestamp(previousKernel)).toBe(maxTimestamp); + + setExpirationTimestamp(maxTimestamp + 123n); + expect(computeTxExpirationTimestamp(previousKernel)).toBe(maxTimestamp); + + setExpirationTimestamp(maxTimestamp); + expect(computeTxExpirationTimestamp(previousKernel)).toBe(maxTimestamp); + }); + + it('rounds down to the nearest hour', () => { + setExpirationTimestamp(blockTimestamp + maxTxLifetime - 1n); + expect(computeTxExpirationTimestamp(previousKernel)).toBe(blockTimestamp + maxTxLifetime - secondsInHour); + + setExpirationTimestamp(blockTimestamp + secondsInHour * 11n + 1n); + expect(computeTxExpirationTimestamp(previousKernel)).toBe(blockTimestamp + secondsInHour * 11n); + + setExpirationTimestamp(blockTimestamp + secondsInHour * 2n + 123n); + expect(computeTxExpirationTimestamp(previousKernel)).toBe(blockTimestamp + secondsInHour * 2n); + + setExpirationTimestamp(blockTimestamp + secondsInHour); + expect(computeTxExpirationTimestamp(previousKernel)).toBe(blockTimestamp + secondsInHour); + }); + + it('rounds down to 30 mins for duration between 30 mins to 1 hour', () => { + setExpirationTimestamp(blockTimestamp + secondsInHour - 1n); + expect(computeTxExpirationTimestamp(previousKernel)).toBe(blockTimestamp + secondsIn30Mins); + + setExpirationTimestamp(blockTimestamp + secondsIn30Mins + 123n); + expect(computeTxExpirationTimestamp(previousKernel)).toBe(blockTimestamp + secondsIn30Mins); + + setExpirationTimestamp(blockTimestamp + secondsIn30Mins); + expect(computeTxExpirationTimestamp(previousKernel)).toBe(blockTimestamp + secondsIn30Mins); + }); + + it('rounds down to 1 seconds for duration under 30 mins', () => { + setExpirationTimestamp(blockTimestamp + secondsIn30Mins - 1n); + expect(computeTxExpirationTimestamp(previousKernel)).toBe(blockTimestamp + secondsIn30Mins - 1n); + + setExpirationTimestamp(blockTimestamp + 60n * 10n); + expect(computeTxExpirationTimestamp(previousKernel)).toBe(blockTimestamp + 60n * 10n); + + setExpirationTimestamp(blockTimestamp + 1n); + expect(computeTxExpirationTimestamp(previousKernel)).toBe(blockTimestamp + 1n); + }); + + it('throws if the timestamp is equal to or less than the block timestamp', () => { + setExpirationTimestamp(blockTimestamp); + expect(() => computeTxExpirationTimestamp(previousKernel)).toThrow(); + + setExpirationTimestamp(blockTimestamp - 1n); + expect(() => computeTxExpirationTimestamp(previousKernel)).toThrow(); + }); + + it('allows custom expiration timestamp', () => { + setExpirationTimestamp(blockTimestamp + maxTxLifetime); + const customTxLifetime = maxTxLifetime / 2n; + const expirationTimestamp = computeTxExpirationTimestamp(previousKernel, Number(customTxLifetime)); + expect(expirationTimestamp).toBe(blockTimestamp + customTxLifetime); + }); + + it('throws if custom tx lifetime is greater than the max allowed', () => { + const customTxLifetime = maxTxLifetime + 1n; + expect(() => computeTxExpirationTimestamp(previousKernel, Number(customTxLifetime))).toThrow(); + }); +}); diff --git a/yarn-project/pxe/src/private_kernel/hints/compute_tx_include_by_timestamp.ts b/yarn-project/pxe/src/private_kernel/hints/compute_tx_expiration_timestamp.ts similarity index 66% rename from yarn-project/pxe/src/private_kernel/hints/compute_tx_include_by_timestamp.ts rename to yarn-project/pxe/src/private_kernel/hints/compute_tx_expiration_timestamp.ts index abd4482c86e6..7fd803c87dac 100644 --- a/yarn-project/pxe/src/private_kernel/hints/compute_tx_include_by_timestamp.ts +++ b/yarn-project/pxe/src/private_kernel/hints/compute_tx_expiration_timestamp.ts @@ -1,4 +1,4 @@ -import { MAX_INCLUDE_BY_TIMESTAMP_DURATION } from '@aztec/constants'; +import { MAX_TX_LIFETIME } from '@aztec/constants'; import type { PrivateKernelCircuitPublicInputs } from '@aztec/stdlib/kernel'; import type { UInt64 } from '@aztec/stdlib/types'; @@ -8,12 +8,12 @@ const ROUNDED_DURATIONS = [ 1, // 1 second ]; -function roundTimestamp(blockTimestamp: bigint, includeByTimestamp: bigint): UInt64 { +function roundTimestamp(blockTimestamp: bigint, expirationTimestamp: bigint): UInt64 { return ROUNDED_DURATIONS.reduce((timestamp, duration) => { if (timestamp <= blockTimestamp) { // The timestamp must be greater than the block timestamp. // If it is too small, round it down again using a smaller duration. - const totalDuration = includeByTimestamp - blockTimestamp; + const totalDuration = expirationTimestamp - blockTimestamp; const roundedDuration = totalDuration - (totalDuration % BigInt(duration)); return blockTimestamp + roundedDuration; } @@ -21,36 +21,36 @@ function roundTimestamp(blockTimestamp: bigint, includeByTimestamp: bigint): UIn }, 0n); } -export function computeTxIncludeByTimestamp( +export function computeTxExpirationTimestamp( previousKernel: PrivateKernelCircuitPublicInputs, - maxDuration = MAX_INCLUDE_BY_TIMESTAMP_DURATION, + txLifetime = MAX_TX_LIFETIME, ): UInt64 { - if (maxDuration > MAX_INCLUDE_BY_TIMESTAMP_DURATION) { + if (txLifetime > MAX_TX_LIFETIME) { throw new Error( - `Custom max duration cannot be greater than the max allowed. Max allowed: ${MAX_INCLUDE_BY_TIMESTAMP_DURATION}. Custom value: ${maxDuration}.`, + `Custom tx lifetime cannot be greater than the max allowed. Max allowed: ${MAX_TX_LIFETIME}. Custom value: ${txLifetime}.`, ); } const anchorBlockTimestamp = previousKernel.constants.anchorBlockHeader.globalVariables.timestamp; - const maxTimestamp = anchorBlockTimestamp + BigInt(maxDuration); - const includeByTimestamp = previousKernel.includeByTimestamp; + const maxTimestamp = anchorBlockTimestamp + BigInt(txLifetime); + const expirationTimestamp = previousKernel.expirationTimestamp; - // If the includeByTimestamp set during the tx execution is greater than or equal to the max allowed duration, + // If the expirationTimestamp set during the tx execution is greater than or equal to the max allowed duration, // use the maximum allowed timestamp. // Note: It shouldn't be larger than the max allowed duration, but we check for it anyway. - if (includeByTimestamp >= maxTimestamp) { + if (expirationTimestamp >= maxTimestamp) { return maxTimestamp; } // Round it down to the nearest hour/min/second to reduce precision and avoid revealing the exact value. // This makes it harder for others to infer what function calls may have been used to produce a specific timestamp. - const roundedTimestamp = roundTimestamp(anchorBlockTimestamp, includeByTimestamp); + const roundedTimestamp = roundTimestamp(anchorBlockTimestamp, expirationTimestamp); // The tx can't be published if the timestamp is the same or less than the anchor block's timestamp. // Future blocks will have a greater timestamp, so the tx would never be included. if (roundedTimestamp <= anchorBlockTimestamp) { throw new Error( - `Include-by timestamp must be greater than the anchor block timestamp. Anchor block timestamp: ${anchorBlockTimestamp}. Include-by timestamp: ${includeByTimestamp}.`, + `Include-by timestamp must be greater than the anchor block timestamp. Anchor block timestamp: ${anchorBlockTimestamp}. Include-by timestamp: ${expirationTimestamp}.`, ); } diff --git a/yarn-project/pxe/src/private_kernel/hints/compute_tx_include_by_timestamp.test.ts b/yarn-project/pxe/src/private_kernel/hints/compute_tx_include_by_timestamp.test.ts deleted file mode 100644 index ea2ca225f59b..000000000000 --- a/yarn-project/pxe/src/private_kernel/hints/compute_tx_include_by_timestamp.test.ts +++ /dev/null @@ -1,91 +0,0 @@ -import { MAX_INCLUDE_BY_TIMESTAMP_DURATION } from '@aztec/constants'; -import { PrivateKernelCircuitPublicInputs } from '@aztec/stdlib/kernel'; - -import { computeTxIncludeByTimestamp } from './compute_tx_include_by_timestamp.js'; - -describe('computeTxIncludeByTimestamp', () => { - let previousKernel: PrivateKernelCircuitPublicInputs; - - const blockTimestamp = 99999n; - const maxDuration = BigInt(MAX_INCLUDE_BY_TIMESTAMP_DURATION); - const secondsInHour = 3600n; - const secondsIn30Mins = 60n * 30n; - - const setIncludeByTimestamp = (timestamp: bigint) => { - previousKernel.includeByTimestamp = timestamp; - }; - - beforeEach(() => { - previousKernel = PrivateKernelCircuitPublicInputs.empty(); - previousKernel.constants.anchorBlockHeader.globalVariables.timestamp = blockTimestamp; - }); - - it('rounds down to the max allowed duration', () => { - const maxTimestamp = blockTimestamp + maxDuration; - - setIncludeByTimestamp(maxTimestamp + 87654n); - expect(computeTxIncludeByTimestamp(previousKernel)).toBe(maxTimestamp); - - setIncludeByTimestamp(maxTimestamp + 123n); - expect(computeTxIncludeByTimestamp(previousKernel)).toBe(maxTimestamp); - - setIncludeByTimestamp(maxTimestamp); - expect(computeTxIncludeByTimestamp(previousKernel)).toBe(maxTimestamp); - }); - - it('rounds down to the nearest hour', () => { - setIncludeByTimestamp(blockTimestamp + maxDuration - 1n); - expect(computeTxIncludeByTimestamp(previousKernel)).toBe(blockTimestamp + maxDuration - secondsInHour); - - setIncludeByTimestamp(blockTimestamp + secondsInHour * 11n + 1n); - expect(computeTxIncludeByTimestamp(previousKernel)).toBe(blockTimestamp + secondsInHour * 11n); - - setIncludeByTimestamp(blockTimestamp + secondsInHour * 2n + 123n); - expect(computeTxIncludeByTimestamp(previousKernel)).toBe(blockTimestamp + secondsInHour * 2n); - - setIncludeByTimestamp(blockTimestamp + secondsInHour); - expect(computeTxIncludeByTimestamp(previousKernel)).toBe(blockTimestamp + secondsInHour); - }); - - it('rounds down to 30 mins for duration between 30 mins to 1 hour', () => { - setIncludeByTimestamp(blockTimestamp + secondsInHour - 1n); - expect(computeTxIncludeByTimestamp(previousKernel)).toBe(blockTimestamp + secondsIn30Mins); - - setIncludeByTimestamp(blockTimestamp + secondsIn30Mins + 123n); - expect(computeTxIncludeByTimestamp(previousKernel)).toBe(blockTimestamp + secondsIn30Mins); - - setIncludeByTimestamp(blockTimestamp + secondsIn30Mins); - expect(computeTxIncludeByTimestamp(previousKernel)).toBe(blockTimestamp + secondsIn30Mins); - }); - - it('rounds down to 1 seconds for duration under 30 mins', () => { - setIncludeByTimestamp(blockTimestamp + secondsIn30Mins - 1n); - expect(computeTxIncludeByTimestamp(previousKernel)).toBe(blockTimestamp + secondsIn30Mins - 1n); - - setIncludeByTimestamp(blockTimestamp + 60n * 10n); - expect(computeTxIncludeByTimestamp(previousKernel)).toBe(blockTimestamp + 60n * 10n); - - setIncludeByTimestamp(blockTimestamp + 1n); - expect(computeTxIncludeByTimestamp(previousKernel)).toBe(blockTimestamp + 1n); - }); - - it('throws if the timestamp is equal to or less than the block timestamp', () => { - setIncludeByTimestamp(blockTimestamp); - expect(() => computeTxIncludeByTimestamp(previousKernel)).toThrow(); - - setIncludeByTimestamp(blockTimestamp - 1n); - expect(() => computeTxIncludeByTimestamp(previousKernel)).toThrow(); - }); - - it('allows custom max duration', () => { - setIncludeByTimestamp(blockTimestamp + maxDuration); - const customMaxDuration = maxDuration / 2n; - const includeByTimestamp = computeTxIncludeByTimestamp(previousKernel, Number(customMaxDuration)); - expect(includeByTimestamp).toBe(blockTimestamp + customMaxDuration); - }); - - it('throws if the custom max duration is greater than the max allowed', () => { - const customMaxDuration = maxDuration + 1n; - expect(() => computeTxIncludeByTimestamp(previousKernel, Number(customMaxDuration))).toThrow(); - }); -}); diff --git a/yarn-project/pxe/src/private_kernel/hints/index.ts b/yarn-project/pxe/src/private_kernel/hints/index.ts index 09746e5e26ab..7fdd7f858e20 100644 --- a/yarn-project/pxe/src/private_kernel/hints/index.ts +++ b/yarn-project/pxe/src/private_kernel/hints/index.ts @@ -1,2 +1,2 @@ export * from './private_kernel_reset_private_inputs_builder.js'; -export * from './compute_tx_include_by_timestamp.js'; +export * from './compute_tx_expiration_timestamp.js'; diff --git a/yarn-project/pxe/src/private_kernel/private_kernel_execution_prover.test.ts b/yarn-project/pxe/src/private_kernel/private_kernel_execution_prover.test.ts index 1236fe2dd285..b1e73bf2e919 100644 --- a/yarn-project/pxe/src/private_kernel/private_kernel_execution_prover.test.ts +++ b/yarn-project/pxe/src/private_kernel/private_kernel_execution_prover.test.ts @@ -1,10 +1,5 @@ import { BackendType, BarretenbergSync } from '@aztec/bb.js'; -import { - MAX_INCLUDE_BY_TIMESTAMP_DURATION, - MAX_NOTE_HASHES_PER_CALL, - MAX_NOTE_HASHES_PER_TX, - VK_TREE_HEIGHT, -} from '@aztec/constants'; +import { MAX_NOTE_HASHES_PER_CALL, MAX_NOTE_HASHES_PER_TX, MAX_TX_LIFETIME, VK_TREE_HEIGHT } from '@aztec/constants'; import { padArrayEnd } from '@aztec/foundation/collection'; import { Fr } from '@aztec/foundation/curves/bn254'; import { createLogger } from '@aztec/foundation/log'; @@ -42,7 +37,7 @@ describe('Private Kernel Sequencer', () => { const contractAddress = AztecAddress.fromBigInt(987654n); const blockTimestamp = 12345n; - const includeByTimestamp = blockTimestamp + BigInt(MAX_INCLUDE_BY_TIMESTAMP_DURATION); + const expirationTimestamp = blockTimestamp + BigInt(MAX_TX_LIFETIME); beforeAll(async () => { await BarretenbergSync.initSingleton({ backend: BackendType.NativeSharedMemory, logger: logger.debug }); @@ -97,7 +92,7 @@ describe('Private Kernel Sequencer', () => { const simulateProofOutput = (newNoteIndices: number[]) => { const publicInputs = PrivateKernelCircuitPublicInputs.empty(); publicInputs.constants.anchorBlockHeader.globalVariables.timestamp = blockTimestamp; - publicInputs.includeByTimestamp = includeByTimestamp; + publicInputs.expirationTimestamp = expirationTimestamp; publicInputs.end.noteHashes = new ClaimedLengthArray( padArrayEnd( newNoteIndices.map(newNoteIndex => diff --git a/yarn-project/pxe/src/private_kernel/private_kernel_execution_prover.ts b/yarn-project/pxe/src/private_kernel/private_kernel_execution_prover.ts index 0f1d978c6e0a..61825073b921 100644 --- a/yarn-project/pxe/src/private_kernel/private_kernel_execution_prover.ts +++ b/yarn-project/pxe/src/private_kernel/private_kernel_execution_prover.ts @@ -260,20 +260,20 @@ export class PrivateKernelExecutionProver { // TODO: Enable padding once we better understand the final amounts to pad to. const paddedSideEffectAmounts = PaddedSideEffectAmounts.empty(); - // Use the aggregated includeByTimestamp set throughout the tx execution. - // TODO: Call `computeTxIncludeByTimestamp` to round the value down and reduce precision, improving privacy. - const includeByTimestampUpperBound = previousKernelData.publicInputs.includeByTimestamp; + // Use the aggregated expirationTimestamp set throughout the tx execution. + // TODO: Call `computeTxExpirationTimestamp` to round the value down and reduce precision, improving privacy. + const expirationTimestampUpperBound = previousKernelData.publicInputs.expirationTimestamp; const anchorBlockTimestamp = previousKernelData.publicInputs.constants.anchorBlockHeader.globalVariables.timestamp; - if (includeByTimestampUpperBound <= anchorBlockTimestamp) { + if (expirationTimestampUpperBound <= anchorBlockTimestamp) { throw new Error( - `Include-by timestamp must be greater than the anchor block timestamp. Anchor block timestamp: ${anchorBlockTimestamp}. Include-by timestamp: ${includeByTimestampUpperBound}.`, + `Include-by timestamp must be greater than the anchor block timestamp. Anchor block timestamp: ${anchorBlockTimestamp}. Include-by timestamp: ${expirationTimestampUpperBound}.`, ); } const privateInputs = new PrivateKernelTailCircuitPrivateInputs( previousKernelData, paddedSideEffectAmounts, - includeByTimestampUpperBound, + expirationTimestampUpperBound, ); const witgenTimer = new Timer(); diff --git a/yarn-project/pxe/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.test.ts b/yarn-project/pxe/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.test.ts index 0eb57894e675..7a19c393ae72 100644 --- a/yarn-project/pxe/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.test.ts +++ b/yarn-project/pxe/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.test.ts @@ -1,4 +1,4 @@ -import { MAX_INCLUDE_BY_TIMESTAMP_DURATION } from '@aztec/constants'; +import { MAX_TX_LIFETIME } from '@aztec/constants'; import { BlockNumber } from '@aztec/foundation/branded-types'; import { Fr } from '@aztec/foundation/curves/bn254'; import { openTmpStore } from '@aztec/kv-store/lmdb-v2'; @@ -113,7 +113,7 @@ describe('loadPrivateLogsForSenderRecipientPair', () => { it('loads log and updates both highest aged and highest finalized indexes', async () => { const finalizedBlockNumber = 10; - const logBlockTimestamp = currentTimestamp - BigInt(MAX_INCLUDE_BY_TIMESTAMP_DURATION) - 1000n; // aged + const logBlockTimestamp = currentTimestamp - BigInt(MAX_TX_LIFETIME) - 1000n; // aged const logIndex = 7; const logTag = await computeSiloedTagForIndex(logIndex); @@ -148,7 +148,7 @@ describe('loadPrivateLogsForSenderRecipientPair', () => { it('logs at boundaries are properly loaded, window and highest indexes advance as expected', async () => { const finalizedBlockNumber = 10; - const log1BlockTimestamp = currentTimestamp - BigInt(MAX_INCLUDE_BY_TIMESTAMP_DURATION) - 1000n; // Aged + const log1BlockTimestamp = currentTimestamp - BigInt(MAX_TX_LIFETIME) - 1000n; // Aged const log2BlockTimestamp = currentTimestamp - 5000n; // Not aged const highestAgedIndex = 3; const highestFinalizedIndex = 5; diff --git a/yarn-project/pxe/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts b/yarn-project/pxe/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts index 68b85d03d0a5..de527f8a7f61 100644 --- a/yarn-project/pxe/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +++ b/yarn-project/pxe/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts @@ -30,7 +30,7 @@ export async function loadPrivateLogsForSenderRecipientPair( // (highestAgedIndex, highestFinalizedIndex + WINDOW_LEN] // // highestAgedIndex is the highest index that was used in a tx that is included in a block at least - // `MAX_INCLUDE_BY_TIMESTAMP_DURATION` seconds ago. + // `MAX_TX_LIFETIME` seconds ago. // highestFinalizedIndex is the highest index that was used in a tx that is included in a finalized block. // // "(" denotes an open end of the range - the index is not included in the range. @@ -42,19 +42,19 @@ export async function loadPrivateLogsForSenderRecipientPair( // ever appear. // // This relies on the "maximum inclusion timestamp" rule enforced by the kernel and rollup circuits: - // - a transaction's maximum inclusion timestamp is at most `MAX_INCLUDE_BY_TIMESTAMP_DURATION` seconds after + // - a transaction's maximum inclusion timestamp is at most `MAX_TX_LIFETIME` seconds after // the timestamp of its anchor block; and // - a rollup only includes transactions whose inclusion timestamp is >= the L2 block's timestamp. // // Suppose some device used index `I` in a transaction anchored to block `B_N` at time `N`, and that block is now at - // least `MAX_INCLUDE_BY_TIMESTAMP_DURATION` seconds in the past. Then there is no possibility of any *other* device + // least `MAX_TX_LIFETIME` seconds in the past. Then there is no possibility of any *other* device // trying to use an index <= `I` while anchoring to a *newer* block than `B_N` because if we were anchoring to // a newer block than `B_N` then we would already have seen the log with index `I` and hence the device would have // chosen a larger index. // If that *other* device would anchor to a block older than `B_N` then that tx could never be included in a block // because it would already have been expired. // - // Therefore, once we see that index `I` has been used in a block that is at least `MAX_INCLUDE_BY_TIMESTAMP_DURATION` + // Therefore, once we see that index `I` has been used in a block that is at least `MAX_TX_LIFETIME` // seconds old, we can safely stop syncing logs for all indexes <= `I` and set highestAgedIndex = `I`. // // ## Explanation of the upper bound `highestFinalizedIndex + WINDOW_LEN` diff --git a/yarn-project/pxe/src/tagging/recipient_sync/utils/find_highest_indexes.test.ts b/yarn-project/pxe/src/tagging/recipient_sync/utils/find_highest_indexes.test.ts index 73adcd51f51d..2667029abaf7 100644 --- a/yarn-project/pxe/src/tagging/recipient_sync/utils/find_highest_indexes.test.ts +++ b/yarn-project/pxe/src/tagging/recipient_sync/utils/find_highest_indexes.test.ts @@ -1,4 +1,4 @@ -import { MAX_INCLUDE_BY_TIMESTAMP_DURATION } from '@aztec/constants'; +import { MAX_TX_LIFETIME } from '@aztec/constants'; import { TxScopedL2Log } from '@aztec/stdlib/logs'; import { randomTxScopedPrivateL2Log } from '@aztec/stdlib/testing'; @@ -24,7 +24,7 @@ describe('findHighestIndexes', () => { it('returns undefined for highestFinalizedIndex when no logs are in finalized blocks', () => { const finalizedBlockNumber = 5; - const blockTimestamp = currentTimestamp - BigInt(MAX_INCLUDE_BY_TIMESTAMP_DURATION); + const blockTimestamp = currentTimestamp - BigInt(MAX_TX_LIFETIME); const log = makeLog(10, blockTimestamp); // block 10 > finalizedBlockNumber 5 const result = findHighestIndexes([{ log, taggingIndex: 3 }], currentTimestamp, finalizedBlockNumber); @@ -35,8 +35,8 @@ describe('findHighestIndexes', () => { it('selects the highest index from multiple aged logs', () => { const finalizedBlockNumber = 10; - const blockTimestamp1 = currentTimestamp - BigInt(MAX_INCLUDE_BY_TIMESTAMP_DURATION) - 1000n; // aged - const blockTimestamp2 = currentTimestamp - BigInt(MAX_INCLUDE_BY_TIMESTAMP_DURATION) - 500n; // aged + const blockTimestamp1 = currentTimestamp - BigInt(MAX_TX_LIFETIME) - 1000n; // aged + const blockTimestamp2 = currentTimestamp - BigInt(MAX_TX_LIFETIME) - 500n; // aged const log1 = makeLog(5, blockTimestamp1); const log2 = makeLog(6, blockTimestamp2); @@ -77,8 +77,8 @@ describe('findHighestIndexes', () => { it('handles mixed scenarios with multiple logs of different types', () => { const finalizedBlockNumber = 10; - const veryOldTimestamp = currentTimestamp - BigInt(MAX_INCLUDE_BY_TIMESTAMP_DURATION) * 2n - 1000n; // Aged - const oldTimestamp = currentTimestamp - BigInt(MAX_INCLUDE_BY_TIMESTAMP_DURATION) - 1000n; // Aged + const veryOldTimestamp = currentTimestamp - BigInt(MAX_TX_LIFETIME) * 2n - 1000n; // Aged + const oldTimestamp = currentTimestamp - BigInt(MAX_TX_LIFETIME) - 1000n; // Aged const recentTimestamp = currentTimestamp - 5000n; // Not aged const logs = [ diff --git a/yarn-project/pxe/src/tagging/recipient_sync/utils/find_highest_indexes.ts b/yarn-project/pxe/src/tagging/recipient_sync/utils/find_highest_indexes.ts index 7306931a3634..f863365a80e7 100644 --- a/yarn-project/pxe/src/tagging/recipient_sync/utils/find_highest_indexes.ts +++ b/yarn-project/pxe/src/tagging/recipient_sync/utils/find_highest_indexes.ts @@ -1,4 +1,4 @@ -import { MAX_INCLUDE_BY_TIMESTAMP_DURATION } from '@aztec/constants'; +import { MAX_TX_LIFETIME } from '@aztec/constants'; import type { TxScopedL2Log } from '@aztec/stdlib/logs'; /** @@ -16,7 +16,7 @@ export function findHighestIndexes( const ageInSeconds = currentTimestamp - log.blockTimestamp; if ( - ageInSeconds >= BigInt(MAX_INCLUDE_BY_TIMESTAMP_DURATION) && + ageInSeconds >= BigInt(MAX_TX_LIFETIME) && (highestAgedIndex === undefined || taggingIndex > highestAgedIndex) ) { highestAgedIndex = taggingIndex; diff --git a/yarn-project/simulator/src/public/fixtures/utils.ts b/yarn-project/simulator/src/public/fixtures/utils.ts index 1b948aefa651..c058c9d7c128 100644 --- a/yarn-project/simulator/src/public/fixtures/utils.ts +++ b/yarn-project/simulator/src/public/fixtures/utils.ts @@ -134,13 +134,13 @@ export async function createTxForPublicCalls( const txContext = new TxContext(Fr.zero(), Fr.zero(), gasSettings); const header = BlockHeader.empty({ globalVariables: globals }); const constantData = new TxConstantData(header, txContext, Fr.zero(), Fr.zero()); - const includeByTimestamp = 0n; // Not used in the simulator. + const expirationTimestamp = 0n; // Not used in the simulator. const txData = new PrivateKernelTailCircuitPublicInputs( constantData, /*gasUsed=*/ gasUsedByPrivate, feePayer, - includeByTimestamp, + expirationTimestamp, forPublic, ); @@ -171,13 +171,13 @@ export async function createTxForPrivateOnly( const gasSettings = new GasSettings(gasLimits, Gas.empty(), maxFeesPerGas, GasFees.empty()); const txContext = new TxContext(Fr.zero(), Fr.zero(), gasSettings); const constantData = new TxConstantData(BlockHeader.empty(), txContext, Fr.zero(), Fr.zero()); - const includeByTimestamp = 0n; // Not used in the simulator. + const expirationTimestamp = 0n; // Not used in the simulator. const txData = new PrivateKernelTailCircuitPublicInputs( constantData, /*gasUsed=*/ gasUsedByPrivate, feePayer, - includeByTimestamp, + expirationTimestamp, /*forPublic=*/ undefined, forRollup, ); diff --git a/yarn-project/simulator/src/public/fuzzing/avm_fuzzer_simulator.ts b/yarn-project/simulator/src/public/fuzzing/avm_fuzzer_simulator.ts index a0eb39022a95..d55c1c030907 100644 --- a/yarn-project/simulator/src/public/fuzzing/avm_fuzzer_simulator.ts +++ b/yarn-project/simulator/src/public/fuzzing/avm_fuzzer_simulator.ts @@ -146,7 +146,7 @@ async function createTxFromHint(cppTx: AvmTxHint): Promise { constants, cppTx.gasUsedByPrivate, cppTx.feePayer, - 0n, // includeByTimestamp + 0n, // expirationTimestamp forPublic, undefined, // forRollup - not needed for public simulation ); diff --git a/yarn-project/stdlib/src/interfaces/aztec-node.ts b/yarn-project/stdlib/src/interfaces/aztec-node.ts index c7aa938e9fe9..34b8639eee7f 100644 --- a/yarn-project/stdlib/src/interfaces/aztec-node.ts +++ b/yarn-project/stdlib/src/interfaces/aztec-node.ts @@ -443,7 +443,7 @@ export interface AztecNode /** * Returns true if the transaction is valid for inclusion at the current state. Valid transactions can be * made invalid by *other* transactions if e.g. they emit the same nullifiers, or come become invalid - * due to e.g. the include_by_timestamp property. + * due to e.g. the expiration_timestamp property. * @param tx - The transaction to validate for correctness. * @param isSimulation - True if the transaction is a simulated one without generated proofs. (Optional) * @param skipFeeEnforcement - True if the validation of the fee should be skipped. Useful when the simulation is for estimating fee (Optional) diff --git a/yarn-project/stdlib/src/kernel/private_circuit_public_inputs.ts b/yarn-project/stdlib/src/kernel/private_circuit_public_inputs.ts index c76e34dcf2d6..f95c3861c20d 100644 --- a/yarn-project/stdlib/src/kernel/private_circuit_public_inputs.ts +++ b/yarn-project/stdlib/src/kernel/private_circuit_public_inputs.ts @@ -80,7 +80,7 @@ export class PrivateCircuitPublicInputs { /** * The highest timestamp of a block in which the transaction can still be included. */ - public includeByTimestamp: UInt64, + public expirationTimestamp: UInt64, /** * The side effect counter at the start of this call. */ @@ -263,7 +263,7 @@ export class PrivateCircuitPublicInputs { this.txContext.isEmpty() && this.minRevertibleSideEffectCounter.isZero() && !this.isFeePayer && - !this.includeByTimestamp && + !this.expirationTimestamp && this.startSideEffectCounter.isZero() && this.endSideEffectCounter.isZero() && this.expectedNonRevertibleSideEffectCounter.isZero() && @@ -296,7 +296,7 @@ export class PrivateCircuitPublicInputs { fields.txContext, fields.minRevertibleSideEffectCounter, fields.isFeePayer, - fields.includeByTimestamp, + fields.expirationTimestamp, fields.startSideEffectCounter, fields.endSideEffectCounter, fields.expectedNonRevertibleSideEffectCounter, @@ -330,7 +330,7 @@ export class PrivateCircuitPublicInputs { this.txContext, this.minRevertibleSideEffectCounter, this.isFeePayer, - bigintToUInt64BE(this.includeByTimestamp), + bigintToUInt64BE(this.expirationTimestamp), this.startSideEffectCounter, this.endSideEffectCounter, this.expectedNonRevertibleSideEffectCounter, diff --git a/yarn-project/stdlib/src/kernel/private_kernel_circuit_public_inputs.ts b/yarn-project/stdlib/src/kernel/private_kernel_circuit_public_inputs.ts index f05d5fae705a..efc82b4c4d1a 100644 --- a/yarn-project/stdlib/src/kernel/private_kernel_circuit_public_inputs.ts +++ b/yarn-project/stdlib/src/kernel/private_kernel_circuit_public_inputs.ts @@ -41,7 +41,7 @@ export class PrivateKernelCircuitPublicInputs { /** * The timestamp by which the transaction must be included in a block. */ - public includeByTimestamp: UInt64, + public expirationTimestamp: UInt64, /** * Wether this is a private only tx or not */ @@ -72,7 +72,7 @@ export class PrivateKernelCircuitPublicInputs { this.end, this.publicTeardownCallRequest, this.feePayer, - bigintToUInt64BE(this.includeByTimestamp), + bigintToUInt64BE(this.expirationTimestamp), this.isPrivateOnly, this.claimedFirstNullifier, this.claimedRevertibleCounter, diff --git a/yarn-project/stdlib/src/kernel/private_kernel_tail_circuit_private_inputs.ts b/yarn-project/stdlib/src/kernel/private_kernel_tail_circuit_private_inputs.ts index d070c5b45a18..6c6469d4116b 100644 --- a/yarn-project/stdlib/src/kernel/private_kernel_tail_circuit_private_inputs.ts +++ b/yarn-project/stdlib/src/kernel/private_kernel_tail_circuit_private_inputs.ts @@ -20,7 +20,7 @@ export class PrivateKernelTailCircuitPrivateInputs { /** * The timestamp by which the transaction must be included in a block. */ - public includeByTimestampUpperBound: UInt64, + public expirationTimestampUpperBound: UInt64, ) {} isForPublic() { @@ -38,7 +38,7 @@ export class PrivateKernelTailCircuitPrivateInputs { return serializeToBuffer( this.previousKernel, this.paddedSideEffectAmounts, - bigintToUInt64BE(this.includeByTimestampUpperBound), + bigintToUInt64BE(this.expirationTimestampUpperBound), ); } diff --git a/yarn-project/stdlib/src/kernel/private_kernel_tail_circuit_public_inputs.ts b/yarn-project/stdlib/src/kernel/private_kernel_tail_circuit_public_inputs.ts index 96d0ce636d42..b3b8b8f79f4a 100644 --- a/yarn-project/stdlib/src/kernel/private_kernel_tail_circuit_public_inputs.ts +++ b/yarn-project/stdlib/src/kernel/private_kernel_tail_circuit_public_inputs.ts @@ -116,7 +116,7 @@ export class PrivateKernelTailCircuitPublicInputs { /** * The timestamp by which the transaction must be included in a block. */ - public includeByTimestamp: UInt64, + public expirationTimestamp: UInt64, public forPublic?: PartialPrivateTailPublicInputsForPublic, public forRollup?: PartialPrivateTailPublicInputsForRollup, @@ -146,7 +146,7 @@ export class PrivateKernelTailCircuitPublicInputs { this.constants.getSize() + this.gasUsed.getSize() + this.feePayer.size + - 8 // includeByTimestamp + 8 // expirationTimestamp ); } @@ -161,7 +161,7 @@ export class PrivateKernelTailCircuitPublicInputs { this.forPublic.publicTeardownCallRequest, this.gasUsed, this.feePayer, - this.includeByTimestamp, + this.expirationTimestamp, ); } @@ -180,7 +180,7 @@ export class PrivateKernelTailCircuitPublicInputs { this.forRollup.end, this.gasUsed, this.feePayer, - this.includeByTimestamp, + this.expirationTimestamp, ); } @@ -298,7 +298,7 @@ export class PrivateKernelTailCircuitPublicInputs { this.constants, this.gasUsed, this.feePayer, - bigintToUInt64BE(this.includeByTimestamp), + bigintToUInt64BE(this.expirationTimestamp), isForPublic ? this.forPublic!.toBuffer() : this.forRollup!.toBuffer(), ); } diff --git a/yarn-project/stdlib/src/kernel/private_to_public_kernel_circuit_public_inputs.ts b/yarn-project/stdlib/src/kernel/private_to_public_kernel_circuit_public_inputs.ts index 251fa48b9d2f..0a5bce2ac0c4 100644 --- a/yarn-project/stdlib/src/kernel/private_to_public_kernel_circuit_public_inputs.ts +++ b/yarn-project/stdlib/src/kernel/private_to_public_kernel_circuit_public_inputs.ts @@ -21,7 +21,7 @@ export class PrivateToPublicKernelCircuitPublicInputs { public publicTeardownCallRequest: PublicCallRequest, public gasUsed: Gas, public feePayer: AztecAddress, - public includeByTimestamp: UInt64, + public expirationTimestamp: UInt64, ) {} toBuffer() { @@ -32,7 +32,7 @@ export class PrivateToPublicKernelCircuitPublicInputs { this.publicTeardownCallRequest, this.gasUsed, this.feePayer, - bigintToUInt64BE(this.includeByTimestamp), + bigintToUInt64BE(this.expirationTimestamp), ); } @@ -44,7 +44,7 @@ export class PrivateToPublicKernelCircuitPublicInputs { fields.publicTeardownCallRequest, fields.gasUsed, fields.feePayer, - fields.includeByTimestamp, + fields.expirationTimestamp, ] as const; } diff --git a/yarn-project/stdlib/src/kernel/private_to_rollup_kernel_circuit_public_inputs.ts b/yarn-project/stdlib/src/kernel/private_to_rollup_kernel_circuit_public_inputs.ts index cd8a3439bd68..551cc038e176 100644 --- a/yarn-project/stdlib/src/kernel/private_to_rollup_kernel_circuit_public_inputs.ts +++ b/yarn-project/stdlib/src/kernel/private_to_rollup_kernel_circuit_public_inputs.ts @@ -37,7 +37,7 @@ export class PrivateToRollupKernelCircuitPublicInputs { /** * The timestamp by which the transaction must be included in a block. */ - public includeByTimestamp: UInt64, + public expirationTimestamp: UInt64, ) {} getNonEmptyNullifiers() { @@ -50,7 +50,7 @@ export class PrivateToRollupKernelCircuitPublicInputs { this.end, this.gasUsed, this.feePayer, - bigintToUInt64BE(this.includeByTimestamp), + bigintToUInt64BE(this.expirationTimestamp), ); } @@ -94,7 +94,7 @@ export class PrivateToRollupKernelCircuitPublicInputs { } static getFields(fields: FieldsOf) { - return [fields.constants, fields.end, fields.gasUsed, fields.feePayer, fields.includeByTimestamp] as const; + return [fields.constants, fields.end, fields.gasUsed, fields.feePayer, fields.expirationTimestamp] as const; } /** Creates an instance from a hex string. */ diff --git a/yarn-project/stdlib/src/tests/factories.ts b/yarn-project/stdlib/src/tests/factories.ts index 317a5b90ab1c..c3aaa0ea76b1 100644 --- a/yarn-project/stdlib/src/tests/factories.ts +++ b/yarn-project/stdlib/src/tests/factories.ts @@ -656,7 +656,7 @@ function makeClaimedLengthArray( */ export function makePrivateCircuitPublicInputs(seed = 0): PrivateCircuitPublicInputs { return PrivateCircuitPublicInputs.from({ - includeByTimestamp: BigInt(seed + 0x31415), + expirationTimestamp: BigInt(seed + 0x31415), callContext: makeCallContext(seed, { isStaticCall: true }), argsHash: fr(seed + 0x100), returnsHash: fr(seed + 0x200), diff --git a/yarn-project/stdlib/src/tests/mocks.ts b/yarn-project/stdlib/src/tests/mocks.ts index e50c78fa0ce7..6ce72b3563de 100644 --- a/yarn-project/stdlib/src/tests/mocks.ts +++ b/yarn-project/stdlib/src/tests/mocks.ts @@ -2,9 +2,9 @@ import { FIXED_DA_GAS, FIXED_L2_GAS, MAX_ENQUEUED_CALLS_PER_TX, - MAX_INCLUDE_BY_TIMESTAMP_DURATION, MAX_NULLIFIERS_PER_TX, MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, + MAX_TX_LIFETIME, } from '@aztec/constants'; import { type FieldsOf, makeTuple } from '@aztec/foundation/array'; import { BlockNumber, CheckpointNumber, IndexWithinCheckpoint, SlotNumber } from '@aztec/foundation/branded-types'; @@ -139,8 +139,8 @@ export const mockTx = async ( data.constants.vkTreeRoot = vkTreeRoot; data.constants.protocolContractsHash = protocolContractsHash; - // Set includeByTimestamp to the maximum allowed duration from the current time. - data.includeByTimestamp = BigInt(Math.floor(Date.now() / 1000) + MAX_INCLUDE_BY_TIMESTAMP_DURATION); + // Set expirationTimestamp to the maximum allowed duration from the current time. + data.expirationTimestamp = BigInt(Math.floor(Date.now() / 1000) + MAX_TX_LIFETIME); const publicFunctionCalldata: HashedValues[] = []; if (!isForPublic) { diff --git a/yarn-project/stdlib/src/tx/validator/error_texts.ts b/yarn-project/stdlib/src/tx/validator/error_texts.ts index 8979941960fd..30f4867d209f 100644 --- a/yarn-project/stdlib/src/tx/validator/error_texts.ts +++ b/yarn-project/stdlib/src/tx/validator/error_texts.ts @@ -12,7 +12,7 @@ export const TX_ERROR_DUPLICATE_NULLIFIER_IN_TX = 'Duplicate nullifier in tx'; export const TX_ERROR_EXISTING_NULLIFIER = 'Existing nullifier'; // Metadata -export const TX_ERROR_INVALID_INCLUDE_BY_TIMESTAMP = 'Invalid expiration timestamp'; +export const TX_ERROR_INVALID_EXPIRATION_TIMESTAMP = 'Invalid expiration timestamp'; export const TX_ERROR_INCORRECT_L1_CHAIN_ID = 'Incorrect L1 chain id'; export const TX_ERROR_INCORRECT_ROLLUP_VERSION = 'Incorrect rollup version'; export const TX_ERROR_INCORRECT_VK_TREE_ROOT = 'Incorrect verification keys tree root'; diff --git a/yarn-project/txe/src/oracle/txe_oracle_top_level_context.ts b/yarn-project/txe/src/oracle/txe_oracle_top_level_context.ts index ec5e13e7f37c..29ec046bec14 100644 --- a/yarn-project/txe/src/oracle/txe_oracle_top_level_context.ts +++ b/yarn-project/txe/src/oracle/txe_oracle_top_level_context.ts @@ -591,7 +591,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl constantData, /*gasUsed=*/ new Gas(0, 0), /*feePayer=*/ AztecAddress.zero(), - /*includeByTimestamp=*/ 0n, + /*expirationTimestamp=*/ 0n, inputsForPublic, undefined, );