PoV Reclaim (Clawback) Node Side (#1462)
This PR provides the infrastructure for the pov-reclaim mechanism discussed in #209. The goal is to provide the current proof size to the runtime so it can be used to reclaim storage weight. ## New Host Function - A new host function is provided [here](https://github.com/skunert/polkadot-sdk/blob/5b317fda /cumulus/primitives/pov-reclaim/src/lib.rs#L23). It returns the size of the current proof size to the runtime. If recording is not enabled, it returns 0. ## Implementation Overview - Implement option to enable proof recording during import in the client. This is currently enabled for `polkadot-parachain`, `parachain-template` and the cumulus test node. - Make the proof recorder ready for no-std. It was previously only enabled for std environments, but we need to record the proof size in `validate_block` too. - Provide a recorder implementation that only the records the size of incoming nodes and does not store the nodes itself. - Fix benchmarks that were broken by async backing changes - Provide new externalities extension that is registered by default if proof recording is enabled. - I think we should discuss the naming, pov-reclaim was more intuitive to me, but we could also go with clawback like in the issue. ## Impact of proof recording during import With proof recording: 6.3058 Kelem/s Without proof recording: 6.3427 Kelem/s The measured impact on the importing performance is quite low on my machine using the block import benchmark. With proof recording I am seeing a performance hit of 0.585%. --------- Co-authored-by: command-bot <> Co-authored-by:Davide Galassi <davxy@datawok.net> Co-authored-by:
Bastian Köcher <git@kchr.de>
parent
64361ac1
Showing
- Cargo.lock 19 additions, 0 deletionsCargo.lock
- Cargo.toml 1 addition, 0 deletionsCargo.toml
- cumulus/client/service/Cargo.toml 1 addition, 0 deletionscumulus/client/service/Cargo.toml
- cumulus/client/service/src/lib.rs 2 additions, 0 deletionscumulus/client/service/src/lib.rs
- cumulus/pallets/parachain-system/Cargo.toml 3 additions, 0 deletionscumulus/pallets/parachain-system/Cargo.toml
- cumulus/pallets/parachain-system/src/validate_block/mod.rs 4 additions, 0 deletionscumulus/pallets/parachain-system/src/validate_block/mod.rs
- cumulus/pallets/parachain-system/src/validate_block/trie_recorder.rs 286 additions, 0 deletions...lets/parachain-system/src/validate_block/trie_recorder.rs
- cumulus/primitives/proof-size-hostfunction/Cargo.toml 21 additions, 0 deletionscumulus/primitives/proof-size-hostfunction/Cargo.toml
- cumulus/primitives/proof-size-hostfunction/src/lib.rs 107 additions, 0 deletionscumulus/primitives/proof-size-hostfunction/src/lib.rs
- cumulus/test/client/Cargo.toml 1 addition, 0 deletionscumulus/test/client/Cargo.toml
- cumulus/test/client/src/lib.rs 2 additions, 1 deletioncumulus/test/client/src/lib.rs
- cumulus/test/service/benches/block_import.rs 55 additions, 37 deletionscumulus/test/service/benches/block_import.rs
- cumulus/test/service/benches/block_import_glutton.rs 26 additions, 11 deletionscumulus/test/service/benches/block_import_glutton.rs
- cumulus/test/service/benches/validate_block.rs 12 additions, 3 deletionscumulus/test/service/benches/validate_block.rs
- cumulus/test/service/src/bench_utils.rs 6 additions, 1 deletioncumulus/test/service/src/bench_utils.rs
- cumulus/test/service/src/lib.rs 37 additions, 17 deletionscumulus/test/service/src/lib.rs
- cumulus/test/service/src/main.rs 2 additions, 1 deletioncumulus/test/service/src/main.rs
- substrate/client/api/src/execution_extensions.rs 1 addition, 4 deletionssubstrate/client/api/src/execution_extensions.rs
- substrate/client/block-builder/Cargo.toml 1 addition, 0 deletionssubstrate/client/block-builder/Cargo.toml
- substrate/client/block-builder/src/lib.rs 5 additions, 0 deletionssubstrate/client/block-builder/src/lib.rs
Please register or sign in to comment