-
Notifications
You must be signed in to change notification settings - Fork 324
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: add historical library tests and remove old inclusion proof contract / related tests #12215
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
e720b2a
to
393d16c
Compare
@@ -71,18 +71,24 @@ impl NoteInterface for MockNote { | |||
pub(crate) struct MockNoteBuilder { | |||
value: Field, | |||
contract_address: Option<AztecAddress>, | |||
nonce: Option<Field>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was modified to allow for creating deterministic note hashes.
@@ -3,7 +3,7 @@ use dep::protocol_types::{ | |||
hash::compute_siloed_nullifier, | |||
}; | |||
|
|||
trait ProveContractDeployment { | |||
pub trait ProveContractDeployment { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These were exposed to be used in the counter-contracts due to not being able to test this in aztec-nr.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They should be exposed anyway as the history library and the whole of Aztec.nr is to be consumed from contracts.
mod nullifier_inclusion; | ||
mod nullifier_non_inclusion; | ||
mod public_storage; | ||
pub mod contract_inclusion; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exposing all these as well to remove warnings
} | ||
|
||
#[private] | ||
fn test_note_inclusion(owner: AztecAddress, storage_slot: Field) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are adding this here because it was the only function from the nuked inclusion proofs contract that was not present but had functionality in a used e2e test.
393d16c
to
d8b7add
Compare
3df202b
to
2b5c42c
Compare
2b5c42c
to
0522cb7
Compare
8966263
to
d74c4a6
Compare
0522cb7
to
1a5b205
Compare
d74c4a6
to
8181149
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. The globals made it way more readable.
Feel free to merge once you address my last comments.
noir-projects/aztec-nr/aztec/src/history/public_storage/test.nr
Outdated
Show resolved
Hide resolved
noir-projects/aztec-nr/aztec/src/history/public_storage/test.nr
Outdated
Show resolved
Hide resolved
@@ -14,6 +14,11 @@ use crate::oracle::{ | |||
use protocol_types::constants::PUBLIC_DISPATCH_SELECTOR; | |||
use protocol_types::traits::Packable; | |||
|
|||
// This is the first nullifier emitted from the TXe. It is an arbitrary number assigned in the TXe that is | |||
// larger than the first prefilled subtree of the nullifier tree. We use know FIRST_NULLIFIER_EMITTED_IN_TXE exists |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// larger than the first prefilled subtree of the nullifier tree. We use know FIRST_NULLIFIER_EMITTED_IN_TXE exists | |
// larger than the first prefilled subtree of the nullifier tree. We know FIRST_NULLIFIER_EMITTED_IN_TXE exists |
Where does TXE emit this? I cannot find that the global variable used when emitting it. Would use it for that if possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's emitted in the first block that gets automined, txe_oracle.ts:678/760
. I didn't want to make a constant that's used across both ts / nr as I thought that would be a bit overkill / not protocol enshrined as a constant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH I find this quite problematic as this breaks the tests if that random value injected in txe_oracle.ts changes. I think the best thing here would be to just not use it and insert our own nullifier in the tests. That shouldn't be a problem, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah you make a good point. I've added an issue tag here to #12226 and will address in a downstack PR as soon as this is in. Will nuke this completely and not make the assumption that this nullifier will exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been addressed in #12360.
noir-projects/noir-contracts/contracts/docs_example_contract/src/main.nr
Show resolved
Hide resolved
(&mut env, contract_address, owner) | ||
} | ||
|
||
// These tests need to be here instead of a saner place like aztec-nr/aztec/src/history/contract_inclusion/test.nr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add a comment to noir-projects/aztec-nr/aztec/src/history/contract_inclusion.nr that it's tested here since the tests are in a bit of a random location.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, have added a comment in that location !
let (env, contract_address) = setup(); | ||
|
||
let context = env.private(); | ||
let header_at_block_before_deployment = context.get_block_header_at(2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know the header name makes it pretty clear but anyway would assign smt. like CONTRACT_DEPLOYED_AT, I would check it matches in the setup when deploying and then use the value here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep you're 100% correct. Have addressed.
let (env, contract_address) = setup(); | ||
|
||
let context = env.private(); | ||
let header_at_block_before_deployment = context.get_block_header_at(2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above would replace the "2"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, addressed !
let (env, contract_address) = setup(); | ||
|
||
let context = env.private(); | ||
let header_at_block_before_deployment = context.get_block_header_at(2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above would replace the "2"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, addressed !
Co-authored-by: Jan Beneš <janbenes1234@gmail.com>
Co-authored-by: Jan Beneš <janbenes1234@gmail.com>
Co-authored-by: Jan Beneš <janbenes1234@gmail.com>
Co-authored-by: Jan Beneš <janbenes1234@gmail.com>
Co-authored-by: Jan Beneš <janbenes1234@gmail.com>
4737290
to
2113ba0
Compare
2113ba0
to
53e8d21
Compare
Adding txe tests to the historical apis, and removing inclusion proofs contract with corresponding (flaky) e2e test