PolkaVM Query for Polkadot
- Pull vendored
polkavm
and patched (for XCM integration PoC)polkadot-sdk
:git submodule update --init --recursive
. - Install
polkatool
(for relinking the standard RV32E ELF to a PolkaVM blob) andchain-spec-builder
(for building chainspec from a wasm):make tools
guest-examples
contains several guest programs to test the PVQ.
- Build guest program:
make guests
- Run test runner:
cargo run -p pvq-test-runner -- --program output/<guest-program>
Available PoC guest programs:
guest-sum-balance
: sum the balances of multiple accountsguest-total-supply
: get the total supply of an assetguest-sum-balance-percent
: sum the balances of multiple accounts and calculate the percentage of the total supply
- Use chopsticks to start a local chain with the RuntimeAPI enabled:
make run
- Build guest programs:
make guests
- Run test runner to display hex-encoded
args
in tracing logs:cargo run -p pvq-test-runner -- --program output/<guest-program>
- Upload
program
andargs
in PJS UI.
The test case of XCM integration is located in vendor/polkadot-sdk/polkadot/xcm/xcm-simulator/example/src/tests.rs
#[test]
fn test_report_query() {
...
}