Skip to content

fix 400 error on /cosmos/tx/v1beta1/txs/block/ with block with no transactions#3259

Open
h45hc47 wants to merge 1 commit intosei-protocol:mainfrom
h45hc47:main
Open

fix 400 error on /cosmos/tx/v1beta1/txs/block/ with block with no transactions#3259
h45hc47 wants to merge 1 commit intosei-protocol:mainfrom
h45hc47:main

Conversation

@h45hc47
Copy link
Copy Markdown

@h45hc47 h45hc47 commented Apr 16, 2026

The current condition offset >= blockTxsLn incorrectly rejects valid requests when offset = 0 and blockTxsLn = 0, so on empty blocks node return error

{
    "code": 3,
    "message": "out of range: cannot paginate 0 txs with offset 0 and limit 100: invalid request: invalid request",
    "details": []
}

Changing to offset > blockTxsLn is save because:

  1. Iteration bounds are protected: the actual transaction processing loops have their own bounds checking:
    • Forward pagination: i < blockTxsLn && count != limit
    • Reverse pagination: i > 0 && count != limit
  2. Invalid offsets are still rejected: offsets greater than the number of transactions (like offset = 1 when blockTxsLn = 0) will still be properly rejected

Now node return valid response on empty blocks.

Issue: #3239

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 this pull request may close these issues.

1 participant