Skip to content

Fix transaction_index issue with HOP promote#574

Merged
bkontur merged 13 commits into
mainfrom
fix-promote-tx-index
May 29, 2026
Merged

Fix transaction_index issue with HOP promote#574
bkontur merged 13 commits into
mainfrom
fix-promote-tx-index

Conversation

@franciscoaguirre
Copy link
Copy Markdown
Contributor

sp_io::transaction_index::index() requires the last parameter of the extrinsic to be the data. This is the case with TransactionStorage::store() but was not the case with HopPromotion::promote(). I reordered the parameters and added a test to make sure we catch something like this in the future

@bkontur bkontur requested a review from karolk91 May 29, 2026 07:33
@bkontur
Copy link
Copy Markdown
Collaborator

bkontur commented May 29, 2026

I am adding Also zombienetsdk fór this

bkontur added 4 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.
…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 bkontur changed the base branch from main to bko-hop May 29, 2026 09:03
@bkontur
Copy link
Copy Markdown
Collaborator

bkontur commented May 29, 2026

I changed the base of this PR to this PR: #577.
577 should have failing hop zombienet test
and this PR should pass this test,
this will be ultimate double check.

@bkontur bkontur changed the base branch from bko-hop to main May 29, 2026 09:13
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`.
@bkontur bkontur changed the base branch from main to bko-hop May 29, 2026 09:19
@bkontur bkontur changed the base branch from bko-hop to main May 29, 2026 09:19
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 bkontur changed the base branch from main to bko-hop May 29, 2026 09:46
@bkontur bkontur changed the base branch from bko-hop to main May 29, 2026 09:47
@bkontur bkontur enabled auto-merge (squash) May 29, 2026 09:55
@bkontur bkontur merged commit f813d0e into main May 29, 2026
51 of 53 checks passed
@bkontur bkontur deleted the fix-promote-tx-index branch May 29, 2026 10:45
@franciscoaguirre franciscoaguirre mentioned this pull request Jun 2, 2026
16 tasks
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.

3 participants