-
Notifications
You must be signed in to change notification settings - Fork 134
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
Rename precondition.assert* to require* #1247
Comments
Hi @mitschabaude , I am get that you want occurrences of assert* to be changed and I would like to contribute. Thank you 😃 |
Hey @Saurabhpatil-dev that would be very welcome!! The API that we want to change is implemented in two files:
It should be enough to change those two files, and then adapt all tests. Important: Don't delete the old APIs, only deprecate them using the |
Awesome!!! Let me try to get it done and up for review by tomorrow.😃 Thanks |
As discussed in issue o1-labs#1247 , I have replaced old api by deprecating them rather than removing. Question: Do we need to update this `assertStatePrecondition` too ? Please review and let know if anything else is required.
Hi @mitschabaude , I have made changes in Also, I am not sure about the changes in Thank You 😃 |
@Saurabhpatil-dev sure, if you look at Places to change:
You can see your changes in TS by re-running |
Hi @mitschabaude , Okay, Will make a PR for this once the current PR is merged if it's fine ? |
Hi @mitschabaude , While re-building the project locally I got the errors related to this PR you made yesterday #1260 . Locally I am just reverting the changes locally for testing. Will not commit it. |
@Saurabhpatil-dev you need to update the submodule, |
Hey @mitschabaude , Thanks it worked. The Precondition API's are also renamed and the testing is also completed. Please let know if I should commit changes now or wait for the PR to get merged and then create a new PR ? |
@Saurabhpatil-dev I'd prefer a new PR. And yes please also commit the test changes. Ideally your next PR would also update most examples in |
Hi @mitschabaude , Created a new PR : #1265 Once this PR get approved and merged I would like to start updating the examples in Thank You😃 |
HI @mitschabaude , As discussed I am starting with changing the example files locally. Can you please check and let me know if this what you were expecting ? Thank You 😃 |
Yes @Saurabhpatil-dev, exactly what I was expecting 💯 |
Hi @mitschabaude, Okay. Will start committing them. Thanks 😃 |
They're tested in CI. You can test them locally with ./run file --bundle |
Hi @mitschabaude , Testing of the example is in progress.
|
Hey @LuffySama-Dev no that error doesn't need to be updated, because it's about Field.assertEquals(), which didn't change. The whole point of these changes is to distinguish assertions on Field elements and other provable type from preconditions (which now use require()) |
|
Hi @mitschabaude , As discussed new PR is created #1269. Thank You 😃 |
Updated assert* to require* for rest pending precondition apis. #1247
♻️ Updated and tested the examples after the renaming of preconditions #1247
I think we can call this done! Next step for us is to update zkapp-cli examples and docs |
Hi @mitschabaude , Okay, can you please assign the issue to me once it is raised ?? I would love to start working on it 😃. Thank You 🙌 |
Why: The shared "assert" naming between constraints like
x.assertEquals(0)
and preconditions likethis.state.assertEquals(Field(0))
is a constant source of confusion. We settled on usingrequire()
instead ofassert()
for preconditions to clearly mark it as a distinct concept.How: Change all occurences of assert* in precondition methods, e.g.
this.state.assertEquals()
->this.state.requireEquals()
this.state.getAndAssertEquals()
->this.state.getAndRequireEquals()
(is that too verbose?)this.account.balance.assertBetween()
->this.account.balance.requireBetween()
The text was updated successfully, but these errors were encountered: