mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-29 03:41:45 +00:00
vm: increase BigInt parsing precision
Follow the https://github.com/neo-project/neo/pull/2883. Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
This commit is contained in:
parent
562293c74b
commit
d90608ddbf
2 changed files with 6 additions and 6 deletions
|
@ -27,9 +27,9 @@ const MaxAllowedInteger = 2<<53 - 1
|
|||
const MaxJSONDepth = 10
|
||||
|
||||
// MaxIntegerPrec is the maximum precision allowed for big.Integer parsing.
|
||||
// It equals to the reference value and doesn't allow to precisely parse big
|
||||
// numbers, see the https://github.com/neo-project/neo/issues/2879.
|
||||
const MaxIntegerPrec = 53
|
||||
// It allows to properly parse integer numbers that our 256-bit VM is able to
|
||||
// handle.
|
||||
const MaxIntegerPrec = 1<<8 + 1
|
||||
|
||||
// ErrInvalidValue is returned when an item value doesn't fit some constraints
|
||||
// during serialization or deserialization.
|
||||
|
|
|
@ -134,10 +134,10 @@ func TestFromToJSON(t *testing.T) {
|
|||
// the C# one, ref. https://github.com/neo-project/neo/issues/2879.
|
||||
func TestFromJSON_CompatBigInt(t *testing.T) {
|
||||
tcs := map[string]string{
|
||||
`9.05e+28`: "90499999999999993918259200000",
|
||||
`9.05e+28`: "90500000000000000000000000000",
|
||||
`1.871e+21`: "1871000000000000000000",
|
||||
`3.0366e+32`: "303660000000000004445016810323968",
|
||||
`1e+30`: "1000000000000000019884624838656",
|
||||
`3.0366e+32`: "303660000000000000000000000000000",
|
||||
`1e+30`: "1000000000000000000000000000000",
|
||||
}
|
||||
for in, expected := range tcs {
|
||||
t.Run(in, func(t *testing.T) {
|
||||
|
|
Loading…
Reference in a new issue