From f7b62e550696c3a7379d17228744c65e2dd29e7b Mon Sep 17 00:00:00 2001 From: Delweng Date: Wed, 25 Oct 2023 21:20:23 +0800 Subject: [PATCH] graphql: logs return error if from block > to (#28412) As per discussion in ethereum/execution-apis#475 Signed-off-by: jsvisa --- graphql/graphql.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/graphql/graphql.go b/graphql/graphql.go index ec7382f80..50f0c6ca4 100644 --- a/graphql/graphql.go +++ b/graphql/graphql.go @@ -1417,6 +1417,9 @@ func (r *Resolver) Logs(ctx context.Context, args struct{ Filter FilterCriteria if args.Filter.ToBlock != nil { end = int64(*args.Filter.ToBlock) } + if begin > 0 && end > 0 && begin > end { + return nil, errInvalidBlockRange + } var addresses []common.Address if args.Filter.Addresses != nil { addresses = *args.Filter.Addresses