From 2f10aac60f5fa8b926db7036ef9f50bd75253730 Mon Sep 17 00:00:00 2001 From: wgr523 <wgr523@gmail.com> Date: Thu, 25 May 2023 12:22:23 +0800 Subject: [PATCH] eth: ensure from<to when tracing chain (credits Chen Nan via bugbounty) (#251) Co-authored-by: Martin Holst Swende <martin@swende.se> --- eth/api_tracer.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/eth/api_tracer.go b/eth/api_tracer.go index aa4d74b7b2bb..a6daf7f4897d 100644 --- a/eth/api_tracer.go +++ b/eth/api_tracer.go @@ -121,6 +121,9 @@ func (api *PrivateDebugAPI) TraceChain(ctx context.Context, start, end rpc.Block if to == nil { return nil, fmt.Errorf("end block #%d not found", end) } + if from.Number().Cmp(to.Number()) >= 0 { + return nil, fmt.Errorf("end block (#%d) needs to come after start block (#%d)", end, start) + } return api.traceChain(ctx, from, to, config) }