-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Refactor signature function's argument #8773
Conversation
@@ -98,8 +98,8 @@ func VerifySigningRoot(obj fssz.HashRoot, pub, signature, domain []byte) error { | |||
} | |||
|
|||
// VerifyBlockSigningRoot verifies the signing root of a block given it's public key, signature and domain. | |||
func VerifyBlockSigningRoot(blk *ethpb.BeaconBlock, pub, signature, domain []byte) error { | |||
set, err := BlockSignatureSet(blk, pub, signature, domain) | |||
func VerifyBlockSigningRoot(rootFunc func() ([32]byte, error), pub, signature, domain []byte) error { |
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.
While on it, probably it is worth moving rootFunc
argument to the end of argument list (for consistency, similar to core/blocks/signature.go:BlockSignatureSet()
)?
@@ -120,13 +120,13 @@ func VerifyBlockSigningRoot(blk *ethpb.BeaconBlock, pub, signature, domain []byt | |||
|
|||
// BlockSignatureSet retrieves the relevant signature, message and pubkey data from a block and collating it | |||
// into a signature set object. | |||
func BlockSignatureSet(blk *ethpb.BeaconBlock, pub, signature, domain []byte) (*bls.SignatureSet, error) { | |||
func BlockSignatureSet(rootFunc func() ([32]byte, error), pub, signature, domain []byte) (*bls.SignatureSet, error) { |
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.
Same here.
Codecov Report
@@ Coverage Diff @@
## develop #8773 +/- ##
===========================================
+ Coverage 60.54% 60.56% +0.01%
===========================================
Files 519 519
Lines 36271 36274 +3
===========================================
+ Hits 21962 21969 +7
+ Misses 11144 11141 -3
+ Partials 3165 3164 -1 |
Motivated by #8638
Flat out the following arguments so functions extensible for future hard forks to not use versioned block
VerifyBlockSignature
->proposerIndex types.ValidatorIndex, sig []byte, rootFunc func() ([32]byte, error)
BlockSignatureSet
->proposerIndex types.ValidatorIndex, sig []byte, rootFunc func() ([32]byte, error)
RandaoSignatureSet
->reveal []byte
VerifyBlockSigningRoot
->rootFunc func() ([32]byte, error)