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

fix(turbo/execution): skip if header number is nil #12033

Merged
merged 1 commit into from
Sep 19, 2024

Conversation

jsvisa
Copy link
Contributor

@jsvisa jsvisa commented Sep 19, 2024

I'm running with erigon e3 in holesky chain, and found somd panic message in erigon's log:

[EROR] [09-18|23:57:23.899] RPC method engine_getPayloadBodiesByHashV1 crashed: runtime error: invalid memory address or nil pointer dereference
[service.go:223 panic.go:770 panic.go:261 signal_unix.go:881 getters.go:154 execution_client.go:41 chain_reader.go:220 engine_server.go:599 engine_server.go:766 value.go:596 value.go:380 service.go:228 handler.go:534 handler.go:484 handler.go:425 handler.go:245 handler.go:338 asm_amd64.s:1695]

The panic was raised in this line

number, err := e.blockReader.HeaderNumber(ctx, tx, h)
if err != nil {
return nil, fmt.Errorf("ethereumExecutionModule.GetBodiesByHashes: HeaderNumber error %w", err)
}
body, err := e.getBody(ctx, tx, h, *number)

After some digging, found HeaderByNumber maybe return nil, nil, so I think we need to handle the nil number case

func (r *RemoteBlockReader) HeaderNumber(ctx context.Context, tx kv.Getter, hash common.Hash) (*uint64, error) {
resp, err := r.client.HeaderNumber(ctx, &remote.HeaderNumberRequest{Hash: gointerfaces.ConvertHashToH256(hash)})
if err != nil {
return nil, err
}
if resp == nil {
return nil, nil
}
return resp.Number, nil
}

func (r *BlockReader) HeaderNumber(ctx context.Context, tx kv.Getter, hash common.Hash) (*uint64, error) {
ret := rawdb.ReadHeaderNumber(tx, hash)
if ret != nil {
return ret, nil
}
h, err := r.HeaderByHash(ctx, tx, hash)
if err != nil {
return nil, err
}
if h == nil {
return nil, nil
}

Signed-off-by: jsvisa <delweng@gmail.com>
@AskAlexSharov
Copy link
Collaborator

FYI: @Giulio2002

@AskAlexSharov AskAlexSharov merged commit 7496488 into erigontech:main Sep 19, 2024
8 checks passed
@jsvisa jsvisa deleted the execution-getBlock-panic branch September 19, 2024 04:05
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.

2 participants