Files
pezkuwi-subxt/prdoc/pr_3002.prdoc
T
Sebastian Kunert 3386377b0f 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>
2024-02-23 14:09:49 +00:00

30 lines
1.4 KiB
Plaintext

# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json
title: PoV Reclaim Runtime Side
author: skunert
topic: runtime
doc:
- audience: Runtime Dev
description: |
Adds a mechanism to reclaim proof size weight.
1. Introduces a new `SignedExtension` that reclaims the difference
between benchmarked proof size weight and actual consumed proof size weight.
2. Introduces a manual mechanism, `StorageWeightReclaimer`, to reclaim excess storage weight for situations
that require manual weight management. The most prominent case is the `on_idle` hook.
3. Adds the `storage_proof_size` host function to the PVF. Parachain nodes should add it to ensure compatibility.
To enable proof size reclaiming, add the host `storage_proof_size` host function to the parachain node. Add the
`StorageWeightReclaim` `SignedExtension` to your runtime and enable proof recording during block import.
crates:
- name: "cumulus-primitives-storage-weight-reclaim"
host_functions:
- name: "storage_proof_size"
description: |
This host function is used to pass the current size of the storage proof to the runtime.
It was introduced before but becomes relevant now.
Note: This host function is intended to be used through `cumulus_primitives_storage_weight_reclaim::get_proof_size`.
Direct usage is not recommended.