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

Validate code when scheduling upgrades from registrar #3232

Merged
merged 9 commits into from
Feb 14, 2024

Conversation

Szegoo
Copy link
Contributor

@Szegoo Szegoo commented Feb 6, 2024

Currently, anyone can registrar a code that exceeds the code size limit when performing the upgrade from the registrar. This PR fixes that and adds a new test to cover this.

cc @bkchr @eskimor

Copy link
Member

@bkchr bkchr left a comment

Choose a reason for hiding this comment

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

I would move the check, otherwise it looks good.

polkadot/runtime/common/src/paras_registrar/mod.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@seadanda seadanda left a comment

Choose a reason for hiding this comment

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

LGTM

@Szegoo Szegoo requested a review from bkchr February 7, 2024 17:21
Copy link
Contributor

@s0me0ne-unkn0wn s0me0ne-unkn0wn left a comment

Choose a reason for hiding this comment

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

Looks good! Left a nit suggestion, not a blocker.

polkadot/runtime/parachains/src/paras/mod.rs Outdated Show resolved Hide resolved
@bkchr bkchr added the T8-polkadot This PR/Issue is related to/affects the Polkadot network. label Feb 13, 2024
Comment on lines 1235 to 1237
// Validation code sanity checks:
ensure!(new_code.check_sanity(), Error::<T>::InvalidCode);
ensure!(new_code.0.len() <= config.max_code_size as usize, Error::<T>::InvalidCode);
Copy link
Member

Choose a reason for hiding this comment

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

I still think that this should be moved to schedule_code_upgrade.

Copy link
Member

@bkchr bkchr left a comment

Choose a reason for hiding this comment

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

Ty! Still some benchmarks are failing.

@Szegoo
Copy link
Contributor Author

Szegoo commented Feb 14, 2024

Still some benchmarks are failing.

🙈Should be good now.

@bkchr bkchr enabled auto-merge February 14, 2024 16:27
@bkchr bkchr added this pull request to the merge queue Feb 14, 2024
Merged via the queue into paritytech:master with commit 7e7c488 Feb 14, 2024
122 of 124 checks passed
@ggwpez ggwpez changed the title Validate code when scheduling uprades from registrar Validate code when scheduling upgrades from registrar Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T8-polkadot This PR/Issue is related to/affects the Polkadot network.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants