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!: aztec_macros are dead, long live aztec::macros #8438

Merged
merged 103 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from 54 commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
a10676c
wip
Thunkar Sep 4, 2024
8f49fd4
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Sep 5, 2024
b73cd7e
derive serialize, contract interfaces, full private, lfg
Thunkar Sep 6, 2024
53f0e8f
almost finished storage
Thunkar Sep 6, 2024
e5a9ca1
more things working
Thunkar Sep 6, 2024
0b1c482
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Sep 12, 2024
f7d11eb
align with noir
Thunkar Sep 12, 2024
687fd85
more stuff
Thunkar Sep 12, 2024
3305098
separated note interface + arithmetic generics
Thunkar Sep 12, 2024
09ff34e
the witch is dead
Thunkar Sep 13, 2024
4e81f4d
towards token_contract
Thunkar Sep 13, 2024
b23d25c
fixes
Thunkar Sep 16, 2024
aac230d
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Sep 16, 2024
14a2fd1
heck yeah
Thunkar Sep 16, 2024
bc3c873
almost there
Thunkar Sep 16, 2024
e55f2cd
removed dumb helper
Thunkar Sep 16, 2024
1b7e294
first pass at all contracts
Thunkar Sep 16, 2024
0087534
contract fixin'
Thunkar Sep 16, 2024
f033fcc
more fixin
Thunkar Sep 17, 2024
e0853f7
we have liftoff
Thunkar Sep 17, 2024
b8e5d80
fmt
Thunkar Sep 17, 2024
a300679
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Sep 17, 2024
5cff536
removed log line
Thunkar Sep 17, 2024
8424bfb
macro intensifies
Thunkar Sep 17, 2024
450bb83
bootstrapin
Thunkar Sep 17, 2024
a7d74b0
unhack
Thunkar Sep 17, 2024
393449a
woooooo
Thunkar Sep 17, 2024
817f09f
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Sep 17, 2024
35dfdb2
fix transpiler
Thunkar Sep 17, 2024
fb0ca20
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Sep 17, 2024
b73b94b
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Sep 18, 2024
e0ed976
removed hacks
Thunkar Sep 18, 2024
7d385e8
revert
Thunkar Sep 18, 2024
10df443
one step to go
Thunkar Sep 18, 2024
13e016f
more fixing and updating aztec.nr
Thunkar Sep 18, 2024
03e6b09
final fixes
Thunkar Sep 18, 2024
5a292b3
more generic numerics
Thunkar Sep 18, 2024
ebda8a0
fix: address a bunch of issues with generics
TomAFrench Sep 18, 2024
fcb39b3
chore: add safety check for converting u32 to u8
TomAFrench Sep 18, 2024
ae87091
remove .quoted_contents() as much as possible
Thunkar Sep 18, 2024
75dbb7e
.
TomAFrench Sep 18, 2024
6d071a7
.
TomAFrench Sep 18, 2024
279a22e
.
TomAFrench Sep 18, 2024
75238c3
.
TomAFrench Sep 18, 2024
34144d6
indexed note fields
Thunkar Sep 18, 2024
fab5112
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Sep 18, 2024
432a8bf
Merge branch 'tf/fix-bad-generics' of github.com:AztecProtocol/aztec-…
Thunkar Sep 18, 2024
ebd3817
uint note
Thunkar Sep 18, 2024
86ae957
more u32
Thunkar Sep 18, 2024
a596821
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Sep 18, 2024
5a2d6c7
fixes
Thunkar Sep 18, 2024
1d1f7c4
Merge branch 'master' into gj/metaprogramming_experiments
TomAFrench Sep 19, 2024
b0f7034
.
TomAFrench Sep 19, 2024
461574b
Merge branch 'master' into gj/metaprogramming_experiments
TomAFrench Sep 19, 2024
ae31dfa
migration notes
benesjan Sep 19, 2024
57b980f
Merge branch 'master' into gj/metaprogramming_experiments
TomAFrench Sep 19, 2024
e5e2990
Minor migration doc adjustments
nventuro Sep 19, 2024
cd9df60
Fix nargo fmt crash
nventuro Sep 19, 2024
8810631
Add comments and misc improvements to utils
nventuro Sep 19, 2024
0324653
Add comments to storage
nventuro Sep 19, 2024
585deed
Merge branch 'master' into gj/metaprogramming_experiments
TomAFrench Sep 20, 2024
f50815b
Let type always be a slice
asterite Sep 20, 2024
6c73e62
nargo fmt
asterite Sep 20, 2024
c59d739
Merge branch 'master' into gj/metaprogramming_experiments
asterite Sep 20, 2024
4d7795d
More nargo fmt
asterite Sep 20, 2024
8784eef
Merge branch 'gj/metaprogramming_experiments' of github.com:AztecProt…
asterite Sep 20, 2024
9cd31eb
Don't run the old macros anymore
asterite Sep 20, 2024
d8a14ee
nargo fmt
asterite Sep 20, 2024
e4e041b
Fix build
nventuro Sep 20, 2024
ab5f219
Fix docs
nventuro Sep 20, 2024
64f5936
Make rs macros not do nothing but compile
nventuro Sep 20, 2024
5295b7e
Fix rust linter
nventuro Sep 20, 2024
09e457a
Merge branch 'master' into gj/metaprogramming_experiments
nventuro Sep 20, 2024
b822c30
Add some notes to function macros
nventuro Sep 20, 2024
6e9cd8a
Restore nullifier
nventuro Sep 20, 2024
cad19e5
Minor comments on aztec macr
nventuro Sep 20, 2024
89e8bd8
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Sep 23, 2024
d4693bf
updated constants and boxes
Thunkar Sep 23, 2024
976c6d4
comment
Thunkar Sep 23, 2024
173356b
remake constants again
Thunkar Sep 23, 2024
4b16d8a
added missing condition to init check
Thunkar Sep 23, 2024
6059703
fixed note type computation
Thunkar Sep 23, 2024
c4b15ce
unused imports
Thunkar Sep 23, 2024
8d68266
correctly generate compute_note_hash_and_nullifier
Thunkar Sep 23, 2024
ec5a41d
e2e fixes
Thunkar Sep 23, 2024
c7ef24e
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Sep 23, 2024
f938346
fixes
Thunkar Sep 23, 2024
15ef260
Update noir-projects/aztec-nr/aztec/src/macros/notes/mod.nr
Thunkar Sep 23, 2024
bd3f54c
comment
Thunkar Sep 23, 2024
4218cfa
Merge branch 'gj/metaprogramming_experiments' of github.com:AztecProt…
Thunkar Sep 23, 2024
2f81b78
added more generators
Thunkar Sep 23, 2024
db80913
fmt
Thunkar Sep 23, 2024
469abb8
fixed logs
Thunkar Sep 23, 2024
06dae6f
fixed partial notes
Thunkar Sep 23, 2024
b07e6d8
Merge branch 'master' into gj/metaprogramming_experiments
Thunkar Sep 23, 2024
b2fb913
final fixes
Thunkar Sep 23, 2024
43edd62
Merge branch 'master' into gj/metaprogramming_experiments
Thunkar Sep 23, 2024
df1f1ef
Use panic instead of assert(false)
nventuro Sep 23, 2024
fd67160
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Sep 24, 2024
af652f3
better approach for note hiding point
Thunkar Sep 24, 2024
e59d315
Merge branch 'gj/metaprogramming_experiments' of github.com:AztecProt…
Thunkar Sep 24, 2024
08fb04e
fixed test
Thunkar Sep 24, 2024
ecac29d
final fixes?
Thunkar Sep 24, 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 avm-transpiler/src/transpile_contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl From<CompiledAcirContractArtifact> for TranspiledContractArtifact {

for function in contract.functions {
// TODO(4269): once functions are tagged for transpilation to AVM, check tag
if function.custom_attributes.contains(&"aztec(public)".to_string()) {
if function.custom_attributes.contains(&"public".to_string()) {
info!("Transpiling AVM function {} on contract {}", function.name, contract.name);
// Extract Brillig Opcodes from acir
let acir_program = function.bytecode;
Expand Down
14 changes: 9 additions & 5 deletions boxes/boxes/react/src/contracts/src/main.nr
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
use dep::aztec::macros::aztec;

#[aztec]
contract BoxReact {
use dep::aztec::{
keys::public_keys::{IvpkM, OvpkM},
prelude::{AztecAddress, PrivateMutable, Map, NoteInterface, NoteHeader, Point},
encrypted_logs::encrypted_note_emission::encode_and_encrypt_note_with_keys
encrypted_logs::encrypted_note_emission::encode_and_encrypt_note_with_keys,
macros::{storage::storage, functions::{private, public, initializer}}
};
use dep::value_note::value_note::{ValueNote, VALUE_NOTE_LEN};

#[aztec(storage)]
#[storage]
struct Storage {
numbers: Map<AztecAddress, PrivateMutable<ValueNote>>,
}

#[aztec(private)]
#[aztec(initializer)]
#[private]
#[initializer]
fn constructor(
number: Field,
owner: AztecAddress,
Expand All @@ -25,7 +29,7 @@ contract BoxReact {
numbers.at(owner).initialize(&mut new_number).emit(encode_and_encrypt_note_with_keys(&mut context, owner_ovpk_m, owner_ivpk_m, owner));
}

#[aztec(private)]
#[private]
fn setNumber(
number: Field,
owner: AztecAddress,
Expand Down
14 changes: 9 additions & 5 deletions boxes/boxes/vanilla/src/contracts/src/main.nr
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
use dep::aztec::macros::aztec;

#[aztec]
contract Vanilla {
use dep::aztec::{
keys::public_keys::{IvpkM, OvpkM},
prelude::{AztecAddress, PrivateMutable, Map, NoteInterface, NoteHeader, Point},
encrypted_logs::encrypted_note_emission::encode_and_encrypt_note_with_keys
encrypted_logs::encrypted_note_emission::encode_and_encrypt_note_with_keys,
macros::{storage::storage, functions::{private, public, initializer}}
};
use dep::value_note::value_note::{ValueNote, VALUE_NOTE_LEN};

#[aztec(storage)]
#[storage]
struct Storage {
numbers: Map<AztecAddress, PrivateMutable<ValueNote>>,
}

#[aztec(private)]
#[aztec(initializer)]
#[private]
#[initializer]
fn constructor(
number: Field,
owner: AztecAddress,
Expand All @@ -25,7 +29,7 @@ contract Vanilla {
numbers.at(owner).initialize(&mut new_number).emit(encode_and_encrypt_note_with_keys(&mut context, owner_ovpk_m, owner_ivpk_m, owner));
}

#[aztec(private)]
#[private]
fn setNumber(
number: Field,
owner: AztecAddress,
Expand Down
7 changes: 5 additions & 2 deletions boxes/init/src/main.nr
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@

use dep::aztec::macros::aztec;

#[aztec]
contract Main {
#[aztec(private)]
#[aztec(initializer)]
#[private]
#[initializer]
fn constructor() { }
}
12 changes: 7 additions & 5 deletions l1-contracts/src/core/libraries/ConstantsGen.sol
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,18 @@ library Constants {
uint256 internal constant L2_GAS_PER_LOG_BYTE = 4;
uint256 internal constant L2_GAS_PER_NOTE_HASH = 32;
uint256 internal constant L2_GAS_PER_NULLIFIER = 64;
uint256 internal constant CANONICAL_KEY_REGISTRY_ADDRESS =
10536361358275073765062614648062211780027045486672640416335829595694222800789;
uint256 internal constant CANONICAL_AUTH_REGISTRY_ADDRESS =
19361441716519463065948254497947932755739298943049449145365332870925554042208;
3193394520848240339042174260887368015244189807412437862264526499389876805968;
uint256 internal constant DEPLOYER_CONTRACT_ADDRESS =
17119407406465801909352274670277571579675739451008438338071219340964365249977;
2888253181140434202600946137610803790678961451820394869801342223909105696356;
uint256 internal constant REGISTERER_CONTRACT_ADDRESS =
12405643717676802437578418009978929188439257864607100766293128479227092050857;
21748523092328826737377319989875487952297567340504996985769574672917248477115;
uint256 internal constant FEE_JUICE_ADDRESS =
12096583827711775893711303288210371301779120762215263550909768879597884314839;
8841799412790957220630076556157089925484823620333112594242679125846566463920;
uint256 internal constant ROUTER_ADDRESS =
13369993014609648298719593339393818582619449364029983937306132176549332172208;
949422206351581749693459491613246405703946584592224897261267487800745982005;
uint256 internal constant AZTEC_ADDRESS_LENGTH = 1;
uint256 internal constant GAS_FEES_LENGTH = 2;
uint256 internal constant GAS_LENGTH = 2;
Expand Down
18 changes: 6 additions & 12 deletions noir-projects/aztec-nr/address-note/src/address_note.nr
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
use dep::aztec::{
protocol_types::{
address::AztecAddress, traits::Empty, constants::GENERATOR_INDEX__NOTE_NULLIFIER,
hash::poseidon2_hash_with_separator
},
note::{note_header::NoteHeader, note_interface::NoteInterface, utils::compute_note_hash_for_nullify},
oracle::unsafe_rand::unsafe_rand, keys::getters::get_nsk_app, context::PrivateContext
protocol_types::{address::AztecAddress, constants::GENERATOR_INDEX__NOTE_NULLIFIER, hash::poseidon2_hash_with_separator},
note::{note_header::NoteHeader, note_interface::NullifiableNote, utils::compute_note_hash_for_nullify},
oracle::unsafe_rand::unsafe_rand, keys::getters::get_nsk_app, context::PrivateContext,
macros::notes::note
};

global ADDRESS_NOTE_LEN: u32 = 3;
// ADDRESS_NOTE_LEN * 32 + 32(storage_slot as bytes) + 32(note_type_id as bytes)
global ADDRESS_NOTE_BYTES_LEN: u32 = 3 * 32 + 64;

// docs:start:address_note_def
// docs:start:address_note_struct
// Stores an address
#[aztec(note)]
#[note]
struct AddressNote {
address: AztecAddress,
// The nullifying public key hash is used with the nsk_app to ensure that the note can be privately spent.
Expand All @@ -23,7 +17,7 @@ struct AddressNote {
}
// docs:end:address_note_struct

impl NoteInterface<ADDRESS_NOTE_LEN, ADDRESS_NOTE_BYTES_LEN> for AddressNote {
impl NullifiableNote for AddressNote {

fn compute_nullifier(self, context: &mut PrivateContext, note_hash_for_nullify: Field) -> Field {
let secret = context.request_nsk_app(self.npk_m_hash);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use dep::protocol_types::{
};

// When finished, one can call .finish() to convert back to the abi
struct PrivateContext {
pub struct PrivateContext {
// docs:start:private-context
inputs: PrivateContextInputs,
side_effect_counter: u32,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ use crate::{
};
use dep::protocol_types::{address::AztecAddress, hash::sha256_to_field};

unconstrained fn compute_unconstrained<Event, let NB: u32, let MB: u32, let OB: u32>(
unconstrained fn compute_unconstrained<Event, let N: u32, let OB: u32>(
contract_address: AztecAddress,
randomness: Field,
ovsk_app: Field,
ovpk: OvpkM,
ivpk: IvpkM,
recipient: AztecAddress,
event: Event
) -> ([u8; OB], Field) where Event: EventInterface<NB, MB>, [u8; NB]: LensForEncryptedEvent<NB, OB> {
) -> ([u8; OB], Field) where Event: EventInterface<N>, [u8; N * 32 + 64]: LensForEncryptedEvent<N * 32 + 64, OB> {
compute(
contract_address,
randomness,
Expand All @@ -26,15 +26,15 @@ unconstrained fn compute_unconstrained<Event, let NB: u32, let MB: u32, let OB:
)
}

fn compute<Event, let NB: u32, let MB: u32, let OB: u32>(
fn compute<Event, let N: u32, let OB: u32>(
contract_address: AztecAddress,
randomness: Field,
ovsk_app: Field,
ovpk: OvpkM,
ivpk: IvpkM,
recipient: AztecAddress,
event: Event
) -> ([u8; OB], Field) where Event: EventInterface<NB, MB>, [u8; NB]: LensForEncryptedEvent<NB, OB> {
) -> ([u8; OB], Field) where Event: EventInterface<N>, [u8; N * 32 + 64]: LensForEncryptedEvent<N * 32 + 64, OB> {
let encrypted_log: [u8; OB] = compute_encrypted_event_log(
contract_address,
randomness,
Expand All @@ -48,26 +48,26 @@ fn compute<Event, let NB: u32, let MB: u32, let OB: u32>(
(encrypted_log, log_hash)
}

fn emit_with_keys<Event, let NB: u32, let MB: u32, let OB: u32>(
fn emit_with_keys<Event, let N: u32, let OB: u32>(
context: &mut PrivateContext,
randomness: Field,
event: Event,
ovpk: OvpkM,
ivpk: IvpkM,
iv: AztecAddress,
inner_compute: fn(AztecAddress, Field, Field, OvpkM, IvpkM, AztecAddress, Event) -> ([u8; OB], Field)
) where Event: EventInterface<NB, MB>, [u8; NB]: LensForEncryptedEvent<NB, OB> {
) where Event: EventInterface<N>, [u8; N * 32 + 64]: LensForEncryptedEvent<N * 32 + 64, OB> {
let contract_address: AztecAddress = context.this_address();
let ovsk_app: Field = context.request_ovsk_app(ovpk.hash());
let (encrypted_log, log_hash) = inner_compute(contract_address, randomness, ovsk_app, ovpk, ivpk, iv, event);
context.emit_raw_event_log_with_masked_address(randomness, encrypted_log, log_hash);
}

pub fn encode_and_encrypt_event<Event, let NB: u32, let MB: u32, let OB: u32>(
pub fn encode_and_encrypt_event<Event, let N: u32, let OB: u32>(
context: &mut PrivateContext,
ov: AztecAddress,
iv: AztecAddress
) -> fn[(AztecAddress, AztecAddress, &mut PrivateContext)](Event) -> () where Event: EventInterface<NB, MB>, [u8; NB]: LensForEncryptedEvent<NB, OB> {
) -> fn[(AztecAddress, AztecAddress, &mut PrivateContext)](Event) -> () where Event: EventInterface<N>, [u8; N * 32 + 64]: LensForEncryptedEvent<N * 32 + 64, OB> {
| e: Event | {
let ovpk = get_public_keys(ov).ovpk_m;
let ivpk = get_public_keys(iv).ivpk_m;
Expand All @@ -76,11 +76,11 @@ pub fn encode_and_encrypt_event<Event, let NB: u32, let MB: u32, let OB: u32>(
}
}

pub fn encode_and_encrypt_event_unconstrained<Event, let NB: u32, let MB: u32, let OB: u32>(
pub fn encode_and_encrypt_event_unconstrained<Event, let N: u32, let OB: u32>(
context: &mut PrivateContext,
ov: AztecAddress,
iv: AztecAddress
) -> fn[(AztecAddress, AztecAddress, &mut PrivateContext)](Event) -> () where Event: EventInterface<NB, MB>, [u8; NB]: LensForEncryptedEvent<NB, OB> {
) -> fn[(AztecAddress, AztecAddress, &mut PrivateContext)](Event) -> () where Event: EventInterface<N>, [u8; N * 32 + 64]: LensForEncryptedEvent<N * 32 + 64, OB> {
| e: Event | {
let ovpk = get_public_keys(ov).ovpk_m;
let ivpk = get_public_keys(iv).ivpk_m;
Expand All @@ -89,75 +89,75 @@ pub fn encode_and_encrypt_event_unconstrained<Event, let NB: u32, let MB: u32, l
}
}

pub fn encode_and_encrypt_event_with_randomness<Event, let NB: u32, let MB: u32, let OB: u32>(
pub fn encode_and_encrypt_event_with_randomness<Event, let N: u32, let OB: u32>(
context: &mut PrivateContext,
randomness: Field,
ov: AztecAddress,
iv: AztecAddress
) -> fn[(AztecAddress, AztecAddress, &mut PrivateContext, Field)](Event) -> () where Event: EventInterface<NB, MB>, [u8; NB]: LensForEncryptedEvent<NB, OB> {
) -> fn[(AztecAddress, AztecAddress, &mut PrivateContext, Field)](Event) -> () where Event: EventInterface<N>, [u8; N * 32 + 64]: LensForEncryptedEvent<N * 32 + 64, OB> {
| e: Event | {
let ovpk = get_public_keys(ov).ovpk_m;
let ivpk = get_public_keys(iv).ivpk_m;
emit_with_keys(context, randomness, e, ovpk, ivpk, iv, compute);
}
}

pub fn encode_and_encrypt_event_with_randomness_unconstrained<Event, let NB: u32, let MB: u32, let OB: u32>(
pub fn encode_and_encrypt_event_with_randomness_unconstrained<Event, let N: u32, let OB: u32>(
context: &mut PrivateContext,
randomness: Field,
ov: AztecAddress,
iv: AztecAddress
) -> fn[(AztecAddress, AztecAddress, &mut PrivateContext, Field)](Event) -> () where Event: EventInterface<NB, MB>, [u8; NB]: LensForEncryptedEvent<NB, OB> {
) -> fn[(AztecAddress, AztecAddress, &mut PrivateContext, Field)](Event) -> () where Event: EventInterface<N>, [u8; N * 32 + 64]: LensForEncryptedEvent<N * 32 + 64, OB> {
| e: Event | {
let ovpk = get_public_keys(ov).ovpk_m;
let ivpk = get_public_keys(iv).ivpk_m;
emit_with_keys(context, randomness, e, ovpk, ivpk, iv, compute_unconstrained);
}
}

pub fn encode_and_encrypt_event_with_keys<Event, let NB: u32, let MB: u32, let OB: u32>(
pub fn encode_and_encrypt_event_with_keys<Event, let N: u32, let OB: u32>(
context: &mut PrivateContext,
ovpk: OvpkM,
ivpk: IvpkM,
recipient: AztecAddress
) -> fn[(&mut PrivateContext, OvpkM, IvpkM, AztecAddress)](Event) -> () where Event: EventInterface<NB, MB>, [u8; NB]: LensForEncryptedEvent<NB, OB> {
) -> fn[(&mut PrivateContext, OvpkM, IvpkM, AztecAddress)](Event) -> () where Event: EventInterface<N>, [u8; N * 32 + 64]: LensForEncryptedEvent<N * 32 + 64, OB> {
| e: Event | {
let randomness = unsafe_rand();
emit_with_keys(context, randomness, e, ovpk, ivpk, recipient, compute);
}
}

pub fn encode_and_encrypt_event_with_keys_unconstrained<Event, let NB: u32, let MB: u32, let OB: u32>(
pub fn encode_and_encrypt_event_with_keys_unconstrained<Event, let N: u32, let OB: u32>(
context: &mut PrivateContext,
ovpk: OvpkM,
ivpk: IvpkM,
recipient: AztecAddress
) -> fn[(&mut PrivateContext, OvpkM, IvpkM, AztecAddress)](Event) -> () where Event: EventInterface<NB, MB>, [u8; NB]: LensForEncryptedEvent<NB, OB> {
) -> fn[(&mut PrivateContext, OvpkM, IvpkM, AztecAddress)](Event) -> () where Event: EventInterface<N>, [u8; N * 32 + 64]: LensForEncryptedEvent<N * 32 + 64, OB> {
| e: Event | {
let randomness = unsafe_rand();
emit_with_keys(context, randomness, e, ovpk, ivpk, recipient, compute_unconstrained);
}
}

pub fn encode_and_encrypt_event_with_keys_with_randomness<Event, let NB: u32, let MB: u32, let OB: u32>(
pub fn encode_and_encrypt_event_with_keys_with_randomness<Event, let N: u32, let OB: u32>(
context: &mut PrivateContext,
randomness: Field,
ovpk: OvpkM,
ivpk: IvpkM,
recipient: AztecAddress
) -> fn[(&mut PrivateContext, Field, OvpkM, IvpkM, AztecAddress)](Event) -> () where Event: EventInterface<NB, MB>, [u8; NB]: LensForEncryptedEvent<NB, OB> {
) -> fn[(&mut PrivateContext, Field, OvpkM, IvpkM, AztecAddress)](Event) -> () where Event: EventInterface<N>, [u8; N * 32 + 64]: LensForEncryptedEvent<N * 32 + 64, OB> {
| e: Event | {
emit_with_keys(context, randomness, e, ovpk, ivpk, recipient, compute);
}
}

pub fn encode_and_encrypt_event_with_keys_with_randomness_unconstrained<Event, let NB: u32, let MB: u32, let OB: u32>(
pub fn encode_and_encrypt_event_with_keys_with_randomness_unconstrained<Event, let N: u32, let OB: u32>(
context: &mut PrivateContext,
randomness: Field,
ovpk: OvpkM,
ivpk: IvpkM,
recipient: AztecAddress
) -> fn[(&mut PrivateContext, Field, OvpkM, IvpkM, AztecAddress)](Event) -> () where Event: EventInterface<NB, MB>, [u8; NB]: LensForEncryptedEvent<NB, OB> {
) -> fn[(&mut PrivateContext, Field, OvpkM, IvpkM, AztecAddress)](Event) -> () where Event: EventInterface<N>, [u8; N * 32 + 64]: LensForEncryptedEvent<N * 32 + 64, OB> {
| e: Event | {
emit_with_keys(context, randomness, e, ovpk, ivpk, recipient, compute_unconstrained);
}
Expand Down
Loading
Loading