Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: TXE #6985

Merged
merged 70 commits into from
Jun 18, 2024
Merged
Changes from 1 commit
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
39e88bf
Adapt public immutable
nventuro May 30, 2024
de4dfef
Add comments to private imnmutable
nventuro May 31, 2024
584250d
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Jun 3, 2024
8c5bdf1
TXE
Thunkar Jun 3, 2024
3fbc3ee
improvements
Thunkar Jun 3, 2024
58c4c82
fixed tsconfig
Thunkar Jun 3, 2024
84af5e8
public data tree witness
Thunkar Jun 3, 2024
aab9959
return null
Thunkar Jun 3, 2024
c94d32e
more oracle calls
Thunkar Jun 4, 2024
5d857ae
more oracles, timetravel
Thunkar Jun 4, 2024
717a16a
fix
Thunkar Jun 4, 2024
58e7bfa
Sketch nr tests for txe testing
nventuro Jun 4, 2024
d543edf
fix
Thunkar Jun 4, 2024
92b9a48
Begin test refactor
nventuro Jun 4, 2024
c6fdef6
fix
Thunkar Jun 4, 2024
b29b3a4
fixes
Thunkar Jun 4, 2024
6628ab0
fix
Thunkar Jun 4, 2024
460a1d1
private context inputs
Thunkar Jun 4, 2024
069a09a
return struct
Thunkar Jun 4, 2024
7edc719
fix
Thunkar Jun 4, 2024
f2820a7
configurable private inputs
Thunkar Jun 4, 2024
cbe1564
???
nventuro Jun 4, 2024
2250b98
???
nventuro Jun 4, 2024
45434f9
fixes
Thunkar Jun 4, 2024
c180bdb
git add .
nventuro Jun 4, 2024
a34bf85
fixes and moar
Thunkar Jun 4, 2024
fdbeaf8
note handling
Thunkar Jun 4, 2024
12453ea
Samples
nventuro Jun 5, 2024
fdd5cf1
Add address fixes
nventuro Jun 7, 2024
ff3fa71
almost there
Thunkar Jun 7, 2024
ea506ab
working proto
Thunkar Jun 7, 2024
562e92e
initial txe version
Thunkar Jun 10, 2024
e037804
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Jun 10, 2024
21f3178
removed file
Thunkar Jun 10, 2024
c543a2c
Add TXE
nventuro Jun 10, 2024
0d1221a
Merge branch 'gj_nv/txe' of github.com:AztecProtocol/aztec-packages i…
Thunkar Jun 10, 2024
6083ade
fixes
Thunkar Jun 10, 2024
b80f6c7
fixes
Thunkar Jun 10, 2024
ca42523
account abstraction
Thunkar Jun 11, 2024
38fb77e
reverted parallel changes since we have session ids now
Thunkar Jun 11, 2024
dc373da
Merge branch 'master' into gj_nv/txe
Thunkar Jun 11, 2024
85b7dec
updated tsconfig
Thunkar Jun 11, 2024
84292d0
Merge branch 'master' into gj_nv/txe
Thunkar Jun 11, 2024
907e26d
external calls
Thunkar Jun 12, 2024
5a92553
private calls
Thunkar Jun 12, 2024
8b278a1
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Jun 12, 2024
cf027a2
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Jun 12, 2024
5e9486e
public initializers
Thunkar Jun 13, 2024
bbeaa00
34 token transfer
Thunkar Jun 13, 2024
963990a
cleanup
Thunkar Jun 14, 2024
a68fec7
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Jun 14, 2024
44d63aa
sessionId compatibility
Thunkar Jun 14, 2024
9f1dbe6
corrected docs
Thunkar Jun 14, 2024
93f32d0
cleanup
Thunkar Jun 14, 2024
19123bd
formatting
Thunkar Jun 14, 2024
35fe257
better comment
Thunkar Jun 14, 2024
e41a19c
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Jun 14, 2024
1ccfe4f
Merge branch 'master' into gj_nv/txe
Thunkar Jun 14, 2024
eb48006
Merge branch 'master' into gj_nv/txe
Thunkar Jun 17, 2024
cca4e8c
test ci
Thunkar Jun 17, 2024
83c16e5
Merge branch 'gj_nv/txe' of github.com:AztecProtocol/aztec-packages i…
Thunkar Jun 17, 2024
f564d92
working CI
Thunkar Jun 17, 2024
083b1f8
better dockerfile
Thunkar Jun 17, 2024
2155e79
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Jun 18, 2024
c583065
Merge branch 'master' into gj_nv/txe
Thunkar Jun 18, 2024
ab5e0e9
nargo fmt
Thunkar Jun 18, 2024
44669d9
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Jun 18, 2024
39b5f76
comments from PR
Thunkar Jun 18, 2024
9e0ac91
kill txe even if nargo test fails
Thunkar Jun 18, 2024
fa744a5
Merge branch 'master' into gj_nv/txe
Thunkar Jun 18, 2024
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
Prev Previous commit
Next Next commit
Samples
  • Loading branch information
nventuro committed Jun 5, 2024
commit 12453eae864f6bc3def7d2f06c2ef83227f56a31
2 changes: 1 addition & 1 deletion noir-projects/aztec-nr/aztec/src/note/note_getter/test.nr
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ use crate::{
};
use dep::protocol_types::address::AztecAddress;

use crate::test::{helpers::{context_builder::TestEnvironment, cheatcodes}, mocks::mock_note::MockNote};
use crate::test::{helpers::{test_environment::TestEnvironment, cheatcodes}, mocks::mock_note::MockNote};

global contract_address = AztecAddress::from_field(69);
global storage_slot: Field = 42;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use dep::protocol_types::{address::AztecAddress, grumpkin_point::GrumpkinPoint};
use crate::{context::PrivateContext, state_vars::private_mutable::PrivateMutable};
use crate::test::{mocks::mock_note::MockNote, helpers::context_builder::TestEnvironment};
use crate::test::{mocks::mock_note::MockNote, helpers::test_environment::TestEnvironment};
use dep::std::{unsafe::zeroed, test::OracleMock};

global contract_address = AztecAddress::from_field(13);
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::{context::PublicContext, state_vars::public_immutable::PublicImmutable};
use crate::test::{helpers::context_builder::TestEnvironment, mocks::mock_struct::MockStruct};
use dep::std::test::OracleMock;
use crate::test::{helpers::test_environment::TestEnvironment, mocks::mock_struct::MockStruct};
use dep::protocol_types::traits::Serialize;

global storage_slot = 7;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this just to have "some" value? Seems to be used just in the in_public but guess it is nicer to have it clearly named here 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as previous

136 changes: 70 additions & 66 deletions noir-projects/aztec-nr/aztec/src/state_vars/shared_mutable/test.nr
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
use dep::std::{merkle::compute_merkle_root, test::OracleMock};

use crate::{
context::{PublicContext, PrivateContext},
state_vars::shared_mutable::{
shared_mutable::SharedMutable, scheduled_value_change::ScheduledValueChange,
scheduled_delay_change::ScheduledDelayChange
},
test::helpers::context_builder::TestEnvironment, oracle::get_public_data_witness::PublicDataWitness
context::{PublicContext, PrivateContext}, state_vars::shared_mutable::shared_mutable::SharedMutable,
test::helpers::test_environment::TestEnvironment
};

use dep::protocol_types::{
constants::{GENERATOR_INDEX__PUBLIC_LEAF_INDEX, PUBLIC_DATA_TREE_HEIGHT}, hash::pedersen_hash,
address::AztecAddress, public_data_tree_leaf_preimage::PublicDataTreeLeafPreimage
};
use dep::protocol_types::address::AztecAddress;

global new_value = 57;

@@ -21,7 +12,7 @@ global post_delay = 15;

global storage_slot = 57;

global TEST_INITIAL_DELAY: u32 = 3;
global TEST_INITIAL_DELAY: u32 = 30;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty wild to see so long delays without it totally nuking testing time 😎


fn setup() -> TestEnvironment {
TestEnvironment::new()
@@ -92,6 +83,71 @@ fn test_get_current_value_in_public_after_scheduled_change() {
assert_eq(state_var.get_current_value_in_public(), new_value);
}

#[test]
fn test_get_current_value_in_private_before_change() {
let mut env = setup();

let public_state_var = in_public(env);
public_state_var.schedule_value_change(new_value);

let (_, block_of_change) = public_state_var.get_scheduled_value_in_public();

let schedule_block_number = env.block_number;

let private_state_var = in_private(&mut env, schedule_block_number);
assert_eq(private_state_var.get_current_value_in_private(), 0);
assert_eq(private_state_var.context.max_block_number.unwrap(), block_of_change - 1);
}

#[test]
fn test_get_current_value_in_private_immediately_before_change() {
let mut env = setup();

let public_state_var = in_public(env);
public_state_var.schedule_value_change(new_value);

let (_, block_of_change) = public_state_var.get_scheduled_value_in_public();

let private_state_var = in_private(&mut env, block_of_change - 1);

assert_eq(private_state_var.get_current_value_in_private(), 0);
assert_eq(private_state_var.context.max_block_number.unwrap(), block_of_change - 1);
}

#[test]
fn test_get_current_value_in_private_at_change() {
let mut env = setup();

let public_state_var = in_public(env);
public_state_var.schedule_value_change(new_value);

let (_, block_of_change) = public_state_var.get_scheduled_value_in_public();

let historical_block_number = block_of_change;
let private_state_var = in_private(&mut env, historical_block_number);
assert_eq(private_state_var.get_current_value_in_private(), new_value);
assert_eq(
private_state_var.context.max_block_number.unwrap(), historical_block_number + TEST_INITIAL_DELAY
);
}

#[test]
fn test_get_current_value_in_private_after_change() {
let mut env = setup();

let public_state_var = in_public(env);
public_state_var.schedule_value_change(new_value);

let (_, block_of_change) = public_state_var.get_scheduled_value_in_public();

let historical_block_number = block_of_change + 10;
let private_state_var = in_private(&mut env, historical_block_number);
assert_eq(private_state_var.get_current_value_in_private(), new_value);
assert_eq(
private_state_var.context.max_block_number.unwrap(), historical_block_number + TEST_INITIAL_DELAY
);
}

// #[test]
// fn test_get_current_delay_in_public() {
// let (state_var, block_number) = setup();
@@ -304,56 +360,4 @@ fn test_get_current_value_in_public_after_scheduled_change() {
// new_delay,
// block_number + post_delay - new_delay
// );
// }

#[test]
fn test_get_current_value_in_private_before_change() {
let mut env = setup();

let public_state_var = in_public(env);
public_state_var.schedule_value_change(new_value);

let schedule_block_number = env.block_number;

let private_state_var = in_private(&mut env, schedule_block_number);
assert_eq(private_state_var.get_current_value_in_private(), 0);
}

#[test]
fn test_get_current_value_in_private_immediately_before_change() {
let mut env = setup();

let state_var = in_public(env);
state_var.schedule_value_change(new_value);

let (_, block_horizon) = state_var.get_scheduled_value_in_public();

let private_state_var = in_private(&mut env, block_horizon - 1);
assert_eq(private_state_var.get_current_value_in_private(), 0);
}

#[test]
fn test_get_current_value_in_private_at_change() {
let mut env = setup();

let state_var = in_public(env);
state_var.schedule_value_change(new_value);

let (_, block_horizon) = state_var.get_scheduled_value_in_public();

let private_state_var = in_private(&mut env, block_horizon);
assert_eq(private_state_var.get_current_value_in_private(), new_value);
}

#[test]
fn test_get_current_value_in_private_after_change() {
let mut env = setup();

let state_var = in_public(env);
state_var.schedule_value_change(new_value);

let (_, block_horizon) = state_var.get_scheduled_value_in_public();

let private_state_var = in_private(&mut env, block_horizon + 10);
assert_eq(private_state_var.get_current_value_in_private(), new_value);
}
// }
2 changes: 1 addition & 1 deletion noir-projects/aztec-nr/aztec/src/test/helpers.nr
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
mod context_builder;
mod test_environment;
mod cheatcodes;
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ impl TestEnvironment {

fn private_at(&mut self, historical_block_number: u32) -> PrivateContext {
if historical_block_number >= self.block_number {
self.advance_block_to(historical_block_number + 2);
self.advance_block_to(historical_block_number + 1);
}

let mut inputs = cheatcodes::get_private_context_inputs(historical_block_number);