diff --git a/cl/phase1/core/state/accessors.go b/cl/phase1/core/state/accessors.go index fca4b5103f4..99563c98d7c 100644 --- a/cl/phase1/core/state/accessors.go +++ b/cl/phase1/core/state/accessors.go @@ -246,6 +246,12 @@ func IsValidatorEligibleForActivation(b abstract.BeaconState, validator solid.Va // IsMergeTransitionComplete returns whether a merge transition is complete by verifying the presence of a valid execution payload header. func IsMergeTransitionComplete(b abstract.BeaconState) bool { + if b.Version() < clparams.BellatrixVersion { + return false + } + if b.Version() > clparams.BellatrixVersion { + return true + } return !b.LatestExecutionPayloadHeader().IsZero() } diff --git a/cl/spectest/consensus_tests/operations.go b/cl/spectest/consensus_tests/operations.go index df059698053..0e3b7a3acc4 100644 --- a/cl/spectest/consensus_tests/operations.go +++ b/cl/spectest/consensus_tests/operations.go @@ -480,7 +480,6 @@ func operationExecutionPayloadHandler(t *testing.T, root fs.FS, c spectest.TestC return err } if err := c.Machine.ProcessExecutionPayload(preState, body); err != nil { - //if err := machine.ProcessBlock(c.Machine, preState, body); err != nil { if expectedError { return nil } diff --git a/cl/transition/impl/eth2/operations.go b/cl/transition/impl/eth2/operations.go index 09a89afbe50..13f015f8120 100644 --- a/cl/transition/impl/eth2/operations.go +++ b/cl/transition/impl/eth2/operations.go @@ -368,16 +368,17 @@ func (I *impl) ProcessExecutionPayload(s abstract.BeaconState, body cltypes.Gene if state.IsMergeTransitionComplete(s) { // Verify consistency of the parent hash with respect to the previous execution payload header // assert payload.parent_hash == state.latest_execution_payload_header.block_hash - if parentHash != s.LatestExecutionPayloadHeader().BlockHash { + if !bytes.Equal(parentHash[:], s.LatestExecutionPayloadHeader().BlockHash[:]) { return errors.New("ProcessExecutionPayload: invalid eth1 chain. mismatching parent") } } - if prevRandao != s.GetRandaoMixes(state.Epoch(s)) { + random := s.GetRandaoMixes(state.Epoch(s)) + if !bytes.Equal(prevRandao[:], random[:]) { // Verify prev_randao // assert payload.prev_randao == get_randao_mix(state, get_current_epoch(state)) return fmt.Errorf( "ProcessExecutionPayload: randao mix mismatches with mix digest, expected %x, got %x", - s.GetRandaoMixes(state.Epoch(s)), + random, prevRandao, ) }