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

Replace hashless ledger with ledger mask in transaction validator #12047

Merged
merged 2 commits into from
Oct 27, 2022

Conversation

nholland94
Copy link
Member

No description provided.

@nholland94 nholland94 added the ci-build-me Add this label to trigger a circle+buildkite build for this branch label Oct 26, 2022
@nholland94 nholland94 requested a review from a team as a code owner October 26, 2022 21:11
include Transaction_logic.Make (Hashless_ledger)

let create = Hashless_ledger.create
let within_mask l ~f =
Copy link
Member

Choose a reason for hiding this comment

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

this might be useful elsewhere, could it added to Ledger.Mask, if it's not too difficult?

@@ -1777,6 +1777,16 @@ module T = struct
epoch_ledger
|> not

let with_ledger_mask base_ledger ~f =
Copy link
Member

Choose a reason for hiding this comment

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

nice if this wasn't duplicated ...

Copy link
Member Author

Choose a reason for hiding this comment

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

The control flow for this is different though. Here the mask doesn't get committed.

Copy link
Member Author

@nholland94 nholland94 Oct 26, 2022

Choose a reason for hiding this comment

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

We need 2 primitives here. One that's ledger -> f:(ledger -> 'a) -> 'a which never commits, and one that's ledger -> f:(ledger -> ('a, 'b) result) -> ('a, 'b) result which only commits if the return value of f is Ok. I'm not sure how to name those.

Copy link
Member

Choose a reason for hiding this comment

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

Could there be a function with an optional ~commit_result flag?

Copy link
Member

Choose a reason for hiding this comment

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

OK. It would be nice if these were generally available.

Copy link
Member Author

Choose a reason for hiding this comment

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

Let's address this in a followup PR. It's not immediately obvious to me what the correct pattern is to abstract over these generally, and I think it's worth taking the time to factor these primitives into the rest of the code as well, so we can do that there.

@nholland94 nholland94 force-pushed the test-validator-master branch from d1ccbd8 to a0d1235 Compare October 26, 2022 21:37
Copy link
Member

@psteckler psteckler left a comment

Choose a reason for hiding this comment

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

@deepthiskumar should also look at this.

@lk86 lk86 merged commit 25388a0 into master Oct 27, 2022
@lk86 lk86 deleted the test-validator-master branch October 27, 2022 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci-build-me Add this label to trigger a circle+buildkite build for this branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants