diff --git a/decoder.go b/decoder.go index 26f469d..08777cc 100644 --- a/decoder.go +++ b/decoder.go @@ -227,14 +227,14 @@ func DecodeUint256BigInt(dec *Decoder, n **big.Int) { dec.inRead += 32 dec.bufInt.UnmarshalSSZ(dec.buf[:32]) - *n = dec.bufInt.ToBig() // TODO(karalabe): make this alloc free (https://github.com/holiman/uint256/pull/177) + dec.bufInt.IntoBig(n) } else { if len(dec.inBuffer) < 32 { dec.err = io.ErrUnexpectedEOF return } dec.bufInt.UnmarshalSSZ(dec.inBuffer[:32]) - *n = dec.bufInt.ToBig() // TODO(karalabe): make this alloc free (https://github.com/holiman/uint256/pull/177) + dec.bufInt.IntoBig(n) dec.inBuffer = dec.inBuffer[32:] } } diff --git a/go.mod b/go.mod index 7084d6f..3dcc79f 100644 --- a/go.mod +++ b/go.mod @@ -4,9 +4,10 @@ go 1.21 require ( github.com/golang/snappy v0.0.4 - github.com/holiman/uint256 v1.3.0 + github.com/holiman/uint256 v1.3.1 github.com/prysmaticlabs/go-bitfield v0.0.0-20240618144021-706c95b2dd15 github.com/prysmaticlabs/gohashtree v0.0.4-beta + golang.org/x/sync v0.7.0 golang.org/x/tools v0.22.0 gopkg.in/yaml.v3 v3.0.1 ) @@ -14,5 +15,4 @@ require ( require ( github.com/klauspost/cpuid/v2 v2.0.9 // indirect golang.org/x/mod v0.18.0 // indirect - golang.org/x/sync v0.7.0 // indirect ) diff --git a/go.sum b/go.sum index 03bd6e0..e5daf85 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/holiman/uint256 v1.3.0 h1:4wdcm/tnd0xXdu7iS3ruNvxkWwrb4aeBQv19ayYn8F4= -github.com/holiman/uint256 v1.3.0/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= +github.com/holiman/uint256 v1.3.1 h1:JfTzmih28bittyHM8z360dCjIA9dbPIBlcTI6lmctQs= +github.com/holiman/uint256 v1.3.1/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/minio/sha256-simd v1.0.0 h1:v1ta+49hkWZyvaKwrQB8elexRqm6Y0aMLjCNsrYxo6g=