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

Cannot decode height 1 - Error in parsing for rollapps #1590

Open
Segfaultd opened this issue Jun 3, 2024 · 1 comment
Open

Cannot decode height 1 - Error in parsing for rollapps #1590

Segfaultd opened this issue Jun 3, 2024 · 1 comment

Comments

@Segfaultd
Copy link

Segfaultd commented Jun 3, 2024

Introduction

Using tendermint RPC, it is impossible to query the height 1 when the last_commit (genesis) signatures object is null. That's the case on a Rollapp implementation, which has no builtin validator set.
It fails to decode the block, because it expects here to be an array
https://github.com/cosmos/cosmjs/blob/main/packages/tendermint-rpc/src/comet38/adaptor/responses.ts#L491

Stack trace

Error: Value must not be null
    at assertSet (/Users/segfaultd/dev/orbit-codes/bridge/node_modules/@cosmjs/tendermint-rpc/src/comet38/encodings.ts:17:11)
    at assertArray (/Users/segfaultd/dev/orbit-codes/bridge/node_modules/@cosmjs/tendermint-rpc/src/comet38/encodings.ts:72:3)
    at decodeCommit (/Users/segfaultd/dev/orbit-codes/bridge/node_modules/@cosmjs/tendermint-rpc/src/comet38/adaptor/responses.ts:491:28)
    at decodeBlock (/Users/segfaultd/dev/orbit-codes/bridge/node_modules/@cosmjs/tendermint-rpc/src/comet38/adaptor/responses.ts:795:50)
    at decodeBlockResponse (/Users/segfaultd/dev/orbit-codes/bridge/node_modules/@cosmjs/tendermint-rpc/src/comet38/adaptor/responses.ts:811:12)
    at decodeBlock (/Users/segfaultd/dev/orbit-codes/bridge/node_modules/@cosmjs/tendermint-rpc/src/comet38/adaptor/responses.ts:849:12)
    at Comet38Client.doCall (/Users/segfaultd/dev/orbit-codes/bridge/node_modules/@cosmjs/tendermint-rpc/src/comet38/comet38client.ts:347:12)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at BlockService.sync (/Users/segfaultd/dev/orbit-codes/bridge/src/features/block/services/block.service.ts:129:25)
    at BlocksController.getByHeight (/Users/segfaultd/dev/orbit-codes/bridge/src/features/block/http/controllers/blocks.controller.ts:39:23)

Block structure

{
   "block_id":{
      "hash":"617E8F71CC8D555B0D30D2628C919C0DB20F9AFA07E3AA547DF3CBB999B9B33C",
      "parts":{
         "total":1,
         "hash":"617E8F71CC8D555B0D30D2628C919C0DB20F9AFA07E3AA547DF3CBB999B9B33C"
      }
   },
   "block":{
      "header":{
         "version":{
            "block":"11"
         },
         "chain_id":"test-network-1",
         "height":"1",
         "time":"2024-04-30T05:41:58.005961781Z",
         "last_block_id":{
            "hash":"0000000000000000000000000000000000000000000000000000000000000000",
            "parts":{
               "total":1,
               "hash":"0000000000000000000000000000000000000000000000000000000000000000"
            }
         },
         "last_commit_hash":"E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855",
         "data_hash":"E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855",
         "validators_hash":"6B52BC5E14DCEC36FCB8A2709B7D4967D58BBB78D1BA42A373784E3F172B2728",
         "next_validators_hash":"6B52BC5E14DCEC36FCB8A2709B7D4967D58BBB78D1BA42A373784E3F172B2728",
         "consensus_hash":"0000000000000000000000000000000000000000000000000000000000000000",
         "app_hash":"E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855",
         "last_results_hash":"E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855",
         "evidence_hash":"E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855",
         "proposer_address":"6F4C4E4482AC111E9EA4D4450869889AF738046A"
      },
      "data":{
         "txs":null
      },
      "evidence":{
         "evidence":null
      },
      "last_commit":{
         "height":"0",
         "round":0,
         "block_id":{
            "hash":"617E8F71CC8D555B0D30D2628C919C0DB20F9AFA07E3AA547DF3CBB999B9B33C",
            "parts":{
               "total":1,
               "hash":"617E8F71CC8D555B0D30D2628C919C0DB20F9AFA07E3AA547DF3CBB999B9B33C"
            }
         },
         "signatures":null
      }
   }
}

Proposed fix

Can we make that check optional, or at least give it a default empty array in case of empty signatures prop ?

Used versions

"dependencies": {
    "@cosmjs/amino": "^0.32.2",
    "@cosmjs/crypto": "^0.32.2",
    "@cosmjs/encoding": "^0.32.2",
    "@cosmjs/json-rpc": "^0.32.2",
    "@cosmjs/proto-signing": "^0.32.2",
    "@cosmjs/stargate": "^0.32.2",
    "@cosmjs/tendermint-rpc": "^0.32.2",
    "@cosmjs/utils": "^0.32.2",
    "@cosmology/lcd": "^0.13.3"
  }
@Segfaultd Segfaultd changed the title Cannot decode height 1 Cannot decode height 1 - Error in parsing for rollapps Jun 3, 2024
@Segfaultd
Copy link
Author

Any chance this get attention? Simple fix somehow.

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

No branches or pull requests

1 participant