-
Notifications
You must be signed in to change notification settings - Fork 118
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
expose network precondition setters to LocalBlockchain
#329
Conversation
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.
LGTM! Just some small questions
src/lib/mina.ts
Outdated
setBlockchainLength(height: UInt32) { | ||
networkState.blockchainLength = height; | ||
}, | ||
setTotalCurrency(currency: UInt32) { |
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.
Just a small question, will we ever need a UInt64
for any of these as well as UInt32
?
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.
actually, currency is supposed to be UInt64
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.
argh.. turns out that UInt32
extends UInt64
(but not the other way). I wonder if this is a bug which we should fix, or if it makes sense in a weird way, because a UInt32
also fits in 64 bits
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.
Ah thats right, currency is also supposed to be UInt64. I should probably set it to UInt64 as well, since it is also defined like this in all the Precondition interfaces
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 is great! I appreciate the example
Description
Exposes various setters to individually set network preconditions. Network state is now entirely being managed on the side of SnarkyJS and can easily be customized.
Example
Under the hood
LocalBlockchain
has been extended to manage the network state within a new variablenetworkState
, instead of relying on a hard-coded value within OCaml.LocalBlockchain
now exposes the following closures:When a transaction is being processed, the network state is now being passed in as an additional parameter.
bindings not included, requires MinaProtocol/mina#11639