-
Notifications
You must be signed in to change notification settings - Fork 709
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
[bridges] Prune messages from confirmation tx body, not from the on_idle #4944
[bridges] Prune messages from confirmation tx body, not from the on_idle #4944
Conversation
e6dea3a
to
b352ea0
Compare
bot bench cumulus-bridge-hubs --runtime=bridge-hub-rococo --pallet=pallet_bridge_messages |
Original PR with more context: paritytech/parity-bridges-common#2211 Signed-off-by: Branislav Kontur <[email protected]> Co-authored-by: Svyatoslav Nikolsky <[email protected]>
…=bridge-hub-westend --runtime_dir=bridge-hubs --target_dir=cumulus --pallet=pallet_bridge_messages
…=bridge-hub-rococo --runtime_dir=bridge-hubs --target_dir=cumulus --pallet=pallet_bridge_messages
fa0035c
to
7aa55e2
Compare
bot clean |
const MAX_MESSAGES_ITERATION: u64 = 16; | ||
let start_nonce = | ||
expected_last_prunned_nonce.checked_sub(MAX_MESSAGES_ITERATION).unwrap_or(0); | ||
for current_nonce in start_nonce..=expected_last_prunned_nonce { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not familiar with try_state()
. Why do we use MAX_MESSAGES_ITERATION
and not iterate all the way ?
Otherwise replacing the loop
wit ha for
looks good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not familiar with
try_state()
. Why do we useMAX_MESSAGES_ITERATION
and not iterate all the way ?
Because, on every runtime upgrade it would be more and more waste of time, e.g.
- first time it would run from e.g. message with nonce 1000 to 0
- another runtime upgrade (when more messages happen) it would run e.g. 3000 to 0 (we previously checked interval 1000 to 0)
- another runtime upgrade (when more messages happen) it would run e.g. 6000 to 0 (we previously checked interval 3000 to 0)
- and so on
Yes, that's why I updated description that maybe oldest_unpruned_nonce
and do_try_state_for_outbound_lanes
are not really needed.
Slava wanted to create migration, that remove all messages < oldest_unpruned_nonce
, but I think his concert was valid only if we have already more than one lane, because on_idle
he picked different/random lanes to prune depending on ActiveOutboundLanes::count
, which is for fellows 1 :). I think MBM migration is too much for this and also for standard migration, we would need to handle consumed weights and store last pruned block somewhere else, because oldest_unpruned_nonce
is incremented on delivery now.
But as I am thinking about it again now, I think we should really remove attribute lane.oldest_unpruned_nonce
, because we prune on delivery and this attribute does not make sense. So, the removal of this attribute could cause storage version change and migration, which would clean everything :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, MBM migration and removed oldest_unpruned_nonce
, would do the job :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't use oldest_unpruned_nonce
for relayer, anyway we can leave also without these migration, the worst can happen that we will have just a few messages in the storage, which we don't need. We add monitoring or do some sanity checks with seaching storage manually after upgrade, and when few messages left, we could remove them with set_prefix
/ kill_storage
.
7c875be
into
bko-bridges-v2-backport-refactoring
…cations (#4935) ## Summary This PR contains migrated code from the Bridges V2 [branch](#4427) from the old `parity-bridges-common` [repo](https://github.com/paritytech/parity-bridges-common/tree/bridges-v2). Even though the PR looks large, it does not (or should not) contain any significant changes (also not relevant for audit). This PR is a requirement for permissionless lanes, as they were implemented on top of these changes. ## TODO - [x] generate fresh weights for BridgeHubs - [x] run `polkadot-fellows` bridges zombienet tests with actual runtime 1.2.5. or 1.2.6 to check compatibility - ☑️ working, checked with 1.2.8 fellows BridgeHubs - [x] run `polkadot-sdk` bridges zombienet tests - ☑️ with old relayer in CI (1.6.5) - [x] run `polkadot-sdk` bridges zombienet tests (locally) - with the relayer based on this branch - paritytech/parity-bridges-common#3022 - [x] check/fix relayer companion in bridges repo - paritytech/parity-bridges-common#3022 - [x] extract pruning stuff to separate PR #4944 Relates to: paritytech/parity-bridges-common#2976 Relates to: paritytech/parity-bridges-common#2451 --------- Signed-off-by: Branislav Kontur <[email protected]> Co-authored-by: Serban Iorga <[email protected]> Co-authored-by: Svyatoslav Nikolsky <[email protected]> Co-authored-by: command-bot <>
…cations (paritytech#4935) ## Summary This PR contains migrated code from the Bridges V2 [branch](paritytech#4427) from the old `parity-bridges-common` [repo](https://github.com/paritytech/parity-bridges-common/tree/bridges-v2). Even though the PR looks large, it does not (or should not) contain any significant changes (also not relevant for audit). This PR is a requirement for permissionless lanes, as they were implemented on top of these changes. ## TODO - [x] generate fresh weights for BridgeHubs - [x] run `polkadot-fellows` bridges zombienet tests with actual runtime 1.2.5. or 1.2.6 to check compatibility - ☑️ working, checked with 1.2.8 fellows BridgeHubs - [x] run `polkadot-sdk` bridges zombienet tests - ☑️ with old relayer in CI (1.6.5) - [x] run `polkadot-sdk` bridges zombienet tests (locally) - with the relayer based on this branch - paritytech/parity-bridges-common#3022 - [x] check/fix relayer companion in bridges repo - paritytech/parity-bridges-common#3022 - [x] extract pruning stuff to separate PR paritytech#4944 Relates to: paritytech/parity-bridges-common#2976 Relates to: paritytech/parity-bridges-common#2451 --------- Signed-off-by: Branislav Kontur <[email protected]> Co-authored-by: Serban Iorga <[email protected]> Co-authored-by: Svyatoslav Nikolsky <[email protected]> Co-authored-by: command-bot <>
…cations (paritytech#4935) ## Summary This PR contains migrated code from the Bridges V2 [branch](paritytech#4427) from the old `parity-bridges-common` [repo](https://github.com/paritytech/parity-bridges-common/tree/bridges-v2). Even though the PR looks large, it does not (or should not) contain any significant changes (also not relevant for audit). This PR is a requirement for permissionless lanes, as they were implemented on top of these changes. ## TODO - [x] generate fresh weights for BridgeHubs - [x] run `polkadot-fellows` bridges zombienet tests with actual runtime 1.2.5. or 1.2.6 to check compatibility - ☑️ working, checked with 1.2.8 fellows BridgeHubs - [x] run `polkadot-sdk` bridges zombienet tests - ☑️ with old relayer in CI (1.6.5) - [x] run `polkadot-sdk` bridges zombienet tests (locally) - with the relayer based on this branch - paritytech/parity-bridges-common#3022 - [x] check/fix relayer companion in bridges repo - paritytech/parity-bridges-common#3022 - [x] extract pruning stuff to separate PR paritytech#4944 Relates to: paritytech/parity-bridges-common#2976 Relates to: paritytech/parity-bridges-common#2451 --------- Signed-off-by: Branislav Kontur <[email protected]> Co-authored-by: Serban Iorga <[email protected]> Co-authored-by: Svyatoslav Nikolsky <[email protected]> Co-authored-by: command-bot <>
…dle (#5006) (Please, do not merge until SA, reverted and restored of #4944) Original PR with more context: paritytech/parity-bridges-common#2211 Relates to: paritytech/parity-bridges-common#2210 ## TODO - [x] fresh weighs for `pallet_bridge_messages` - [x] add `try_state` for `pallet_bridge_messages` which checks for unpruned messages - relates to the [comment](paritytech/parity-bridges-common#2211 (comment)) - [x] ~prepare migration, that prunes leftovers, which would be pruned eventually from `on_idle` the [comment](paritytech/parity-bridges-common#2211 (comment) can be done also by `set_storage` / `kill_storage` or with `OnRuntimeUpgrade` implementatino when `do_try_state_for_outbound_lanes` detects problem. ## Open question - [ ] Do we really need `oldest_unpruned_nonce` afterwards? - after the runtime upgrade and when `do_try_state_for_outbound_lanes` pass, we won't need any migrations here - we won't even need `do_try_state_for_outbound_lanes` - please check comments bellow: #4944 (comment) --------- Signed-off-by: Branislav Kontur <[email protected]> Co-authored-by: Serban Iorga <[email protected]> Co-authored-by: Svyatoslav Nikolsky <[email protected]> Co-authored-by: command-bot <>
Original PR with more context: paritytech/parity-bridges-common#2211
Relates to: paritytech/parity-bridges-common#2210
TODO
pallet_bridge_messages
try_state
forpallet_bridge_messages
which checks for unpruned messages - relates to the commentprepare migration, that prunes leftovers, which would be pruned eventually fromcan be done also byon_idle
the commentset_storage
/kill_storage
or withOnRuntimeUpgrade
implementatino whendo_try_state_for_outbound_lanes
detects problem.Open question
oldest_unpruned_nonce
afterwards?do_try_state_for_outbound_lanes
pass, we won't need any migrations heredo_try_state_for_outbound_lanes