mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 19:40:37 +00:00
Validator-Registration: E2E current release fix and better error handling (#11075)
* initial commit * removing generated auth-token * addressing feedback * removing mev from message * removing unneeded limitation
This commit is contained in:
parent
4b083c2ca9
commit
65a9ede2d3
@ -348,7 +348,7 @@ var (
|
||||
// EnableBuilderFlag enables the periodic validator registration API calls that will update the custom builder with validator settings.
|
||||
EnableBuilderFlag = &cli.BoolFlag{
|
||||
Name: "enable-builder",
|
||||
Usage: "Enables MEV Builder validator registration APIs for the validator client to update settings such as fee recipient and gas limit. Note* this flag is not required if using proposer settings config file",
|
||||
Usage: "Enables Builder validator registration APIs for the validator client to update settings such as fee recipient and gas limit. Note* this flag is not required if using proposer settings config file",
|
||||
Value: false,
|
||||
}
|
||||
)
|
||||
|
@ -227,7 +227,6 @@ func (v *ValidatorNode) Start(ctx context.Context) error {
|
||||
fmt.Sprintf("--%s=localhost:%d", flags.BeaconRPCProviderFlag.Name, beaconRPCPort),
|
||||
fmt.Sprintf("--%s=%s", flags.GrpcHeadersFlag.Name, "dummy=value,foo=bar"), // Sending random headers shouldn't break anything.
|
||||
fmt.Sprintf("--%s=%s", cmdshared.VerbosityFlag.Name, "debug"),
|
||||
fmt.Sprintf("--%s=%s", flags.ProposerSettingsFlag.Name, proposerSettingsPathPath),
|
||||
"--" + cmdshared.ForceClearDB.Name,
|
||||
"--" + cmdshared.E2EConfigFlag.Name,
|
||||
"--" + cmdshared.AcceptTosFlag.Name,
|
||||
@ -235,6 +234,8 @@ func (v *ValidatorNode) Start(ctx context.Context) error {
|
||||
// Only apply e2e flags to the current branch. New flags may not exist in previous release.
|
||||
if !v.config.UsePrysmShValidator {
|
||||
args = append(args, features.E2EValidatorFlags...)
|
||||
//TODO: current release breaks with proposer settings, add back in after 2.1.4
|
||||
args = append(args, fmt.Sprintf("--%s=%s", flags.ProposerSettingsFlag.Name, proposerSettingsPathPath))
|
||||
}
|
||||
if v.config.UseWeb3RemoteSigner {
|
||||
args = append(args, fmt.Sprintf("--%s=http://localhost:%d", flags.Web3SignerURLFlag.Name, Web3RemoteSignerPort))
|
||||
|
@ -8,7 +8,6 @@ import (
|
||||
|
||||
"github.com/prysmaticlabs/prysm/config/params"
|
||||
ev "github.com/prysmaticlabs/prysm/testing/endtoend/evaluators"
|
||||
"github.com/prysmaticlabs/prysm/testing/endtoend/helpers"
|
||||
e2eParams "github.com/prysmaticlabs/prysm/testing/endtoend/params"
|
||||
"github.com/prysmaticlabs/prysm/testing/endtoend/types"
|
||||
"github.com/prysmaticlabs/prysm/testing/require"
|
||||
@ -104,11 +103,6 @@ func e2eMainnet(t *testing.T, usePrysmSh, useMultiClient bool, cfgo ...types.E2E
|
||||
require.NoError(t, err)
|
||||
}
|
||||
_, crossClient := os.LookupEnv("RUN_CROSS_CLIENT")
|
||||
if usePrysmSh {
|
||||
// If using prysm.sh, run for only 6 epochs.
|
||||
// TODO(#9166): remove this block once v2 changes are live.
|
||||
epochsToRun = helpers.AltairE2EForkEpoch - 1
|
||||
}
|
||||
seed := 0
|
||||
seedStr, isValid := os.LookupEnv("E2E_SEED")
|
||||
if isValid {
|
||||
@ -133,7 +127,7 @@ func e2eMainnet(t *testing.T, usePrysmSh, useMultiClient bool, cfgo ...types.E2E
|
||||
ev.APIGatewayV1Alpha1VerifyIntegrity,
|
||||
ev.FinishedSyncing,
|
||||
ev.AllNodesHaveSameHead,
|
||||
ev.FeeRecipientIsPresent,
|
||||
//ev.FeeRecipientIsPresent, TODO: add back in after 2.1.4 when validator registration is no longer called.
|
||||
//ev.TransactionsPresent, TODO: Renable Transaction evaluator once it tx pool issues are fixed.
|
||||
}
|
||||
testConfig := &types.E2EConfig{
|
||||
|
@ -56,7 +56,11 @@ func run(ctx context.Context, v iface.Validator) {
|
||||
sub := km.SubscribeAccountChanges(accountsChangedChan)
|
||||
// Set properties on the beacon node like the fee recipient for validators that are being used & active.
|
||||
if err := v.PushProposerSettings(ctx, km); err != nil {
|
||||
log.Fatalf("Failed to update proposer settings: %v", err) // allow fatal. skipcq
|
||||
if errors.Is(err, ErrBuilderValidatorRegistration) {
|
||||
log.Warnf("Push proposer settings error, %v", err)
|
||||
} else {
|
||||
log.Fatalf("Failed to update proposer settings: %v", err) // allow fatal. skipcq
|
||||
}
|
||||
}
|
||||
for {
|
||||
_, cancel := context.WithCancel(ctx)
|
||||
|
@ -2,10 +2,10 @@ package client
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/async/event"
|
||||
fieldparams "github.com/prysmaticlabs/prysm/config/fieldparams"
|
||||
"github.com/prysmaticlabs/prysm/config/params"
|
||||
@ -263,3 +263,23 @@ func TestUpdateProposerSettingsAt_EpochStart(t *testing.T) {
|
||||
run(ctx, v)
|
||||
assert.LogsContain(t, hook, "updated proposer settings")
|
||||
}
|
||||
|
||||
func TestUpdateProposerSettings_ContinuesAfterValidatorRegistrationFails(t *testing.T) {
|
||||
errSomeotherError := errors.New("some internal error")
|
||||
v := &testutil.FakeValidator{
|
||||
ProposerSettingsErr: errors.Wrap(ErrBuilderValidatorRegistration, errSomeotherError.Error()),
|
||||
Km: &mockKeymanager{accountsChangedFeed: &event.Feed{}},
|
||||
}
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
hook := logTest.NewGlobal()
|
||||
slot := params.BeaconConfig().SlotsPerEpoch
|
||||
ticker := make(chan types.Slot)
|
||||
v.NextSlotRet = ticker
|
||||
go func() {
|
||||
ticker <- slot
|
||||
|
||||
cancel()
|
||||
}()
|
||||
run(ctx, v)
|
||||
assert.LogsContain(t, hook, ErrBuilderValidatorRegistration.Error())
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ type FakeValidator struct {
|
||||
NextSlotRet <-chan types.Slot
|
||||
PublicKey string
|
||||
UpdateDutiesRet error
|
||||
ProposerSettingsErr error
|
||||
RolesAtRet []iface.ValidatorRole
|
||||
Balances map[[fieldparams.BLSPubkeyLength]byte]uint64
|
||||
IndexToPubkeyMap map[uint64][fieldparams.BLSPubkeyLength]byte
|
||||
@ -252,7 +253,10 @@ func (_ *FakeValidator) SubmitSignedContributionAndProof(_ context.Context, _ ty
|
||||
}
|
||||
|
||||
// PushProposerSettings for mocking
|
||||
func (_ *FakeValidator) PushProposerSettings(_ context.Context, _ keymanager.IKeymanager) error {
|
||||
func (fv *FakeValidator) PushProposerSettings(_ context.Context, _ keymanager.IKeymanager) error {
|
||||
if fv.ProposerSettingsErr != nil {
|
||||
return fv.ProposerSettingsErr
|
||||
}
|
||||
log.Infoln("Mock updated proposer settings")
|
||||
return nil
|
||||
}
|
||||
|
@ -51,7 +51,8 @@ import (
|
||||
// keyFetchPeriod is the frequency that we try to refetch validating keys
|
||||
// in case no keys were fetched previously.
|
||||
var (
|
||||
keyRefetchPeriod = 30 * time.Second
|
||||
keyRefetchPeriod = 30 * time.Second
|
||||
ErrBuilderValidatorRegistration = errors.New("Builder API validator registration unsuccessful")
|
||||
)
|
||||
|
||||
var (
|
||||
@ -988,7 +989,7 @@ func (v *validator) PushProposerSettings(ctx context.Context, km keymanager.IKey
|
||||
log.Infoln("Prepared beacon proposer with fee recipient to validator index mapping")
|
||||
|
||||
if err := SubmitValidatorRegistration(ctx, v.validatorClient, signedRegisterValidatorRequests); err != nil {
|
||||
return err
|
||||
return errors.Wrap(ErrBuilderValidatorRegistration, err.Error())
|
||||
}
|
||||
|
||||
return nil
|
||||
@ -1078,7 +1079,7 @@ func (v *validator) buildProposerSettingsRequests(ctx context.Context, pubkeys [
|
||||
if len(signedRegisterValidatorRequests) != len(pubkeys) && anyValidatorRegistrationEnabled {
|
||||
log.WithFields(logrus.Fields{
|
||||
"totalNonActivePubkeys": len(pubkeys) - len(signedRegisterValidatorRequests),
|
||||
}).Warnln("will not be included in MEV builder validator registration until a validator index is assigned")
|
||||
}).Warnln("will not be included in builder validator registration until a validator index is assigned")
|
||||
}
|
||||
|
||||
return proposerFeeRecipientRequests, signedRegisterValidatorRequests, nil
|
||||
|
@ -1618,7 +1618,7 @@ func TestValidator_PushProposerSettings(t *testing.T) {
|
||||
GasLimit: uint64(40000000),
|
||||
},
|
||||
},
|
||||
logMessages: []string{"will not be included in MEV builder validator registration"},
|
||||
logMessages: []string{"will not be included in builder validator registration"},
|
||||
},
|
||||
{
|
||||
name: " Happy Path default doesn't send any validator registrations",
|
||||
@ -1676,7 +1676,7 @@ func TestValidator_PushProposerSettings(t *testing.T) {
|
||||
1: "0x055Fb65722E7b2455043BFEBf6177F1D2e9738D9",
|
||||
2: defaultFeeHex,
|
||||
},
|
||||
logMessages: []string{"will not be included in MEV builder validator registration"},
|
||||
logMessages: []string{"will not be included in builder validator registration"},
|
||||
doesntContainLogs: true,
|
||||
},
|
||||
{
|
||||
@ -2053,7 +2053,7 @@ func TestValidator_PushProposerSettings(t *testing.T) {
|
||||
},
|
||||
logMessages: []string{
|
||||
"prepare beacon proposer and update fee recipient until a validator index is assigned",
|
||||
"will not be included in MEV builder validator registration until a validator index is assigned",
|
||||
"will not be included in builder validator registration until a validator index is assigned",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user