From da8919ddd9cc533edd28f2d7b9a13453c62e38e7 Mon Sep 17 00:00:00 2001 From: marcello33 Date: Mon, 11 Nov 2024 07:07:22 +0100 Subject: [PATCH] fix: address negative blockNumber --- helper/call.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/helper/call.go b/helper/call.go index b41da5a08..556291d41 100644 --- a/helper/call.go +++ b/helper/call.go @@ -465,6 +465,9 @@ func (c *ContractCaller) GetMaticChainBlock(blockNum *big.Int) (header *ethTypes var latestBlock *ethTypes.Header if c.MaticGrpcFlag && blockNum != nil { + if blockNum.Sign() < 0 { + blockNum = new(big.Int).Abs(blockNum) + } latestBlock, err = c.MaticGrpcClient.HeaderByNumber(ctx, blockNum.Uint64()) } else { latestBlock, err = c.MaticChainClient.HeaderByNumber(ctx, blockNum)