Skip to content

Commit

Permalink
[compiler-v2 framework] Fixed the error of function params signer is …
Browse files Browse the repository at this point in the history
…reference (#4282)
  • Loading branch information
welbon authored Nov 13, 2024
1 parent 19ee5d3 commit 1f94920
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
6 changes: 5 additions & 1 deletion abi/decoder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,11 @@ fn decode_script_function_inner(
let arg_abis = func_abi.args();
let first_arg_is_signer = arg_abis
.first()
.filter(|abi| abi.type_abi() == &TypeInstantiation::Signer)
.filter(|abi| {
abi.type_abi() == &TypeInstantiation::Signer
|| abi.type_abi()
== &TypeInstantiation::Reference(false, Box::new(TypeInstantiation::Signer))
})
.is_some();
if first_arg_is_signer {
&arg_abis[1..]
Expand Down
3 changes: 2 additions & 1 deletion vm/vm-runtime/src/move_vm_ext/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -545,10 +545,11 @@ impl<'r, 'l> SessionExt<'r, 'l> {
args: Vec<Vec<u8>>,
sender: AccountAddress,
) -> VMResult<Vec<Vec<u8>>> {
let signer_ref = Type::Reference(Box::new(Type::Signer));
let has_signer = func
.param_tys()
.iter()
.position(|i| matches!(i, &Type::Signer))
.position(|i| i == &Type::Signer || i == &signer_ref)
.map(|pos| {
if pos != 0 {
Err(
Expand Down
4 changes: 3 additions & 1 deletion vm/vm-runtime/src/verifier/transaction_arg_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ pub(crate) fn validate_combine_singer_and_args(
match ty {
Type::Signer => signer_param_cnt += 1,
Type::Reference(inner_type) => {
if matches!(&**inner_type, Type::Signer) {
let signer_ref_type = Type::Reference(Box::new(Type::Signer));

Check warning on line 102 in vm/vm-runtime/src/verifier/transaction_arg_validation.rs

View workflow job for this annotation

GitHub Actions / Build release asset (ubuntu-latest)

unused variable: `signer_ref_type`

Check warning on line 102 in vm/vm-runtime/src/verifier/transaction_arg_validation.rs

View workflow job for this annotation

GitHub Actions / Build release asset (ubuntu-20.04)

unused variable: `signer_ref_type`

Check warning on line 102 in vm/vm-runtime/src/verifier/transaction_arg_validation.rs

View workflow job for this annotation

GitHub Actions / Build release asset with selfhosted

unused variable: `signer_ref_type`
if matches!(&**inner_type, Type::Signer) || matches!(&**inner_type, signer_ref_type)

Check warning on line 103 in vm/vm-runtime/src/verifier/transaction_arg_validation.rs

View workflow job for this annotation

GitHub Actions / Build release asset (ubuntu-latest)

unused variable: `signer_ref_type`

Check warning on line 103 in vm/vm-runtime/src/verifier/transaction_arg_validation.rs

View workflow job for this annotation

GitHub Actions / Build release asset (ubuntu-20.04)

unused variable: `signer_ref_type`

Check warning on line 103 in vm/vm-runtime/src/verifier/transaction_arg_validation.rs

View workflow job for this annotation

GitHub Actions / Build release asset with selfhosted

unused variable: `signer_ref_type`
{
signer_param_cnt += 1;
}
}
Expand Down

0 comments on commit 1f94920

Please sign in to comment.