cosmjs
cosmjs copied to clipboard
`Tendermint34Client` "min height 8014 can't be greater than max height 8013"
First off, I'm really happy to be putting CosmJS to work! Thanks for this project.
Things are working pretty well, but I'm running into intermittent failures when trying to do provable queries from a web browser to a local chain. My client is currently issuing a new query every block or so (4-6 seconds).
Here a sample error message I get in the browser:
Error: {"code":-32603,"message":"Internal error","data":"min height 8274 can't be greater than max height 8273"}
at HttpClient.execute (httpclient.ts:89:1)
at async Tendermint34Client.doCall (tendermint34client.ts:341:1)
at async QueryClient.getNextHeader (queryclient.ts:614:1)
at async QueryClient.queryVerified (queryclient.ts:523:1)
the stack trace is async after that.
Every error I've seen is of the format "min height ${N+1} can't be greater than max height ${N}". It looks like there's some bad state somehow?
Here is the query I'm making:
const key = new Uint8Array([
51, 0, 112, 117, 98, 108, 105, 115, 104, 101, 100,
0, 119, 97, 108, 108, 101, 116, 0, 97, 103, 111,
114, 105, 99, 49, 50, 102, 108, 99, 106, 109, 113,
55, 48, 48, 102, 117, 107, 48, 52, 50, 100, 103,
100, 119, 50, 99, 97, 101, 116, 107, 99, 106, 106,
55, 118, 55, 119, 52, 107, 119, 55, 104
]);
await queryClient.queryVerified('vstorage', key, undefined)
I'm using @cosmjs/tendermint-rpc 0.28.7.
Thanks for any help you can offer, Michael.
Hey Michael, which Tendermint version are you connecting to?
Assuming Tendermint does not mix up things, the error message makes sense. Personally I'd say [8274, 8273] is an empty interval and not an error case, but fine.
So where do the values come from? The only place where we have min and max height in one call is the public async blockchain(minHeight?: number, maxHeight?: number): Promise<responses.BlockchainResponse> { function in the Tendermint client. This is called here: https://github.com/cosmos/cosmjs/blob/v0.28.7/packages/stargate/src/queryclient/queryclient.ts#L614. At this place height (min height) seems to be greater than searchHeight (max height). However, I don't see how this is possible with const searchHeight = height + 1;.
If you have the chance to debug the input value of line 614 (e.g. manually hacking the .js file in your node_modules), that would be great.
Did you get any insight debugging this?