Skip to content

Commit

Permalink
Return move value instead of value (#5)
Browse files Browse the repository at this point in the history
* Return move value instead of value

* update tests
  • Loading branch information
Poytr1 committed Nov 1, 2023
1 parent 77053b2 commit 1f60e4f
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
"module_id": "0000000000000000000000000000000000000000000000000000000000000001::account",
"func_name": "create_account",
"inputs": [
"Address(34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)"
"0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf"
],
"outputs": [
"(container 600003fbec88: [Address(34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)])"
"signer(0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)"
],
"type_args": [],
"sub_traces": [
Expand All @@ -25,10 +25,10 @@
"module_id": "0000000000000000000000000000000000000000000000000000000000000001::account",
"func_name": "create_account_unchecked",
"inputs": [
"Address(34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)"
"0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf"
],
"outputs": [
"(container 600003fbec88: [Address(34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)])"
"signer(0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)"
],
"type_args": [],
"sub_traces": [
Expand All @@ -37,11 +37,11 @@
"module_id": "0000000000000000000000000000000000000000000000000000000000000001::guid",
"func_name": "create",
"inputs": [
"Address(34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)",
"(&container 600003fd1bd8)[3]"
"0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf",
"0u64"
],
"outputs": [
"(container 600003fd1b78: [(container 600003fd1848: [U64(0), Address(34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)])])"
"struct[struct[0u64, 0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf]]"
],
"type_args": [],
"sub_traces": []
Expand All @@ -51,10 +51,10 @@
"module_id": "0000000000000000000000000000000000000000000000000000000000000001::event",
"func_name": "new_event_handle",
"inputs": [
"(container 600003fd1a28: [(container 600003fd1ab8: [U64(0), Address(34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)])])"
"struct[struct[0u64, 0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf]]"
],
"outputs": [
"(container 600003fd1f68: [U64(0), (container 600003fd18d8: [(container 600003fd1848: [U64(0), Address(34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)])])])"
"struct[0u64, struct[struct[0u64, 0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf]]]"
],
"type_args": [],
"sub_traces": []
Expand All @@ -64,11 +64,11 @@
"module_id": "0000000000000000000000000000000000000000000000000000000000000001::guid",
"func_name": "create",
"inputs": [
"Address(34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)",
"(&container 600003fd1bd8)[3]"
"0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf",
"1u64"
],
"outputs": [
"(container 600003fd1e48: [(container 600003fd1ea8: [U64(1), Address(34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)])])"
"struct[struct[1u64, 0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf]]"
],
"type_args": [],
"sub_traces": []
Expand All @@ -78,10 +78,10 @@
"module_id": "0000000000000000000000000000000000000000000000000000000000000001::event",
"func_name": "new_event_handle",
"inputs": [
"(container 600003fd18d8: [(container 600003fd1ab8: [U64(1), Address(34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)])])"
"struct[struct[1u64, 0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf]]"
],
"outputs": [
"(container 600003fd1d88: [U64(0), (container 600003fd1de8: [(container 600003fd1ea8: [U64(1), Address(34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)])])])"
"struct[0u64, struct[struct[1u64, 0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf]]]"
],
"type_args": [],
"sub_traces": []
Expand All @@ -92,7 +92,7 @@
"func_name": "none",
"inputs": [],
"outputs": [
"(container 600003fbf978: [(container 600003fbf6d8: [])])"
""
],
"type_args": [],
"sub_traces": []
Expand All @@ -103,7 +103,7 @@
"func_name": "none",
"inputs": [],
"outputs": [
"(container 600003fbc978: [(container 600003fbc948: [])])"
""
],
"type_args": [],
"sub_traces": []
Expand All @@ -117,7 +117,7 @@
"module_id": "0000000000000000000000000000000000000000000000000000000000000001::coin",
"func_name": "register",
"inputs": [
"(&container 600003fd1f98)"
"signer(0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)"
],
"outputs": [],
"type_args": [],
Expand All @@ -127,10 +127,10 @@
"module_id": "0000000000000000000000000000000000000000000000000000000000000001::signer",
"func_name": "address_of",
"inputs": [
"(&container 600003fd1f98)"
"signer(0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)"
],
"outputs": [
"Address(34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)"
"0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf"
],
"type_args": [],
"sub_traces": []
Expand All @@ -140,7 +140,7 @@
"module_id": "0000000000000000000000000000000000000000000000000000000000000001::coin",
"func_name": "is_account_registered",
"inputs": [
"Address(34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)"
"0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf"
],
"outputs": [
"false"
Expand All @@ -153,7 +153,7 @@
"module_id": "0000000000000000000000000000000000000000000000000000000000000001::account",
"func_name": "register_coin",
"inputs": [
"Address(34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)"
"0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf"
],
"outputs": [],
"type_args": [],
Expand All @@ -163,8 +163,8 @@
"module_id": "0000000000000000000000000000000000000000000000000000000000000001::event",
"func_name": "emit_event",
"inputs": [
"(&container 600003fd1b78)",
"(container 600003fbfb88: [(container 600003fbf588: [Address(1), (container 600003fbee38: [97, 112, 116, 111, 115, 95, 99, 111, 105, 110]), (container 600003fbe8f8: [65, 112, 116, 111, 115, 67, 111, 105, 110])])])"
"struct[0u64, struct[struct[0u64, 0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf]]]",
""
],
"outputs": [],
"type_args": [],
Expand All @@ -177,10 +177,10 @@
"module_id": "0000000000000000000000000000000000000000000000000000000000000001::account",
"func_name": "new_event_handle",
"inputs": [
"(&container 600003fd1f98)"
"signer(0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)"
],
"outputs": [
"(container 600003fbe808: [U64(0), (container 600003fbeb68: [(container 600003fbeb38: [U64(2), Address(34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)])])])"
"struct[0u64, struct[struct[2u64, 0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf]]]"
],
"type_args": [],
"sub_traces": [
Expand All @@ -189,10 +189,10 @@
"module_id": "0000000000000000000000000000000000000000000000000000000000000001::account",
"func_name": "create_guid",
"inputs": [
"(&container 600003fd1f98)"
"signer(0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)"
],
"outputs": [
"(container 600003fbea48: [(container 600003fbee38: [U64(2), Address(34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)])])"
"struct[struct[2u64, 0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf]]"
],
"type_args": [],
"sub_traces": [
Expand All @@ -201,10 +201,10 @@
"module_id": "0000000000000000000000000000000000000000000000000000000000000001::signer",
"func_name": "address_of",
"inputs": [
"(&container 600003fd1f98)"
"signer(0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)"
],
"outputs": [
"Address(34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)"
"0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf"
],
"type_args": [],
"sub_traces": []
Expand All @@ -214,11 +214,11 @@
"module_id": "0000000000000000000000000000000000000000000000000000000000000001::guid",
"func_name": "create",
"inputs": [
"Address(34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)",
"(&container 600003fbc948)[2]"
"0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf",
"2u64"
],
"outputs": [
"(container 600003fbe808: [(container 600003fbeef8: [U64(2), Address(34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)])])"
"struct[struct[2u64, 0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf]]"
],
"type_args": [],
"sub_traces": []
Expand All @@ -230,10 +230,10 @@
"module_id": "0000000000000000000000000000000000000000000000000000000000000001::event",
"func_name": "new_event_handle",
"inputs": [
"(container 600003fbeb68: [(container 600003fbeb38: [U64(2), Address(34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)])])"
"struct[struct[2u64, 0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf]]"
],
"outputs": [
"(container 600003fbe808: [U64(0), (container 600003fbee38: [(container 600003fbea48: [U64(2), Address(34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)])])])"
"struct[0u64, struct[struct[2u64, 0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf]]]"
],
"type_args": [],
"sub_traces": []
Expand All @@ -245,10 +245,10 @@
"module_id": "0000000000000000000000000000000000000000000000000000000000000001::account",
"func_name": "new_event_handle",
"inputs": [
"(&container 600003fd1f98)"
"signer(0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)"
],
"outputs": [
"(container 600003fbec28: [U64(0), (container 600003fbeb68: [(container 600003fbea48: [U64(3), Address(34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)])])])"
"struct[0u64, struct[struct[3u64, 0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf]]]"
],
"type_args": [],
"sub_traces": [
Expand All @@ -257,10 +257,10 @@
"module_id": "0000000000000000000000000000000000000000000000000000000000000001::account",
"func_name": "create_guid",
"inputs": [
"(&container 600003fd1f98)"
"signer(0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)"
],
"outputs": [
"(container 600003fbeef8: [(container 600003fbe508: [U64(3), Address(34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)])])"
"struct[struct[3u64, 0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf]]"
],
"type_args": [],
"sub_traces": [
Expand All @@ -269,10 +269,10 @@
"module_id": "0000000000000000000000000000000000000000000000000000000000000001::signer",
"func_name": "address_of",
"inputs": [
"(&container 600003fd1f98)"
"signer(0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)"
],
"outputs": [
"Address(34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)"
"0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf"
],
"type_args": [],
"sub_traces": []
Expand All @@ -282,11 +282,11 @@
"module_id": "0000000000000000000000000000000000000000000000000000000000000001::guid",
"func_name": "create",
"inputs": [
"Address(34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)",
"(&container 600003fbc948)[2]"
"0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf",
"3u64"
],
"outputs": [
"(container 600003fbec28: [(container 600003fbeb98: [U64(3), Address(34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)])])"
"struct[struct[3u64, 0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf]]"
],
"type_args": [],
"sub_traces": []
Expand All @@ -298,10 +298,10 @@
"module_id": "0000000000000000000000000000000000000000000000000000000000000001::event",
"func_name": "new_event_handle",
"inputs": [
"(container 600003fbeb68: [(container 600003fbea48: [U64(3), Address(34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)])])"
"struct[struct[3u64, 0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf]]"
],
"outputs": [
"(container 600003fbec28: [U64(0), (container 600003fbe508: [(container 600003fbeef8: [U64(3), Address(34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf)])])])"
"struct[0u64, struct[struct[3u64, 0x34bf7e2d17674feb234371a7ea58efd715f0e56ba20ebf13789480d9d643afaf]]]"
],
"type_args": [],
"sub_traces": []
Expand Down
2 changes: 1 addition & 1 deletion api/src/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ impl TransactionsApi {
)
})?;
AptosVM::get_call_trace(
&state_view,
&state_view.as_executor_view(),
entry_func.module().clone(),
entry_func.function().to_owned(),
entry_func.ty_args().to_owned(),
Expand Down
8 changes: 4 additions & 4 deletions aptos-move/aptos-vm/src/aptos_vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1408,23 +1408,23 @@ impl AptosVM {
}

pub fn get_call_trace(
state_view: &impl StateView,
executor_view: &impl ExecutorView,
module_id: ModuleId,
func_name: Identifier,
type_args: Vec<TypeTag>,
arguments: Vec<Vec<u8>>,
gas_budget: u64,
) -> Result<CallTraces> {
let vm = AptosVM::new_from_state_view(state_view);
let log_context = AdapterLogSchema::new(state_view.id(), 0);
let vm = AptosVM::new_from_executor_view(executor_view);
let log_context = AdapterLogSchema::new(executor_view.id(), 0);
let mut gas_meter =
MemoryTrackedGasMeter::new(StandardGasMeter::new(StandardGasAlgebra::new(
vm.0.get_gas_feature_version(),
vm.0.get_gas_parameters(&log_context)?.vm.clone(),
vm.0.get_storage_gas_parameters(&log_context)?.clone(),
gas_budget,
)));
let resolver = vm.as_move_resolver(state_view);
let resolver = vm.as_move_resolver(executor_view);
let mut session = vm.new_session(&resolver, SessionId::Void);
let call_trace_res = session.call_trace(&module_id, &func_name, type_args, arguments, &mut gas_meter);
match call_trace_res {
Expand Down
Loading

0 comments on commit 1f60e4f

Please sign in to comment.