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

[sui-types] avoid deserialization when fetching ID of non-upgraded pa… #19849

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions crates/sui-types/src/move_package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,10 @@ impl MovePackage {
/// The ObjectID that this package's modules believe they are from, at runtime (can differ from
/// `MovePackage::id()` in the case of package upgrades).
pub fn original_package_id(&self) -> ObjectID {
if self.version == OBJECT_START_VERSION {
Copy link
Contributor

Choose a reason for hiding this comment

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

I forget, packages don't get the lamport timestamp?

Copy link
Member

Choose a reason for hiding this comment

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

No, they are versioned linearly.

// for a non-upgraded package, original ID is just the package ID
return self.id;
}
let bytes = self.module_map.values().next().expect("Empty module map");
let module = CompiledModule::deserialize_with_defaults(bytes)
.expect("A Move package contains a module that cannot be deserialized");
Expand Down
Loading