Skip to content

zombienet-sdk-tests: HOP promotion bitswap test#577

Closed
bkontur wants to merge 7 commits into
mainfrom
bko-hop
Closed

zombienet-sdk-tests: HOP promotion bitswap test#577
bkontur wants to merge 7 commits into
mainfrom
bko-hop

Conversation

@bkontur
Copy link
Copy Markdown
Collaborator

@bkontur bkontur commented May 29, 2026

Summary

Adds parachain_hop_promotion_bitswap_test under a new zombie-hop-tests feature flag. The test exercises the end-to-end HOP (Hand-Off Protocol) promotion path on a single-collator parachain network and is deliberately designed to fail at the bitswap step, surfacing the HOP -> col11 / bitswap gap.

What the test does:

  • Spawns a HOP-enabled collator (--enable-hop --hop-disable-rate-limit --hop-retention-secs=10 --hop-promotion-buffer-secs=60 --hop-check-interval=5) so submitted entries are promotable on the first maintenance tick.
  • Sets the on-chain RetentionPeriod to 10 blocks via sudo and authorizes Alice.
  • Submits hop_submit over JSON-RPC with Alice's sr25519 signature, then waits for the maintenance task to land the HopPromotion::promote extrinsic (detected via the TransactionStorage::Stored event).
  • Waits past store_block + RetentionPeriod and asserts the storage-proof inherent fired (ProofChecked event). This passes.
  • Compares bitswap-served content to the original both before and after promotion. This fails — by design — and is the bug the test is meant to drive out.

Also adds:

  • utils::hop_rpc helper that reconstructs the on-chain submit signing payload and SCALE-encoded MultiSigner / MultiSignature so the test can drive hop_submit directly via JSON-RPC without depending on sc-hop from polkadot-sdk.
  • just test-zombienet-hop recipe and README matrix entry.

bkontur added 2 commits May 29, 2026 10:43
Adds parachain_hop_promotion_bitswap_test under a new
`zombie-hop-tests` feature flag. The test:

- spawns a single HOP-enabled collator (small RP, small HOP retention,
  promotion buffer > retention so entries are promotable immediately)
- authorizes Alice, submits `hop_submit` over JSON-RPC, waits for the
  collator's maintenance task to land the `HopPromotion::promote`
  extrinsic (detected via the Stored event)
- after the retention period, asserts a `ProofChecked` event fired
- compares the bitswap-served content to the original both before and
  after promotion -- this assertion is expected to fail and is the
  whole point of the test (surfacing the HOP -> col11/bitswap gap)

Also adds a `utils::hop_rpc` helper that reconstructs the on-chain
submit signing payload + SCALE-encoded MultiSigner/MultiSignature so
the test can drive `hop_submit` without depending on `sc-hop` from
polkadot-sdk, plus a `just test-zombienet-hop` recipe.
Move `current_best_block`, `current_finalized_block`, `block_hash_at`,
`finalized_block_hash_at`, and `assert_proof_checked_at` out of
`auto_renew_storage.rs` and `hop_promotion_storage.rs` into a new
`utils::blocks` module. Both test files now use the shared
implementation -- net diff is -128 lines.
@bkontur bkontur requested a review from karolk91 May 29, 2026 08:53
bkontur added 2 commits May 29, 2026 10:56
…ted blob

Before asserting `ProofChecked` at `store_block + RetentionPeriod`,
read `TransactionByContentHash[content_hash]` at the proof block and
assert it equals `(store_block, 0)`. The runtime's storage-proof
inherent at block N proves `Transactions[N - RetentionPeriod]`, so
tying the index back to our HOP content_hash at the proof block's
state guarantees the upcoming ProofChecked event covers our promoted
blob and not some unrelated extrinsic that happened to land in the
same slot.

Refactor `canonical_store_block` to share its decode path with a new
`transaction_location_at` helper that returns both `(block, index)`
from the same `TransactionByContentHash` read.
Drop the `transaction_location_at` helper -- the HOP test only needs
the block number, so it can call the existing `canonical_store_block`
directly. Single `assert_eq!(indexed_at, store_block, ...)` before
`assert_proof_checked_at` ties the ProofChecked event back to the
HOP-promoted blob.
bkontur added 2 commits May 29, 2026 11:17
Add a matching CI job for the new HOP suite, mirroring the
`zombienet-sync-tests` shape: matrix over westend + paseo, label-gated
so it doesn't run on every PR. The HOP test is currently designed to
fail (it surfaces the HOP -> col11/bitswap gap), so unconditional
execution would block every PR.

Trigger with the `zombienet-hop-tests` label or
`workflow_dispatch`.
CI:
- Drop the `if:` gate on `zombienet-hop-tests` so it runs on every PR
  push, the same as `zombienet-auto-renew-tests`.
- README CI matrix row updated.

Logging:
- `verify_data_matches` (called from every bitswap probe) now logs the
  full hex of expected + fetched on mismatch, plus both byte-len and
  hex-string-len so postmortems can see where the data diverges.
@bkontur
Copy link
Copy Markdown
Collaborator Author

bkontur commented May 29, 2026

nice, locally this fails as expected:

2026-05-29T09:50:24.102447Z ERROR tests::utils::crypto: Bitswap fetch data mismatch: expected.len=2048 (hex.len=4096), got.len=2048 (hex.len=4096), expected=0x484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f, got=0x4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f505f50524f4d4f54494f4e5f544553545f313738303034383231363739325f484f01d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d01e8bc8d11b4b6ad2470cb3dbd83d9420da9d933e4610ae7d9de7b5940b3be0166874da9bea62886a464587aa4a56b664b591027362648c956a0f207f6fd299281054324739e010000
2026-05-29T09:50:24.102508Z  INFO tests::hop_promotion_storage: bitswap AFTER promotion: match=false

@bkontur
Copy link
Copy Markdown
Collaborator Author

bkontur commented May 29, 2026

@bkontur
Copy link
Copy Markdown
Collaborator Author

bkontur commented May 29, 2026

@bkontur
Copy link
Copy Markdown
Collaborator Author

bkontur commented May 29, 2026

merged as a part of #574

@bkontur bkontur closed this May 29, 2026
@bkontur bkontur deleted the bko-hop branch May 29, 2026 11:24
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.

2 participants