Skip to content

Hand-off protocol#11662

Open
franciscoaguirre wants to merge 6 commits intomasterfrom
hop-base
Open

Hand-off protocol#11662
franciscoaguirre wants to merge 6 commits intomasterfrom
hop-base

Conversation

@franciscoaguirre
Copy link
Copy Markdown
Contributor

No description provided.

In order to support promotion to Bulletin in HOP, we need both node-side
and runtime-side changes.
This PR adds the node-side changes to sc-hop and ultimately to
polkadot-omni-node, since that's what will be used to run the Bulletin
chain.
The runtime-side is tested in
[polkadot-bulletin-chain](paritytech/polkadot-bulletin-chain#348)
before the real deploy to fellowship runtimes.

## How promotion works

When entries are about to expire, the collator will submit low-priority
transactions to store them in Bulletin. These transactions are not
propagated, they'll stay in the collators transaction pool until they
expire or it's his turn to build a block and he can fit them in. Given
that they are low-priority, all other external transactions take
precedence. That's why promotion is a best-effort system. It only tries
to fill in blocks if they have some space available.

A background HopMaintenanceTask runs on a configurable interval (default
60s). Each cycle it:
1. Queries the pool for entries within hop_buffer_blocks (default ~2h)
of their expiry that haven't been promoted yet (get_promotable)
2. For each, calls HopPromoter::promote(data) which uses the
HopPromotionApi runtime API to construct a general transaction extrinsic
and submits it to the local tx pool
3. Marks successfully promoted entries
4. Cleans up expired entries

Promoted entries don't get immediately deleted, they wait for their
actual expiry. This is so that the recipient can quickly get them from
HOP if he comes online before the expiry time. If he comes online after
the expiry time, then it will try to get it from HOP, fail and then go
try to retrieve it from Bulletin via IPFS.

## Runtime API detection

try_build_promoter() probes for HopPromotionApi support at startup. If
the runtime doesn't implement it, the node logs a warning and runs in
cleanup-only mode. The pool still works for submit/claim, just without
automatic on-chain promotion. This keeps the node functional regardless
of whether the runtime has pallet-hop-promotion.

We don't want the omni node to crash if the runtime is not Bulletin,
clearly. Ideally we want all of this to be enabled only when the node is
run with --enable-hop.

## Companion: bulletin-chain runtime

The companion to this PR is on bulletin-chain. It has
pallet-hop-promotion which implements the runtime API. This API gives
the node the necessary promote() extrinsic to submit. To know more, go
to that PR. We'll have to deploy that pallet to Polkadot to make use of
HOP promotion.
@socket-security
Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedcargo/​libfuzzer-sys@​0.4.7 ⏵ 0.4.1247 -1110093 -7100100
Updatedcargo/​tokio@​1.45.0 ⏵ 1.51.059 -310093100100
Updatedcargo/​subxt@​0.44.2 ⏵ 0.44.372 -281009310090
Updatedcargo/​honggfuzz@​0.5.55 ⏵ 0.5.607210010010080
Updatedcargo/​hyper-util@​0.1.17 ⏵ 0.1.207910093100100
Updatedcargo/​assert_cmd@​2.0.14 ⏵ 2.2.07910093100100
Updatedcargo/​nix@​0.24.3 ⏵ 0.30.180 -191009310070
Updatedcargo/​nix@​0.24.3 ⏵ 0.31.280 -191009310070
Updatedcargo/​libc@​0.2.172 ⏵ 0.2.1848010093100100
Updatedcargo/​thiserror@​2.0.12 ⏵ 2.0.188010093100100
Updatedcargo/​proc-macro2@​1.0.95 ⏵ 1.0.1068010093100100
Updatedcargo/​anyhow@​1.0.98 ⏵ 1.0.10281 +110093100100
Updatedcargo/​rustversion@​1.0.17 ⏵ 1.0.228110093100100
Updatedcargo/​thiserror@​2.0.12 ⏵ 1.0.698110093100100
Updatedcargo/​rustls@​0.23.31 ⏵ 0.21.128110093100100
Updatedcargo/​ref-cast@​1.0.23 ⏵ 1.0.258110093100100
Updatedcargo/​isahc@​1.7.2 ⏵ 1.8.08210093100100 +31
Updatedcargo/​rustls@​0.23.31 ⏵ 0.23.378210093100100
Updatedcargo/​prometheus@​0.13.3 ⏵ 0.13.482 +110093100100
Updatedcargo/​quote@​1.0.40 ⏵ 1.0.4582 -1810093100100
Updatedcargo/​serde_json@​1.0.132 ⏵ 1.0.1498210093100100
Updatedcargo/​ahash@​0.8.11 ⏵ 0.8.128210093100100
Updatedcargo/​rustix@​1.0.8 ⏵ 0.38.448310093100100
Updatedcargo/​rustix@​1.0.8 ⏵ 1.1.48310093100100
Updatedcargo/​slotmap@​1.0.6 ⏵ 1.1.18310093100100
Updatedcargo/​git2@​0.20.0 ⏵ 0.20.483100 +195100100
Updatedcargo/​serde_with@​3.12.0 ⏵ 3.18.088 -12100100 +11100100
Updatedcargo/​ss58-registry@​1.43.0 ⏵ 1.51.089100100100100
Updatedcargo/​derive_more@​2.0.1 ⏵ 0.99.2010010090100100
Updatedcargo/​env_logger@​0.11.3 ⏵ 0.10.210010090100100
Updatedcargo/​pretty_assertions@​1.4.0 ⏵ 1.4.110010090100100
Updatedcargo/​toml_edit@​0.22.22 ⏵ 0.22.2710010090100100
See 126 more rows in the dashboard

View full report

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