Skip to content

Commit f018a5b

Browse files
authored
Merge pull request #133 from movementlabsxyz/l-monninger/fix-movement
fix: release package missing.
2 parents f43e66b + 68c376c commit f018a5b

File tree

18 files changed

+14067
-597
lines changed

18 files changed

+14067
-597
lines changed

aptos-move/aptos-vm/src/aptos_vm.rs

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -750,10 +750,11 @@ impl AptosVM {
750750
let module_id = traversal_context
751751
.referenced_module_ids
752752
.alloc(entry_fn.module().clone());
753-
session.check_dependencies_and_charge_gas(gas_meter, traversal_context, [(
754-
module_id.address(),
755-
module_id.name(),
756-
)])?;
753+
session.check_dependencies_and_charge_gas(
754+
gas_meter,
755+
traversal_context,
756+
[(module_id.address(), module_id.name())],
757+
)?;
757758
}
758759

759760
let function =
@@ -1318,7 +1319,14 @@ impl AptosVM {
13181319
)?;
13191320
} else {
13201321
return Err(PartialVMError::new(StatusCode::CONSTRAINT_NOT_SATISFIED)
1321-
.finish(Location::Undefined));
1322+
.with_message(format!(
1323+
"initializer not found in module '{}'",
1324+
module.self_id().name()
1325+
))
1326+
.finish(Location::Constraint(format!(
1327+
"module must have an initializer function name '{}'",
1328+
init_func_name
1329+
))));
13221330
}
13231331
}
13241332
}
@@ -1541,7 +1549,9 @@ impl AptosVM {
15411549
fn metadata_validation_error(msg: &str) -> VMError {
15421550
PartialVMError::new(StatusCode::CONSTRAINT_NOT_SATISFIED)
15431551
.with_message(format!("metadata and code bundle mismatch: {}", msg))
1544-
.finish(Location::Undefined)
1552+
.finish(Location::Constraint(
1553+
"metadata must match the code bundle".to_string(),
1554+
))
15451555
}
15461556

15471557
fn validate_signed_transaction(
@@ -2335,6 +2345,11 @@ impl AptosVM {
23352345
// The known Move function failure and type resolution failure could be a result of speculative execution. Use speculative logger.
23362346
StatusCode::UNEXPECTED_ERROR_FROM_KNOWN_MOVE_FUNCTION
23372347
| StatusCode::TYPE_RESOLUTION_FAILURE => {
2348+
println!(
2349+
"[aptos_vm] Transaction breaking known Move function failure. txn: {:?}, status: {:?}",
2350+
bcs::to_bytes::<SignedTransaction>(txn),
2351+
vm_status,
2352+
);
23382353
speculative_error!(
23392354
log_context,
23402355
format!(

aptos-move/aptos-vm/src/errors.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ pub fn convert_prologue_error(
9797
let err_msg = format!("[aptos_vm] Unexpected prologue Move abort: {:?}::{:?} (Category: {:?} Reason: {:?})",
9898
location, code, category, reason);
9999
speculative_error!(log_context, err_msg.clone());
100+
println!("Error: {:?}", err_msg);
100101
return Err(VMStatus::error(
101102
StatusCode::UNEXPECTED_ERROR_FROM_KNOWN_MOVE_FUNCTION,
102103
Some(err_msg),
@@ -138,6 +139,7 @@ pub fn convert_prologue_error(
138139
let err_msg = format!("[aptos_vm] Unexpected prologue Move abort: {:?}::{:?} (Category: {:?} Reason: {:?})",
139140
location, code, category, reason);
140141
speculative_error!(log_context, err_msg.clone());
142+
println!("Error: {:?}", err_msg);
141143
return Err(VMStatus::Error {
142144
status_code: StatusCode::UNEXPECTED_ERROR_FROM_KNOWN_MOVE_FUNCTION,
143145
sub_status: None,
@@ -152,10 +154,11 @@ pub fn convert_prologue_error(
152154
log_context,
153155
format!("[aptos_vm] Unexpected prologue error: {:?}", status),
154156
);
157+
println!("Error: {:?}", status);
155158
VMStatus::Error {
156159
status_code: StatusCode::UNEXPECTED_ERROR_FROM_KNOWN_MOVE_FUNCTION,
157160
sub_status: status.sub_status(),
158-
message: None,
161+
message: Some(format!("{:?}", status)),
159162
}
160163
},
161164
})
@@ -178,6 +181,7 @@ pub fn convert_epilogue_error(
178181
let err_msg = format!("[aptos_vm] Unexpected success epilogue Move abort: {:?}::{:?} (Category: {:?} Reason: {:?})",
179182
location, code, category, reason);
180183
speculative_error!(log_context, err_msg.clone());
184+
print!("Error: {:?}", err_msg);
181185
VMStatus::error(
182186
StatusCode::UNEXPECTED_ERROR_FROM_KNOWN_MOVE_FUNCTION,
183187
Some(err_msg),
@@ -190,6 +194,7 @@ pub fn convert_epilogue_error(
190194
let err_msg = format!("[aptos_vm] Unexpected success epilogue Move abort: {:?}::{:?} (Category: {:?} Reason: {:?})",
191195
location, code, category, reason);
192196
speculative_error!(log_context, err_msg.clone());
197+
println!("Error: {:?}", err_msg);
193198
VMStatus::error(
194199
StatusCode::UNEXPECTED_ERROR_FROM_KNOWN_MOVE_FUNCTION,
195200
Some(err_msg),
@@ -199,6 +204,7 @@ pub fn convert_epilogue_error(
199204
status => {
200205
let err_msg = format!("[aptos_vm] Unexpected success epilogue error: {:?}", status);
201206
speculative_error!(log_context, err_msg.clone());
207+
println!("Error: {:?}", err_msg);
202208
VMStatus::Error {
203209
status_code: StatusCode::UNEXPECTED_ERROR_FROM_KNOWN_MOVE_FUNCTION,
204210
sub_status: status.sub_status(),
@@ -234,6 +240,7 @@ pub fn expect_only_successful_execution(
234240
function_name, status
235241
);
236242
speculative_warn!(log_context, err_msg.clone());
243+
println!("Error: {:?}", err_msg);
237244
VMStatus::Error {
238245
status_code: StatusCode::UNEXPECTED_ERROR_FROM_KNOWN_MOVE_FUNCTION,
239246
sub_status: status.sub_status(),

aptos-move/aptos-vm/src/verifier/resource_groups.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ fn metadata_validation_err(msg: &str) -> Result<(), VMError> {
2222
fn metadata_validation_error(msg: &str) -> VMError {
2323
PartialVMError::new(StatusCode::CONSTRAINT_NOT_SATISFIED)
2424
.with_message(format!("metadata and code bundle mismatch: {}", msg))
25-
.finish(Location::Undefined)
25+
.finish(Location::Constraint(
26+
"metadata must match code bundle".to_string(),
27+
))
2628
}
2729

2830
/// Perform validation and upgrade checks on resource groups

0 commit comments

Comments
 (0)