You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BigInteger serialization does not respect the JSON specification when value is above 2^53
Expected Behavior
The serialized json value should be of type string, and not number, when value is above the 2^53.
Current Behavior
The value is serialized as number json, which is not guaranteed to be interoperable across json implementation. For example Hardhat refuses it.
Possible Solution
Declaring the C# type as string instead of BigInteger works, at least for Hardhat.
Steps to Reproduce
(coming soon)
Context (Environment)
.Net7 Core on linux + Hardhat 2.17.3 + Nethereum 4.17.1
Detailed Description
Using the EIP2612 Permit model and assigning the deadline field to the max uint256 value 115792089237316195423570985008687907853269984665640564039457584007913129639935 will make Hardhat's eth_signTypedData_v4 call assert.
BigInteger serialization does not respect the JSON specification when value is above 2^53
Expected Behavior
The serialized json value should be of type string, and not number, when value is above the 2^53.
Current Behavior
The value is serialized as number json, which is not guaranteed to be interoperable across json implementation. For example
Hardhat
refuses it.Possible Solution
Declaring the C# type as
string
instead ofBigInteger
works, at least for Hardhat.Steps to Reproduce
(coming soon)
Context (Environment)
.Net7 Core on linux + Hardhat 2.17.3 + Nethereum 4.17.1
Detailed Description
Using the EIP2612 Permit model and assigning the
deadline
field to the maxuint256
value115792089237316195423570985008687907853269984665640564039457584007913129639935
will makeHardhat
'seth_signTypedData_v4
call assert.Possible Implementation
I believe the bug is somewhere around:
Nethereum/src/Nethereum.ABI/EIP712/TypedDataRawJsonConversion.cs
Line 196 in 49a0c1a
It should not insert the BigInteger value as is, but check for maximum (and minimum) value and serialize it to string.
The text was updated successfully, but these errors were encountered: