diff --git a/aptos-move/e2e-benchmark/src/main.rs b/aptos-move/e2e-benchmark/src/main.rs index 7a9691e0e7e697..2c78740f10329a 100644 --- a/aptos-move/e2e-benchmark/src/main.rs +++ b/aptos-move/e2e-benchmark/src/main.rs @@ -253,6 +253,8 @@ fn main() { repeats: 100, map_type: MapType::OrderedMap, }, + EntryPoints::APTPermissionedTransfer, + EntryPoints::APTTransfer, ]; let mut failures = Vec::new(); diff --git a/crates/transaction-workloads-lib/src/args.rs b/crates/transaction-workloads-lib/src/args.rs index 402c4aeb3b54c2..370bad4e72e189 100644 --- a/crates/transaction-workloads-lib/src/args.rs +++ b/crates/transaction-workloads-lib/src/args.rs @@ -78,6 +78,8 @@ pub enum TransactionTypeArg { SmartTablePicture1MWith1KChangeExceedsLimit, DeserializeU256, SimpleScript, + PermissionedTransfer, + APTTransfer, } impl TransactionTypeArg { @@ -351,6 +353,10 @@ impl TransactionTypeArg { }, TransactionTypeArg::DeserializeU256 => call_custom_module(EntryPoints::DeserializeU256), TransactionTypeArg::SimpleScript => call_custom_module(EntryPoints::SimpleScript), + TransactionTypeArg::PermissionedTransfer => { + call_custom_module(EntryPoints::APTPermissionedTransfer) + }, + TransactionTypeArg::APTTransfer => call_custom_module(EntryPoints::APTTransfer), } } diff --git a/crates/transaction-workloads-lib/src/move_workloads.rs b/crates/transaction-workloads-lib/src/move_workloads.rs index 8b5a191c555102..aa3167cb7fd3b0 100644 --- a/crates/transaction-workloads-lib/src/move_workloads.rs +++ b/crates/transaction-workloads-lib/src/move_workloads.rs @@ -232,6 +232,8 @@ pub enum EntryPoints { /// there to slow down deserialization & verification, effectively making it more expensive to /// load it into code cache. SimpleScript, + APTPermissionedTransfer, + APTTransfer, } impl EntryPointTrait for EntryPoints { @@ -284,7 +286,9 @@ impl EntryPointTrait for EntryPoints { | EntryPoints::ResourceGroupsSenderWriteTag { .. } | EntryPoints::ResourceGroupsSenderMultiChange { .. } | EntryPoints::CoinInitAndMint - | EntryPoints::FungibleAssetMint => "framework_usecases", + | EntryPoints::FungibleAssetMint + | EntryPoints::APTPermissionedTransfer + | EntryPoints::APTTransfer => "framework_usecases", EntryPoints::TokenV2AmbassadorMint { .. } | EntryPoints::TokenV2AmbassadorBurn => { "ambassador_token" }, @@ -363,6 +367,9 @@ impl EntryPointTrait for EntryPoints { EntryPoints::IncGlobalMilestoneAggV2 { .. } | EntryPoints::CreateGlobalMilestoneAggV2 { .. } => "counter_with_milestone", EntryPoints::DeserializeU256 => "bcs_stream", + EntryPoints::APTPermissionedTransfer | EntryPoints::APTTransfer => { + "permissioned_transfer" + }, } } @@ -781,6 +788,20 @@ impl EntryPointTrait for EntryPoints { ], ) }, + EntryPoints::APTPermissionedTransfer => get_payload( + module_id, + ident_str!("transfer_permissioned").to_owned(), + vec![ + bcs::to_bytes(&other.expect("Must provide other")).unwrap(), + bcs::to_bytes(&1u64).unwrap(), + ], + ), + EntryPoints::APTTransfer => { + get_payload(module_id, ident_str!("transfer").to_owned(), vec![ + bcs::to_bytes(&other.expect("Must provide other")).unwrap(), + bcs::to_bytes(&1u64).unwrap(), + ]) + }, } } @@ -899,6 +920,9 @@ impl EntryPointTrait for EntryPoints { EntryPoints::DeserializeU256 => AutomaticArgs::None, EntryPoints::IncGlobalMilestoneAggV2 { .. } => AutomaticArgs::None, EntryPoints::CreateGlobalMilestoneAggV2 { .. } => AutomaticArgs::Signer, + EntryPoints::APTPermissionedTransfer | EntryPoints::APTTransfer => { + AutomaticArgs::Signer + }, } } } diff --git a/testsuite/module-publish/src/packages/framework_usecases/sources/permissioned_transfer.move b/testsuite/module-publish/src/packages/framework_usecases/sources/permissioned_transfer.move new file mode 100644 index 00000000000000..a8fc045c0d64f0 --- /dev/null +++ b/testsuite/module-publish/src/packages/framework_usecases/sources/permissioned_transfer.move @@ -0,0 +1,24 @@ + +module 0xABCD::permissioned_transfer { + use aptos_framework::aptos_account; + use aptos_framework::permissioned_signer; + use aptos_framework::primary_fungible_store; + + public entry fun transfer_permissioned( + source: &signer, to: address, amount: u64 + ) { + let handle = permissioned_signer::create_permissioned_handle(source); + let permissioned_signer = permissioned_signer::signer_from_permissioned_handle(&handle); + + primary_fungible_store::grant_apt_permission(source, &permissioned_signer, amount); + aptos_account::transfer(&permissioned_signer, to, amount); + + permissioned_signer::destroy_permissioned_handle(handle); + } + + public entry fun transfer( + source: &signer, to: address, amount: u64 + ) { + aptos_account::transfer(source, to, amount); + } +}