Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{
context::{PublicContext, PrivateContext},
context::{PublicContext, PrivateContext, UnconstrainedContext},
state_vars::shared_mutable::{
shared_mutable::SharedMutable, scheduled_value_change::ScheduledValueChange,
scheduled_delay_change::ScheduledDelayChange
Expand Down Expand Up @@ -33,6 +33,10 @@ fn in_private(
SharedMutable::new(&mut env.private_at(historical_block_number), storage_slot)
}

fn in_unconstrained(env: TestEnvironment) -> SharedMutable<Field, TEST_INITIAL_DELAY, UnconstrainedContext> {
SharedMutable::new(env.unkonstrained(), storage_slot)
}

#[test]
fn test_get_current_value_in_public_initial() {
let env = setup();
Expand Down
14 changes: 14 additions & 0 deletions noir-projects/aztec-nr/aztec/src/test/helpers/cheatcodes.nr
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ unconstrained pub fn reset() {
oracle_reset();
}

unconstrained pub fn get_chain_id() -> Field {
oracle_get_chain_id()
}

unconstrained pub fn get_version() -> Field {
oracle_get_version()
}

unconstrained pub fn get_contract_address() -> AztecAddress {
oracle_get_contract_address()
}
Expand Down Expand Up @@ -112,6 +120,12 @@ unconstrained pub fn set_fn_selector(selector: FunctionSelector) {
#[oracle(reset)]
fn oracle_reset() {}

#[oracle(getChainId)]
fn oracle_get_chain_id() -> Field {}

#[oracle(getVersion)]
fn oracle_get_version() -> Field {}

#[oracle(getContractAddress)]
fn oracle_get_contract_address() -> AztecAddress {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use dep::protocol_types::{
use crate::context::inputs::{PublicContextInputs, PrivateContextInputs};
use crate::context::{packed_returns::PackedReturns, call_interfaces::CallInterface};

use crate::context::{PrivateContext, PublicContext, PrivateVoidCallInterface};
use crate::context::{PrivateContext, PublicContext, UnconstrainedContext, PrivateVoidCallInterface};
use crate::test::helpers::{cheatcodes, utils::{apply_side_effects_private, Deployer, TestAccount}, keys};
use crate::keys::constants::{NULLIFIER_INDEX, INCOMING_INDEX, OUTGOING_INDEX, TAGGING_INDEX};
use crate::hash::{hash_args, hash_args_array};
Expand Down Expand Up @@ -56,6 +56,11 @@ impl TestEnvironment {
self.private_at(cheatcodes::get_block_number())
}

// unconstrained is a key word, so we mis-spell purposefully here, like we do with contrakt
Comment thread
nventuro marked this conversation as resolved.
fn unkonstrained(self) -> UnconstrainedContext {
UnconstrainedContext::new()
Comment thread
nventuro marked this conversation as resolved.
}

fn private_at(&mut self, historical_block_number: u32) -> PrivateContext {
if historical_block_number >= cheatcodes::get_block_number() {
self.advance_block_to(historical_block_number + 1);
Expand Down