Skip to content

Conversation

@ipapandinas
Copy link
Contributor

Pull Request Summary

Closes #1549

@ipapandinas ipapandinas added shiden related to shiden runtime astar Related to Astar shibuya related to shibuya runtime This PR/Issue is related to the topic “runtime”. labels Dec 4, 2025
Copy link
Contributor

@Dinonard Dinonard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can already integrate this into the runtimes.

let mut write = 0u64;

// Use translate to selectively keep or drop keys
LastAuthoredBlock::<T>::translate::<BlockNumberFor<T>, _>(|account, old_value| {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One suggestion I didn't submit - if you want to avoid translate, you can store keys in some vector, and then clean them up in another loop.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested the migration and it works well with translate

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't doubt it works, but it's purpose is to migrate from one type to another.

Dinonard
Dinonard previously approved these changes Dec 5, 2025
Copy link
Contributor

@Dinonard Dinonard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok with the PR as it is right now, but I would suggest to add some 'sanity' limit to the translate iteration, if possible.

I don't think anyone can exploit this to brick the chain with a huge PoV, since we have permissioned collators now, but still it's a good practice.

@ipapandinas
Copy link
Contributor Author

@Dinonard I have added a sanity limit and removed the translate for a 2-step process: scan & remove.

You can already integrate this into the runtimes.

I will do it later to avoid merging conflicts. The AH migration cleanup and the sudo pallet removal also have migrations.

@github-actions
Copy link

github-actions bot commented Dec 5, 2025

Code Coverage

Package Line Rate Branch Rate Health
pallets/static-price-provider/src 91% 0%
chain-extensions/pallet-assets/src 54% 0%
pallets/astar-xcm-benchmarks/src/generic 100% 0%
pallets/xc-asset-config/src 64% 0%
chain-extensions/types/unified-accounts/src 0% 0%
precompiles/unified-accounts/src 100% 0%
pallets/inflation/src 58% 0%
pallets/dynamic-evm-base-fee/src 85% 0%
pallets/price-aggregator/src 75% 0%
precompiles/xcm/src 69% 0%
precompiles/assets-erc20/src 77% 0%
precompiles/dapp-staking/src 89% 0%
pallets/democracy-mbm/src 30% 0%
primitives/src 53% 0%
pallets/dapp-staking/src/benchmarking 95% 0%
primitives/src/xcm 60% 0%
precompiles/sr25519/src 56% 0%
pallets/dapp-staking/rpc/runtime-api/src 0% 0%
chain-extensions/unified-accounts/src 0% 0%
pallets/ethereum-checked/src 76% 0%
precompiles/dapp-staking/src/test 0% 0%
chain-extensions/types/assets/src 0% 0%
pallets/dapp-staking/src/test 0% 0%
precompiles/substrate-ecdsa/src 67% 0%
pallets/collator-selection/src 82% 0%
pallets/astar-xcm-benchmarks/src/fungible 100% 0%
pallets/unified-accounts/src 80% 0%
pallets/vesting-mbm/src 87% 0%
precompiles/dispatch-lockdrop/src 83% 0%
pallets/dapp-staking/src 80% 0%
pallets/collective-proxy/src 94% 0%
pallets/astar-xcm-benchmarks/src 86% 0%
Summary 72% (3890 / 5381) 0% (0 / 0)

Minimum allowed line rate is 50%

Copy link
Contributor

@ashutoshvarma ashutoshvarma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ipapandinas ipapandinas merged commit 111dcb9 into master Dec 9, 2025
7 of 8 checks passed
@ipapandinas ipapandinas deleted the chore/cleanup-collator-selection branch December 9, 2025 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

astar Related to Astar runtime This PR/Issue is related to the topic “runtime”. shibuya related to shibuya shiden related to shiden runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Collator selection - cleanup of LastAuthoredBlock

4 participants