From bf2e341a6c4c3314788fda87fe08003cdb32fe5d Mon Sep 17 00:00:00 2001 From: forkfury Date: Wed, 5 Nov 2025 00:01:20 +0100 Subject: [PATCH] Update contracts.go --- core/vm/contracts.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/vm/contracts.go b/core/vm/contracts.go index cae0be9f2de..03cf5d25b73 100644 --- a/core/vm/contracts.go +++ b/core/vm/contracts.go @@ -591,8 +591,11 @@ func (c *bigModExp) RequiredGas(input []byte) uint64 { if expLen > 32 { expHead.SetBytes(getData(input, baseLen, 32)) } else { - // TODO: Check that if expLen < baseLen, then getData will return an empty slice - expHead.SetBytes(getData(input, baseLen, expLen)) + if expLen < baseLen && uint64(len(input)) < baseLen+expLen { + expHead.SetBytes([]byte{}) + } else { + expHead.SetBytes(getData(input, baseLen, expLen)) + } } }