Skip to content

Commit 92c0534

Browse files
authored
[VM] Fix divergence in error behavior of txn validation (#18208)
PR #17892 simplified some code in the transaction validator, resulting in different behavior. This PR rolls back this particular change and restores the old validator code.
1 parent 8e61d6d commit 92c0534

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -610,11 +610,16 @@ fn load_constructor_function(
610610
}
611611

612612
// Construct the type arguments from the match.
613-
let Ok(ty_args) = map.verify_and_extract_type_args(function.ty_param_abilities()) else {
614-
return Err(
615-
PartialVMError::new(StatusCode::INVALID_MAIN_FUNCTION_SIGNATURE).finish(module_loc()),
616-
);
617-
};
613+
let num_ty_args = function.ty_param_abilities().len();
614+
let mut ty_args = Vec::with_capacity(num_ty_args);
615+
for i in 0..num_ty_args {
616+
ty_args.push(map.get_ty_param(i as u16).ok_or_else(|| {
617+
PartialVMError::new(StatusCode::INVALID_MAIN_FUNCTION_SIGNATURE).finish(module_loc())
618+
})?);
619+
}
620+
621+
Type::verify_ty_arg_abilities(function.ty_param_abilities(), &ty_args)
622+
.map_err(|e| e.finish(module_loc()))?;
618623
let ty_args_id = loader
619624
.runtime_environment()
620625
.ty_pool()

0 commit comments

Comments
 (0)