Skip to content

statement-store: validation without runtime#10787

Merged
alexggh merged 44 commits intomasterfrom
ae-sss-wo-runtime-final
Feb 4, 2026
Merged

statement-store: validation without runtime#10787
alexggh merged 44 commits intomasterfrom
ae-sss-wo-runtime-final

Conversation

@AndreiEres
Copy link
Copy Markdown
Contributor

@AndreiEres AndreiEres commented Jan 13, 2026

Description

Fixes #10799

This removes slow runtime validation from statement-submission hot path. Validation now happens on the node side via direct signature verification and storage reads for account quotas.

Integration

Node validates signatures directly, reads quotas from storage. Setting allowances is implementing in another PR.

@AndreiEres AndreiEres requested a review from a team as a code owner January 13, 2026 11:57
@AndreiEres AndreiEres changed the title [WIP] Use (finally) validation without runtime (mocked) statement-store: validation without runtime Jan 13, 2026
let validation = match validation_result {
Ok(validation) => validation,
Err(InvalidStatement::BadProof) => {
let validation = match (self.read_allowance_fn)(&account_id) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This completely ignores custom validation functions e.g. for POP that allow different kinds of statements, not just based on an allowance.

IMO it is fine to move as much as possible to the node side, but we will still need to call into the runtime for custom implementations of verify. But we could there directly pass the public key (to not needing to call validate_statement again in the runtime.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are those custom validation? So far there is only quota and signature check and from our discussions with Gavin we have not found any other options where directly calling runtime for every statement would be useful.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is a validation to be done by front-end. From the statement-store should knows noting about app layer. Our only concerns are users signatures that impy quota check. Every other verification is app problem.

@P1sar
Copy link
Copy Markdown
Contributor

P1sar commented Jan 14, 2026

Closes: #10799

@AndreiEres
Copy link
Copy Markdown
Contributor Author

/cmd prdoc --audience node_dev --bump minor

@AndreiEres AndreiEres added the T4-runtime_API This PR/Issue is related to runtime APIs. label Jan 28, 2026
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we just solve this by sending some transaction that sets the allowance? But can be done in a later pr.

@paritytech-workflow-stopper
Copy link
Copy Markdown

All GitHub workflows were cancelled due to failure one of the required jobs.
Failed workflow url: https://github.com/paritytech/polkadot-sdk/actions/runs/21517913067
Failed job name: fmt

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>
github-merge-queue bot pushed a commit that referenced this pull request Feb 4, 2026
## Work in progress

## Description

Implements the proposed changes from here
#10452, where the API
surface has been limited to two functions `submit` and a
`subscribe_statement`.

### Submit changes 

For submitting the only changes are implementing the logic of the newly
`expiry` field where statements with an expiration timestamp lower than
current time get rejected.

### Subscribe changes

For subscription the approach is to have a configurable number of
workers that keep track of all subscriptions, each time a new
subscription arrives it gets assigned by a round-robin protocol to one
of the workers.

When a new statements gets accepted by the statement-store it notifies
all workers about the statement, the workers then go and evaluate all
subscription filters they are assigned to and notifies each of them
accordingly.

## Remaining work
- [x] Add more tests.
- [x] Evaluate performance under load and port
`statement_store_bench.rs` to using subscribe API, ported and
performance stay the same on the benchmark, because bottlenecks are
elsewhere and being addressed.
```
[2026-01-07T17:18:51Z INFO  tests::zombie_ci::statement_store_bench] Participants: 49998, each sent: 6, received: 0
[2026-01-07T17:18:51Z INFO  tests::zombie_ci::statement_store_bench] Summary        min       avg       max
[2026-01-07T17:18:51Z INFO  tests::zombie_ci::statement_store_bench]  time, s         8        19        24
[2026-01-07T17:18:51Z INFO  tests::zombie_ci::statement_store_bench]  retries         0         0         0
```

- [x] Evaluate and set proper RPC limits. The normal RPC limits apply
here we just need to make sure RPC nodes run with limits high enough, so
each user can connect to the node all at the same time.
- [x] Periodically scan existing statements and removed expired ones.
- [ ] Plan for deploying it with minimising impact for people prototype
with the old APIs
- [ ] ~This modifies statement format(expiry field), Runtime and Node
need to run latest version.~, post
#10787, statement-store
does not call into runtime anymore, so this dependency is not needed.

## Local testing

To obtain a local node with the new APIs available run:
  
  ```
cargo build -p polkadot -p polkadot-parachain-bin --bin polkadot --bin
polkadot-prepare-worker --bin polkadot-execute-worker --bin
polkadot-parachain --features fast-runtime;
   
ZOMBIE_PROVIDER=native cargo test -p cumulus-zombienet-sdk-tests
--features zombie-ci zombie_ci::statement_store::statement_store
  ```
  
  The rpc addresses are visible in the output:
  ```
charlie: direct link (pjs)
https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:26997#/explorer
dave: direct link (pjs)
https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:12623#/explorer
  ```

---------

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>
Co-authored-by: Andrei Eres <eresav@me.com>
Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@alexggh alexggh enabled auto-merge February 4, 2026 16:38
Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>
@alexggh alexggh added this pull request to the merge queue Feb 4, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 4, 2026
@alexggh alexggh added this pull request to the merge queue Feb 4, 2026
Merged via the queue into master with commit a09c18f Feb 4, 2026
243 of 244 checks passed
@alexggh alexggh deleted the ae-sss-wo-runtime-final branch February 4, 2026 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T0-node This PR/Issue is related to the topic “node”. T4-runtime_API This PR/Issue is related to runtime APIs.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Statement-store: Remove runtime calls from validation piepline

6 participants