mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 15:47:58 +00:00
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>
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use sp_externalities::ExternalitiesExt;
|
||||
|
||||
use sp_runtime_interface::runtime_interface;
|
||||
@@ -35,7 +36,8 @@ pub const PROOF_RECORDING_DISABLED: u64 = u64::MAX;
|
||||
pub trait StorageProofSize {
|
||||
/// Returns the current storage proof size.
|
||||
fn storage_proof_size(&mut self) -> u64 {
|
||||
self.extension::<ProofSizeExt>().map_or(u64::MAX, |e| e.storage_proof_size())
|
||||
self.extension::<ProofSizeExt>()
|
||||
.map_or(PROOF_RECORDING_DISABLED, |e| e.storage_proof_size())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user