Skip to content

Commit

Permalink
[aptos-vm] Fix binary format version compatibility. (#5898)
Browse files Browse the repository at this point in the history
  • Loading branch information
runtian-zhou authored Dec 17, 2022
1 parent 717a8c2 commit 097931e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion aptos-move/aptos-vm/src/aptos_vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,9 +481,18 @@ impl AptosVM {

/// Deserialize a module bundle.
fn deserialize_module_bundle(&self, modules: &ModuleBundle) -> VMResult<Vec<CompiledModule>> {
let max_version = if self
.0
.get_features()
.is_enabled(FeatureFlag::VM_BINARY_FORMAT_V6)
{
6
} else {
5
};
let mut result = vec![];
for module_blob in modules.iter() {
match CompiledModule::deserialize(module_blob.code()) {
match CompiledModule::deserialize_with_max_version(module_blob.code(), max_version) {
Ok(module) => {
result.push(module);
}
Expand Down

0 comments on commit 097931e

Please sign in to comment.