-
Notifications
You must be signed in to change notification settings - Fork 583
Improve zkapp transaction regeneration #17484
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
Conversation
!ci-build-me |
3 similar comments
!ci-build-me |
!ci-build-me |
!ci-build-me |
!ci-build-me |
@@ -302,14 +302,9 @@ let%test_module "Transaction hashes" = | |||
run_test ~transaction_id ~expected_hash | |||
|
|||
(* To regenerate: | |||
* Run dune in this library's directory |
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 funny we have code in comments
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.
Please add test coverage for this new app. I'm wondering why can't we just put those code in the place of the original testcase, instead of creating a new app?
(module Mina_base.User_command.Stable.Latest) | ||
(Zkapp_command txn) | ||
|> Base64.encode | ||
|> function Ok x -> x | Error _ -> "" |
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'd wrap this whole thing in a transaction_id_of_zkapp_command
function returning an option
.
And here I'd just unwrap the result and let it fail if it's Error _
.
c7c2924
to
21eb945
Compare
That's a much better idea, thanks |
!ci-build-me |
8314fee
to
ea28cc3
Compare
!ci-build-me |
!ci-build-me |
!ci-build-me |
let new_zkapp_txn_hash () = | ||
hash_command (Zkapp_command new_zkapp_txn) |> to_base58_check | ||
|
||
let run_test ?regenerate_zkapp ~transaction_id ~expected_hash () = |
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: it seems this optional arg has type unit option
, I think it'd be better to set it to be a bool option
with None
indicating false.
!ci-build-me |
!ci-bypass-changelog |
Can you clean the merge commits before merging in compatible, please? |
492c2cc
to
e133fb4
Compare
!ci-build-me |
Explain your changes:
Currently to regenerate the data for the test in
src/lib/transaction/transaction_hash.ml
you paste comments into utop. Unfortunately when these comments stop compiling this doesn't raise any errors in CI.This pr moves the code to regenerate it out of the comment and into the error case, providing the regenerated value whenever the hash fails.
Explain how you tested your changes: