Conversation
87bf0e8 to
958aca1
Compare
21d1e1c to
a004487
Compare
|
|
||
| Since the `entrypoint` interface is not enshrined, there is nothing that differentiates an account contract from an application one in the protocol. This means that a transaction can be initiated in any contract. This allows implementing functions that do not need to be called by any particular user and are just intended to advance the state of a contract. | ||
|
|
||
| As an example, we can think of a lottery contract, where at some point a prize needs to be paid out to its winners. This `pay` action does not require authentication and does not need to be executed by any user in particular, so anyone could submit a transaction that defines the lottery contract itself as `origin` and `pay` as entrypoint function. For an example of this behavior see our [non_contract_account test](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/end-to-end/src/e2e_non_contract_account.test.ts) and the [SignerLess wallet](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/aztec.js/src/wallet/signerless_wallet.ts) implementation. |
There was a problem hiding this comment.
Nuke the test link because I nuked the test because it was some stale thing that made no sense.
ea68afa to
15d71a3
Compare
15d71a3 to
c9a156d
Compare
| @@ -1,53 +0,0 @@ | |||
| --- | |||
There was a problem hiding this comment.
Renamed this to implementing a note and largely rewrote that as it was very stale.
| @@ -25,8 +25,11 @@ The 3 test accounts deployed in the sandbox are pre-funded with 10 ^ 22 fee juic | |||
| In addition to the native fee juice, users can pay the transaction fees using tokens that have a corresponding FPC contract. The sandbox now includes `BananaCoin` and `BananaFPC`. Users can use a funded test account to mint banana coin for a new account. The new account can then start sending transactions and pay fees with banana coin. | |||
|
|
|||
| ```typescript | |||
There was a problem hiding this comment.
Just applied formatting here.
| + ); | ||
| ``` | ||
|
|
||
| ### [Aztec.nr] Changes to `NoteInterface` |
There was a problem hiding this comment.
Here is where real changes begin.
| use crate::macros::utils::{ | ||
| add_to_field_slice, AsStrQuote, compute_fn_selector, get_trait_impl_method, is_fn_private, | ||
| is_fn_view, | ||
| add_to_field_slice, AsStrQuote, compute_fn_selector, is_fn_private, is_fn_view, |
There was a problem hiding this comment.
This just contained an unused import
| ) -> NoteGetterOptions<ValueNote, N, Field, Field> | ||
| where | ||
| ValueNote: Packable<N>, | ||
| { |
There was a problem hiding this comment.
Sneaked this in (Nico 😝) - we relied on VALUE_NOTE_LEN being exported which is an anti-pattern.
| // TODO(#12008): Remove the need for the manual import of `Packable` trait here. This is a bug in macros. | ||
| use aztec::protocol_types::traits::Packable; | ||
|
|
||
| pub(crate) global VALUE_NOTE_LEN: u32 = 3; // 3 plus a header. |
There was a problem hiding this comment.
Sneaked this in (Nico 😝) - we relied on VALUE_NOTE_LEN being exported which is an anti-pattern. On top of that now it could cause a problem if the derived Packable impl. did not match it.
|
|
||
| #[private] | ||
| // Adapted from TokenContract#redeem_shield but without an initcheck so it can be run in simulator/src/client/private_execution.test.ts | ||
| fn consume_note_from_secret(secret: Field) { |
There was a problem hiding this comment.
This was just used in one test which made zero sense so I just nuked it all.
| @@ -1,54 +0,0 @@ | |||
| import { ExtendedNote, Fr, type Logger, Note, type Wallet } from '@aztec/aztec.js'; | |||
There was a problem hiding this comment.
This test was just weird - it contains just one test case which looks useless at this point and the test case has nothing to do with non_contract_accounts. So I just nuked it all.
| }); | ||
| }); | ||
|
|
||
| it('Should be able to consume a dummy public to private message', async () => { |
There was a problem hiding this comment.
This test seems like a non-sense. It does nothing with messaging!
This test case was first created 20 months ago and I think it has been updated like 426 times in a negligent way that it became something completely different. So I nuked it
79e5879 to
d724762
Compare
| @@ -1,18 +1,21 @@ | |||
| use crate::types::card_note::{CARD_NOTE_LEN, CardNote}; | |||
| use crate::types::card_note::CardNote; | |||
There was a problem hiding this comment.
Sneaked changes in this file in (Nico 😝) - we relied on CARD_NOTE_LEN being exported which is an anti-pattern.
| // docs:start:address_note_struct | ||
| // Stores an address | ||
| #[note] | ||
| #[derive(Eq, Serialize)] |
There was a problem hiding this comment.
The Serialize trait impl. was unused here so I nuked it.
7f791ad to
7bcada0
Compare
3f3f111 to
cf57f73
Compare
docs/docs/developers/guides/smart_contracts/writing_contracts/common_patterns/index.md
Outdated
Show resolved
Hide resolved
docs/docs/developers/guides/smart_contracts/writing_contracts/notes/address_note.md
Outdated
Show resolved
Hide resolved
docs/docs/developers/guides/smart_contracts/writing_contracts/notes/implementing_a_note.md
Show resolved
Hide resolved
docs/docs/developers/reference/smart_contract_reference/storage/private_state.md
Show resolved
Hide resolved
| ) -> NoteGetterOptions<ValueNote, N, Field, Field> | ||
| where | ||
| ValueNote: Packable<N>, | ||
| { |
noir-projects/noir-contracts/contracts/test_contract/src/main.nr
Outdated
Show resolved
Hide resolved
0914eaa to
4690b3d
Compare
| ) -> [u8; N * 32 + 64] | ||
| where | ||
| Note: NoteInterface + Packable<N>, | ||
| Note: NoteType + Packable<N>, |
There was a problem hiding this comment.
Been thinking for a while now that this should be NOTE, not Note. Note looks like a type, and we always use caps for generics in other places.
There was a problem hiding this comment.
e.g. below Note::get_id() looks quite confusing - as if Note was a trait, which also sounds quite reasonable.
There was a problem hiding this comment.
Agree. Created an issue and I will tackle it once we get our note-related PRs merged.
cea2e92 to
e1c19b9
Compare
62a0c50 to
f6e1600
Compare
f6e1600 to
5b28f84
Compare
* master: (92 commits) chore: Log prover publisher address on creation (#12267) feat: https for bootnode in devnet (#12161) feat(avm): support shifts in lookups (#12280) feat(docs): Add flamegraph tool to counter contract tutorial (#12202) feat(spartan): 192 node 1 tps - additional validator service (#12238) feat(avm): class id derivation (#12263) docs: Fees doc snippets and code snippets (#12229) refactor: proving cost in fee header (#12048) fix: prometheus scrapes itself in the cluster (#12277) feat: metrics (#12256) chore: cleanup stdlib internal imports (#12274) git subrepo push --branch=master noir-projects/aztec-nr git_subrepo.sh: Fix parent in .gitrepo file. [skip ci] chore: replace relative paths to noir-protocol-circuits git subrepo push --branch=master barretenberg fix: Enforce no import side effects (#12268) refactor!: note interfaces (#12106) yolo undenoise tests feat: new transcript functionality to hash elements without including in proof (#12233) chore: remove gcloud metrics (#12265) ...

Fixes #12012
Implements a solution described in this comment