Skip to content

fixes & cleanup - #28

Merged
lightclient merged 5 commits into
protolambda:masterfrom
flashbots:rest2
May 13, 2022
Merged

fixes & cleanup#28
lightclient merged 5 commits into
protolambda:masterfrom
flashbots:rest2

Conversation

@metachris

Copy link
Copy Markdown
Contributor

Cleanup of #26 (addresses all the review comments)

@protolambda protolambda left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Not sure where the spec of this code is, but the code is missing a signature domain for safety. You may want to update the spec with something like this.

Comment thread types/utils.go
HashTreeRoot() ([32]byte, error)
}

func VerifySignature(obj HashTreeRoot, pk, s []byte) (bool, error) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

It would be much better to define the signing API in a way where you are forced to include a signing domain and fork version etc. Signatures should be constructed in a way where they are unique for the purpose of the work and version of the protocol. See compute_signing_root and get_domain in the phase0 beacon spec. You essentially want to compute a "domain" (32 bytes) from a fork digest (constructed from genesis + fork info) and a type-domain (e.g. proposals and attestations have different domains to be sure they never have the same signature for two different intents). Or you can implement your own non-standard domain method. But definitely don't just create a BLS signature over data that might have a different meaning later on in the protocol. cc @lightclient

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Also relevant: ethereum/consensus-specs#2884 for the domain

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The current validation code is already merged, in this PR it's just moved. Maybe we should transfer this into it's own issue and make an update independent to this PR, which just complements the code currently in master.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

👉 #29

@lightclient lightclient left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It seems a little weird to use hexutil.Bytes for extra_data since it is a fixed 32 byte value, like many values already in the header. Okay for now though.

@lightclient
lightclient merged commit 8717daf into protolambda:master May 13, 2022
@lightclient

Copy link
Copy Markdown
Collaborator

(oops, I see your msg now about extra_data)

@metachris

Copy link
Copy Markdown
Contributor Author

(oops, I see your msg now about extra_data)

Yeah i wrote to you before, if we use a fixed size then the block hashes don't match, because go-ethereum uses a variable width byte array.

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.

3 participants