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

Deneb - web3signer #12767

Merged
merged 42 commits into from
Oct 16, 2023
Merged

Deneb - web3signer #12767

merged 42 commits into from
Oct 16, 2023

Conversation

james-prysm
Copy link
Contributor

@james-prysm james-prysm commented Aug 21, 2023

What type of PR is this?

Feature

What does this PR do? Why is it needed?

implements web3signer requirements for deneb

  • add Web3signer support for Deneb blocks
  • add Web3signer support for signed blobs

Webhooks defined here ethereum/remote-signing-api#4

Which issues(s) does this PR fix?

part of #12248 and tracked in #9994

@james-prysm james-prysm requested a review from a team as a code owner August 21, 2023 20:24
@james-prysm james-prysm requested review from terencechain, rkapka and nisdas and removed request for a team August 21, 2023 20:24
@james-prysm james-prysm self-assigned this Aug 21, 2023
@james-prysm james-prysm added Deneb PRs or issues for the Deneb upgrade Web3Signer Web3Signer related tasks labels Aug 21, 2023
@james-prysm james-prysm changed the title Deneb web3signer Deneb - web3signer Aug 21, 2023
Base automatically changed from deneb-integration to develop August 31, 2023 13:42
@james-prysm james-prysm force-pushed the deneb-web3signer branch 2 times, most recently from 039d792 to f05526a Compare September 1, 2023 20:18
@james-prysm james-prysm added the Ready For Review A pull request ready for code review label Sep 8, 2023
Comment on lines 144 to 146
func transactionRoot(tx []byte) ([32]byte, error) {
chunkedRoots, err := PackByChunk([][]byte{tx})
// ByteSliceRoot is a helper func to merkleize an arbitrary List[Byte, N]
// this func runs Chunkify + MerkleizeVector
func ByteSliceRoot(slice []byte) ([32]byte, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Are there no tests for this method? Surprised you could rename it without breaking tests 😱

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm your concern here is probably valid I'll double check with kasey and potuz 😅

return json.Marshal(blobRequest)
}

func handleBlindedBlob(ctx context.Context, validator *validator.Validate, request *validatorpb.SignRequest, genesisValidatorsRoot []byte) ([]byte, error) {
Copy link
Member

Choose a reason for hiding this comment

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

genesisValidatorsRoot is not used, is this to conform to some interface? Several methods in this file that have unused params.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is a good point I can probably remove, i had to make this function because of the linter cognit I can remove for many of these.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oof ok it actually needs the fork info so thanks for catching

@@ -337,6 +345,18 @@ type ValidatorRegistration struct {
Pubkey hexutil.Bytes `json:"pubkey" validate:"required"` /* bls hexadecimal string */
}

// BlobSidecar a sub property of BlobSidecarSignRequest
type BlobSidecar struct {
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be blind blob sidecar?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The name is as the web3signer defines (not builder) ethereum/remote-signing-api#4

rawYaml = append(rawYaml, []byte(depContractStr)...)
rawYaml = append(rawYaml, params.NetworkConfigToYaml(params.BeaconNetworkConfig())...)

rawYaml = append(rawYaml, []byte("\nEPOCHS_PER_SUBNET_SUBSCRIPTION: 256\n")...)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

what should I do with this? should i update config to yaml to include network properties? and should these be included to the network configs?
related to ethereum/consensus-specs#3375 and #12864


maxLength := (fieldparams.MaxBytesPerTxLength + 31) / 32
bytesRoot, err := BitwiseMerkleize(chunkedRoots, uint64(len(chunkedRoots)), uint64(maxLength))
maxRootLength := maxLength / fieldparams.RootLength
Copy link
Member

Choose a reason for hiding this comment

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

this looks odd, the reason we did

(value + 31)/32

is so that the ending chunk if it isnt fully occupied ( < 32 bytes) is still
correctly addressed as 1 full chunk.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

let me revert this then, maybe there's a better way to do this

return json.Marshal(randaoRevealSignRequest)
}

func handleExit(ctx context.Context, validator *validator.Validate, request *validatorpb.SignRequest, genesisValidatorsRoot []byte) ([]byte, 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, should this be more like handleVoluntaryExit

return json.Marshal(aggregateAndProofSignRequest)
}

func handleSlot(ctx context.Context, validator *validator.Validate, request *validatorpb.SignRequest, genesisValidatorsRoot []byte) ([]byte, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

A nit pick but this sounds less descriptive than the other handlers, should it be more like handleAggregationSlot

validator/keymanager/remote-web3signer/metrics.go Outdated Show resolved Hide resolved

maxLength := (fieldparams.MaxBytesPerTxLength + 31) / 32
bytesRoot, err := BitwiseMerkleize(chunkedRoots, uint64(len(chunkedRoots)), uint64(maxLength))
maxRootLength := (maxLength + 31) / 32 // nearest number divisible by root length (32)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a comment as to why we are doing + 31 and since 32 is the root length would it be better to minimize the magic numbers and have a const for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(value + 31)/32
is so that the ending chunk if it isnt fully occupied ( < 32 bytes) is still
correctly addressed as 1 full chunk.

potuz and nishant gave me this info.
i added the comment to represent this, any other opinions on making this clearer?

Copy link
Member

Choose a reason for hiding this comment

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

Remove this file

@james-prysm james-prysm removed the Ready For Review A pull request ready for code review label Oct 16, 2023
@prylabs-bulldozer prylabs-bulldozer bot merged commit 493a717 into develop Oct 16, 2023
16 of 17 checks passed
@prylabs-bulldozer prylabs-bulldozer bot deleted the deneb-web3signer branch October 16, 2023 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Deneb PRs or issues for the Deneb upgrade Web3Signer Web3Signer related tasks
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

7 participants