Releases: holiman/uint256
Merle Rideout (v1.3.2)
What's Changed
- conversion: fix unmarshalling overflow by @holiman in #185
- optimize
WriteToArray
and addPutUint256
by @minh-bq in #190 - optimize
Exp
for even bases by @Valeh2012 in #189
New Contributors
- @minh-bq made their first contribution in #190
- @Valeh2012 made their first contribution in #189
Full Changelog: v1.3.1...v1.3.2
Merle Rideout is a character from Thomas Pynchons epic "Against The Day"; a travelling photographer and scientific inventor.
Nathaniel Martin (v1.3.1)
What's Changed
This release fixes one bug in the DivMod
method, which under certain types of aliased inputs would produce faulty output. It also adds a method IntoBig
for alloc-free conversion into big.Int
.
- conversion: introduce 0-alloc IntoBig method by @karalabe in #177
- divmod: fix aliasing error, add tests by @holiman in #180
Full Changelog: v1.3.0...v1.3.1
Nathaniel Martin is a character from Patrick O'Brian's Aubrey/Maturin - books, set in the 1800s, the age of fighting sail. Nathaniel Martin is a natural philosopher and is a kind of sidekick to Stephen Maturin.
Fitcher Penrose (v1.3.0)
The 1.3.0-release contains a lot of optimizations, contributed by @AaronChen0. Thanks for all the contributions! Other than that, a breaking change in the ssz-interface implementation and a bugfix.
What's Changed
-
optimizations to
Mul
,squared
,Exp
,Set
,DivMod
,Byte
,Lsh
,Rsh
,SRsh
,ExtendSign
,AddMod
,MulOverflow
,MulMod
,MulDivOverflow
,MulModWithReciprocal
,Mod
,Sqrt
by @AaronChen0 in (#152, #153, #154, #158, #165, #166, #167, #168, #169, #172, #173, #174 -
Fixes a bug in
SetBytes29
(#157) -
Test-improvements, now using golang-native fuzzing instead of gofuzz-based fuzzing by @holiman (#163, #164)
-
The method
MarshalSSZTo
was removed, and has been replaced byMarshalSSZAppend
andMarshalSSZInto
. This is an intentionally breaking change, forcing users to explicitly choose which implementation they desire. For more info, see #171
Full Changelog: v1.2.4...v1.2.5
The uint256
release naming-convention is "fictional mathematicians", later expanded into "fictional scientists", due to the dearth of fiction about mathematicians.
Fitcher Penrose appears in Amitav Ghosh's Ibis-trilogy, part II, "River of Smoke". He is a botanist collecting rare plants in Asia.
Stephen Maturin (v1.2.4)
What's Changed
- Add go 1.21, make go 1.19 minimum version by @holiman in #142
- Optimize
Log10()
by @fyfyrchik in #141 - Conversion: behavioural changes in
String
,MarshalText
andMarshalJSON
by @holiman in #144
OBS! #144 is a bit of a breaking change, in some situations, since it changes the output-formats when converting to string, in order to better mirror big.Int
behaviour. Please read the PR-description to understand the effects of the change.
New Contributors
- @fyfyrchik made their first contribution in #141
Full Changelog: v1.2.3...v1.2.4
Kit Traverse (v1.2.3)
What's Changed
- Implemented
Float64() float64
by @holiman in #132 - Implemented
CmpBig
by @holiman in #138 - Implemented
Log10
andCmpUint64
by @holiman in #136 - Allow converting between
nil
big.Int
andnil
uint256.Int
by @karalabe in #137 - tests: naming conventions for benchmarks, remove obsolete by @holiman in #133
New API Methods
// Float64 returns the float64 value nearest to x.
//
// Note: The `big.Float` version of `Float64` also returns an 'Accuracy', indicating
// whether the value was too small or too large to be represented by a
// `float64`. However, the `uint256` type is unable to represent values
// out of scope (|x| < math.SmallestNonzeroFloat64 or |x| > math.MaxFloat64),
// therefore this method does not return any accuracy.
func (z *Int) Float64() float64
// CmpBig compares z and x and returns:
//
// -1 if z < x
// 0 if z == x
// +1 if z > x
func (z *Int) CmpBig(x *big.Int) (r int)
// CmpUint64 compares z and x and returns:
//
// -1 if z < x
// 0 if z == x
// +1 if z > x
func (z *Int) CmpUint64(x uint64) int
// Log10 returns the log in base 10, floored to nearest integer.
// **OBS** This method returns '0' for '0', not `-Inf`.
func (z *Int) Log10() uint
Full Changelog: v1.2.2...v1.2.3
Will Hunting (v1.2.2)
What's Changed
- Interfaces to work nicely with
fastssz
by @karalabe in #126 - String conversion from decimal by @elee1766 and @holiman in #122 and #127
- Nice constructions via
MustFromBig
,MustFromHex
andMustFromDecimal
by @karalabe and @holiman in #128, #131 - Implement
PrettyDec
and nativeDec
by @holiman in #130 - Optimize
AddMod
by @jwasinger in #120
New API-methods
Methods to create Int
s
// FromDecimal is a convenience-constructor to create an Int from a
// decimal (base 10) string. Numbers larger than 256 bits are not accepted.
func FromDecimal(decimal string) (*Int, error)
// MustFromBig is a convenience-constructor from big.Int.
// Returns a new Int and panics if overflow occurred.
func MustFromBig(b *big.Int) *Int
// MustFromHex is a convenience-constructor to create an Int from
// a hexadecimal string.
// Returns a new Int and panics if any error occurred.
func MustFromHex(hex string) *Int
// MustFromDecimal is a convenience-constructor to create an Int from a
// decimal (base 10) string.
// Returns a new Int and panics if any error occurred.
func MustFromDecimal(decimal string) *Int
Methods to initialize Int
instances
// SetFromDecimal sets z from the given string, interpreted as a decimal number.
// OBS! This method is _not_ strictly identical to the (*big.Int).SetString(..., 10) method.
// Notable differences:
// - This method does not accept underscore input, e.g. "100_000",
// - This method does not accept negative zero as valid, e.g "-0",
// - (this method does not accept any negative input as valid))
func (z *Int) SetFromDecimal(s string) (err error)
// SetFromHex sets z from the given string, interpreted as a hexadecimal number.
// OBS! This method is _not_ strictly identical to the (*big.Int).SetString(..., 16) method.
// Notable differences:
// - This method _require_ "0x" or "0X" prefix.
// - This method does not accept zero-prefixed hex, e.g. "0x0001"
// - This method does not accept underscore input, e.g. "100_000",
// - This method does not accept negative zero as valid, e.g "-0x0",
// - (this method does not accept any negative input as valid)
func (z *Int) SetFromHex(hex string) error
// Scan implements the database/sql Scanner interface.
// It decodes a string, because that is what postgres uses for its numeric type
func (dst *Int) Scan(src interface{}) error
Methods to output into strings
// MarshalJSON implements json.Marshaler.
func (z *Int) MarshalJSON() ([]byte, error)
// Value implements the database/sql/driver Valuer interface.
func (src *Int) Value() (driver.Value, error)
// Dec returns the decimal representation of z.
func (z *Int) Dec() string
// PrettyDec returns the decimal representation of z, with thousands-separators.
func (z *Int) PrettyDec(separator byte) string
Methods related to ssz
encoding
// MarshalSSZTo implements the fastssz.Marshaler interface and serializes the
// integer into an already pre-allocated buffer.
func (z *Int) MarshalSSZTo(dst []byte) ([]byte, error)
// MarshalSSZ implements the fastssz.Marshaler interface and returns the integer
// marshalled into a newly allocated byte slice.
func (z *Int) MarshalSSZ() ([]byte, error)
// SizeSSZ implements the fastssz.Marshaler interface and returns the byte size
// of the 256 bit int.
func (*Int) SizeSSZ() int
// UnmarshalSSZ implements the fastssz.Unmarshaler interface and parses an encoded
// integer into the local struct.
func (z *Int) UnmarshalSSZ(buf []byte) error
// HashTreeRoot implements the fastssz.HashRoot interface's non-dependent part.
func (z *Int) HashTreeRoot() ([32]byte, error)
New Contributors
- @jwasinger made their first contribution in #120
- @elee1766 made their first contribution in #122
Full Changelog: v1.2.1...v1.2.2
Hari Seldon
The v1.2.1
release, "Hari Seldon", contains some new API-methods and a lot of improvements under the hood and in the surrounding infrastructure.
- OSS-fuzz integration has finally happened, as of (#98) and google/oss-fuzz#6497. The
uint256
library is now continuously fuzzed by the fine folks at OSS-Fuzz. - Optimised modular arithmetic targeting elliptic curve operations (#86). This was a major overhaul and complete rewrite of the modular arithmetic operations.
- Added
DivMod()
(#113) - Added
MulDivOverflow()
(#110) - Added
Sqrt()
(#104) - Improvements ot
Cmp()
(#85) - Test improvements (#112, #95, #93, #92, #91, #89, #88)
Thanks to all contributors to this release: @holiman, @chfast,@daosvik, @Planxnx and @fyrchik.
Enoch Root
Daniel Waterhouse
This release adds various methods for marshalling from text/json, to make integration with go-ethereum easier
Lawrence Waterhouse
The 1.1.0
release of uint256
contains some improvements and new features.
- The function
MulOverflow
was added (#75 and #76) - Squaring, multiplication and expontentiation was improved with 15-20% (#71)
EncodeRLP
method was added (#74)- The
SetBytes
-method was improved by an order of magnitude, and the extremely fast specialized methodsSetBytes1
,SetBytes2
etc were added (#70). - Compatibility with golang-1.12 was fixed (#72)
- Tests are now also run on big-endian architecture (#73)