Skip to content

Remote Signer: Electra #14477

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

Merged
merged 23 commits into from
Jan 16, 2025
Merged

Remote Signer: Electra #14477

merged 23 commits into from
Jan 16, 2025

Conversation

james-prysm
Copy link
Contributor

@james-prysm james-prysm commented Sep 24, 2024

What type of PR is this?

Feature

What does this PR do? Why is it needed?

updates the remote signing to handle changes from PRs ethereum/remote-signing-api#15 and ethereum/remote-signing-api#17

Kurtosis testing with the following settings

participants:
  - el_type: geth
    el_image: ethpandaops/geth:prague-devnet-5-a193537
    cl_type: prysm
    cl_image: gcr.io/prysmaticlabs/prysm/beacon-chain:latest
    vc_type: prysm
    vc_image: gcr.io/prysmaticlabs/prysm/validator:latest
    use_separate_vc: true
    use_remote_signer: true
  - el_type: geth
    el_image: ethpandaops/geth:prague-devnet-5-a193537
    cl_type: prysm
    cl_image: gcr.io/prysmaticlabs/prysm/beacon-chain:latest
    vc_type: prysm
    vc_image: gcr.io/prysmaticlabs/prysm/validator:latest
    use_separate_vc: true
    use_remote_signer: true
network_params:
  electra_fork_epoch: 1
additional_services:
  - dora

image

Which issues(s) does this PR fix?

Fixes #

Other notes for review

Acknowledgements

  • I have read CONTRIBUTING.md.
  • I have made an appropriate entry to CHANGELOG.md.
  • I have added a description to this PR with sufficient context for reviewers to understand this PR.

@james-prysm james-prysm added Blocked Blocked by research or external factors Web3Signer Web3Signer related tasks Electra electra hardfork labels Sep 24, 2024
@james-prysm james-prysm changed the title Remote signer electra Remote signer Electra Sep 24, 2024
@james-prysm james-prysm changed the title Remote signer Electra Remote Signer: Electra Sep 24, 2024
@james-prysm james-prysm marked this pull request as ready for review December 30, 2024 21:21
@james-prysm james-prysm requested a review from a team as a code owner December 30, 2024 21:21
@james-prysm james-prysm added Ready For Review and removed Blocked Blocked by research or external factors labels Jan 2, 2025
Comment on lines 61 to 68
blockElectraSignRequestsTotal = promauto.NewCounter(prometheus.CounterOpts{
Name: "remote_web3signer_block_electra_sign_requests_total",
Help: "Total number of block electra sign requests",
})
blindedBlockElectraSignRequestsTotal = promauto.NewCounter(prometheus.CounterOpts{
Name: "remote_web3signer_blinded_block_electra_sign_requests_total",
Help: "Total number of blinded block electra sign requests",
})
Copy link
Member

Choose a reason for hiding this comment

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

This pattern seems bad. Why not just add a label to mention the fork?

	blockSignRequestsTotal = promauto.NewCounter(prometheus.CounterOpts{
		Name: "remote_web3signer_block_sign_requests_total",
		Help: "Total number of block sign requests",
	})
	blindedBlockSignRequestsTotal = promauto.NewCounter(prometheus.CounterOpts{
		Name: "remote_web3signer_blinded_block_sign_requests_total",
		Help: "Total number of blinded block sign requests",
	})

Then use it with appropriate value

blockSignRequestsTotal.WithLabelValues("fork", "electra").Inc()

I think we should do this for the v6 release. There is no reason to report old fork metrics by registering a counter for every fork when we could use labels. Can you add this for Electra, then we can make the breaking change for old metrics in v6?

Comment on lines 92 to 117
func GetAggregateAndProofV2ElectraSignRequest(request *validatorpb.SignRequest, genesisValidatorsRoot []byte) (*AggregateAndProofV2ElectraSignRequest, error) {
aggregateAttestationAndProof, ok := request.Object.(*validatorpb.SignRequest_AggregateAttestationAndProofElectra)
if !ok {
return nil, errors.New("failed to cast request object to aggregate attestation and proof")
}
if aggregateAttestationAndProof == nil {
return nil, errors.New("invalid sign request: AggregateAndProof is nil")
}
fork, err := MapForkInfo(request.SigningSlot, genesisValidatorsRoot)
if err != nil {
return nil, err
}
aggregateAndProof, err := MapAggregateAndProofElectra(aggregateAttestationAndProof.AggregateAttestationAndProofElectra)
if err != nil {
return nil, err
}
return &AggregateAndProofV2ElectraSignRequest{
Type: "AGGREGATE_AND_PROOF_V2",
ForkInfo: fork,
SigningRoot: request.SigningRoot,
AggregateAndProof: &AggregateAndProofV2Electra{
Version: "ELECTRA",
Data: aggregateAndProof,
},
}, nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This function is not covered by any test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops forgot to add since it was waiting for sammy's pr

@@ -482,8 +488,20 @@ func handleAggregateAttestationAndProof(ctx context.Context, validator *validato
return json.Marshal(aggregateAndProofSignRequest)
}

func handleAggregateAttestationAndProofV2Electra(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.

Not covered by any test.

@@ -30,6 +27,11 @@ var (
Name: "remote_web3signer_attestation_sign_requests_total",
Help: "Total number of attestation sign requests",
})
//TODO: deprecate these fork specific counters in prysm v6...
blockSignRequestsTotal = promauto.NewCounter(prometheus.CounterOpts{
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this one be included in the comment? blockSignRequestsTotal is not fork specific right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's phase 0 sign requests

@@ -482,8 +488,20 @@ func handleAggregateAttestationAndProof(ctx context.Context, validator *validato
return json.Marshal(aggregateAndProofSignRequest)
}

func handleAggregateAttestationAndProofV2Electra(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.

Is this meant to be V2 if it's Electra specific and is the only one?

Suggested change
func handleAggregateAttestationAndProofV2Electra(ctx context.Context, validator *validator.Validate, request *validatorpb.SignRequest, genesisValidatorsRoot []byte) ([]byte, error) {
func handleAggregateAttestationAndProofElectra(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.

or just be, as both seems odd

Suggested change
func handleAggregateAttestationAndProofV2Electra(ctx context.Context, validator *validator.Validate, request *validatorpb.SignRequest, genesisValidatorsRoot []byte) ([]byte, error) {
func handleAggregateAttestationAndProofV2(ctx context.Context, validator *validator.Validate, request *validatorpb.SignRequest, genesisValidatorsRoot []byte) ([]byte, error) {

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 maybe i should just use V2

@@ -58,6 +60,13 @@ var (
Name: "remote_web3signer_blinded_block_deneb_sign_requests_total",
Help: "Total number of blinded block deneb sign requests",
})
/////
Copy link
Contributor

Choose a reason for hiding this comment

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

Meant to be here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah just to show that it's deprecated to there

@@ -88,6 +90,34 @@ func GetAggregateAndProofSignRequest(request *validatorpb.SignRequest, genesisVa
}, nil
}

// GetAggregateAndProofV2SignRequest maps the request for signing type AGGREGATE_AND_PROOF_V2 on Electra changes.
func GetAggregateAndProofV2SignRequest(v int, request *validatorpb.SignRequest, genesisValidatorsRoot []byte) (*AggregateAndProofV2SignRequest, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This function is not test covered.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

wait it is covered in TestKeymanager_Sign

@james-prysm james-prysm added this pull request to the merge queue Jan 16, 2025
Merged via the queue into develop with commit e263687 Jan 16, 2025
15 checks passed
@james-prysm james-prysm deleted the remote-signer-electra branch January 16, 2025 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Electra electra hardfork Web3Signer Web3Signer related tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants