-
Notifications
You must be signed in to change notification settings - Fork 547
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
Conversation
include Transaction_logic.Make (Hashless_ledger) | ||
|
||
let create = Hashless_ledger.create | ||
let within_mask l ~f = |
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.
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 = |
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.
nice if this wasn't duplicated ...
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.
The control flow for this is different though. Here the mask doesn't get committed.
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.
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.
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.
Could there be a function with an optional ~commit_result
flag?
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.
OK. It would be nice if these were generally available.
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.
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.
d1ccbd8
to
a0d1235
Compare
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.
@deepthiskumar should also look at this.
No description provided.