Skip to content

Use generic queries in the VM #2736

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

Merged
merged 5 commits into from
Jun 5, 2025

Conversation

ljedrz
Copy link
Collaborator

@ljedrz ljedrz commented Jun 2, 2025

Caveats:

  • QueryTrait now requires that the implementors are Clone
  • if a query is not supplied (i.e. it's None), it gets recreated in functions that need to use it more than once; this is perfectly fine with the current Query object, or if we assume the query to typically be provided

The 1st commit is the actual change, and the related diff is small; the second commit, and the vast majority of the PR's diff, is the formatting fallout from adjusting the tests to disambiguate the None values.

@ljedrz ljedrz requested a review from niklaslong June 2, 2025 11:14
@ljedrz ljedrz marked this pull request as draft June 2, 2025 13:56
@ljedrz ljedrz force-pushed the refactor/more_generic_queries branch 2 times, most recently from af2f919 to 3f795bd Compare June 2, 2025 15:13
@ljedrz ljedrz marked this pull request as ready for review June 2, 2025 15:29
@niklaslong niklaslong requested a review from vicsn June 3, 2025 10:31
Copy link
Collaborator

@vicsn vicsn left a comment

Choose a reason for hiding this comment

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

LGTM. This will break a ton of dependent software (tx-cannons, delegated provers). I'll make sure to notify everyone during the canary release.

@@ -122,15 +142,20 @@ fn execute(c: &mut Criterion) {
vm.execute_authorization(
execute_authorization.replicate(),
Some(fee_authorization.replicate()),
None,
None::<Query<MainnetV0, <LedgerType<_> as ConsensusStorage<_>>::BlockStorage>>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we add a helper function that returns None or the empty query from below?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure if that's possible (due to concrete/generic type as output), but this gave me the idea that I could introduce type aliases to greatly reduce the diff.

Copy link
Collaborator

@kaimast kaimast left a comment

Choose a reason for hiding this comment

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

Looks good! I added two suggestions.

@ljedrz ljedrz force-pushed the refactor/more_generic_queries branch from 26b1325 to 0fe2c9c Compare June 4, 2025 07:54
ljedrz added 5 commits June 4, 2025 17:12
Signed-off-by: ljedrz <ljedrz@users.noreply.github.com>
Signed-off-by: ljedrz <ljedrz@users.noreply.github.com>
Signed-off-by: ljedrz <ljedrz@users.noreply.github.com>
Signed-off-by: ljedrz <ljedrz@users.noreply.github.com>
Signed-off-by: ljedrz <ljedrz@users.noreply.github.com>
@ljedrz ljedrz force-pushed the refactor/more_generic_queries branch from c7d2006 to 24845db Compare June 5, 2025 08:31
@vicsn vicsn merged commit 75de78d into ProvableHQ:staging Jun 5, 2025
2 checks passed
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.

4 participants