[solana]: host, handler and verifier programs#801
Draft
royvardhan wants to merge 6 commits intomainfrom
Draft
Conversation
7fcf414 to
778b6a5
Compare
778b6a5 to
e0ce6e0
Compare
4b76ba4 to
68087da
Compare
Wizdave97
reviewed
Apr 30, 2026
Wizdave97
reviewed
Apr 30, 2026
Wizdave97
reviewed
Apr 30, 2026
Wizdave97
reviewed
Apr 30, 2026
Wizdave97
reviewed
Apr 30, 2026
Addresses PR review on the inbound-only Solana ISMP host + handler:
- Drop `close_expired_receipt`. Closing the receipt PDA removes the
replay guard — `dispatch_incoming.init` would succeed again for the
same commitment and re-dispatch the message. Mirrors EVM, which only
deletes `_requestReceipts[c]` on dispatch *failure* (for retry).
- Pin `set_consensus_state.params.id` to `host_config.consensus_client_id`
so admin can't bootstrap unrelated `[b"consensus", id]` PDAs. The
`init` constraint already enforces once-per-id by construction.
- Switch `verify_membership` to Keccak MMR multi-proofs against
`state.overlay_root` (mirrors EVM `HandlerV2.handlePostRequests`).
Adds `ckb-merkle-mountain-range` — same no_std crate the BEEFY verifier
uses. Wire: `MmrMembershipProof { leaf_indices, items, leaf_count }`.
Storage-trie path kept for `verify_state_proof`'s non-membership queries.
- Walk parachain-header digests to extract `mmr_root` + `child_trie_root`
(engine_id `b"ISMP"`) and `timestamp` (engine_id `b"ISTM"`). Without
this `overlay_root` stays `None` and the MMR check above rejects
every inbound POST. Hand-rolled SCALE digest decoder to avoid pulling
`sp_runtime`. `StateCommitment` now matches EVM `Header.sol::stateCommitment`.
- Doc-link `host/src/lib.rs` to `handler::ismp::host_facade::SolanaHostFacade`
as the `IsmpHost` impl — a Solana `#[program]` module isn't a Rust
value, so the trait can't sit on it directly.
The MMR `verify_membership` from the prior commit reads `StateCommitment.overlay_root` to validate request multi-proofs, but nothing on the host-side write path was carrying it: the PDA struct had no field for it, `StoreStateCommitmentParams` didn't accept it, and the facade dropped it before the CPI. So in production the verifier always saw `overlay_root: None` and rejected every inbound POST. Tests passed only because `RecordingHost` bypasses the host CPI path entirely. Adds the field end-to-end: `StateCommitment` PDA + params struct, host write, facade `CommitmentSnapshot`, facade reader, and the snapshot built by `handle_post_requests`. Facade writer rejects `None` rather than zero-filling, so a misbehaving consensus client fails loudly instead of poisoning future membership checks.
Collaborator
Author
|
The mental model behind the EVM host and handler inspired Solana programs: https://claude.ai/share/e69ff8b0-a1f6-45ae-a522-aa14269e64c2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Solana on-chain verification of Hyperbridge BEEFY consensus proofs and inbound ISMP message delivery. Inbound-only by design.
Ref: #797