Skip to content

Commit

Permalink
[loader] Fix linker/loader backward compatibility (MystenLabs#10409)
Browse files Browse the repository at this point in the history
## Description 

When running with backward compatibility enabled, we were incorrectly
returning 0x0 as the original package ID for packages, and then passing
that in as the package ID for the function being called, which caused an
error when we tried to fetch a package at that address.

## Test Plan 

Re-sync fullnode with testnet, running the new node software, previously
it was forking immediately, now it works fine.


---
If your changes are not user-facing and not a breaking change, you can
skip the following section. Otherwise, please indicate what changed, and
then add to the Release Notes section as highlighted during the release
process.

### Type of Change (Check all that apply)

- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [x] breaking change for FNs (FN binary must upgrade)
- [x] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes
  • Loading branch information
amnn authored Apr 4, 2023
1 parent 889157c commit 635561b
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -217,7 +217,7 @@ impl<'vm, 'state, 'a, 'b, S: StorageView> ExecutionContext<'vm, 'state, 'a, 'b,
let resolver = self.session.get_resolver();
if resolver.has_linkage(package_id) {
// Setting same context again, can skip.
return Ok(resolver.original_package_id());
return Ok(resolver.original_package_id().unwrap_or(*package_id));
}

let package =
Original file line number Diff line number Diff line change
@@ -183,11 +183,11 @@ impl<'state, S: StorageView> LinkageView<'state, S> {
self.state_view
}

pub fn original_package_id(&self) -> AccountAddress {
pub fn original_package_id(&self) -> Option<AccountAddress> {
if let LinkageInfo::Set(linkage) = &self.linkage_info {
linkage.runtime_id
Some(linkage.runtime_id)
} else {
AccountAddress::ZERO
None
}
}

0 comments on commit 635561b

Please sign in to comment.