-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: remove stale from perseverance as well
- Loading branch information
Showing
5 changed files
with
70 additions
and
60 deletions.
There are no files selected for viewing
This file contains 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
27 changes: 27 additions & 0 deletions
27
state-chain/pallets/cf-broadcast/src/migrations/remove_aborted_broadcasts.rs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use crate::*; | ||
|
||
// Highest stale aborted broadcasts as of 3/10/2024: | ||
// Mainnet | ||
pub const ETHEREUM_MAX_ABORTED_BROADCAST_BERGHAIN: BroadcastId = 11592; | ||
pub const ARBITRUM_MAX_ABORTED_BROADCAST_BERGHAIN: BroadcastId = 426; | ||
// Perseverance testnet | ||
pub const ETHEREUM_MAX_ABORTED_BROADCAST_PERSEVERANCE: BroadcastId = 1609; | ||
pub const ARBITRUM_MAX_ABORTED_BROADCAST_PERSEVERANCE: BroadcastId = 665; | ||
pub const POLKADOT_MAX_ABORTED_BROADCAST_PERSEVERANCE: BroadcastId = 634; | ||
|
||
pub struct EthereumMigration; | ||
pub struct ArbitrumMigration; | ||
|
||
pub fn remove_stale_and_all_older<T: Config<I>, I: 'static>(latest_stale_broadcast: BroadcastId) { | ||
AbortedBroadcasts::<T, I>::mutate(|aborted| { | ||
aborted.retain(|id| id > &latest_stale_broadcast); | ||
}); | ||
} | ||
|
||
#[cfg(feature = "try-runtime")] | ||
pub fn assert_removed<T: Config<I>, I: 'static>(latest_stale_broadcast: BroadcastId) { | ||
let aborted_broadcasts = AbortedBroadcasts::<T, I>::get(); | ||
if let Some(first) = aborted_broadcasts.first() { | ||
assert!(*first > latest_stale_broadcast, "Aborted broadcast {first} was not removed"); | ||
} | ||
} |
This file contains 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
This file contains 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
52 changes: 0 additions & 52 deletions
52
state-chain/runtime/src/migrations/remove_aborted_broadcasts.rs
This file was deleted.
Oops, something went wrong.