Expand description
Disk-backed statement store.
This module contains an implementation of sp_statement_store::StatementStore which is backed
by a database.
Constraint management.
The statement store validates statements using node-side signature verification and static runtime allowance limits. The following constraints are then checked:
- For a given account id, there may be at most
max_countstatements withmax_sizetotal data size. To satisfy this, statements for this account ID are removed from the store starting with the lowest priority until a constraint is satisfied. - There may not be more than
MAX_TOTAL_STATEMENTStotal statements withMAX_TOTAL_SIZEsize. To satisfy this, statements are removed from the store starting with the lowestglobal_priorityuntil a constraint is satisfied.
When a new statement is inserted that would not satisfy constraints in the first place, no
statements are deleted and Ignored result is returned.
The order in which statements with the same priority are deleted is unspecified.
Statement expiration.
Each time a statement is removed from the store (Either evicted by higher priority statement or
explicitly with the remove function) the statement is marked as expired. Expired statements
can’t be added to the store for Options::purge_after_sec seconds. This is to prevent old
statements from being propagated on the network.
Modules§
- subxt_
client - Custom subxt configuration for runtimes interacting with statement-store, used only for tests
- test_
utils - Test utilities for the statement store
Structs§
Enums§
- Error
- Statement store error.
Constants§
- DEFAULT_
MAX_ TOTAL_ SIZE - The maximum amount of data the statement store can hold, regardless of the number of statements from which the data originates.
- DEFAULT_
MAX_ TOTAL_ STATEMENTS - The maximum number of statements the statement store can hold.
- DEFAULT_
NETWORK_ WORKERS - Default number of concurrent workers for statement validation.
- DEFAULT_
PURGE_ AFTER_ SEC - The amount of time an expired statement is kept before it is removed from the store entirely.
- DEFAULT_
RATE_ LIMIT - Default maximum statements per second per peer before rate limiting kicks in. Default maximum statements per second before rate limiting kicks in.
- MAX_
STATEMENT_ SIZE - The maximum size of a single statement in bytes.
Accounts for the 1-byte vector length prefix when statements are gossiped as
Vec<Statement>. - MAX_
TOPICS - Total number of topic fields allowed in a statement and in
MatchAllfilters.
Traits§
- Statement
Store - Statement store API.
- Statement
Store Subscription Api - Trait for initiating statement store subscriptions from the RPC module.