-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Reconstruct full Capella block #11732
Conversation
(cherry picked from commit b060158) # Conflicts: # beacon-chain/rpc/eth/beacon/blocks.go # proto/engine/v1/json_marshal_unmarshal.go
(cherry picked from commit 903cab7) # Conflicts: # beacon-chain/execution/testing/mock_engine_client.go
@@ -92,6 +93,7 @@ func (s *Service) getBlkParentHashAndTD(ctx context.Context, blkHash []byte) ([] | |||
if blk == nil { | |||
return nil, nil, errors.New("pow block is nil") | |||
} | |||
blk.Version = version.Bellatrix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why set this ? Shouldn't it already have its version set in the ExecutionBlockByHash
method ? Or are you not able to infer that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not able to infer from how ExecutionBlockByHash
is implemented. I can add a version
argument, but this seems cleaner to me.
@@ -437,11 +437,12 @@ func (s *Service) ReconstructFullBellatrixBlock( | |||
if executionBlock == nil { | |||
return nil, fmt.Errorf("received nil execution block for request by hash %#x", executionBlockHash) | |||
} | |||
executionBlock.Version = blindedBlock.Version() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question here
// ToBytes20 is a convenience method for converting a byte slice to a fix | ||
// sized 20 byte array. This method will truncate the input if it is larger | ||
// than 20 bytes. | ||
func ToBytes20(x []byte) [20]byte { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add some unit tests for this ?
|
||
rawWithdrawals, ok := decoded["withdrawals"] | ||
if !ok || rawWithdrawals == nil { | ||
e.Version = version.Bellatrix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we know this for sure ? This just means there are 0 withdrawals in the payload.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I asked on Discord and we have this now: ethereum/execution-apis#334.
# Conflicts: # encoding/bytesutil/bytes_test.go
return w, nil | ||
} | ||
|
||
func (w *Withdrawal) toWithdrawalJSON() (*withdrawalJSON, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an odd method, why do we have it ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I use it here:
ws := make([]*withdrawalJSON, len(e.Withdrawals))
for i, w := range e.Withdrawals {
ws[i], err = w.toWithdrawalJSON() <-- HERE
if err != nil {
return nil, err
}
}
decoded["withdrawals"] = ws
* Merge branch 'reconstruct-capella-block' into capella (cherry picked from commit b060158) # Conflicts: # beacon-chain/rpc/eth/beacon/blocks.go # proto/engine/v1/json_marshal_unmarshal.go * remove unneeded test * rename methods * add doc to interface * deepsource (cherry picked from commit 903cab7) # Conflicts: # beacon-chain/execution/testing/mock_engine_client.go * bzl * fix failing tests * single ExecutionBlockByHash function * fix engine mock * deepsource * reorder checks * single execution block type * update tests * update doc * bytes test * remove toWithdrawalJSON Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
What type of PR is this?
Feature
What does this PR do? Why is it needed?
Extends the engine client with the ability to reconstruct full Capella blocks from blinded Capella blocks.
Which issues(s) does this PR fix?
Part of Capella