Skip to content

Commit

Permalink
Merge pull request #133 from movementlabsxyz/l-monninger/fix-movement
Browse files Browse the repository at this point in the history
fix: release package missing.
  • Loading branch information
l-monninger authored Feb 4, 2025
2 parents f43e66b + 68c376c commit f018a5b
Show file tree
Hide file tree
Showing 18 changed files with 14,067 additions and 597 deletions.
27 changes: 21 additions & 6 deletions aptos-move/aptos-vm/src/aptos_vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -750,10 +750,11 @@ impl AptosVM {
let module_id = traversal_context
.referenced_module_ids
.alloc(entry_fn.module().clone());
session.check_dependencies_and_charge_gas(gas_meter, traversal_context, [(
module_id.address(),
module_id.name(),
)])?;
session.check_dependencies_and_charge_gas(
gas_meter,
traversal_context,
[(module_id.address(), module_id.name())],
)?;
}

let function =
Expand Down Expand Up @@ -1318,7 +1319,14 @@ impl AptosVM {
)?;
} else {
return Err(PartialVMError::new(StatusCode::CONSTRAINT_NOT_SATISFIED)
.finish(Location::Undefined));
.with_message(format!(
"initializer not found in module '{}'",
module.self_id().name()
))
.finish(Location::Constraint(format!(
"module must have an initializer function name '{}'",
init_func_name
))));
}
}
}
Expand Down Expand Up @@ -1541,7 +1549,9 @@ impl AptosVM {
fn metadata_validation_error(msg: &str) -> VMError {
PartialVMError::new(StatusCode::CONSTRAINT_NOT_SATISFIED)
.with_message(format!("metadata and code bundle mismatch: {}", msg))
.finish(Location::Undefined)
.finish(Location::Constraint(
"metadata must match the code bundle".to_string(),
))
}

fn validate_signed_transaction(
Expand Down Expand Up @@ -2335,6 +2345,11 @@ impl AptosVM {
// The known Move function failure and type resolution failure could be a result of speculative execution. Use speculative logger.
StatusCode::UNEXPECTED_ERROR_FROM_KNOWN_MOVE_FUNCTION
| StatusCode::TYPE_RESOLUTION_FAILURE => {
println!(
"[aptos_vm] Transaction breaking known Move function failure. txn: {:?}, status: {:?}",
bcs::to_bytes::<SignedTransaction>(txn),
vm_status,
);
speculative_error!(
log_context,
format!(
Expand Down
9 changes: 8 additions & 1 deletion aptos-move/aptos-vm/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ pub fn convert_prologue_error(
let err_msg = format!("[aptos_vm] Unexpected prologue Move abort: {:?}::{:?} (Category: {:?} Reason: {:?})",
location, code, category, reason);
speculative_error!(log_context, err_msg.clone());
println!("Error: {:?}", err_msg);
return Err(VMStatus::error(
StatusCode::UNEXPECTED_ERROR_FROM_KNOWN_MOVE_FUNCTION,
Some(err_msg),
Expand Down Expand Up @@ -138,6 +139,7 @@ pub fn convert_prologue_error(
let err_msg = format!("[aptos_vm] Unexpected prologue Move abort: {:?}::{:?} (Category: {:?} Reason: {:?})",
location, code, category, reason);
speculative_error!(log_context, err_msg.clone());
println!("Error: {:?}", err_msg);
return Err(VMStatus::Error {
status_code: StatusCode::UNEXPECTED_ERROR_FROM_KNOWN_MOVE_FUNCTION,
sub_status: None,
Expand All @@ -152,10 +154,11 @@ pub fn convert_prologue_error(
log_context,
format!("[aptos_vm] Unexpected prologue error: {:?}", status),
);
println!("Error: {:?}", status);
VMStatus::Error {
status_code: StatusCode::UNEXPECTED_ERROR_FROM_KNOWN_MOVE_FUNCTION,
sub_status: status.sub_status(),
message: None,
message: Some(format!("{:?}", status)),
}
},
})
Expand All @@ -178,6 +181,7 @@ pub fn convert_epilogue_error(
let err_msg = format!("[aptos_vm] Unexpected success epilogue Move abort: {:?}::{:?} (Category: {:?} Reason: {:?})",
location, code, category, reason);
speculative_error!(log_context, err_msg.clone());
print!("Error: {:?}", err_msg);
VMStatus::error(
StatusCode::UNEXPECTED_ERROR_FROM_KNOWN_MOVE_FUNCTION,
Some(err_msg),
Expand All @@ -190,6 +194,7 @@ pub fn convert_epilogue_error(
let err_msg = format!("[aptos_vm] Unexpected success epilogue Move abort: {:?}::{:?} (Category: {:?} Reason: {:?})",
location, code, category, reason);
speculative_error!(log_context, err_msg.clone());
println!("Error: {:?}", err_msg);
VMStatus::error(
StatusCode::UNEXPECTED_ERROR_FROM_KNOWN_MOVE_FUNCTION,
Some(err_msg),
Expand All @@ -199,6 +204,7 @@ pub fn convert_epilogue_error(
status => {
let err_msg = format!("[aptos_vm] Unexpected success epilogue error: {:?}", status);
speculative_error!(log_context, err_msg.clone());
println!("Error: {:?}", err_msg);
VMStatus::Error {
status_code: StatusCode::UNEXPECTED_ERROR_FROM_KNOWN_MOVE_FUNCTION,
sub_status: status.sub_status(),
Expand Down Expand Up @@ -234,6 +240,7 @@ pub fn expect_only_successful_execution(
function_name, status
);
speculative_warn!(log_context, err_msg.clone());
println!("Error: {:?}", err_msg);
VMStatus::Error {
status_code: StatusCode::UNEXPECTED_ERROR_FROM_KNOWN_MOVE_FUNCTION,
sub_status: status.sub_status(),
Expand Down
4 changes: 3 additions & 1 deletion aptos-move/aptos-vm/src/verifier/resource_groups.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ fn metadata_validation_err(msg: &str) -> Result<(), VMError> {
fn metadata_validation_error(msg: &str) -> VMError {
PartialVMError::new(StatusCode::CONSTRAINT_NOT_SATISFIED)
.with_message(format!("metadata and code bundle mismatch: {}", msg))
.finish(Location::Undefined)
.finish(Location::Constraint(
"metadata must match code bundle".to_string(),
))
}

/// Perform validation and upgrade checks on resource groups
Expand Down
Loading

0 comments on commit f018a5b

Please sign in to comment.