Skip to content

Commit

Permalink
ssz: update uint256 and use 0-alloc IntoBig (#17)
Browse files Browse the repository at this point in the history
* push

* remove debug

* bet
  • Loading branch information
itsdevbear authored Aug 7, 2024
1 parent 026e397 commit e314ffd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:]
}
}
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ 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
)

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
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -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=
Expand Down

0 comments on commit e314ffd

Please sign in to comment.