Skip to content
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

try to fix the staged_ledger test #14058

Merged
merged 22 commits into from
Sep 25, 2023

Conversation

ghost-not-in-the-shell
Copy link
Contributor

Explain your changes:
This PR tries to fix a staged_ledger unit test bug. The generation of zkApps and user_commands sometimes could crash in their pick of keypairs. This PR fixes that.

Explain how you tested your changes:
*

Checklist:

  • Dependency versions are unchanged
    • Notify Velocity team if dependencies must change in CI
  • Modified the current draft of release notes with details on what is completed or incomplete within this project
  • Document code purpose, how to use it
    • Mention expected invariants, implicit constraints
  • Tests were added for the new behavior
    • Document test purpose, significance of failures
    • Test names should reflect their purpose
  • All tests pass (CI will check this if you didn't)
  • Serialized types are in stable-versioned modules
  • Does this close issues? List them

@ghost-not-in-the-shell ghost-not-in-the-shell requested a review from a team as a code owner September 7, 2023 17:02
@ghost-not-in-the-shell
Copy link
Contributor Author

!ci-build-me

@ghost-not-in-the-shell
Copy link
Contributor Author

!ci-build-me

@ghost-not-in-the-shell
Copy link
Contributor Author

!ci-build-me

@ghost-not-in-the-shell
Copy link
Contributor Author

!ci-build-me

Copy link
Member

@deepthiskumar deepthiskumar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requested some changes for better readability but otherwise looks good

@@ -37,7 +37,22 @@ let zkapp_command_with_ledger ?num_keypairs ?max_account_updates
Option.value num_keypairs
~default:((max_account_updates * 2) + (max_token_updates * 3) + 2)
in
let keypairs = List.init num_keypairs ~f:(fun _ -> Keypair.create ()) in
let existing_keypairs =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is not used elsewhere, could you move this under the keypairs block of code?

Array.map l ~f:(fun (kp, _balance, _nonce, _timing) -> kp)
|> Keypair.Set.of_array )
in
let keypairs =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename this to new_keypairs?

@ghost-not-in-the-shell
Copy link
Contributor Author

!ci-build-me

@ghost-not-in-the-shell
Copy link
Contributor Author

!ci-build-me

@ghost-not-in-the-shell
Copy link
Contributor Author

!ci-build-me

@ghost-not-in-the-shell
Copy link
Contributor Author

!ci-build-me

@ghost-not-in-the-shell
Copy link
Contributor Author

!ci-build-me

@ghost-not-in-the-shell
Copy link
Contributor Author

!ci-build-me

|> Keypair.Set.of_array )
in
List.init num_keypairs ~f:(fun _ ->
let keypair = ref (Keypair.create ()) in
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quickcheck generators are supposed to be deterministic, but Keypair.create will be different each time. Can you fix this so that the generator give the same output for the same input seed?

@ghost-not-in-the-shell
Copy link
Contributor Author

!ci-build-me

@mrmr1993
Copy link
Member

!approved-for-mainnet

@ghost-not-in-the-shell ghost-not-in-the-shell merged commit f5aabd0 into berkeley Sep 25, 2023
2 checks passed
@ghost-not-in-the-shell ghost-not-in-the-shell deleted the fix/staged-ledger-test-zkapp-gen branch September 25, 2023 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants