Expand description
HOP types and data structures.
Structs§
- HopEntry
Meta - Metadata for a pool entry (stored in-memory index and on-disk .meta files).
- Pool
Status - Pool statistics
- Recipient
- One intended recipient of a HOP entry: the ephemeral public key the sender
generated for this handoff, paired with the
claimedflag that tracks whether this recipient has acked. Fusing the two into a single struct (and a singleBoundedVec<Recipient, ...>) makes it impossible — by construction and on disk — for the key list and the ack state to drift out of sync. - Submit
Result - Result of a successful
hop_submitcall
Enums§
- HopError
- HOP errors
Constants§
- DEFAULT_
BANDWIDTH_ BURST_ MIB - Default bandwidth burst per account in MiB.
- DEFAULT_
BANDWIDTH_ PER_ MIN_ MIB - Default sustained bandwidth per account in MiB per minute.
- DEFAULT_
CHECK_ INTERVAL_ SECS - Default maintenance interval in seconds (5 minutes)
- DEFAULT_
MAX_ POOL_ SIZE - Default maximum pool size in bytes (10 GiB)
- DEFAULT_
MAX_ POOL_ SIZE_ MIB - Default maximum pool size in MiB (10 GiB = 10240 MiB)
- DEFAULT_
MAX_ USER_ SIZE_ MIB - Default per-user quota in MiB (256 MiB). Hard cap, not scaled by active users.
- DEFAULT_
PROMOTION_ BUFFER_ SECS - Default buffer before expiry at which to start promoting entries on-chain (2 h).
- DEFAULT_
RETENTION_ SECS - Default retention period in seconds (24 hours).
- DEFAULT_
SUBMIT_ BURST - Default submit burst per account (requests).
- DEFAULT_
SUBMIT_ RATE_ PER_ MIN - Default sustained submit rate per account (requests per minute).
- HOP_
ACK_ CONTEXT - Domain-separator prefix for
hop_acksignatures. - HOP_
BLOCK_ TIME_ SECS - Block-time assumption used when translating the wall-clock maintenance interval into block deltas for the promotion back-off scheduler.
- HOP_
CLAIM_ CONTEXT - Domain-separator prefix for
hop_claimsignatures. - HOP_
META_ VERSION - On-disk format version for
HopEntryMetarecords. Startup recovery rejects.metafiles whoseversionfield doesn’t match, so same-shape schema changes (e.g. semantic reinterpretation of an existing field) can be rolled out by bumping this constant; shape changes are caught by SCALE decode failure. - HOP_
SUBMIT_ CONTEXT - Domain-separator prefix for
hop_submitsignatures. - MAX_
PROMOTION_ ATTEMPTS - Maximum number of promotion attempts per entry before the maintenance task gives up and lets the entry expire naturally. With the back-off schedule below this caps wasted work at 1+2+4+8+16 = 31 check intervals (~2.6 h at the default 5 min cadence) per stuck entry. The first 5 attempts fit inside the default 2 h promotion buffer; the 6th is an upper bound that may land past expiry on a stuck entry.
- MAX_
RECIPIENTS - Maximum number of recipients allowed per submission.
- METADATA_
COST_ PER_ RECIPIENT - Per-recipient overhead charged against pool capacity and per-user quota, in bytes.
Covers the in-memory
Recipient(aMultiSignerplus abool). Kept as a small constant that over-approximatessize_of::<Recipient>().
Functions§
- entry_
accounted_ size - Total bytes an entry charges against pool capacity: the blob plus bounded per-recipient metadata overhead.
- promotion_
backoff_ blocks - Compute the back-off in blocks to wait before the next promotion attempt
after
attemptsconsecutive failures. The first failure triggers a 1× wait, doubling each subsequent failure:1×, 2×, 4×, 8×, 16×, 32×the check interval, with the shift saturated to keep multiplication safe. - signing_
payload - Compute the 32-byte payload that HOP recipients / submitters sign for a given
operation. This is
blake2_256(context || hash)and ensures signatures from one operation cannot be replayed in another. - submit_
signing_ payload - Compute the 32-byte payload signed at
hop_submittime.
Type Aliases§
- HopBlock
Number - Block number type used by HOP.
- HopHash
- Hash type used by HOP.
- Recipient
Vec - A
Vec<Recipient>that SCALE-decode rejects if it exceedsMAX_RECIPIENTS, enforcing the fan-out cap at the type level instead of via scattered runtime checks. - Sender
Id - Sender identity derived from the account that signed the submission.