-
Notifications
You must be signed in to change notification settings - Fork 11.6k
[ptb] Add error for init on new modules during upgrade #22855
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
2 Skipped Deployments
|
if let Some(m) = self | ||
.compiled_state | ||
.dep_modules() | ||
.find(|m| &m.self_id() == id) | ||
{ | ||
Ok(Some(Cow::Borrowed(m))) | ||
} else { | ||
let module = self | ||
.executor | ||
.get_object(&ObjectID::from(*id.address())) | ||
.and_then(|obj| { | ||
let data = obj.data.try_as_package()?.get_module(id)?; | ||
let module = CompiledModule::deserialize_with_defaults(data).unwrap(); | ||
Some(module) | ||
}) | ||
.unwrap_or_else(|| panic!("Internal error: Unbound module {}", id)); | ||
Ok(Some(Cow::Owned(module))) |
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.
This change was left over from attempting to add upgrade on init. I can make it a separate PR but it feels fine for now?
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.
LGTM!
@@ -794,6 +794,46 @@ mod checked { | |||
&modules, | |||
upgrade_ticket.policy, | |||
)?; | |||
if context.protocol_config.check_for_init_during_upgrade() { | |||
// find newly added modules to the package, | |||
// and run their init functions (if applicable) |
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.
Nit: old comment
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.
LGTM
@@ -2162,15 +2163,27 @@ impl SuiTestAdapter { | |||
impl<'a> GetModule for &'a SuiTestAdapter { | |||
type Error = anyhow::Error; | |||
|
|||
type Item = &'a CompiledModule; | |||
type Item = Cow<'a, CompiledModule>; |
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.
seriously?
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.
?
return Err(ExecutionError::new_with_source( | ||
ExecutionErrorKind::FeatureNotYetSupported, | ||
"`init` in new modules on upgrade is not yet supported", | ||
)); |
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.
so this is effectively the new error right?
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.
Correct
Description
Test plan
Release notes
Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.
For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.