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

Refactor signature function's argument #8773

Merged
merged 8 commits into from
Apr 15, 2021
Merged

Conversation

terencechain
Copy link
Member

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)

@terencechain terencechain self-assigned this Apr 15, 2021
@terencechain terencechain requested a review from a team as a code owner April 15, 2021 17:05
@@ -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 {
Copy link
Contributor

@farazdagi farazdagi Apr 15, 2021

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) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here.

@codecov
Copy link

codecov bot commented Apr 15, 2021

Codecov Report

Merging #8773 (fa18885) into develop (3d3b9d1) will increase coverage by 0.01%.
The diff coverage is 93.33%.

@@             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     

@terencechain terencechain merged commit a4ff97d into develop Apr 15, 2021
@delete-merged-branch delete-merged-branch bot deleted the refactor-signature-set branch April 15, 2021 18:35
@terencechain terencechain mentioned this pull request Apr 19, 2021
62 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants