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

Check is_bridge_upgraded at post_upgrade phase #11

Merged
merged 2 commits into from
May 18, 2024

Conversation

yrong
Copy link

@yrong yrong commented May 18, 2024

No description provided.

@yrong yrong merged commit 7bb13b7 into unstuck-snowbridge May 18, 2024
34 of 35 checks passed
@@ -85,6 +90,8 @@ impl OnRuntimeUpgrade for UnstuckSnowbridge {
#[cfg(feature = "try-runtime")]
fn post_upgrade(_: Vec<u8>) -> Result<(), TryRuntimeError> {
frame_support::ensure!(!is_bridge_stuck(), "Snowbridge is still stuck.");
frame_support::ensure!(is_bridge_upgraded(), "Snowbridge is not migrated.");
Copy link

@vgeddes vgeddes May 18, 2024

Choose a reason for hiding this comment

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

I think this is to create false negatives (errors) later down the line when the try-runtime tests fork BridgeHub after the relayer has imported new headers, and the check in is_bridge_upgraded fail

@@ -47,6 +49,9 @@ impl OnRuntimeUpgrade for UnstuckSnowbridge {
if !is_bridge_stuck() {
return RocksDbWeight::get().reads(1);
}
if is_bridge_upgraded() {
Copy link

@vgeddes vgeddes May 18, 2024

Choose a reason for hiding this comment

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

This is redundant and adds confusion. The upgrade should only run if the bridge is stuck according to is_bridge_stuck.

is_bridge_stuck will return false when the last imported header is not the buggy header, indicating that the bridge is migrated.

vgeddes added a commit that referenced this pull request May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants