Compare commits

...

1 Commits

Author SHA1 Message Date
nisdas
4c8e420ab4 simulate 2022-05-10 22:26:58 +08:00
6 changed files with 33 additions and 30 deletions

View File

@@ -114,7 +114,7 @@ func (s *State) LoadBlocks(ctx context.Context, startSlot, endSlot types.Slot, e
}
if blockRoots[length-1] != endBlockRoot {
return nil, errors.New("end block roots don't match")
return nil, errors.Errorf("end block roots don't match: got %#x but wanted %#x for %d to %d at length %d", blockRoots[length-1], endBlockRoot, startSlot, endSlot, length)
}
filteredBlocks := []interfaces.SignedBeaconBlock{blocks[length-1]}

View File

@@ -145,6 +145,8 @@ func (v *ValidatorNode) Start(ctx context.Context) error {
"--" + cmdshared.E2EConfigFlag.Name,
"--" + cmdshared.AcceptTosFlag.Name,
}
args = append(args, "--pprof", fmt.Sprintf("--pprofport=%d", e2e.TestParams.Ports.PrysmBeaconNodePprofPort+20+index))
// 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...)

View File

@@ -7,7 +7,6 @@ import (
"testing"
"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"
@@ -47,28 +46,6 @@ func e2eMinimal(t *testing.T, useWeb3RemoteSigner bool, extraEpochs uint64) {
tracingPort := e2eParams.TestParams.Ports.JaegerTracingPort
tracingEndpoint := fmt.Sprintf("127.0.0.1:%d", tracingPort)
evals := []types.Evaluator{
ev.PeersConnect,
ev.HealthzCheck,
ev.MetricsCheck,
ev.ValidatorsAreActive,
ev.ValidatorsParticipatingAtEpoch(2),
ev.FinalizationOccurs(3),
ev.PeersCheck,
ev.ProcessesDepositsInBlocks,
ev.VerifyBlockGraffiti,
ev.ActivatesDepositedValidators,
ev.DepositedValidatorsAreActive,
ev.ProposeVoluntaryExit,
ev.ValidatorHasExited,
ev.ValidatorsVoteWithTheMajority,
ev.ColdStateCheckpoint,
ev.AltairForkTransition,
ev.BellatrixForkTransition,
ev.APIMiddlewareVerifyIntegrity,
ev.APIGatewayV1Alpha1VerifyIntegrity,
ev.FinishedSyncing,
ev.AllNodesHaveSameHead,
ev.ValidatorSyncParticipation,
//ev.TransactionsPresent, TODO: Renable Transaction evaluator once it tx pool issues are fixed.
}
testConfig := &types.E2EConfig{

View File

@@ -7,7 +7,6 @@ import (
"time"
"github.com/pkg/errors"
"github.com/prysmaticlabs/prysm/async"
"github.com/prysmaticlabs/prysm/beacon-chain/core/signing"
fieldparams "github.com/prysmaticlabs/prysm/config/fieldparams"
"github.com/prysmaticlabs/prysm/config/params"
@@ -21,7 +20,6 @@ import (
validatorpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client"
"github.com/prysmaticlabs/prysm/runtime/version"
prysmTime "github.com/prysmaticlabs/prysm/time"
"github.com/prysmaticlabs/prysm/validator/client/iface"
"github.com/sirupsen/logrus"
"go.opencensus.io/trace"
"google.golang.org/protobuf/types/known/emptypb"
@@ -46,10 +44,6 @@ func (v *validator) ProposeBlock(ctx context.Context, slot types.Slot, pubKey [f
ctx, span := trace.StartSpan(ctx, "validator.ProposeBlock")
defer span.End()
lock := async.NewMultilock(fmt.Sprint(iface.RoleProposer), string(pubKey[:]))
lock.Lock()
defer lock.Unlock()
fmtKey := fmt.Sprintf("%#x", pubKey[:])
span.AddAttributes(trace.StringAttribute("validator", fmtKey))
log := log.WithField("pubKey", fmt.Sprintf("%#x", bytesutil.Trunc(pubKey[:])))
@@ -131,6 +125,34 @@ func (v *validator) ProposeBlock(ctx context.Context, slot types.Slot, pubKey [f
}
return
}
hasProposerNextSlot := false
hasProposerPrevSlot := false
hasProposerPrevPrevSlot := false
for _, d := range v.duties.Duties {
if slot < 6 {
continue
}
if len(d.ProposerSlots) > 0 && d.ProposerSlots[0] == slot+1 {
hasProposerNextSlot = true
}
if len(d.ProposerSlots) > 0 && d.ProposerSlots[0] == slot-1 {
hasProposerPrevSlot = true
}
if len(d.ProposerSlots) > 0 && d.ProposerSlots[0] == slot-2 {
hasProposerPrevPrevSlot = true
}
}
if hasProposerNextSlot && !hasProposerPrevSlot {
log.Infof("waiting for slot %d", slot+1)
<-v.propChan
log.Infof("received from slot %d", slot+1)
}
if hasProposerPrevSlot && !hasProposerPrevPrevSlot {
log.Infof("sending to slot %d", slot-1)
v.propChan <- true
log.Infof("sent to slot %d", slot-1)
}
ctx = context.Background()
blkResp, err := v.validatorClient.ProposeBeaconBlock(ctx, proposal)
if err != nil {
log.WithError(err).Error("Failed to propose block")

View File

@@ -208,6 +208,7 @@ func (v *ValidatorService) Start() {
Web3SignerConfig: v.Web3SignerConfig,
feeRecipientConfig: v.feeRecipientConfig,
walletIntializedChannel: make(chan *wallet.Wallet, 1),
propChan: make(chan bool, 1),
}
// To resolve a race condition at startup due to the interface
// nature of the abstracted block type. We initialize

View File

@@ -81,6 +81,7 @@ type validator struct {
domainDataCache *ristretto.Cache
highestValidSlot types.Slot
genesisTime uint64
propChan chan bool
blockFeed *event.Feed
interopKeysConfig *local.InteropKeymanagerConfig
wallet *wallet.Wallet