Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Staking AHM] Unbounded Era storage deletion at Era start block #7557

Open
Ank4n opened this issue Feb 13, 2025 · 1 comment
Open

[Staking AHM] Unbounded Era storage deletion at Era start block #7557

Ank4n opened this issue Feb 13, 2025 · 1 comment
Labels
T1-FRAME This PR/Issue is related to core FRAME, the framework.

Comments

@Ank4n
Copy link
Contributor

Ank4n commented Feb 13, 2025

Reported by @kianenigma.

At the change of an era, we delete a large amount of storage items linked to the old eras that can be discarded. We need to ensure this operation has a bounded proof size of less than 5 MB so that staking can safely move to a system parachain.

Refer:

pub(crate) fn clear_era_information(era_index: EraIndex) {

@Ank4n Ank4n added the T1-FRAME This PR/Issue is related to core FRAME, the framework. label Feb 13, 2025
@Ank4n Ank4n added this to AHM Feb 13, 2025
@burdges
Copy link

burdges commented Feb 13, 2025

We know this for the current code, no?

At some future point, we should do this by O(1) drops. In fact, Asset hub cannot have both maximum performance and maximum liveness, so ideally we'd eventually move validator elections and era storage off of Asset Hub entirely, so then O(1) drops work off-chain.

We'd do all validator elections in a unique parachain/service type that stores state on the relay chain itself. A validator election has only one a u64 of state: the last block's PJR score.

Actual election chain PoV blocks contain Merkle proofs into some fixed past nomination state, maybe a frozen past Asset Hub state, so you need that state to make blocks in the election chain. Yet, this fixed past nomination state would not be part of the ephemeral election chain's own state, which is only a single u64.

A validator election chain simply dies when nobody can improve the score enough, so then the death block(s) becomes the next elected validator set. Each era's election chain's death block(s) become the era storage, but they're handled entirely off-chain by nodes that apply slashing penalties.

Anyways that u64 state on the realy chain sounds pretty JAM-ish, so this is probably not the first way we do things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T1-FRAME This PR/Issue is related to core FRAME, the framework.
Projects
Status: No status
Development

No branches or pull requests

2 participants