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

Add ePBS to db #13971

Merged
merged 2 commits into from
May 14, 2024
Merged

Add ePBS to db #13971

merged 2 commits into from
May 14, 2024

Conversation

terencechain
Copy link
Member

This PR updates DB pkg to be ePBS compatible. Mainly these three things
1.) Block
2.) Beacon state

  • Marshal method was missing. I added the the correct name to build file
    3.) Exuection Payload Envelope (blind version)
  • New protobuf SignedExecutionPayloadEnvelopeBlind was defined. The payload itself is replaced by payload_root
  • Getter is SignedExecutionPayloadEnvelopeBlind(ctx context.Context, blockRoot []byte) which uses beacon block root to retrieve
  • Setter is SaveSignedExecutionPayloadEnvelopeBlind(ctx context.Context, envelope *ethpb.SignedExecutionPayloadEnvelopeBlind)

@terencechain terencechain added the Ready For Review A pull request ready for code review label May 10, 2024
@@ -87,6 +88,7 @@ type NoHeadAccessDatabase interface {
SaveDepositContractAddress(ctx context.Context, addr common.Address) error
// SaveExecutionChainData operations.
SaveExecutionChainData(ctx context.Context, data *ethpb.ETH1ChainData) error
SaveSignedExecutionPayloadEnvelopeBlind(ctx context.Context, envelope *ethpb.SignedExecutionPayloadEnvelopeBlind) error
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 really need the Blind here? and even such a long name? any problem in calling this SavePayloadEnvelope?

@@ -303,7 +303,7 @@ func prepareBlockBatch(blks []blocks.ROBlock, shouldBlind bool) ([]blockBatchEnt
if !errors.Is(err, blocks.ErrUnsupportedVersion) {
return nil, errors.Wrapf(err, "could not convert block to blinded format for root %#x", batch[i].root)
}
// Pre-deneb blocks give ErrUnsupportedVersion; use the full block already in the batch entry.
// Pre-bellatrix and ePBS blocks give ErrUnsupportedVersion; use the full block already in the batch entry.
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment change is confusing

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll revert this change. There's nothing we have to do here anyway

@@ -857,7 +869,7 @@ func TestStore_BlocksBySlot_BlockRootsBySlot(t *testing.T) {
require.NoError(t, err)
assert.Equal(t, true, proto.Equal(wantedPb, retrieved0Pb), "Wanted: %v, received: %v", retrievedBlocks[0], wanted)
wanted = b3
if b3.Version() >= version.Bellatrix {
if b3.Version() >= version.Bellatrix && b3.Version() < version.EPBS {
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't we need to add then a test for epbs?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm unclear what you meant. We have an EPBS test in blockTests. These changes fix the previous behavior where the test always assumes the saved block is blinded for b3.

@@ -1,5 +1,5 @@
// Code generated by fastssz. DO NOT EDIT.
// Hash: d06a72227c2f5e350916cce3e89f4e855135a2a22f6ea263dedc68fa506c1ba7
Copy link
Contributor

Choose a reason for hiding this comment

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

This file is better not to add the change

@@ -1,5 +1,5 @@
// Code generated by fastssz. DO NOT EDIT.
// Hash: 6f33097dd41d3dd49d35b7cfceef5a1afca20f05d65b18215748b459db16f99b
// Hash: 6b214399116c0ca31026da23db2b85fccd78e16d7b9113c83b4a9ee4e60977f6
Copy link
Contributor

Choose a reason for hiding this comment

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

This file is better not to add the change

bytes signature = 2 [(ethereum.eth.ext.ssz_size) = "96"];
}

message ExecutionPayloadEnvelopeBlind {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we probably can start naming these PayloadEnvelopeBlind or BlindPayloadEnvelope

option java_package = "org.ethereum.eth.v1alpha1";
option php_namespace = "Ethereum\\Eth\\v1alpha1";

message SignedExecutionPayloadEnvelopeBlind {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same with this, probably can be simply named SignedPayloadEnvelopeBlind or SignedBlindPayloadEnvelope

return &ethpb.Deposit{
Proof: [][]byte{randomBytes(32, t), randomBytes(32, t), randomBytes(32, t)},
Copy link
Contributor

Choose a reason for hiding this comment

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

why before it was 33 and now 32 the length of the slice?

Copy link
Member Author

Choose a reason for hiding this comment

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

Before we didn't use the correct length. Now we are using correct length 33 or else HTR fails

@potuz potuz merged commit e616cc7 into epbs May 14, 2024
15 of 16 checks passed
@potuz potuz deleted the db-epbs branch May 14, 2024 09:29
potuz pushed a commit that referenced this pull request May 14, 2024
* Add ePBS to db
potuz pushed a commit that referenced this pull request May 15, 2024
* Add ePBS to db
potuz pushed a commit that referenced this pull request May 16, 2024
* Add ePBS to db
potuz added a commit that referenced this pull request May 21, 2024
* Add ePBS to db
potuz added a commit that referenced this pull request May 22, 2024
* Add ePBS to db
potuz added a commit that referenced this pull request May 24, 2024
* Add ePBS to db
potuz added a commit that referenced this pull request May 24, 2024
* Add ePBS to db
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready For Review A pull request ready for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants