PoV Reclaim Runtime Side (#3002)
# Runtime side for PoV Reclaim ## Implementation Overview - Hostfunction to fetch the storage proof size has been added to the PVF. It uses the size tracking recorder that was introduced in my previous PR. - Mechanisms to use the reclaim HostFunction have been introduced. - 1. A SignedExtension that checks the node-reported proof size before and after application of an extrinsic. Then it reclaims the difference. - 2. A manual helper to make reclaiming easier when manual interaction is required, for example in `on_idle` or other hooks. - In order to utilize the manual reclaiming, I modified `WeightMeter` to support the reduction of consumed weight, at least for storage proof size. ## How to use To enable the general functionality for a parachain: 1. Add the SignedExtension to your parachain runtime. 2. Provide the HostFunction to the node 3. Enable proof recording during block import ## TODO - [x] PRDoc --------- Co-authored-by:Dmitry Markin <dmitry@markin.tech> Co-authored-by:
Davide Galassi <davxy@datawok.net> Co-authored-by:
Bastian Köcher <git@kchr.de>
parent
5fc6d67b
Showing
- .gitlab/pipeline/check.yml 3 additions, 1 deletion.gitlab/pipeline/check.yml
- Cargo.lock 23 additions, 0 deletionsCargo.lock
- Cargo.toml 1 addition, 0 deletionsCargo.toml
- cumulus/pallets/parachain-system/src/validate_block/implementation.rs 22 additions, 7 deletions...ets/parachain-system/src/validate_block/implementation.rs
- cumulus/pallets/parachain-system/src/validate_block/tests.rs 1 addition, 1 deletioncumulus/pallets/parachain-system/src/validate_block/tests.rs
- cumulus/pallets/parachain-system/src/validate_block/trie_recorder.rs 11 additions, 0 deletions...lets/parachain-system/src/validate_block/trie_recorder.rs
- cumulus/parachain-template/node/src/command.rs 2 additions, 1 deletioncumulus/parachain-template/node/src/command.rs
- cumulus/parachain-template/node/src/service.rs 6 additions, 2 deletionscumulus/parachain-template/node/src/service.rs
- cumulus/parachain-template/runtime/Cargo.toml 2 additions, 0 deletionscumulus/parachain-template/runtime/Cargo.toml
- cumulus/parachain-template/runtime/src/lib.rs 1 addition, 0 deletionscumulus/parachain-template/runtime/src/lib.rs
- cumulus/polkadot-parachain/src/command.rs 2 additions, 1 deletioncumulus/polkadot-parachain/src/command.rs
- cumulus/polkadot-parachain/src/service.rs 9 additions, 4 deletionscumulus/polkadot-parachain/src/service.rs
- cumulus/primitives/proof-size-hostfunction/src/lib.rs 3 additions, 1 deletioncumulus/primitives/proof-size-hostfunction/src/lib.rs
- cumulus/primitives/storage-weight-reclaim/Cargo.toml 46 additions, 0 deletionscumulus/primitives/storage-weight-reclaim/Cargo.toml
- cumulus/primitives/storage-weight-reclaim/src/lib.rs 663 additions, 0 deletionscumulus/primitives/storage-weight-reclaim/src/lib.rs
- cumulus/test/client/Cargo.toml 1 addition, 0 deletionscumulus/test/client/Cargo.toml
- cumulus/test/client/src/lib.rs 12 additions, 8 deletionscumulus/test/client/src/lib.rs
- cumulus/test/runtime/Cargo.toml 2 additions, 0 deletionscumulus/test/runtime/Cargo.toml
- cumulus/test/runtime/src/lib.rs 1 addition, 0 deletionscumulus/test/runtime/src/lib.rs
- cumulus/test/service/Cargo.toml 1 addition, 0 deletionscumulus/test/service/Cargo.toml
Please register or sign in to comment