-
Notifications
You must be signed in to change notification settings - Fork 205
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
CIP-26 precompile #1307
CIP-26 precompile #1307
Conversation
…mkl/precompile-bls-key
…into mrsmkl/precompile-bls-key
…mkl/precompile-bls-key
Co-authored-by: Kobi Gurkan <kobigurk@gmail.com>
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.
Left some comments!
@@ -185,7 +190,7 @@ func (s *Snapshot) UnmarshalJSON(b []byte) error { | |||
s.Epoch = j.Epoch | |||
s.Number = j.Number | |||
s.Hash = j.Hash | |||
s.ValSet = validator.NewSet(j.Validators) | |||
s.ValSet = validator.NewSetWithCache(j.Validators) |
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.
here's something strange. Not related to this PR actually.
A ValidatorSet is actually a ([]validators, randomness)
, but when we "save" it we don't save the randomness, and thus on unmarshall we don't have it, nor we care.
Which makes me wonder if we really want a validatorSet or if we should save the randomenss.
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.
Looks like randomness is only needed in the round state to determine next proposer, so it's not needed in the snapshots.
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.
Left some comments!
@@ -138,6 +138,7 @@ const ( | |||
FractionMulExpGas uint64 = 50 // Cost of performing multiplication and exponentiation of fractions to an exponent of up to 10^3. | |||
ProofOfPossessionGas uint64 = 350000 // Cost of verifying a BLS proof of possession. | |||
GetValidatorGas uint64 = 1000 // Cost of reading a validator's address. | |||
GetValidatorBLSGas uint64 = 1000 // Cost of reading a validator's BLS public key. |
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.
how did we obtained this value?? cc @prestwich @kobigurk
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.
@mrsmkl's reasoning was that since it's cached, the cost is the same as GetValidatorGas
, because it's just reading a value from a similar place.
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 benchmarking code is in this repo: https://github.com/mrsmkl/b12-sol/
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.
Great for going over all my comments!!! Looks much better now. There's a typo on one godoc that missing, but we're ready to go
Description
#1250
Recover if cannot load the round state.
Changed so that the BLS keys are now uncompressed when the snapshot is created.
Other changes
Tested
I ran some tests to make sure that stored snapshots include the uncompressed keys.
Also checked that it won't get stuck if there's an old roundstate.
Related issues
Backwards compatibility