Skip to content

fix(backend): harden Celestia node response handling#2

Open
loopghost wants to merge 1 commit into
celestiaorg:mainfrom
loopghost:harden-celestia-backend-node-responses
Open

fix(backend): harden Celestia node response handling#2
loopghost wants to merge 1 commit into
celestiaorg:mainfrom
loopghost:harden-celestia-backend-node-responses

Conversation

@loopghost

Copy link
Copy Markdown

Summary

Defensive hardening of the Celestia backend's handling of responses from the configured node. A few spots assume well-formed responses; this makes them return errors on unexpected input instead of relying on implicit invariants. Changes are confined to coro/src/backend/celestia_client.rs.

Changes

  • broadcast: validate the length of the node-returned transaction hash before copying it into [u8; 32], returning Error::CelestiaSubmit on an unexpected length instead of relying on the copy_from_slice length invariant.
  • verify (ProofRequired): contain panics from the NMT proof verifier and map them to Error::InclusionVerificationFailed, so a malformed proof is handled as a verification error along the same path as an explicit rejection.
  • verify: compute the share range bound with checked_add to avoid integer overflow on unexpected index or length values.

Testing

  • cargo check -p coro passes.

cc @Ferret-san

Make the Celestia backend return errors on unexpected responses from the
configured node instead of relying on implicit invariants:

- broadcast: validate the node-returned tx hash length before
  copy_from_slice into [u8; 32]; return CelestiaSubmit on an unexpected
  length.
- verify (ProofRequired): contain NMT proof verifier panics and map them
  to InclusionVerificationFailed so malformed proofs are handled as
  verification errors along the same path as an explicit rejection.
- verify: use checked_add for the share range bound to avoid integer
  overflow on unexpected index or length values.
@loopghost loopghost changed the title Harden Celestia backend handling of node responses fix(backend): harden Celestia node response handling Jul 1, 2026
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