From a0821506bc5aacf7740dfd7c405e3308c56a6fab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Wed, 8 Mar 2023 20:49:28 +0000 Subject: [PATCH] Eth API: fail when requesting future epochs. --- node/impl/full/eth.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/node/impl/full/eth.go b/node/impl/full/eth.go index 7af9e7000..919380ad1 100644 --- a/node/impl/full/eth.go +++ b/node/impl/full/eth.go @@ -254,6 +254,9 @@ func (a *EthModule) parseBlkParam(ctx context.Context, blkParam string, strict b if err != nil { return nil, fmt.Errorf("cannot parse block number: %v", err) } + if abi.ChainEpoch(num) > head.Height()-1 { + return nil, fmt.Errorf("requested a future epoch (beyond 'latest')") + } ts, err := a.Chain.GetTipsetByHeight(ctx, abi.ChainEpoch(num), nil, true) if err != nil { return nil, fmt.Errorf("cannot get tipset at height: %v", num)