Skip to content

Comments

Bellatrix sync changes#10097

Merged
prylabs-bulldozer[bot] merged 21 commits intodevelopfrom
bellatrix-sync-changes
Jan 28, 2022
Merged

Bellatrix sync changes#10097
prylabs-bulldozer[bot] merged 21 commits intodevelopfrom
bellatrix-sync-changes

Conversation

@terencechain
Copy link
Collaborator

Review and merge #10072 first

This PR adds the Bellatrix condition to p2p gossipsub:
https://github.com/ethereum/consensus-specs/blob/dev/specs/bellatrix/p2p-interface.md

// [REJECT] The block's execution payload timestamp is correct with respect to the slot --
// i.e. execution_payload.timestamp == compute_timestamp_at_slot(state, block.slot).
func validateBellatrixBeaconBlock(parentState state.BeaconState, blk block.BeaconBlock) error {
if parentState.Version() != version.Bellatrix || blk.Version() != version.Bellatrix {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look correct, how will gossip handle the first bellatrix block ? The parent state will be an altair state, so this block will skip all the relevant execution payload checks.

Also this will allow a non bellatrix block that references a bellatrix parent state to be valid. It won't return an error and is passed on towards the subscriber.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parent state will be an altair state, so this block will skip all the relevant execution payload checks.

I don't think this is true. The parent state should already be upgraded to Bellatrix state via:

if features.Get().EnableNextSlotStateCache {
		parentState, err = transition.ProcessSlotsUsingNextSlotCache(ctx, parentState, blk.Block().ParentRoot(), blk.Block().Slot())
		if err != nil {
			return err
		}
	} else {
		parentState, err = transition.ProcessSlots(ctx, parentState, blk.Block().Slot())
		if err != nil {
			return err
		}
	}

this will allow a non bellatrix block that references a bellatrix parent state to be valid. It won't return an error and is passed on towards the subscriber.

true, although unlikely, we certainly can add checks around it

return wrapper.WrappedPhase0SignedBeaconBlock(t), nil
case *ethpb.SignedBeaconBlockAltair:
return wrapper.WrappedAltairSignedBeaconBlock(t)
case *ethpb.SignedBeaconBlockMerge:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SignedBeaconBlockBellatrix ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of scope. To be fixed in #10116

@jmozah
Copy link
Contributor

jmozah commented Jan 24, 2022

LGTM

nisdas
nisdas previously approved these changes Jan 24, 2022
@prylabs-bulldozer prylabs-bulldozer bot merged commit eef1730 into develop Jan 28, 2022
@delete-merged-branch delete-merged-branch bot deleted the bellatrix-sync-changes branch January 28, 2022 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants