cosmos / cosmjs

The Swiss Army knife to power JavaScript based client solutions ranging from Web apps/explorers over browser extensions to server-side clients like faucets/scrapers.
https://cosmos.github.io/cosmjs/
Apache License 2.0
635 stars 328 forks source link

blockResults got decodeConsensusParams error with Chihuahua #1543

Closed jiqiang90 closed 6 months ago

jiqiang90 commented 6 months ago

Hi, I'm using Tendermint37Client trying to get blockResults for chihuahua network, and got error

Error: Value must not be undefined
    at assertSet (/Users/jiatwork/subql4/chihuahua-test/node_modules/@cosmjs/tendermint-rpc/build/tendermint37/encodings.js:12:15)
    at assertObject (/Users/jiatwork/subql4/chihuahua-test/node_modules/@cosmjs/tendermint-rpc/build/tendermint37/encodings.js:84:5)
    at decodeConsensusParams (/Users/jiatwork/subql4/chihuahua-test/node_modules/@cosmjs/tendermint-rpc/build/tendermint37/adaptor/responses.js:119:63)
    at may (/Users/jiatwork/subql4/chihuahua-test/node_modules/@cosmjs/tendermint-rpc/build/tendermint37/encodings.js:118:64)
    at decodeBlockResults (/Users/jiatwork/subql4/chihuahua-test/node_modules/@cosmjs/tendermint-rpc/build/tendermint37/adaptor/responses.js:135:47)
    at decodeBlockResults (/Users/jiatwork/subql4/chihuahua-test/node_modules/@cosmjs/tendermint-rpc/build/tendermint37/adaptor/responses.js:385:16)
    at Tendermint37Client.doCall (/Users/jiatwork/subql4/chihuahua-test/node_modules/@cosmjs/tendermint-rpc/build/tendermint37/tendermint37client.js:309:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

To reproduce this:


import {Tendermint37Client} from "@cosmjs/tendermint-rpc"

async function fetchBlockResult(): Promise<void>{
    const tendermintClient = await Tendermint37Client.connect("https://chihuahua-rpc.publicnode.com:443");
    const result = await tendermintClient.blockResults(10925390)
    console.log(result);
}

fetchBlockResult();

No problem with https://chihuahua-rpc.publicnode.com/block_results?height=10925390 Please point out If I haven't done this correctly. Thank you.

jiqiang90 commented 6 months ago

Hi guys, we are blocking by this issue, anyone could help please.

hoangdv2429 commented 6 months ago

If the team don't mind then can I work on this ? something is wrong with https://github.com/decentrio/cosmjs/blob/3d61cde23f31713db0910a65a79d377a7720c71c/packages/tendermint-rpc/src/tendermint37/adaptor/responses.ts#L369-L392

jiqiang90 commented 6 months ago

If the team don't mind then can I work on this ? something is wrong with https://github.com/decentrio/cosmjs/blob/3d61cde23f31713db0910a65a79d377a7720c71c/packages/tendermint-rpc/src/tendermint37/adaptor/responses.ts#L369-L392

Thank @hoangdv2429 really appreciate

hoangdv2429 commented 6 months ago

@jiqiang90 you can apply the fix directly to the library in the node_modules and it'll temporally fix the problem