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

Two fixes 1) Fix getBlock - it never actually pulled in transactions 2) fix nil pointer possible deref #14188

Merged
merged 2 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions op-service/eth/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,9 @@ func BlockAsPayload(bl *types.Block, config *params.ChainConfig) (*ExecutionPayl
}
opaqueTxs[i] = otx
}
if baseFee == nil {
return nil, fmt.Errorf("base fee was nil")
}

payload := &ExecutionPayload{
ParentHash: bl.ParentHash(),
Expand Down
22 changes: 19 additions & 3 deletions op-wheel/engine/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,28 @@ type RPCBlock struct {
}

func getBlock(ctx context.Context, client client.RPC, method string, tag string) (*types.Block, error) {
var bl *RPCBlock
err := client.CallContext(ctx, &bl, method, tag, true)
var raw json.RawMessage
err := client.CallContext(ctx, &raw, method, tag, true)
if err != nil {
return nil, err
}
return types.NewBlockWithHeader(&bl.Header).WithBody(types.Body{Transactions: bl.Transactions}), nil

var head *types.Header
if err := json.Unmarshal(raw, &head); err != nil {
return nil, err
}

type rpcBlock struct {
Hash common.Hash `json:"hash"`
Transactions []*types.Transaction `json:"transactions"`
}

var body *rpcBlock
if err := json.Unmarshal(raw, &body); err != nil {
return nil, err
}

return types.NewBlockWithHeader(head).WithBody(types.Body{Transactions: body.Transactions}), nil
}

func getHeader(ctx context.Context, client client.RPC, method string, tag string) (*types.Header, error) {
Expand Down