Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blockResults: Input not in int53 range #1465

Closed
AndreMiras opened this issue Aug 15, 2023 · 1 comment · Fixed by #1497
Closed

blockResults: Input not in int53 range #1465

AndreMiras opened this issue Aug 15, 2023 · 1 comment · Fixed by #1497
Milestone

Comments

@AndreMiras
Copy link

I came across a block (88458) on evmos that triggers an Input not in int53 range error.
I'm running @cosmjs/tendermint-rpc 0.31.0

Here's a simple reproduction:

import assert from "assert";
import { Tendermint34Client } from "@cosmjs/tendermint-rpc";

const TENDERMINT_RPC_URL = process.env.TENDERMINT_RPC_URL;
assert.ok(TENDERMINT_RPC_URL);

const main = async () => {
  const heights = [88457, 88458];
  const client = await Tendermint34Client.connect(TENDERMINT_RPC_URL);
  for (const height of heights) {
    console.log({height})
    const blockResults = await client.blockResults(height);
    console.log("OK")
  }
};

main();

Executed with:

node_modules/.bin/ts-node src/cosmos-int53-range-error.ts

Output was:

{ height: 88457 }
OK
{ height: 88458 }
Error: Input not in int53 range: 168139200000000000
    at new Int53 (/project/node_modules/@cosmjs/math/src/integers.ts:137:13)
    at Function.fromString (/project/node_modules/@cosmjs/math/src/integers.ts:122:12)
    at apiToSmallInt (/project/node_modules/@cosmjs/tendermint-rpc/src/inthelpers.ts:12:70)
    at decodeTxData (/project/node_modules/@cosmjs/tendermint-rpc/src/tendermint34/adaptor/responses.ts:161:29)
    at Array.map (<anonymous>)
    at decodeBlockResults (/project/node_modules/@cosmjs/tendermint-rpc/src/tendermint34/adaptor/responses.ts:298:39)
    at decodeBlockResults (/project/node_modules/@cosmjs/tendermint-rpc/src/tendermint34/adaptor/responses.ts:844:12)
    at Tendermint34Client.doCall (/project/node_modules/@cosmjs/tendermint-rpc/src/tendermint34/tendermint34client.ts:344:12)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

These are some pretty old blocks so I've attached /block_results?height=88457 and /block_results?height=88458 in case you don't have access to an archive node.
block_results?height=88457.txt
block_results?height=88458.txt

@webmaster128
Copy link
Member

webmaster128 commented Aug 21, 2023

Bildschirmfoto 2023-08-21 um 09 53 17

Interesting, thanks for the detailed report. Seems like a gas_wanted value in a transaction. This value is higher than any reasonable amount but users can enter it.

The solution here would probably be to avoid using apiToSmallInt and return a bigint instead of number.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants