[stable2503] Backport #7936#8201
Closed
paritytech-release-backport-bot[bot] wants to merge 1 commit intostable2503from
Closed
[stable2503] Backport #7936#8201paritytech-release-backport-bot[bot] wants to merge 1 commit intostable2503from
paritytech-release-backport-bot[bot] wants to merge 1 commit intostable2503from
Conversation
…nce` (#7936) closes #6344. related paritytech/substrate#14048. --- ## Overview Post-AHM, RC will no longer have validator exposure information, as all of it will move to AH alongside `pallet-staking`. Currently, we use `Exposure` to identify a validator when an offence report is received. After this change, we’ll only need to check whether the validator exists in the session. Also, the storage map `pallet-offences::Reports` depends on the `Exposure` type and is heavily bloated (and never cleared). There was [some work](paritytech/substrate#14048) to clean it up, but it was never completed. Replacing `Exposure` with `Existence` would make the old storage undecodable, and migrating it would be a pain. The `pallet-offences` storage layout needs to be redesigned, and I didn’t want to make any rushed decisions there that could lead to long-term issues. Instead, this PR introduces a new type, `ExistenceOrLegacyExposure`, with a custom encoder/decoder that can handle both the legacy `Exposure` and the new `Existence` type. It also introduces `ExistenceOf` and `ExistenceOrLegacyExposureOf`, which replaces `ExposureOf`. With this change, runtimes can be configured to identify a validator based solely on their presence, without needing full exposure data. This is useful when configuring historical sessions. For example: ``` impl pallet_session::historical::Config for Runtime { type FullIdentification = pallet_staking::Existence; type FullIdentificationOf = pallet_staking::ExistenceOf<Runtime>; } ``` ## Backward Compatibility For existing runtimes that still depend on the Exposure type in pallet-offences — typically configured like this: ``` impl pallet_offences::Config for Runtime { ... type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>; } ``` Where `IdentificationTuple` is defined as: ``` pub type IdentificationTuple<T> = (<T as pallet_session::Config>::ValidatorId, <T as Config>::FullIdentification); ``` You should now use `ExistenceOrLegacyExposureOf`. This type includes a custom encoder/decoder that supports both the legacy `Exposure` and the new `Existence` types. This compatibility layer is essential to ensure the `Offences::Reports` storage map can still decode older entries. ## TODO - [x] TryStateCheck to see existing offence report decodes correctly. --------- Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> (cherry picked from commit 68aa033)
1 task
Contributor
|
This pull request is amending an existing release. Please proceed with extreme caution,
Emergency Bypass
If you really need to bypass this check: add |
Contributor
|
This does not need to be backported. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport #7936 into
stable2503from Ank4n.See the documentation on how to use this bot.