Fix e2e flakynes for new state mgmt (#5790)

This commit is contained in:
terence tsao 2020-05-08 21:56:51 -07:00 committed by GitHub
parent a25354adf0
commit 419343123a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -43,6 +43,18 @@ func (s *Service) getBlockPreState(ctx context.Context, b *ethpb.BeaconBlock) (*
return nil, err return nil, err
} }
// For new state management, this ensures the state does not get mutated since initial syncing
// uses verifyBlkPreState.
if featureconfig.Get().NewStateMgmt {
preState, err = s.stateGen.StateByRoot(ctx, bytesutil.ToBytes32(b.ParentRoot))
if err != nil {
return nil, errors.Wrapf(err, "could not get pre state for slot %d", b.Slot)
}
if preState == nil {
return nil, errors.Wrapf(err, "nil pre state for slot %d", b.Slot)
}
}
// Verify block slot time is not from the feature. // Verify block slot time is not from the feature.
if err := helpers.VerifySlotTime(preState.GenesisTime(), b.Slot, helpers.TimeShiftTolerance); err != nil { if err := helpers.VerifySlotTime(preState.GenesisTime(), b.Slot, helpers.TimeShiftTolerance); err != nil {
return nil, err return nil, err

View File

@ -433,4 +433,5 @@ var E2EBeaconChainFlags = []string{
"--check-head-state", "--check-head-state",
"--enable-state-field-trie", "--enable-state-field-trie",
"--enable-state-ref-copy", "--enable-state-ref-copy",
"--enable-new-state-mgmt",
} }