magicblock-labs / magicblock-labs/Solana.Unity-Core
[Bug]rentEpoc > ulong.MaxValue
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 53
- Forks
- 23
- PR merge metrics
- No merged PRs in 30d
Description
**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:
1. Call the `rpc.GetTokenAccountsByOwnerAsync` method to retrieve information about token accounts associated with an owner.
2. Identify a scenario where the `rentEpoch` value in the returned JSON data exceeds `ulong.MaxValue`.
3. Observe an overflow error during the conversion of JSON to .NET objects when encountering large `rentEpoch` values.
**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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with rpc.GetTokenAccountsByOwnerAsync and trace how the returned JSON is converted into .NET objects, focusing on the rentEpoch value shown in the report. Reproduce the overflow with the supplied JSON and confirm that handling values beyond ulong.MaxValue either succeeds or produces a clear supported-range error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100