Solana.Unity-Core
Solana.Unity-Core copied to clipboard
[Bug]rentEpoc > ulong.MaxValue
Describe the bug
I encountered an overflow error when converting the result from JSON using the rpc.GetTokenAccountsByOwnerAsync method, specifically when the rentEpoch value exceeds ulong.MaxValue. This issue arises when processing rentEpoch values larger than what ulong can represent.
To Reproduce Steps to reproduce the behavior:
- Call the
rpc.GetTokenAccountsByOwnerAsyncmethod to retrieve information about token accounts associated with an owner. - Identify a scenario where the
rentEpochvalue in the returned JSON data exceedsulong.MaxValue. - Observe an overflow error during the conversion of JSON to .NET objects when encountering large
rentEpochvalues.
Expected behavior
I expected the library to either handle rentEpoch values of any size properly or provide a clear error message indicating that the value exceeds the supported range. Ideally, measures such as using a different data type or implementing a validation mechanism should be taken to accommodate scenarios where rentEpoch could surpass ulong limits.
Additional context Error json excerpt
{"id":1,"jsonrpc":"2.0","result":{"context":{"apiVersion":"1.17.18","slot":246405854},"value":[{"account":{"data":{"parsed":{"info":{"isNative":false,"mint":"4wjPQJ6PrkC4dHhYghwJzGBVP78DkBzA2U3kHoFNBuhj","owner":"xxxxxxxxxxxxxxxxxx","state":"initialized","tokenAmount":{"amount":"100754","decimals":6,"uiAmount":0.100754,"uiAmountString":"0.100754"}},"type":"account"},"program":"spl-token","space":165},"executable":false,"lamports":2039280,"owner":"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA","rentEpoch":18446744073709552000,"space":165},"pubkey":"RVM2fCzme8o13BcyuZ2Ja1U7e6bHkf43Fze3iQNgJ1e"}....
Note: This issue report was created with the assistance of ChatGPT.