From 4a4ba278dc2c30be5e2ea5b644a853484035b67b Mon Sep 17 00:00:00 2001 From: Manav Darji Date: Tue, 25 Mar 2025 23:51:56 +0530 Subject: [PATCH] common/math: add BigIntToUint256Int method back --- common/math/big.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/common/math/big.go b/common/math/big.go index 2bf3c8fb4f..862ca1f609 100644 --- a/common/math/big.go +++ b/common/math/big.go @@ -20,6 +20,8 @@ package math import ( "fmt" "math/big" + + "github.com/holiman/uint256" ) // Various big integer limit values. @@ -194,3 +196,9 @@ func U256(x *big.Int) *big.Int { func U256Bytes(n *big.Int) []byte { return PaddedBigBytes(U256(n), 32) } + +// BigIntToUint256Int converts big Int to uint256 Int by setting bytes representing +// big-endian unsigned integer. +func BigIntToUint256Int(x *big.Int) *uint256.Int { + return new(uint256.Int).SetBytes(x.Bytes()) +}