-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Remote Signer: Electra #14477
Changes from 18 commits
e70122c
3d809bb
6ca4fa6
759f0e7
bed422a
3eb62c9
767259f
d61a796
dd71aae
1ba4420
4c1e7f0
182749d
0cd6050
e14a335
1a4dcb1
5ad06d1
0cb9cf8
a2ba49f
5239021
a8b19b7
c4dfb00
08e5119
a8d449f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -27,7 +27,7 @@ import ( | |||||||||
"github.com/prysmaticlabs/prysm/v5/validator/accounts/petnames" | ||||||||||
"github.com/prysmaticlabs/prysm/v5/validator/keymanager" | ||||||||||
"github.com/prysmaticlabs/prysm/v5/validator/keymanager/remote-web3signer/internal" | ||||||||||
web3signerv1 "github.com/prysmaticlabs/prysm/v5/validator/keymanager/remote-web3signer/v1" | ||||||||||
"github.com/prysmaticlabs/prysm/v5/validator/keymanager/remote-web3signer/types" | ||||||||||
"github.com/sirupsen/logrus" | ||||||||||
"golang.org/x/exp/maps" | ||||||||||
) | ||||||||||
|
@@ -406,6 +406,8 @@ func getSignRequestJson(ctx context.Context, validator *validator.Validate, requ | |||||||||
return handleAttestationData(ctx, validator, request, genesisValidatorsRoot) | ||||||||||
case *validatorpb.SignRequest_AggregateAttestationAndProof: | ||||||||||
return handleAggregateAttestationAndProof(ctx, validator, request, genesisValidatorsRoot) | ||||||||||
case *validatorpb.SignRequest_AggregateAttestationAndProofElectra: | ||||||||||
return handleAggregateAttestationAndProofV2Electra(ctx, validator, request, genesisValidatorsRoot) | ||||||||||
case *validatorpb.SignRequest_Slot: | ||||||||||
return handleAggregationSlot(ctx, validator, request, genesisValidatorsRoot) | ||||||||||
case *validatorpb.SignRequest_BlockAltair: | ||||||||||
|
@@ -422,6 +424,10 @@ func getSignRequestJson(ctx context.Context, validator *validator.Validate, requ | |||||||||
return handleBlockDeneb(ctx, validator, request, genesisValidatorsRoot) | ||||||||||
case *validatorpb.SignRequest_BlindedBlockDeneb: | ||||||||||
return handleBlindedBlockDeneb(ctx, validator, request, genesisValidatorsRoot) | ||||||||||
case *validatorpb.SignRequest_BlockElectra: | ||||||||||
return handleBlockElectra(ctx, validator, request, genesisValidatorsRoot) | ||||||||||
case *validatorpb.SignRequest_BlindedBlockElectra: | ||||||||||
return handleBlindedBlockElectra(ctx, validator, request, genesisValidatorsRoot) | ||||||||||
// We do not support "DEPOSIT" type. | ||||||||||
/* | ||||||||||
case *validatorpb.: | ||||||||||
|
@@ -447,7 +453,7 @@ func getSignRequestJson(ctx context.Context, validator *validator.Validate, requ | |||||||||
} | ||||||||||
|
||||||||||
func handleBlock(ctx context.Context, validator *validator.Validate, request *validatorpb.SignRequest, genesisValidatorsRoot []byte) ([]byte, error) { | ||||||||||
bockSignRequest, err := web3signerv1.GetBlockSignRequest(request, genesisValidatorsRoot) | ||||||||||
bockSignRequest, err := types.GetBlockSignRequest(request, genesisValidatorsRoot) | ||||||||||
if err != nil { | ||||||||||
return nil, err | ||||||||||
} | ||||||||||
|
@@ -459,7 +465,7 @@ func handleBlock(ctx context.Context, validator *validator.Validate, request *va | |||||||||
} | ||||||||||
|
||||||||||
func handleAttestationData(ctx context.Context, validator *validator.Validate, request *validatorpb.SignRequest, genesisValidatorsRoot []byte) ([]byte, error) { | ||||||||||
attestationSignRequest, err := web3signerv1.GetAttestationSignRequest(request, genesisValidatorsRoot) | ||||||||||
attestationSignRequest, err := types.GetAttestationSignRequest(request, genesisValidatorsRoot) | ||||||||||
if err != nil { | ||||||||||
return nil, err | ||||||||||
} | ||||||||||
|
@@ -471,7 +477,7 @@ func handleAttestationData(ctx context.Context, validator *validator.Validate, r | |||||||||
} | ||||||||||
|
||||||||||
func handleAggregateAttestationAndProof(ctx context.Context, validator *validator.Validate, request *validatorpb.SignRequest, genesisValidatorsRoot []byte) ([]byte, error) { | ||||||||||
aggregateAndProofSignRequest, err := web3signerv1.GetAggregateAndProofSignRequest(request, genesisValidatorsRoot) | ||||||||||
aggregateAndProofSignRequest, err := types.GetAggregateAndProofSignRequest(request, genesisValidatorsRoot) | ||||||||||
if err != nil { | ||||||||||
return nil, err | ||||||||||
} | ||||||||||
|
@@ -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) { | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. or just be, as both seems odd
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm maybe i should just use V2 |
||||||||||
aggregateAndProofSignRequestV2, err := types.GetAggregateAndProofV2ElectraSignRequest(request, genesisValidatorsRoot) | ||||||||||
if err != nil { | ||||||||||
return nil, err | ||||||||||
} | ||||||||||
if err = validator.StructCtx(ctx, aggregateAndProofSignRequestV2); err != nil { | ||||||||||
return nil, err | ||||||||||
} | ||||||||||
aggregateAndProofSignRequestsTotal.Inc() | ||||||||||
return json.Marshal(aggregateAndProofSignRequestV2) | ||||||||||
} | ||||||||||
|
||||||||||
func handleAggregationSlot(ctx context.Context, validator *validator.Validate, request *validatorpb.SignRequest, genesisValidatorsRoot []byte) ([]byte, error) { | ||||||||||
aggregationSlotSignRequest, err := web3signerv1.GetAggregationSlotSignRequest(request, genesisValidatorsRoot) | ||||||||||
aggregationSlotSignRequest, err := types.GetAggregationSlotSignRequest(request, genesisValidatorsRoot) | ||||||||||
if err != nil { | ||||||||||
return nil, err | ||||||||||
} | ||||||||||
|
@@ -495,7 +513,7 @@ func handleAggregationSlot(ctx context.Context, validator *validator.Validate, r | |||||||||
} | ||||||||||
|
||||||||||
func handleBlockAltair(ctx context.Context, validator *validator.Validate, request *validatorpb.SignRequest, genesisValidatorsRoot []byte) ([]byte, error) { | ||||||||||
blockv2AltairSignRequest, err := web3signerv1.GetBlockAltairSignRequest(request, genesisValidatorsRoot) | ||||||||||
blockv2AltairSignRequest, err := types.GetBlockAltairSignRequest(request, genesisValidatorsRoot) | ||||||||||
if err != nil { | ||||||||||
return nil, err | ||||||||||
} | ||||||||||
|
@@ -507,7 +525,7 @@ func handleBlockAltair(ctx context.Context, validator *validator.Validate, reque | |||||||||
} | ||||||||||
|
||||||||||
func handleBlockBellatrix(ctx context.Context, validator *validator.Validate, request *validatorpb.SignRequest, genesisValidatorsRoot []byte) ([]byte, error) { | ||||||||||
blockv2BellatrixSignRequest, err := web3signerv1.GetBlockV2BlindedSignRequest(request, genesisValidatorsRoot) | ||||||||||
blockv2BellatrixSignRequest, err := types.GetBlockV2BlindedSignRequest(request, genesisValidatorsRoot) | ||||||||||
if err != nil { | ||||||||||
return nil, err | ||||||||||
} | ||||||||||
|
@@ -519,7 +537,7 @@ func handleBlockBellatrix(ctx context.Context, validator *validator.Validate, re | |||||||||
} | ||||||||||
|
||||||||||
func handleBlindedBlockBellatrix(ctx context.Context, validator *validator.Validate, request *validatorpb.SignRequest, genesisValidatorsRoot []byte) ([]byte, error) { | ||||||||||
blindedBlockv2SignRequest, err := web3signerv1.GetBlockV2BlindedSignRequest(request, genesisValidatorsRoot) | ||||||||||
blindedBlockv2SignRequest, err := types.GetBlockV2BlindedSignRequest(request, genesisValidatorsRoot) | ||||||||||
if err != nil { | ||||||||||
return nil, err | ||||||||||
} | ||||||||||
|
@@ -531,7 +549,7 @@ func handleBlindedBlockBellatrix(ctx context.Context, validator *validator.Valid | |||||||||
} | ||||||||||
|
||||||||||
func handleBlockCapella(ctx context.Context, validator *validator.Validate, request *validatorpb.SignRequest, genesisValidatorsRoot []byte) ([]byte, error) { | ||||||||||
blockv2CapellaSignRequest, err := web3signerv1.GetBlockV2BlindedSignRequest(request, genesisValidatorsRoot) | ||||||||||
blockv2CapellaSignRequest, err := types.GetBlockV2BlindedSignRequest(request, genesisValidatorsRoot) | ||||||||||
if err != nil { | ||||||||||
return nil, err | ||||||||||
} | ||||||||||
|
@@ -543,7 +561,7 @@ func handleBlockCapella(ctx context.Context, validator *validator.Validate, requ | |||||||||
} | ||||||||||
|
||||||||||
func handleBlindedBlockCapella(ctx context.Context, validator *validator.Validate, request *validatorpb.SignRequest, genesisValidatorsRoot []byte) ([]byte, error) { | ||||||||||
blindedBlockv2CapellaSignRequest, err := web3signerv1.GetBlockV2BlindedSignRequest(request, genesisValidatorsRoot) | ||||||||||
blindedBlockv2CapellaSignRequest, err := types.GetBlockV2BlindedSignRequest(request, genesisValidatorsRoot) | ||||||||||
if err != nil { | ||||||||||
return nil, err | ||||||||||
} | ||||||||||
|
@@ -555,7 +573,7 @@ func handleBlindedBlockCapella(ctx context.Context, validator *validator.Validat | |||||||||
} | ||||||||||
|
||||||||||
func handleBlockDeneb(ctx context.Context, validator *validator.Validate, request *validatorpb.SignRequest, genesisValidatorsRoot []byte) ([]byte, error) { | ||||||||||
blockv2DenebSignRequest, err := web3signerv1.GetBlockV2BlindedSignRequest(request, genesisValidatorsRoot) | ||||||||||
blockv2DenebSignRequest, err := types.GetBlockV2BlindedSignRequest(request, genesisValidatorsRoot) | ||||||||||
if err != nil { | ||||||||||
return nil, err | ||||||||||
} | ||||||||||
|
@@ -567,7 +585,7 @@ func handleBlockDeneb(ctx context.Context, validator *validator.Validate, reques | |||||||||
} | ||||||||||
|
||||||||||
func handleBlindedBlockDeneb(ctx context.Context, validator *validator.Validate, request *validatorpb.SignRequest, genesisValidatorsRoot []byte) ([]byte, error) { | ||||||||||
blindedBlockv2DenebSignRequest, err := web3signerv1.GetBlockV2BlindedSignRequest(request, genesisValidatorsRoot) | ||||||||||
blindedBlockv2DenebSignRequest, err := types.GetBlockV2BlindedSignRequest(request, genesisValidatorsRoot) | ||||||||||
if err != nil { | ||||||||||
return nil, err | ||||||||||
} | ||||||||||
|
@@ -578,8 +596,32 @@ func handleBlindedBlockDeneb(ctx context.Context, validator *validator.Validate, | |||||||||
return json.Marshal(blindedBlockv2DenebSignRequest) | ||||||||||
} | ||||||||||
|
||||||||||
func handleBlockElectra(ctx context.Context, validator *validator.Validate, request *validatorpb.SignRequest, genesisValidatorsRoot []byte) ([]byte, error) { | ||||||||||
blockv2ElectraSignRequest, err := types.GetBlockV2BlindedSignRequest(request, genesisValidatorsRoot) | ||||||||||
if err != nil { | ||||||||||
return nil, err | ||||||||||
} | ||||||||||
if err = validator.StructCtx(ctx, blockv2ElectraSignRequest); err != nil { | ||||||||||
return nil, err | ||||||||||
} | ||||||||||
remoteBlockSignRequestsTotal.WithLabelValues("electra", "false").Inc() | ||||||||||
return json.Marshal(blockv2ElectraSignRequest) | ||||||||||
} | ||||||||||
|
||||||||||
func handleBlindedBlockElectra(ctx context.Context, validator *validator.Validate, request *validatorpb.SignRequest, genesisValidatorsRoot []byte) ([]byte, error) { | ||||||||||
blindedBlockv2ElectraSignRequest, err := types.GetBlockV2BlindedSignRequest(request, genesisValidatorsRoot) | ||||||||||
if err != nil { | ||||||||||
return nil, err | ||||||||||
} | ||||||||||
if err = validator.StructCtx(ctx, blindedBlockv2ElectraSignRequest); err != nil { | ||||||||||
return nil, err | ||||||||||
} | ||||||||||
remoteBlockSignRequestsTotal.WithLabelValues("electra", "true").Inc() | ||||||||||
return json.Marshal(blindedBlockv2ElectraSignRequest) | ||||||||||
} | ||||||||||
|
||||||||||
func handleRandaoReveal(ctx context.Context, validator *validator.Validate, request *validatorpb.SignRequest, genesisValidatorsRoot []byte) ([]byte, error) { | ||||||||||
randaoRevealSignRequest, err := web3signerv1.GetRandaoRevealSignRequest(request, genesisValidatorsRoot) | ||||||||||
randaoRevealSignRequest, err := types.GetRandaoRevealSignRequest(request, genesisValidatorsRoot) | ||||||||||
if err != nil { | ||||||||||
return nil, err | ||||||||||
} | ||||||||||
|
@@ -591,7 +633,7 @@ func handleRandaoReveal(ctx context.Context, validator *validator.Validate, requ | |||||||||
} | ||||||||||
|
||||||||||
func handleVoluntaryExit(ctx context.Context, validator *validator.Validate, request *validatorpb.SignRequest, genesisValidatorsRoot []byte) ([]byte, error) { | ||||||||||
voluntaryExitRequest, err := web3signerv1.GetVoluntaryExitSignRequest(request, genesisValidatorsRoot) | ||||||||||
voluntaryExitRequest, err := types.GetVoluntaryExitSignRequest(request, genesisValidatorsRoot) | ||||||||||
if err != nil { | ||||||||||
return nil, err | ||||||||||
} | ||||||||||
|
@@ -603,7 +645,7 @@ func handleVoluntaryExit(ctx context.Context, validator *validator.Validate, req | |||||||||
} | ||||||||||
|
||||||||||
func handleSyncMessageBlockRoot(ctx context.Context, validator *validator.Validate, request *validatorpb.SignRequest, genesisValidatorsRoot []byte) ([]byte, error) { | ||||||||||
syncCommitteeMessageRequest, err := web3signerv1.GetSyncCommitteeMessageSignRequest(request, genesisValidatorsRoot) | ||||||||||
syncCommitteeMessageRequest, err := types.GetSyncCommitteeMessageSignRequest(request, genesisValidatorsRoot) | ||||||||||
if err != nil { | ||||||||||
return nil, err | ||||||||||
} | ||||||||||
|
@@ -615,7 +657,7 @@ func handleSyncMessageBlockRoot(ctx context.Context, validator *validator.Valida | |||||||||
} | ||||||||||
|
||||||||||
func handleSyncAggregatorSelectionData(ctx context.Context, validator *validator.Validate, request *validatorpb.SignRequest, genesisValidatorsRoot []byte) ([]byte, error) { | ||||||||||
syncCommitteeSelectionProofRequest, err := web3signerv1.GetSyncCommitteeSelectionProofSignRequest(request, genesisValidatorsRoot) | ||||||||||
syncCommitteeSelectionProofRequest, err := types.GetSyncCommitteeSelectionProofSignRequest(request, genesisValidatorsRoot) | ||||||||||
if err != nil { | ||||||||||
return nil, err | ||||||||||
} | ||||||||||
|
@@ -627,7 +669,7 @@ func handleSyncAggregatorSelectionData(ctx context.Context, validator *validator | |||||||||
} | ||||||||||
|
||||||||||
func handleContributionAndProof(ctx context.Context, validator *validator.Validate, request *validatorpb.SignRequest, genesisValidatorsRoot []byte) ([]byte, error) { | ||||||||||
contributionAndProofRequest, err := web3signerv1.GetSyncCommitteeContributionAndProofSignRequest(request, genesisValidatorsRoot) | ||||||||||
contributionAndProofRequest, err := types.GetSyncCommitteeContributionAndProofSignRequest(request, genesisValidatorsRoot) | ||||||||||
if err != nil { | ||||||||||
return nil, err | ||||||||||
} | ||||||||||
|
@@ -639,7 +681,7 @@ func handleContributionAndProof(ctx context.Context, validator *validator.Valida | |||||||||
} | ||||||||||
|
||||||||||
func handleRegistration(ctx context.Context, validator *validator.Validate, request *validatorpb.SignRequest) ([]byte, error) { | ||||||||||
validatorRegistrationRequest, err := web3signerv1.GetValidatorRegistrationSignRequest(request) | ||||||||||
validatorRegistrationRequest, err := types.GetValidatorRegistrationSignRequest(request) | ||||||||||
if err != nil { | ||||||||||
return nil, err | ||||||||||
} | ||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,10 +14,7 @@ var ( | |
Name: "remote_web3signer_errored_responses_total", | ||
Help: "Total number of errored responses when calling web3signer", | ||
}) | ||
blockSignRequestsTotal = promauto.NewCounter(prometheus.CounterOpts{ | ||
Name: "remote_web3signer_block_sign_requests_total", | ||
Help: "Total number of block sign requests", | ||
}) | ||
|
||
aggregationSlotSignRequestsTotal = promauto.NewCounter(prometheus.CounterOpts{ | ||
Name: "remote_web3signer_aggregation_slot_requests_total", | ||
Help: "Total number of aggregation slot requests", | ||
|
@@ -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{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this one be included in the comment? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's phase 0 sign requests |
||
Name: "remote_web3signer_block_sign_requests_total", | ||
Help: "Total number of block sign requests", | ||
}) | ||
blockAltairSignRequestsTotal = promauto.NewCounter(prometheus.CounterOpts{ | ||
Name: "remote_web3signer_block_altair_sign_requests_total", | ||
Help: "Total number of block altair sign requests", | ||
|
@@ -58,6 +60,13 @@ var ( | |
Name: "remote_web3signer_blinded_block_deneb_sign_requests_total", | ||
Help: "Total number of blinded block deneb sign requests", | ||
}) | ||
///// | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Meant to be here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah just to show that it's deprecated to there |
||
|
||
remoteBlockSignRequestsTotal = promauto.NewCounterVec(prometheus.CounterOpts{ | ||
Name: "remote_block_sign_requests_total", | ||
Help: "Total number of block sign requests with fork and blinded block check", | ||
}, []string{"fork", "isBlinded"}) | ||
|
||
randaoRevealSignRequestsTotal = promauto.NewCounter(prometheus.CounterOpts{ | ||
Name: "remote_web3signer_randao_reveal_sign_requests_total", | ||
Help: "Total number of randao reveal sign requests", | ||
|
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.
Not covered by any test.