Add PVQ executor, primitives, and runtime API crates #10671
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This is PR 1 of a 6-PR series to upstream the PVQ system. See tracking issue: #8251.
This PR introduces the foundation layer for PVQ (PolkaVM Query).
What's included
This PR adds three new foundational crates:
pvq-primitives(~50 lines): Core types includingPvqResult,PvqResponse, andPvqErrorwith bothstdandno_stdsupportpvq-runtime-api(~35 lines): Substrate runtime API definition withPvqApitrait providingexecute_queryandmetadatamethodspvq-executor(~400-500 lines): PolkaVM execution wrapper includingPvqExecutor,PvqExecutorContexttrait for registering host functions, program execution with gas limits, and error handlingIntegration
For Runtime Developers:
These crates provide the foundation infrastructure but are not yet ready for production use. No action is required from downstream teams at this time.
The complete PVQ system will be available after the all PRs are merged.
Once the full system is available, runtime developers can:
pvq-executorand extensions to their runtime dependenciesPvqApiruntime APIFor Node Operators & Client Developers:
No changes required. This is purely additive runtime infrastructure.
Review Notes
Architecture Overview
See tracking issue: #8251
Implementation Details
1. pvq-primitives
no_stdcompatible with optionalstdfeaturePvqResultencapsulates success/failure with structured errors2. pvq-runtime-api
sp_api::decl_runtime_apis!macroexecute_query: Takes program bytes, arguments, and gas limitmetadata: Returns available extensions and their capabilities3. pvq-executor
polkavmfor program executionPvqExecutorContexttrait allows runtimes to inject host functionsTesting
Future PRs
This foundation enables: