diff --git a/pkg/vm/stackitem/json.go b/pkg/vm/stackitem/json.go index 508d91fbd..482ff27ae 100644 --- a/pkg/vm/stackitem/json.go +++ b/pkg/vm/stackitem/json.go @@ -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. diff --git a/pkg/vm/stackitem/json_test.go b/pkg/vm/stackitem/json_test.go index 679da1b3b..0895b283d 100644 --- a/pkg/vm/stackitem/json_test.go +++ b/pkg/vm/stackitem/json_test.go @@ -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) {