-
Notifications
You must be signed in to change notification settings - Fork 266
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: replace private token in testing #2304
Conversation
9864fd1
to
87aa0a0
Compare
2b379f7
to
e284b94
Compare
87aa0a0
to
7c8dc95
Compare
17466aa
to
33225d8
Compare
b57a57e
to
9fc02a8
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.
lgtm, have a few nits, just points for discussion though rather than issues
@@ -401,7 +401,7 @@ describe('Private Execution test suite', () => { | |||
}); | |||
}); | |||
|
|||
describe('private token contract', () => { | |||
describe('stateful test contract contract', () => { |
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.
nit: double contract
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.
What do you mean by double contract?
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 says contract twice
stateful test contract contract
aztec-cli send _initialize \ | ||
--args $ALICE \ | ||
--contract-abi TokenContractAbi \ | ||
--contract-address 0x2d23acefa3ce07b3c308caf78d86c064cdf8957bcea48b38753cf58441796c8c \ |
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.
probably worth making the address a param if its used alot / fixed. especially since its in the docs
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.
Josh has a PR open for this and we will probably nuke this file so I think it's ok to not do that change 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.
As mentioned in #2304 (comment), nuke it.
const secret = Fr.random(); | ||
const secretHash = await computeMessageSecretHash(secret); | ||
|
||
await token.methods.mint_private(50, secretHash).send().wait(); |
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.
in general all of these could probably be sped up in the tests by sending the promises together and doing a Promise.all
.
Or is this not doable as we require the mint private to happen before the redeem
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.
If done with promise all it still got in as separate txs, so it cannot perform the second part that depends on the first. Might be replaces with requests I guess to do it in the same tx.
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.
Nvm, we can't do it in same tx because the mint_private is a public call and we need the result in private.
token = await Contract.deploy(owner, PrivateTokenArtifact, [100n, owner.getAddress()]).send().deployed(); | ||
|
||
token = await Contract.deploy(owner, TokenContractAbi, []).send().deployed(); | ||
await token.methods._initialize({ address: owner.getAddress() }).send().wait(); |
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.
hmm, we might want to move the docs:start:setup to another example now, as this has rough syntax with the initialise
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 ugly but I feel that if we explain it in the docs why it's necessary to call here it's ok given that we'll change in hopefully not-too-distant future. @LHerskind do you know if the work allowing for public calls from constructor has been mapped out?
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.
Think it might be fine to point out that you need to initialise if you need any private values set etc, and that it is horribly insecure but it will be addressed when constructor can do calls.
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 👍
token = await Contract.deploy(owner, PrivateTokenArtifact, [100n, owner.getAddress()]).send().deployed(); | ||
|
||
token = await Contract.deploy(owner, TokenContractAbi, []).send().deployed(); | ||
await token.methods._initialize({ address: owner.getAddress() }).send().wait(); |
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 ugly but I feel that if we explain it in the docs why it's necessary to call here it's ok given that we'll change in hopefully not-too-distant future. @LHerskind do you know if the work allowing for public calls from constructor has been mapped out?
aztec-cli send _initialize \ | ||
--args $ALICE \ | ||
--contract-abi TokenContractAbi \ | ||
--contract-address 0x2d23acefa3ce07b3c308caf78d86c064cdf8957bcea48b38753cf58441796c8c \ |
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.
Josh has a PR open for this and we will probably nuke this file so I think it's ok to not do that change here.
Not sure, maybe @iAmMichaelConnor and @PhilWindle started on it? |
There's just a github issue at the moment, sitting there for someone to pick up and discuss, then build, when they have time. #2249 |
🤖 I have created a release *beep* *boop* --- <details><summary>aztec-packages: 0.7.6</summary> ## [0.7.6](aztec-packages-v0.7.5...aztec-packages-v0.7.6) (2023-09-18) ### Features * New api to get note nonces ([#2327](#2327)) ([8f5eb28](8f5eb28)) * Replace private token in testing ([#2304](#2304)) ([934ba96](934ba96)) ### Bug Fixes * Exit with error log when COMMIT_TAG is not set properly on canary ([#2371](#2371)) ([68fe053](68fe053)) * Preserve public function call ordering in account entrypoint ([#2348](#2348)) ([5b2cf75](5b2cf75)) * Return output-debug flag ([#2364](#2364)) ([af86580](af86580)) * Revert "fix: strip leading 'v' from dockerhub tags" ([#2367](#2367)) ([53bc041](53bc041)) * Stale CLI docs ([#2336](#2336)) ([f38873b](f38873b)) * Strip leading 'v' from dockerhub tags ([#2360](#2360)) ([a4bb05c](a4bb05c)) ### Miscellaneous * Added docs for artifact files ([#2362](#2362)) ([6d3ba3f](6d3ba3f)), closes [#2190](#2190) * **aztec_noir:** Remove inputs from consume l1 to l2 message ([#2354](#2354)) ([2235f7c](2235f7c)) * Remove "as unknown" casts for ABIs where possible ([#2331](#2331)) ([bf2651e](bf2651e)) * Script to extract tag version ([#2368](#2368)) ([4b686b0](4b686b0)) * Share e2e code with canary ([#2299](#2299)) ([21224de](21224de)) </details> <details><summary>barretenberg.js: 0.7.6</summary> ## [0.7.6](barretenberg.js-v0.7.5...barretenberg.js-v0.7.6) (2023-09-18) ### Miscellaneous * **barretenberg.js:** Synchronize aztec-packages versions </details> <details><summary>barretenberg: 0.7.6</summary> ## [0.7.6](barretenberg-v0.7.5...barretenberg-v0.7.6) (2023-09-18) ### Miscellaneous * **barretenberg:** Synchronize aztec-packages versions </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Fixes #2301.
Replaces the private token in most testing. Not altering docs and some of the cli_docs testing.
Checklist:
Remove the checklist to signal you've completed it. Enable auto-merge if the PR is ready to merge.