Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capella beacon block #11566

Merged
merged 27 commits into from
Oct 31, 2022
Merged

Capella beacon block #11566

merged 27 commits into from
Oct 31, 2022

Conversation

rkapka
Copy link
Contributor

@rkapka rkapka commented Oct 21, 2022

What type of PR is this?

Feature

What does this PR do? Why is it needed?

  • adds all the necessary Capella block consensus types
  • handles version.Capella for block processing
  • new tests for Capella

@rkapka rkapka marked this pull request as ready for review October 21, 2022 18:34
@rkapka rkapka requested a review from a team as a code owner October 21, 2022 18:34
if err != nil {
return err
}
obtainedCtx = digest[:]
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is obtainedCtx assigned in each case instead of after the switch statement?

deposits []*eth.Deposit
voluntaryExits []*eth.SignedVoluntaryExit
syncAggregate *eth.SyncAggregate
executionPayload *engine.ExecutionPayload
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't these be in a single interface executionPayload that has different implementations? Otherwise each fork we'll have to add a possibly nil pointer to the BeaconBlockBody

Copy link
Member

@terencechain terencechain left a comment

Choose a reason for hiding this comment

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

I quickly glanced through this. It looks fine
Is there any reason to use a mega PR (2000+) lines diff versus splitting this into more management PRs (e.g. 500 lines) by various components. You'll make @prestonvanloon's day :D

It also might be easier to root cause the e2e failure that way

@rkapka
Copy link
Contributor Author

rkapka commented Oct 26, 2022

I quickly glanced through this. It looks fine Is there any reason to use a mega PR (2000+) lines diff versus splitting this into more management PRs (e.g. 500 lines) by various components. You'll make @prestonvanloon's day :D

I think we agreed that splitting PRs does more harm than good.

It also might be easier to root cause the e2e failure that way

Current e2e failures cannot be attributed to this PR because it's not merged yet. Or do you mean potential failures that this PR might cause? 😅

@terencechain
Copy link
Member

I think we agreed that splitting PRs does more harm than good.

Why is this?

@@ -145,7 +145,7 @@ func (v *validator) ProposeBlock(ctx context.Context, slot types.Slot, pubKey [f
trace.Int64Attribute("numAttestations", int64(len(blk.Block().Body().Attestations()))),
)

if blk.Version() == version.Bellatrix {
if blk.Version() > version.Altair {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to log here also the number of withdrawals included?

BaseFeePerGas: make([]byte, fieldparams.RootLength),
BlockHash: make([]byte, fieldparams.RootLength),
Transactions: make([][]byte, 0),
ExtraData: make([]byte, 0),
Copy link
Contributor

Choose a reason for hiding this comment

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

Withdrawals?

Comment on lines 919 to 920
WithdrawalIndex: 456,
ValidatorIndex: 456,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
WithdrawalIndex: 456,
ValidatorIndex: 456,
WithdrawalIndex: 123,
ValidatorIndex: 456,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why?

Copy link
Contributor

Choose a reason for hiding this comment

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

Because it's closer to reality: withdrawals are sequential in a block or the block is invalid, it should be 124 though, not 123 :)

func genAttestation() *v1alpha1.Attestation {
return &v1alpha1.Attestation{
AggregationBits: bytes(32),
Data: genAttData(),
Signature: bytes(32),
Signature: bytes(96),
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this thing?

@@ -360,35 +360,95 @@ func TestCopyBeaconBlockBodyBellatrix(t *testing.T) {
}

func TestCopySignedBlindedBeaconBlockBellatrix(t *testing.T) {
sbb := genSignedBeaconBlockBellatrix()
sbb := genSignedBlindedBeaconBlockBellatrix()
Copy link
Contributor

Choose a reason for hiding this comment

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

What are these unrelated fixes?

@@ -243,7 +243,7 @@ func ProcessOperationsNoVerifyAttsSigs(
if err != nil {
return nil, err
}
case version.Altair, version.Bellatrix:
case version.Altair, version.Bellatrix, version.Capella:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
case version.Altair, version.Bellatrix, version.Capella:
case version.Altair, version.Bellatrix

Better to leave transition changes out of this PR.

@@ -81,6 +81,76 @@ func TestWrapExecutionPayloadHeader_SSZ(t *testing.T) {
assert.NoError(t, wsb.UnmarshalSSZ(encoded))
}

func TestWrapExecutionPayloadCapella(t *testing.T) {
data := &enginev1.ExecutionPayloadCapella{GasUsed: 54}
Copy link
Member

Choose a reason for hiding this comment

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

Personally, I think there's great value to fill in all the fields and test they are not nil

@@ -81,6 +81,76 @@ func TestWrapExecutionPayloadHeader_SSZ(t *testing.T) {
assert.NoError(t, wsb.UnmarshalSSZ(encoded))
}

func TestWrapExecutionPayloadCapella(t *testing.T) {
data := &enginev1.ExecutionPayloadCapella{GasUsed: 54}
wsb, err := blocks.WrappedExecutionPayloadCapella(data)
Copy link
Member

Choose a reason for hiding this comment

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

wsb wrapped signed block? this is not a block

terencechain
terencechain previously approved these changes Oct 31, 2022
if b.executionPayloadHeader != nil {
ph, ok = b.executionPayloadHeader.Proto().(*enginev1.ExecutionPayloadHeader)
if !ok {
return nil, errPayloadHeaderWrongType
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we test for this? there are four instances that we may hit these errors.

Comment on lines 919 to 920
WithdrawalIndex: 456,
ValidatorIndex: 456,
Copy link
Contributor

Choose a reason for hiding this comment

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

Because it's closer to reality: withdrawals are sequential in a block or the block is invalid, it should be 124 though, not 123 :)

@prylabs-bulldozer prylabs-bulldozer bot merged commit ffac232 into develop Oct 31, 2022
@delete-merged-branch delete-merged-branch bot deleted the capella-block branch October 31, 2022 17:58
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.

3 participants