Skip to content
Unverified Commit e617d1d0 authored by Stephane Gurgenidze's avatar Stephane Gurgenidze Committed by GitHub
Browse files

backing: improve session buffering for runtime information (#6284)

## Issue
[[#3421] backing: improve session buffering for runtime
information](https://github.com/paritytech/polkadot-sdk/issues/3421)

## Description
In the current implementation of the backing module, certain pieces of
information, which remain unchanged throughout a session, are fetched
multiple times via runtime API calls. The goal of this task was to
introduce a local cache to store such session-stable information and
perform the runtime API call only once per session.

This PR implements caching specifically for the validators list, node
features, executor parameters, minimum backing votes threshold, and
validator-to-group mapping, which were previously fetched from the
runtime or computed each time `PerRelayParentState` was built. Now, this
information is cached and reused within the session.

## TODO
* [X] Create a separate struct for per-session caches;
* [X] Cache validators list;
* [X] Cache node features;
* [X] Cache executor parameters;
* [X] Cache minimum backing votes threshold;
* [X] Cache validator-to-group mapping;
* [X] Update tests to reflect these changes;
* [X] Add prdoc.

## For the next PR
Cache validator groups and any other session-stable data (if present).
parent a84f2598
Pipeline #505470 waiting for manual action with stages
in 1 hour, 9 minutes, and 9 seconds