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
Show file tree
Hide file tree
Changes from 33 commits
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
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,5 +169,5 @@
"**/noir/noir-repo/docs/versioned_docs/**": true
},
"cmake.sourceDirectory": "${workspaceFolder}/barretenberg/cpp",
"noir.nargoPath": "./noir/noir-repo/target/release/nargo"
Thunkar marked this conversation as resolved.
Show resolved Hide resolved
"noir.nargoPath": "/mnt/user-data/grego/.nargo/bin/nargo"
}
135 changes: 101 additions & 34 deletions noir-projects/aztec-nr/aztec/src/context/call_interfaces.nr
Original file line number Diff line number Diff line change
@@ -1,20 +1,51 @@
use dep::protocol_types::{abis::function_selector::FunctionSelector, address::AztecAddress, traits::Deserialize};
use dep::protocol_types::{
abis::{function_selector::FunctionSelector, private_circuit_public_inputs::PrivateCircuitPublicInputs},
address::AztecAddress, traits::Deserialize
};

use crate::context::private_context::PrivateContext;
use crate::context::public_context::PublicContext;
use crate::context::gas::GasOpts;
use crate::context::public_context::FunctionReturns;
use crate::context::{
private_context::PrivateContext, public_context::PublicContext, gas::GasOpts,
public_context::FunctionReturns, inputs::{PrivateContextInputs, PublicContextInputs}
};

use crate::oracle::arguments;

struct PrivateCallInterface<T> {
trait CallInterface<N, T, P, Env> {
fn get_args(self) -> [Field];
Thunkar marked this conversation as resolved.
Show resolved Hide resolved
fn get_original(self) -> fn[Env](T) -> P;
fn get_selector(self) -> FunctionSelector;
fn get_name(self) -> str<N>;
}

impl<N, T, P, Env> CallInterface<N, PrivateContextInputs, PrivateCircuitPublicInputs, Env> for PrivateCallInterface<N, T, Env> {
fn get_args(self) -> [Field] {
self.args
}

fn get_original(self) -> fn[Env](PrivateContextInputs) -> PrivateCircuitPublicInputs {
self.original
}

fn get_selector(self) -> FunctionSelector {
self.selector
}

fn get_name(self) -> str<N> {
self.name
}
}

struct PrivateCallInterface<N, T, Env> {
target_contract: AztecAddress,
selector: FunctionSelector,
name: str<N>,
args_hash: Field,
args: [Field],
original: fn[Env](PrivateContextInputs) -> PrivateCircuitPublicInputs
}

impl<T> PrivateCallInterface<T> {
pub fn call<N>(self, context: &mut PrivateContext) -> T where T: Deserialize<N> {
impl<N, T, Env> PrivateCallInterface<N, T, Env> {
pub fn call<M>(self, context: &mut PrivateContext) -> T where T: Deserialize<M> {
let returns = context.call_private_function_with_packed_args(
self.target_contract,
self.selector,
Expand All @@ -26,24 +57,45 @@ impl<T> PrivateCallInterface<T> {
unpacked
}

pub fn view<N>(self, context: &mut PrivateContext) -> T where T: Deserialize<N> {
pub fn view<M>(self, context: &mut PrivateContext) -> T where T: Deserialize<M> {
let returns = context.call_private_function_with_packed_args(self.target_contract, self.selector, self.args_hash, true, false);
returns.unpack_into()
}

pub fn delegate_call<N>(self, context: &mut PrivateContext) -> T where T: Deserialize<N> {
pub fn delegate_call<M>(self, context: &mut PrivateContext) -> T where T: Deserialize<M> {
let returns = context.call_private_function_with_packed_args(self.target_contract, self.selector, self.args_hash, false, true);
returns.unpack_into()
}
}

struct PrivateVoidCallInterface {
impl<N, T, P, Env> CallInterface<N, PrivateContextInputs, PrivateCircuitPublicInputs, Env> for PrivateVoidCallInterface<N, Env> {
fn get_args(self) -> [Field] {
self.args
}

fn get_original(self) -> fn[Env](PrivateContextInputs) -> PrivateCircuitPublicInputs {
self.original
}

fn get_selector(self) -> FunctionSelector {
self.selector
}

fn get_name(self) -> str<N> {
self.name
}
}

struct PrivateVoidCallInterface<N, Env> {
target_contract: AztecAddress,
selector: FunctionSelector,
name: str<N>,
args_hash: Field,
args: [Field],
original: fn[Env](PrivateContextInputs) -> PrivateCircuitPublicInputs
}

impl PrivateVoidCallInterface {
impl<N, Env> PrivateVoidCallInterface<N, Env> {
pub fn call(self, context: &mut PrivateContext) {
context.call_private_function_with_packed_args(
self.target_contract,
Expand All @@ -63,55 +115,63 @@ impl PrivateVoidCallInterface {
}
}

struct PrivateStaticCallInterface<T> {
struct PrivateStaticCallInterface<N, T, Env> {
target_contract: AztecAddress,
selector: FunctionSelector,
name: str<N>,
args_hash: Field,
args: [Field],
original: fn[Env](PrivateContextInputs) -> PrivateCircuitPublicInputs
}

impl<T> PrivateStaticCallInterface<T> {
pub fn view<N>(self, context: &mut PrivateContext) -> T where T: Deserialize<N> {
impl<N, T, Env> PrivateStaticCallInterface<N, T, Env> {
pub fn view<M>(self, context: &mut PrivateContext) -> T where T: Deserialize<M> {
let returns = context.call_private_function_with_packed_args(self.target_contract, self.selector, self.args_hash, true, false);
returns.unpack_into()
}
}

struct PrivateStaticVoidCallInterface {
struct PrivateStaticVoidCallInterface<N, Env> {
target_contract: AztecAddress,
selector: FunctionSelector,
name: str<N>,
args_hash: Field,
args: [Field],
original: fn[Env](PrivateContextInputs) -> PrivateCircuitPublicInputs
}

impl PrivateStaticVoidCallInterface {
impl<N, Env> PrivateStaticVoidCallInterface<N, Env> {
pub fn view(self, context: &mut PrivateContext) {
context.call_private_function_with_packed_args(self.target_contract, self.selector, self.args_hash, true, false).assert_empty();
}
}

struct PublicCallInterface<T> {
struct PublicCallInterface<N, T, Env> {
target_contract: AztecAddress,
selector: FunctionSelector,
name: str<N>,
args: [Field],
gas_opts: GasOpts,
original: fn[Env](PublicContextInputs) -> T
}

impl<T> PublicCallInterface<T> {
impl<N, T, Env> PublicCallInterface<N, T, Env> {
pub fn with_gas(self: &mut Self, gas_opts: GasOpts) -> &mut Self {
self.gas_opts = gas_opts;
self
}

pub fn call<N>(self, context: &mut PublicContext) -> T where T: Deserialize<N> {
pub fn call<M>(self, context: &mut PublicContext) -> T where T: Deserialize<M> {
let returns = context.call_public_function(self.target_contract, self.selector, self.args, self.gas_opts);
returns.deserialize_into()
}

pub fn view<N>(self, context: &mut PublicContext) -> T where T: Deserialize<N> {
pub fn view<M>(self, context: &mut PublicContext) -> T where T: Deserialize<M> {
let returns = context.static_call_public_function(self.target_contract, self.selector, self.args, self.gas_opts);
returns.deserialize_into()
}

pub fn delegate_call<N>(self, context: &mut PublicContext) -> T where T: Deserialize<N> {
pub fn delegate_call<M>(self, context: &mut PublicContext) -> T where T: Deserialize<M> {
let returns = context.delegate_call_public_function(self.target_contract, self.selector, self.args);
returns.deserialize_into()
}
Expand Down Expand Up @@ -153,30 +213,32 @@ impl<T> PublicCallInterface<T> {
}
}

struct PublicVoidCallInterface {
struct PublicVoidCallInterface<N, Env> {
target_contract: AztecAddress,
selector: FunctionSelector,
name: str<N>,
args: [Field],
gas_opts: GasOpts,
original: fn[Env](PublicContextInputs) -> ()
}

impl PublicVoidCallInterface {
impl<N, Env> PublicVoidCallInterface<N, Env> {
pub fn with_gas(self: &mut Self, gas_opts: GasOpts) -> &mut Self {
self.gas_opts = gas_opts;
self
}

pub fn call<N>(self, context: &mut PublicContext) {
pub fn call(self, context: &mut PublicContext) {
let returns = context.call_public_function(self.target_contract, self.selector, self.args, self.gas_opts);
returns.assert_empty()
}

pub fn view<N>(self, context: &mut PublicContext) {
pub fn view(self, context: &mut PublicContext) {
let returns = context.static_call_public_function(self.target_contract, self.selector, self.args, self.gas_opts);
returns.assert_empty()
}

pub fn delegate_call<N>(self, context: &mut PublicContext) {
pub fn delegate_call(self, context: &mut PublicContext) {
let returns = context.delegate_call_public_function(self.target_contract, self.selector, self.args);
returns.assert_empty()
}
Expand Down Expand Up @@ -218,22 +280,25 @@ impl PublicVoidCallInterface {
}
}

struct PublicStaticCallInterface<T> {
struct PublicStaticCallInterface<N, T, Env> {
target_contract: AztecAddress,
selector: FunctionSelector,
name: str<N>,
args: [Field],
gas_opts: GasOpts,
original: fn[Env](PublicContextInputs) -> T
}

impl<T> PublicStaticCallInterface<T> {
impl<N, T, Env> PublicStaticCallInterface<N, T, Env> {
pub fn with_gas(self: &mut Self, gas_opts: GasOpts) -> &mut Self {
self.gas_opts = gas_opts;
self
}

pub fn view<N>(self, context: &mut PublicContext) -> T where T: Deserialize<N> {
pub fn view<M>(self, context: &mut PublicContext) -> T where T: Deserialize<M> {
let returns = context.static_call_public_function(self.target_contract, self.selector, self.args, self.gas_opts);
returns.deserialize_into()
let unpacked: T = returns.deserialize_into();
unpacked
}

pub fn enqueue_view(self, context: &mut PrivateContext) {
Expand All @@ -249,20 +314,22 @@ impl<T> PublicStaticCallInterface<T> {
}
}

struct PublicStaticVoidCallInterface {
struct PublicStaticVoidCallInterface<N, Env> {
target_contract: AztecAddress,
selector: FunctionSelector,
name: str<N>,
args: [Field],
gas_opts: GasOpts,
original: fn[Env](PublicContextInputs) -> ()
}

impl PublicStaticVoidCallInterface {
impl<N, Env> PublicStaticVoidCallInterface<N, Env> {
pub fn with_gas(self: &mut Self, gas_opts: GasOpts) -> &mut Self {
self.gas_opts = gas_opts;
self
}

pub fn view<N>(self, context: &mut PublicContext) {
pub fn view(self, context: &mut PublicContext) {
let returns = context.static_call_public_function(self.target_contract, self.selector, self.args, self.gas_opts);
returns.assert_empty()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ impl PrivateContext {
let request_and_generator = KeyValidationRequestAndGenerator { request, sk_app_generator: sk_generators[key_index] };
// We constrain that the pk_m_hash matches the one in the request (otherwise we could get an arbitrary
// valid key request and not the one corresponding to pk_m_hash).
assert(request.pk_m.hash() == pk_m_hash);
//assert(request.pk_m.hash() == pk_m_hash);
self.key_validation_requests_and_generators.push(request_and_generator);
self.last_key_validation_requests[key_index] = Option::some(request);
request.sk_app
Expand Down
2 changes: 1 addition & 1 deletion noir-projects/aztec-nr/aztec/src/keys/getters.nr
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ fn fetch_and_constrain_keys(address: AztecAddress) -> PublicKeys {

let computed_address = AztecAddress::compute(public_keys.hash(), partial_address);

assert(computed_address.eq(address));
//assert(computed_address.eq(address));

public_keys
}
Expand Down
Loading
Loading