From a6f8f05fc182abb8e17af4048eac8e05f132d2d9 Mon Sep 17 00:00:00 2001 From: Tim Zakian <2895723+tzakian@users.noreply.github.com> Date: Wed, 11 Sep 2024 11:07:51 -0700 Subject: [PATCH] [move] Initial trace format and implementation (#18729) ## Description This PR adds the initial trace format, and the implementation of this trace format in the VM. I've gone through the tracing format with most of you synchronously so won't write out all the details here (but I will take it on to write a spec for the trace format once this is done so other folks can use it when consuming this format). Happy to go through it at any point in real time. Other TODO: right now the `MoveValue`s only support serialize and not deserialize back into Rust so we can only push a trace out from Rust but not consume it. The next thing I'm working on right now is adding support for that, and it may be either an update to this PR, or an additional PR depending on how involved that is... Tests and integration of this into the Move CLI (not the Sui CLI yet) is in the PR above this one. This keeps the tracing largely feature-gated in the VM, and the only additional overhead/change at runtime with `gas-profiling` turned off is the additional argument, but this argument is unused and should be optimized away (and at worst only add essentially no overhead). I kept the `gas-profiling` feature flag and gated the new tracing under it. The plan being to eventually rename that flag at the same time that we update test coverage and gas profiling to use this new tracing format as well (but that's for a couple future PRs!). ### PR Stack: 1. #18727 2. #18729 **<<<<< You are here** 3. #18730 ## Test plan PR above this one --- ## Release notes Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required. For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] Indexer: - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK: - [ ] REST API: --- Cargo.lock | 18 + external-crates/move/Cargo.lock | 21 + external-crates/move/Cargo.toml | 1 + .../src/file_format_common.rs | 16 +- .../move/crates/move-cli/Cargo.toml | 5 + .../move/crates/move-cli/src/base/test.rs | 6 + .../tracing-unit-tests/Move.toml | 9 + .../tracing-unit-tests/NO_TEMPDIR | 0 .../tracing_tests/tracing-unit-tests/args.exp | 28 + .../tracing_tests/tracing-unit-tests/args.txt | 2 + .../0x1__calls__test_call_order.json | 1 + .../0x1__calls__test_call_return_order.json | 1 + ...0x1__calls__test_complex_nested_calls.json | 1 + .../0x1__calls__test_return_order.json | 1 + .../new_traces/0x1__errors__aborter.json | 1 + .../new_traces/0x1__errors__bad_cast.json | 1 + .../new_traces/0x1__errors__div_0.json | 1 + .../0x1__errors__fail_during_abort.json | 1 + .../new_traces/0x1__errors__overshift_l.json | 1 + .../new_traces/0x1__errors__overshift_r.json | 1 + .../new_traces/0x1__errors__underflow.json | 1 + ...0x1__natives__get_orig_type_name_test.json | 1 + .../0x1__natives__get_type_name_test.json | 1 + .../0x1__packs__test_gen_pack_order.json | 1 + .../0x1__packs__test_gen_unpack_order.json | 1 + .../0x1__packs__test_pack_order.json | 1 + .../0x1__packs__test_unpack_order.json | 1 + ...ces__nested_struct_reference_mutation.json | 1 + ...ferences__pass_mut_assign_in_other_fn.json | 1 + .../0x1__references__test_struct_borrow.json | 1 + ...1__references__test_vector_mut_borrow.json | 1 + ...eferences__test_vector_mut_borrow_pop.json | 1 + .../0x1__calls__test_call_order.json | 1 + .../0x1__calls__test_call_return_order.json | 1 + ...0x1__calls__test_complex_nested_calls.json | 1 + .../0x1__calls__test_return_order.json | 1 + .../saved_traces/0x1__errors__aborter.json | 1 + .../saved_traces/0x1__errors__bad_cast.json | 1 + .../saved_traces/0x1__errors__div_0.json | 1 + .../0x1__errors__fail_during_abort.json | 1 + .../0x1__errors__overshift_l.json | 1 + .../0x1__errors__overshift_r.json | 1 + .../saved_traces/0x1__errors__underflow.json | 1 + ...0x1__natives__get_orig_type_name_test.json | 1 + .../0x1__natives__get_type_name_test.json | 1 + .../0x1__packs__test_gen_pack_order.json | 1 + .../0x1__packs__test_gen_unpack_order.json | 1 + .../0x1__packs__test_pack_order.json | 1 + .../0x1__packs__test_unpack_order.json | 1 + ...ces__nested_struct_reference_mutation.json | 1 + ...ferences__pass_mut_assign_in_other_fn.json | 1 + .../0x1__references__test_struct_borrow.json | 1 + ...1__references__test_vector_mut_borrow.json | 1 + ...eferences__test_vector_mut_borrow_pop.json | 1 + .../tracing-unit-tests/sources/calls.move | 75 + .../tracing-unit-tests/sources/errors.move | 44 + .../tracing-unit-tests/sources/natives.move | 17 + .../sources/references.move | 74 + .../tracing-unit-tests/sources/structs.move | 44 + .../move-cli/tests/tracing_testsuite.rs | 26 + .../move/crates/move-trace-format/Cargo.toml | 34 + .../crates/move-trace-format/src/format.rs | 388 ++++ .../crates/move-trace-format/src/interface.rs | 39 + .../move/crates/move-trace-format/src/lib.rs | 6 + .../move-trace-format/src/memory_tracer.rs | 196 ++ .../move/crates/move-unit-test/Cargo.toml | 1 + .../move/crates/move-unit-test/src/lib.rs | 12 + .../move-unit-test/src/test_reporter.rs | 32 +- .../crates/move-unit-test/src/test_runner.rs | 54 +- .../move/crates/move-vm-runtime/Cargo.toml | 1 + .../crates/move-vm-runtime/src/interpreter.rs | 140 +- .../move/crates/move-vm-runtime/src/lib.rs | 1 + .../move/crates/move-vm-runtime/src/loader.rs | 13 +- .../crates/move-vm-runtime/src/runtime.rs | 7 + .../crates/move-vm-runtime/src/session.rs | 42 + .../move-vm-runtime/src/tracing2/mod.rs | 1 + .../move-vm-runtime/src/tracing2/tracer.rs | 1799 +++++++++++++++++ .../move-vm-types/src/values/values_impl.rs | 138 ++ external-crates/tests.sh | 2 + 79 files changed, 3296 insertions(+), 40 deletions(-) create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/Move.toml create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/NO_TEMPDIR create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/args.exp create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/args.txt create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__calls__test_call_order.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__calls__test_call_return_order.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__calls__test_complex_nested_calls.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__calls__test_return_order.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__errors__aborter.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__errors__bad_cast.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__errors__div_0.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__errors__fail_during_abort.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__errors__overshift_l.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__errors__overshift_r.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__errors__underflow.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__natives__get_orig_type_name_test.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__natives__get_type_name_test.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__packs__test_gen_pack_order.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__packs__test_gen_unpack_order.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__packs__test_pack_order.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__packs__test_unpack_order.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__references__nested_struct_reference_mutation.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__references__pass_mut_assign_in_other_fn.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__references__test_struct_borrow.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__references__test_vector_mut_borrow.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__references__test_vector_mut_borrow_pop.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__calls__test_call_order.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__calls__test_call_return_order.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__calls__test_complex_nested_calls.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__calls__test_return_order.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__errors__aborter.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__errors__bad_cast.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__errors__div_0.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__errors__fail_during_abort.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__errors__overshift_l.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__errors__overshift_r.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__errors__underflow.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__natives__get_orig_type_name_test.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__natives__get_type_name_test.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__packs__test_gen_pack_order.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__packs__test_gen_unpack_order.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__packs__test_pack_order.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__packs__test_unpack_order.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__references__nested_struct_reference_mutation.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__references__pass_mut_assign_in_other_fn.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__references__test_struct_borrow.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__references__test_vector_mut_borrow.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__references__test_vector_mut_borrow_pop.json create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/sources/calls.move create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/sources/errors.move create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/sources/natives.move create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/sources/references.move create mode 100644 external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/sources/structs.move create mode 100644 external-crates/move/crates/move-cli/tests/tracing_testsuite.rs create mode 100644 external-crates/move/crates/move-trace-format/Cargo.toml create mode 100644 external-crates/move/crates/move-trace-format/src/format.rs create mode 100644 external-crates/move/crates/move-trace-format/src/interface.rs create mode 100644 external-crates/move/crates/move-trace-format/src/lib.rs create mode 100644 external-crates/move/crates/move-trace-format/src/memory_tracer.rs create mode 100644 external-crates/move/crates/move-vm-runtime/src/tracing2/mod.rs create mode 100644 external-crates/move/crates/move-vm-runtime/src/tracing2/tracer.rs diff --git a/Cargo.lock b/Cargo.lock index 85d22bac7e4f02..86ea246d567692 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7122,6 +7122,7 @@ dependencies = [ "move-ir-types", "move-symbol-pool", "serde", + "serde_json", ] [[package]] @@ -7627,6 +7628,21 @@ dependencies = [ "serde", ] +[[package]] +name = "move-trace-format" +version = "0.0.1" +dependencies = [ + "anyhow", + "enum-compat-util", + "move-binary-format", + "move-core-types", + "move-proc-macros", + "ref-cast", + "serde", + "serde_json", + "variant_count", +] + [[package]] name = "move-transactional-test-runner" version = "0.1.0" @@ -7678,6 +7694,7 @@ dependencies = [ "move-stdlib", "move-stdlib-natives", "move-symbol-pool", + "move-trace-format", "move-vm-profiler", "move-vm-runtime", "move-vm-test-utils", @@ -7716,6 +7733,7 @@ dependencies = [ "move-binary-format", "move-bytecode-verifier", "move-core-types", + "move-trace-format", "move-vm-config", "move-vm-profiler", "move-vm-types", diff --git a/external-crates/move/Cargo.lock b/external-crates/move/Cargo.lock index 3238470f66d495..4909aa369549c5 100644 --- a/external-crates/move/Cargo.lock +++ b/external-crates/move/Cargo.lock @@ -2163,6 +2163,25 @@ dependencies = [ "serde_json", ] +[[package]] +name = "move-trace-format" +version = "0.0.1" +dependencies = [ + "anyhow", + "arbitrary", + "enum-compat-util", + "getrandom 0.2.15", + "move-binary-format", + "move-core-types", + "move-proc-macros", + "proptest", + "proptest-derive", + "ref-cast", + "serde", + "serde_json", + "variant_count", +] + [[package]] name = "move-transactional-test-runner" version = "0.1.0" @@ -2218,6 +2237,7 @@ dependencies = [ "move-stdlib", "move-stdlib-natives", "move-symbol-pool", + "move-trace-format", "move-vm-profiler", "move-vm-runtime", "move-vm-test-utils", @@ -2282,6 +2302,7 @@ dependencies = [ "move-compiler", "move-core-types", "move-ir-compiler", + "move-trace-format", "move-vm-config", "move-vm-profiler", "move-vm-types", diff --git a/external-crates/move/Cargo.toml b/external-crates/move/Cargo.toml index e74dc56214b3e4..33925884a3a999 100644 --- a/external-crates/move/Cargo.toml +++ b/external-crates/move/Cargo.toml @@ -138,6 +138,7 @@ module-generation = { path = "crates/module-generation" } move-abstract-interpreter = { path = "crates/move-abstract-interpreter" } move-abstract-stack = { path = "crates/move-abstract-stack" } move-binary-format = { path = "crates/move-binary-format" } +move-trace-format = { path = "crates/move-trace-format" } move-borrow-graph = { path = "crates/move-borrow-graph" } move-bytecode-source-map = { path = "crates/move-bytecode-source-map" } move-bytecode-utils = { path = "crates/move-bytecode-utils" } diff --git a/external-crates/move/crates/move-binary-format/src/file_format_common.rs b/external-crates/move/crates/move-binary-format/src/file_format_common.rs index 7d006ef74f9f9d..94447450d5b9d8 100644 --- a/external-crates/move/crates/move-binary-format/src/file_format_common.rs +++ b/external-crates/move/crates/move-binary-format/src/file_format_common.rs @@ -529,11 +529,10 @@ pub const VERSION_MAX: u32 = VERSION_7; // TODO(#145): finish v4 compatibility; as of now, only metadata is implemented pub const VERSION_MIN: u32 = VERSION_5; -/// The encoding of the instruction is the serialized form of it, but disregarding the -/// serialization of the instruction's argument(s). -pub fn instruction_key(instruction: &Bytecode) -> u8 { +/// The corresponding opcode for each bytecode (disregards the argument). +pub fn instruction_opcode(instruction: &Bytecode) -> Opcodes { use Bytecode::*; - let opcode = match instruction { + match instruction { Pop => Opcodes::POP, Ret => Opcodes::RET, BrTrue(_) => Opcodes::BR_TRUE, @@ -621,6 +620,11 @@ pub fn instruction_key(instruction: &Bytecode) -> u8 { MutBorrowGlobalGenericDeprecated(_) => Opcodes::MUT_BORROW_GLOBAL_GENERIC_DEPRECATED, ImmBorrowGlobalDeprecated(_) => Opcodes::IMM_BORROW_GLOBAL_DEPRECATED, ImmBorrowGlobalGenericDeprecated(_) => Opcodes::IMM_BORROW_GLOBAL_GENERIC_DEPRECATED, - }; - opcode as u8 + } +} + +/// The encoding of the instruction is the serialized form of it, but disregarding the +/// serialization of the instruction's argument(s). +pub fn instruction_key(instruction: &Bytecode) -> u8 { + instruction_opcode(instruction) as u8 } diff --git a/external-crates/move/crates/move-cli/Cargo.toml b/external-crates/move/crates/move-cli/Cargo.toml index d718f3727217e9..128c9493155fa5 100644 --- a/external-crates/move/crates/move-cli/Cargo.toml +++ b/external-crates/move/crates/move-cli/Cargo.toml @@ -58,5 +58,10 @@ harness = false name = "build_testsuite" harness = false +[[test]] +name = "tracing_testsuite" +harness = false + [features] tiered-gas = ["move-vm-test-utils/tiered-gas"] +gas-profiler = ["move-vm-runtime/gas-profiler"] diff --git a/external-crates/move/crates/move-cli/src/base/test.rs b/external-crates/move/crates/move-cli/src/base/test.rs index 8f91b7b2e790ad..6bab47572df757 100644 --- a/external-crates/move/crates/move-cli/src/base/test.rs +++ b/external-crates/move/crates/move-cli/src/base/test.rs @@ -67,6 +67,10 @@ pub struct Test { /// The number of iterations to run each test that uses generated values (only used with #[random_test]). #[clap(name = "rand-num-iters", long = "rand-num-iters")] pub rand_num_iters: Option, + + // Enable tracing for tests + #[clap(long = "trace-execution", value_name = "PATH")] + pub trace_execution: Option>, } impl Test { @@ -107,6 +111,7 @@ impl Test { compute_coverage: _, seed, rand_num_iters, + trace_execution, } = self; UnitTestingConfig { gas_limit, @@ -117,6 +122,7 @@ impl Test { verbose: verbose_mode, seed, rand_num_iters, + trace_execution, ..UnitTestingConfig::default_with_bound(None) } } diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/Move.toml b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/Move.toml new file mode 100644 index 00000000000000..b0a3ed435137dd --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/Move.toml @@ -0,0 +1,9 @@ + [package] + name = "tracing_unit_tests" + edition = "2024.beta" # edition = "legacy" to use legacy (pre-2024) Move + + [dependencies] + MoveStdlib = { local = "../../../../move-stdlib" } + + [addresses] + std = "0x1" diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/NO_TEMPDIR b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/NO_TEMPDIR new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/args.exp b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/args.exp new file mode 100644 index 00000000000000..7f92068e1202aa --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/args.exp @@ -0,0 +1,28 @@ +Command `test -t 1 --trace-execution new_traces`: +INCLUDING DEPENDENCY MoveStdlib +BUILDING tracing_unit_tests +Running Move unit tests +[ PASS ] 0x1::calls::test_call_order +[ PASS ] 0x1::calls::test_call_return_order +[ PASS ] 0x1::calls::test_complex_nested_calls +[ PASS ] 0x1::calls::test_return_order +[ PASS ] 0x1::errors::aborter +[ PASS ] 0x1::errors::bad_cast +[ PASS ] 0x1::errors::div_0 +[ PASS ] 0x1::errors::fail_during_abort +[ PASS ] 0x1::errors::overshift_l +[ PASS ] 0x1::errors::overshift_r +[ PASS ] 0x1::errors::underflow +[ PASS ] 0x1::natives::get_orig_type_name_test +[ PASS ] 0x1::natives::get_type_name_test +[ PASS ] 0x1::packs::test_gen_pack_order +[ PASS ] 0x1::packs::test_gen_unpack_order +[ PASS ] 0x1::packs::test_pack_order +[ PASS ] 0x1::packs::test_unpack_order +[ PASS ] 0x1::references::nested_struct_reference_mutation +[ PASS ] 0x1::references::pass_mut_assign_in_other_fn +[ PASS ] 0x1::references::test_struct_borrow +[ PASS ] 0x1::references::test_vector_mut_borrow +[ PASS ] 0x1::references::test_vector_mut_borrow_pop +Test result: OK. Total tests: 22; passed: 22; failed: 0 +External Command `diff -qr new_traces saved_traces`: diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/args.txt b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/args.txt new file mode 100644 index 00000000000000..9a232bf403fd0d --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/args.txt @@ -0,0 +1,2 @@ +test -t 1 --trace-execution new_traces +> diff -qr new_traces saved_traces diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__calls__test_call_order.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__calls__test_call_order.json new file mode 100644 index 00000000000000..925a0e8a072b2d --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__calls__test_call_order.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":0,"frame_id":0,"function_name":"test_call_order","is_native":false,"locals_types":[],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"calls"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999999998,"instruction":"LD_U64","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999999996,"instruction":"LD_TRUE","pc":1,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999994,"instruction":"LD_U8","pc":2,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999999994,"instruction":"CALL","pc":3,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":1,"frame_id":8,"function_name":"f_test_call_order","is_native":false,"locals_types":[{"ref_type":null,"type_":"u64"},{"ref_type":null,"type_":"bool"},{"ref_type":null,"type_":"u8"}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"calls"},"parameters":[{"RuntimeValue":{"value":1}},{"RuntimeValue":{"value":true}},{"RuntimeValue":{"value":1}}],"return_types":[],"type_instantiation":[]},"gas_left":999999994}},{"Instruction":{"gas_left":999994823,"instruction":"RET","pc":0,"type_parameters":[]}},{"CloseFrame":{"frame_id":8,"gas_left":999994823,"return_":[]}},{"Instruction":{"gas_left":999994184,"instruction":"RET","pc":4,"type_parameters":[]}},{"CloseFrame":{"frame_id":0,"gas_left":999994184,"return_":[]}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__calls__test_call_return_order.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__calls__test_call_return_order.json new file mode 100644 index 00000000000000..7a997c124db28f --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__calls__test_call_return_order.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":4,"frame_id":0,"function_name":"test_call_return_order","is_native":false,"locals_types":[],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"calls"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":1000000000,"instruction":"CALL","pc":0,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":3,"frame_id":2,"function_name":"f_test_return_order","is_native":false,"locals_types":[],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"calls"},"parameters":[],"return_types":[{"ref_type":null,"type_":"u64"},{"ref_type":null,"type_":"bool"},{"ref_type":null,"type_":"u8"}],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999998865,"instruction":"LD_U64","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999998863,"instruction":"LD_TRUE","pc":1,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999998861,"instruction":"LD_U8","pc":2,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999998222,"instruction":"RET","pc":3,"type_parameters":[]}},{"CloseFrame":{"frame_id":2,"gas_left":999998222,"return_":[{"RuntimeValue":{"value":1}},{"RuntimeValue":{"value":true}},{"RuntimeValue":{"value":0}}]}},{"Instruction":{"gas_left":999998222,"instruction":"CALL","pc":1,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":1,"frame_id":12,"function_name":"f_test_call_order","is_native":false,"locals_types":[{"ref_type":null,"type_":"u64"},{"ref_type":null,"type_":"bool"},{"ref_type":null,"type_":"u8"}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"calls"},"parameters":[{"RuntimeValue":{"value":1}},{"RuntimeValue":{"value":true}},{"RuntimeValue":{"value":0}}],"return_types":[],"type_instantiation":[]},"gas_left":999998222}},{"Instruction":{"gas_left":999993051,"instruction":"RET","pc":0,"type_parameters":[]}},{"CloseFrame":{"frame_id":12,"gas_left":999993051,"return_":[]}},{"Instruction":{"gas_left":999992412,"instruction":"RET","pc":2,"type_parameters":[]}},{"CloseFrame":{"frame_id":0,"gas_left":999992412,"return_":[]}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__calls__test_complex_nested_calls.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__calls__test_complex_nested_calls.json new file mode 100644 index 00000000000000..bc9e09f22d0276 --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__calls__test_complex_nested_calls.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":5,"frame_id":0,"function_name":"test_complex_nested_calls","is_native":false,"locals_types":[],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"calls"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":1000000000,"instruction":"CALL","pc":0,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":6,"frame_id":2,"function_name":"f","is_native":false,"locals_types":[{"ref_type":null,"type_":"u64"}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"calls"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999998867,"instruction":"CALL","pc":0,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":7,"frame_id":4,"function_name":"k","is_native":false,"locals_types":[],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"calls"},"parameters":[],"return_types":[{"ref_type":null,"type_":"u64"}],"type_instantiation":[]},"gas_left":999998867}},{"Instruction":{"gas_left":999997732,"instruction":"LD_U64","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999997093,"instruction":"RET","pc":1,"type_parameters":[]}},{"CloseFrame":{"frame_id":4,"gas_left":999997093,"return_":[{"RuntimeValue":{"value":1}}]}},{"Instruction":{"gas_left":999997091,"instruction":"LD_U64","pc":1,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999997089,"instruction":"ADD","pc":2,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Push":{"RuntimeValue":{"value":2}}}},{"Instruction":{"gas_left":999997057,"instruction":"ST_LOC","pc":3,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":2}}}},{"Effect":{"Write":{"location":{"Local":[2,0]},"root_value_after_write":{"RuntimeValue":{"value":2}}}}},{"Instruction":{"gas_left":999997025,"instruction":"COPY_LOC","pc":4,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[2,0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":2}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":2}}}},{"Instruction":{"gas_left":999997023,"instruction":"LD_U64","pc":5,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999997021,"instruction":"GT","pc":6,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":2}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999997019,"instruction":"BR_FALSE","pc":7,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999996987,"instruction":"MOVE_LOC","pc":8,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[2,0]},"moved":true,"root_value_read":{"RuntimeValue":{"value":2}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":2}}}},{"Instruction":{"gas_left":999996987,"instruction":"CALL","pc":9,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":8,"frame_id":33,"function_name":"g","is_native":false,"locals_types":[{"ref_type":null,"type_":"u64"},{"ref_type":null,"type_":"u8"}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"calls"},"parameters":[{"RuntimeValue":{"value":2}}],"return_types":[],"type_instantiation":[]},"gas_left":999996987}},{"Instruction":{"gas_left":999994689,"instruction":"MOVE_LOC","pc":0,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[33,0]},"moved":true,"root_value_read":{"RuntimeValue":{"value":2}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":2}}}},{"Instruction":{"gas_left":999994686,"instruction":"CAST_U8","pc":1,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":2}}}},{"Effect":{"Push":{"RuntimeValue":{"value":2}}}},{"Instruction":{"gas_left":999994654,"instruction":"ST_LOC","pc":2,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":2}}}},{"Effect":{"Write":{"location":{"Local":[33,1]},"root_value_after_write":{"RuntimeValue":{"value":2}}}}},{"Instruction":{"gas_left":999994604,"instruction":"LD_CONST","pc":3,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":[1,2,3]}}}},{"Instruction":{"gas_left":999994602,"instruction":"POP","pc":4,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":[1,2,3]}}}},{"Instruction":{"gas_left":999994586,"instruction":"LD_CONST","pc":5,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999994584,"instruction":"LD_TRUE","pc":6,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999994482,"instruction":"PACK","pc":7,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Push":{"RuntimeValue":{"value":{"fields":{"x":1,"y":true},"type":"0x1::calls::X"}}}}},{"Instruction":{"gas_left":999994480,"instruction":"LD_TRUE","pc":8,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999994324,"instruction":"PACK_GENERIC","pc":9,"type_parameters":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"calls","name":"X","type_args":[]}},"bool"]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":{"fields":{"x":1,"y":true},"type":"0x1::calls::X"}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":{"fields":{"x":{"fields":{"x":1,"y":true},"type":"0x1::calls::X"},"y":true},"type":"0x1::calls::Y<0x1::calls::X, bool>"}}}}},{"Instruction":{"gas_left":999994324,"instruction":"CALL_GENERIC","pc":10,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":10,"frame_id":62,"function_name":"i","is_native":false,"locals_types":[{"ref_type":null,"type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"calls","name":"Y","type_args":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"calls","name":"X","type_args":[]}},"bool"]}}},{"ref_type":null,"type_":"u64"},{"ref_type":null,"type_":"u8"},{"ref_type":"Mut","type_":"u8"}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"calls"},"parameters":[{"RuntimeValue":{"value":{"fields":{"x":{"fields":{"x":1,"y":true},"type":"0x1::calls::X"},"y":true},"type":"0x1::calls::Y<0x1::calls::X, bool>"}}}],"return_types":[{"ref_type":null,"type_":"u8"}],"type_instantiation":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"calls","name":"X","type_args":[]}},"bool"]},"gas_left":999994324}},{"Instruction":{"gas_left":999991888,"instruction":"MOVE_LOC","pc":0,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[62,0]},"moved":true,"root_value_read":{"RuntimeValue":{"value":{"fields":{"x":{"fields":{"x":1,"y":true},"type":"0x1::calls::X"},"y":true},"type":"0x1::calls::Y<0x1::calls::X, bool>"}}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":{"fields":{"x":{"fields":{"x":1,"y":true},"type":"0x1::calls::X"},"y":true},"type":"0x1::calls::Y<0x1::calls::X, bool>"}}}}},{"Instruction":{"gas_left":999991732,"instruction":"UNPACK_GENERIC","pc":1,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":{"fields":{"x":{"fields":{"x":1,"y":true},"type":"0x1::calls::X"},"y":true},"type":"0x1::calls::Y<0x1::calls::X, bool>"}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":{"fields":{"x":1,"y":true},"type":"0x1::calls::X"}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999991730,"instruction":"POP","pc":2,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999991728,"instruction":"POP","pc":3,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":{"fields":{"x":1,"y":true},"type":"0x1::calls::X"}}}}},{"Instruction":{"gas_left":999991726,"instruction":"LD_U64","pc":4,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999991694,"instruction":"ST_LOC","pc":5,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Write":{"location":{"Local":[62,1]},"root_value_after_write":{"RuntimeValue":{"value":1}}}}},{"Instruction":{"gas_left":999991692,"instruction":"IMM_BORROW_LOC","pc":6,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[62,1]},"moved":false,"root_value_read":{"RuntimeValue":{"value":1}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Local":[62,1]},"snapshot":1}}}},{"Instruction":{"gas_left":999991660,"instruction":"READ_REF","pc":7,"type_parameters":[]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Local":[62,1]},"snapshot":1}}}},{"Effect":{"Read":{"location":{"Local":[62,1]},"moved":false,"root_value_read":{"RuntimeValue":{"value":1}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999991658,"instruction":"POP","pc":8,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999991656,"instruction":"LD_U8","pc":9,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999991624,"instruction":"ST_LOC","pc":10,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Write":{"location":{"Local":[62,2]},"root_value_after_write":{"RuntimeValue":{"value":1}}}}},{"Instruction":{"gas_left":999991621,"instruction":"MUT_BORROW_LOC","pc":11,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[62,2]},"moved":false,"root_value_read":{"RuntimeValue":{"value":1}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Local":[62,2]},"snapshot":1}}}},{"Instruction":{"gas_left":999991605,"instruction":"ST_LOC","pc":12,"type_parameters":[]}},{"Effect":{"Pop":{"MutRef":{"location":{"Local":[62,2]},"snapshot":1}}}},{"Effect":{"Write":{"location":{"Local":[62,3]},"root_value_after_write":{"MutRef":{"location":{"Local":[62,2]},"snapshot":1}}}}},{"Instruction":{"gas_left":999991603,"instruction":"LD_U8","pc":13,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":2}}}},{"Instruction":{"gas_left":999991587,"instruction":"COPY_LOC","pc":14,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[62,3]},"moved":false,"root_value_read":{"MutRef":{"location":{"Local":[62,2]},"snapshot":1}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Local":[62,2]},"snapshot":1}}}},{"Instruction":{"gas_left":999991555,"instruction":"WRITE_REF","pc":15,"type_parameters":[]}},{"Effect":{"Pop":{"MutRef":{"location":{"Local":[62,2]},"snapshot":1}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":2}}}},{"Effect":{"Write":{"location":{"Local":[62,2]},"root_value_after_write":{"RuntimeValue":{"value":2}}}}},{"Instruction":{"gas_left":999991539,"instruction":"MOVE_LOC","pc":16,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[62,3]},"moved":true,"root_value_read":{"MutRef":{"location":{"Local":[62,2]},"snapshot":2}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Local":[62,2]},"snapshot":2}}}},{"Instruction":{"gas_left":999991507,"instruction":"READ_REF","pc":17,"type_parameters":[]}},{"Effect":{"Pop":{"MutRef":{"location":{"Local":[62,2]},"snapshot":2}}}},{"Effect":{"Read":{"location":{"Local":[62,2]},"moved":false,"root_value_read":{"RuntimeValue":{"value":2}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":2}}}},{"Instruction":{"gas_left":999990868,"instruction":"RET","pc":18,"type_parameters":[]}},{"CloseFrame":{"frame_id":62,"gas_left":999990868,"return_":[{"RuntimeValue":{"value":2}}]}},{"Instruction":{"gas_left":999990868,"instruction":"CALL","pc":11,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":9,"frame_id":118,"function_name":"h","is_native":false,"locals_types":[{"ref_type":null,"type_":"u8"}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"calls"},"parameters":[{"RuntimeValue":{"value":2}}],"return_types":[],"type_instantiation":[]},"gas_left":999990868}},{"Instruction":{"gas_left":999987963,"instruction":"RET","pc":0,"type_parameters":[]}},{"CloseFrame":{"frame_id":118,"gas_left":999987963,"return_":[]}},{"Instruction":{"gas_left":999987931,"instruction":"MOVE_LOC","pc":12,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[33,1]},"moved":true,"root_value_read":{"RuntimeValue":{"value":2}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":2}}}},{"Instruction":{"gas_left":999987931,"instruction":"CALL","pc":13,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":9,"frame_id":125,"function_name":"h","is_native":false,"locals_types":[{"ref_type":null,"type_":"u8"}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"calls"},"parameters":[{"RuntimeValue":{"value":2}}],"return_types":[],"type_instantiation":[]},"gas_left":999987931}},{"Instruction":{"gas_left":999985026,"instruction":"RET","pc":0,"type_parameters":[]}},{"CloseFrame":{"frame_id":125,"gas_left":999985026,"return_":[]}},{"Instruction":{"gas_left":999984387,"instruction":"RET","pc":14,"type_parameters":[]}},{"CloseFrame":{"frame_id":33,"gas_left":999984387,"return_":[]}},{"Instruction":{"gas_left":999983748,"instruction":"RET","pc":10,"type_parameters":[]}},{"CloseFrame":{"frame_id":2,"gas_left":999983748,"return_":[]}},{"Instruction":{"gas_left":999983109,"instruction":"RET","pc":1,"type_parameters":[]}},{"CloseFrame":{"frame_id":0,"gas_left":999983109,"return_":[]}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__calls__test_return_order.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__calls__test_return_order.json new file mode 100644 index 00000000000000..da67d038efda7f --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__calls__test_return_order.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":2,"frame_id":0,"function_name":"test_return_order","is_native":false,"locals_types":[{"ref_type":null,"type_":"u64"},{"ref_type":null,"type_":"bool"},{"ref_type":null,"type_":"u8"}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"calls"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":1000000000,"instruction":"CALL","pc":0,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":3,"frame_id":2,"function_name":"f_test_return_order","is_native":false,"locals_types":[],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"calls"},"parameters":[],"return_types":[{"ref_type":null,"type_":"u64"},{"ref_type":null,"type_":"bool"},{"ref_type":null,"type_":"u8"}],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999998865,"instruction":"LD_U64","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999998863,"instruction":"LD_TRUE","pc":1,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999998861,"instruction":"LD_U8","pc":2,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999998222,"instruction":"RET","pc":3,"type_parameters":[]}},{"CloseFrame":{"frame_id":2,"gas_left":999998222,"return_":[{"RuntimeValue":{"value":1}},{"RuntimeValue":{"value":true}},{"RuntimeValue":{"value":0}}]}},{"Instruction":{"gas_left":999998190,"instruction":"ST_LOC","pc":1,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Write":{"location":{"Local":[0,2]},"root_value_after_write":{"RuntimeValue":{"value":0}}}}},{"Instruction":{"gas_left":999998158,"instruction":"ST_LOC","pc":2,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Effect":{"Write":{"location":{"Local":[0,1]},"root_value_after_write":{"RuntimeValue":{"value":true}}}}},{"Instruction":{"gas_left":999998126,"instruction":"ST_LOC","pc":3,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Write":{"location":{"Local":[0,0]},"root_value_after_write":{"RuntimeValue":{"value":1}}}}},{"Instruction":{"gas_left":999998094,"instruction":"MOVE_LOC","pc":4,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,2]},"moved":true,"root_value_read":{"RuntimeValue":{"value":0}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999998092,"instruction":"LD_U8","pc":5,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999998028,"instruction":"EQ","pc":6,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999998026,"instruction":"BR_FALSE","pc":7,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999998024,"instruction":"BRANCH","pc":8,"type_parameters":[]}},{"Instruction":{"gas_left":999997992,"instruction":"MOVE_LOC","pc":11,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,1]},"moved":true,"root_value_read":{"RuntimeValue":{"value":true}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999997990,"instruction":"BR_FALSE","pc":12,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999997988,"instruction":"BRANCH","pc":13,"type_parameters":[]}},{"Instruction":{"gas_left":999997349,"instruction":"RET","pc":16,"type_parameters":[]}},{"CloseFrame":{"frame_id":0,"gas_left":999997349,"return_":[]}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__errors__aborter.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__errors__aborter.json new file mode 100644 index 00000000000000..689f2c8ec07bf7 --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__errors__aborter.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":0,"frame_id":0,"function_name":"aborter","is_native":false,"locals_types":[],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"errors"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999999998,"instruction":"LD_U64","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":2}}}},{"Instruction":{"gas_left":999999996,"instruction":"ABORT","pc":1,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":2}}}},{"Effect":{"ExecutionError":"ABORTED"}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__errors__bad_cast.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__errors__bad_cast.json new file mode 100644 index 00000000000000..c68db2b6df2955 --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__errors__bad_cast.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":3,"frame_id":0,"function_name":"bad_cast","is_native":false,"locals_types":[],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"errors"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999999998,"instruction":"LD_U64","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":256}}}},{"Instruction":{"gas_left":999999995,"instruction":"CAST_U8","pc":1,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":256}}}},{"Effect":{"ExecutionError":"ARITHMETIC_ERROR"}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__errors__div_0.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__errors__div_0.json new file mode 100644 index 00000000000000..d901830856afa2 --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__errors__div_0.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":1,"frame_id":0,"function_name":"div_0","is_native":false,"locals_types":[],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"errors"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999999998,"instruction":"LD_U64","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999999996,"instruction":"LD_U64","pc":1,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999999992,"instruction":"DIV","pc":2,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"ExecutionError":"ARITHMETIC_ERROR"}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__errors__fail_during_abort.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__errors__fail_during_abort.json new file mode 100644 index 00000000000000..2b27b5e5b212dc --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__errors__fail_during_abort.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":6,"frame_id":0,"function_name":"fail_during_abort","is_native":false,"locals_types":[],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"errors"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999999998,"instruction":"LD_U64","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999999996,"instruction":"LD_U64","pc":1,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999999992,"instruction":"DIV","pc":2,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"ExecutionError":"ARITHMETIC_ERROR"}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__errors__overshift_l.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__errors__overshift_l.json new file mode 100644 index 00000000000000..61d23d2759dfc7 --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__errors__overshift_l.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":4,"frame_id":0,"function_name":"overshift_l","is_native":false,"locals_types":[],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"errors"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999999998,"instruction":"LD_U8","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999999996,"instruction":"LD_U8","pc":1,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":20}}}},{"Instruction":{"gas_left":999999993,"instruction":"SHL","pc":2,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":20}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"ExecutionError":"ARITHMETIC_ERROR"}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__errors__overshift_r.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__errors__overshift_r.json new file mode 100644 index 00000000000000..4222baf2612553 --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__errors__overshift_r.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":5,"frame_id":0,"function_name":"overshift_r","is_native":false,"locals_types":[],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"errors"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999999998,"instruction":"LD_U8","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999999996,"instruction":"LD_U8","pc":1,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":20}}}},{"Instruction":{"gas_left":999999993,"instruction":"SHL","pc":2,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":20}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"ExecutionError":"ARITHMETIC_ERROR"}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__errors__underflow.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__errors__underflow.json new file mode 100644 index 00000000000000..e0a985da8d255e --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__errors__underflow.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":2,"frame_id":0,"function_name":"underflow","is_native":false,"locals_types":[],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"errors"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999999998,"instruction":"LD_U64","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999999996,"instruction":"LD_U64","pc":1,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":10}}}},{"Instruction":{"gas_left":999999994,"instruction":"SUB","pc":2,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":10}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"ExecutionError":"ARITHMETIC_ERROR"}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__natives__get_orig_type_name_test.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__natives__get_orig_type_name_test.json new file mode 100644 index 00000000000000..dc92e46114e19c --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__natives__get_orig_type_name_test.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":1,"frame_id":0,"function_name":"get_orig_type_name_test","is_native":false,"locals_types":[{"ref_type":null,"type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"type_name","name":"TypeName","type_args":[]}}}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"natives"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":1000000000,"instruction":"CALL_GENERIC","pc":0,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":1,"frame_id":2,"function_name":"get_with_original_ids","is_native":true,"locals_types":[],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"type_name"},"parameters":[],"return_types":[{"ref_type":null,"type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"type_name","name":"TypeName","type_args":[]}}}],"type_instantiation":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"natives","name":"X","type_args":[]}}]},"gas_left":1000000000}},{"Effect":{"Push":{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"CloseFrame":{"frame_id":2,"gas_left":999998834,"return_":[{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}]}},{"Instruction":{"gas_left":999998674,"instruction":"ST_LOC","pc":1,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Effect":{"Write":{"location":{"Local":[0,0]},"root_value_after_write":{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}}},{"Instruction":{"gas_left":999998672,"instruction":"IMM_BORROW_LOC","pc":2,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Instruction":{"gas_left":999998672,"instruction":"CALL","pc":3,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":3,"frame_id":12,"function_name":"borrow_string","is_native":false,"locals_types":[{"ref_type":"Imm","type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"type_name","name":"TypeName","type_args":[]}}}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"type_name"},"parameters":[{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}],"return_types":[{"ref_type":"Imm","type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"ascii","name":"String","type_args":[]}}}],"type_instantiation":[]},"gas_left":999998672}},{"Instruction":{"gas_left":999996390,"instruction":"MOVE_LOC","pc":0,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[12,0]},"moved":true,"root_value_read":{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Instruction":{"gas_left":999996388,"instruction":"IMM_BORROW_FIELD","pc":1,"type_parameters":[]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Indexed":[{"Local":[0,0]},0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Instruction":{"gas_left":999995749,"instruction":"RET","pc":2,"type_parameters":[]}},{"CloseFrame":{"frame_id":12,"gas_left":999995749,"return_":[{"ImmRef":{"location":{"Indexed":[{"Local":[0,0]},0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}]}},{"Instruction":{"gas_left":999995747,"instruction":"POP","pc":4,"type_parameters":[]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Indexed":[{"Local":[0,0]},0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Instruction":{"gas_left":999995587,"instruction":"MOVE_LOC","pc":5,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":true,"root_value_read":{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Instruction":{"gas_left":999995587,"instruction":"CALL","pc":6,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":6,"frame_id":27,"function_name":"into_string","is_native":false,"locals_types":[{"ref_type":null,"type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"type_name","name":"TypeName","type_args":[]}}}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"type_name"},"parameters":[{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}],"return_types":[{"ref_type":null,"type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"ascii","name":"String","type_args":[]}}}],"type_instantiation":[]},"gas_left":999995587}},{"Instruction":{"gas_left":999993319,"instruction":"IMM_BORROW_LOC","pc":0,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[27,0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Local":[27,0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Instruction":{"gas_left":999993317,"instruction":"IMM_BORROW_FIELD","pc":1,"type_parameters":[]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Local":[27,0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Indexed":[{"Local":[27,0]},0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Instruction":{"gas_left":999993161,"instruction":"READ_REF","pc":2,"type_parameters":[]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Indexed":[{"Local":[27,0]},0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Effect":{"Read":{"location":{"Indexed":[{"Local":[27,0]},0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}}}}},{"Instruction":{"gas_left":999992522,"instruction":"RET","pc":3,"type_parameters":[]}},{"CloseFrame":{"frame_id":27,"gas_left":999992522,"return_":[{"RuntimeValue":{"value":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}}}]}},{"Instruction":{"gas_left":999992520,"instruction":"POP","pc":7,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}}}}},{"Instruction":{"gas_left":999991881,"instruction":"RET","pc":8,"type_parameters":[]}},{"CloseFrame":{"frame_id":0,"gas_left":999991881,"return_":[]}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__natives__get_type_name_test.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__natives__get_type_name_test.json new file mode 100644 index 00000000000000..2c8e76ffa4fe29 --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__natives__get_type_name_test.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":0,"frame_id":0,"function_name":"get_type_name_test","is_native":false,"locals_types":[{"ref_type":null,"type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"type_name","name":"TypeName","type_args":[]}}}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"natives"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":1000000000,"instruction":"CALL_GENERIC","pc":0,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":0,"frame_id":2,"function_name":"get","is_native":true,"locals_types":[],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"type_name"},"parameters":[],"return_types":[{"ref_type":null,"type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"type_name","name":"TypeName","type_args":[]}}}],"type_instantiation":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"natives","name":"X","type_args":[]}}]},"gas_left":1000000000}},{"Effect":{"Push":{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"CloseFrame":{"frame_id":2,"gas_left":999998834,"return_":[{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}]}},{"Instruction":{"gas_left":999998674,"instruction":"ST_LOC","pc":1,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Effect":{"Write":{"location":{"Local":[0,0]},"root_value_after_write":{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}}},{"Instruction":{"gas_left":999998672,"instruction":"IMM_BORROW_LOC","pc":2,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Instruction":{"gas_left":999998672,"instruction":"CALL","pc":3,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":3,"frame_id":12,"function_name":"borrow_string","is_native":false,"locals_types":[{"ref_type":"Imm","type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"type_name","name":"TypeName","type_args":[]}}}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"type_name"},"parameters":[{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}],"return_types":[{"ref_type":"Imm","type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"ascii","name":"String","type_args":[]}}}],"type_instantiation":[]},"gas_left":999998672}},{"Instruction":{"gas_left":999996390,"instruction":"MOVE_LOC","pc":0,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[12,0]},"moved":true,"root_value_read":{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Instruction":{"gas_left":999996388,"instruction":"IMM_BORROW_FIELD","pc":1,"type_parameters":[]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Indexed":[{"Local":[0,0]},0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Instruction":{"gas_left":999995749,"instruction":"RET","pc":2,"type_parameters":[]}},{"CloseFrame":{"frame_id":12,"gas_left":999995749,"return_":[{"ImmRef":{"location":{"Indexed":[{"Local":[0,0]},0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}]}},{"Instruction":{"gas_left":999995747,"instruction":"POP","pc":4,"type_parameters":[]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Indexed":[{"Local":[0,0]},0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Instruction":{"gas_left":999995587,"instruction":"MOVE_LOC","pc":5,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":true,"root_value_read":{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Instruction":{"gas_left":999995587,"instruction":"CALL","pc":6,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":6,"frame_id":27,"function_name":"into_string","is_native":false,"locals_types":[{"ref_type":null,"type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"type_name","name":"TypeName","type_args":[]}}}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"type_name"},"parameters":[{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}],"return_types":[{"ref_type":null,"type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"ascii","name":"String","type_args":[]}}}],"type_instantiation":[]},"gas_left":999995587}},{"Instruction":{"gas_left":999993319,"instruction":"IMM_BORROW_LOC","pc":0,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[27,0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Local":[27,0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Instruction":{"gas_left":999993317,"instruction":"IMM_BORROW_FIELD","pc":1,"type_parameters":[]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Local":[27,0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Indexed":[{"Local":[27,0]},0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Instruction":{"gas_left":999993161,"instruction":"READ_REF","pc":2,"type_parameters":[]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Indexed":[{"Local":[27,0]},0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Effect":{"Read":{"location":{"Indexed":[{"Local":[27,0]},0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}}}}},{"Instruction":{"gas_left":999992522,"instruction":"RET","pc":3,"type_parameters":[]}},{"CloseFrame":{"frame_id":27,"gas_left":999992522,"return_":[{"RuntimeValue":{"value":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}}}]}},{"Instruction":{"gas_left":999992520,"instruction":"POP","pc":7,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}}}}},{"Instruction":{"gas_left":999991881,"instruction":"RET","pc":8,"type_parameters":[]}},{"CloseFrame":{"frame_id":0,"gas_left":999991881,"return_":[]}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__packs__test_gen_pack_order.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__packs__test_gen_pack_order.json new file mode 100644 index 00000000000000..ace8cfe264562d --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__packs__test_gen_pack_order.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":2,"frame_id":0,"function_name":"test_gen_pack_order","is_native":false,"locals_types":[{"ref_type":null,"type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"packs","name":"GenX","type_args":["u64","bool","u8"]}}}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"packs"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999999998,"instruction":"LD_U64","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999999996,"instruction":"LD_TRUE","pc":1,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999994,"instruction":"LD_U8","pc":2,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999999841,"instruction":"PACK_GENERIC","pc":3,"type_parameters":["u64","bool","u8"]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Push":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::GenX"}}}}},{"Instruction":{"gas_left":999999741,"instruction":"ST_LOC","pc":4,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::GenX"}}}}},{"Effect":{"Write":{"location":{"Local":[0,0]},"root_value_after_write":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::GenX"}}}}}},{"Instruction":{"gas_left":999999739,"instruction":"IMM_BORROW_LOC","pc":5,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::GenX"}}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::GenX"}}}}},{"Instruction":{"gas_left":999999737,"instruction":"IMM_BORROW_FIELD_GENERIC","pc":6,"type_parameters":["u64","bool","u8"]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::GenX"}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Indexed":[{"Local":[0,0]},2]},"snapshot":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::GenX"}}}}},{"Instruction":{"gas_left":999999705,"instruction":"READ_REF","pc":7,"type_parameters":[]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Indexed":[{"Local":[0,0]},2]},"snapshot":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::GenX"}}}}},{"Effect":{"Read":{"location":{"Indexed":[{"Local":[0,0]},2]},"moved":false,"root_value_read":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::GenX"}}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999999703,"instruction":"LD_U8","pc":8,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999999639,"instruction":"EQ","pc":9,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999637,"instruction":"BR_FALSE","pc":10,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999635,"instruction":"BRANCH","pc":11,"type_parameters":[]}},{"Instruction":{"gas_left":999998996,"instruction":"RET","pc":16,"type_parameters":[]}},{"CloseFrame":{"frame_id":0,"gas_left":999998996,"return_":[]}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__packs__test_gen_unpack_order.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__packs__test_gen_unpack_order.json new file mode 100644 index 00000000000000..0d2facae5bfd9b --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__packs__test_gen_unpack_order.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":3,"frame_id":0,"function_name":"test_gen_unpack_order","is_native":false,"locals_types":[{"ref_type":null,"type_":"bool"},{"ref_type":null,"type_":"u64"},{"ref_type":null,"type_":"bool"},{"ref_type":null,"type_":"u8"}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"packs"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999999998,"instruction":"LD_U64","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999999996,"instruction":"LD_TRUE","pc":1,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999994,"instruction":"LD_U8","pc":2,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999999841,"instruction":"PACK_GENERIC","pc":3,"type_parameters":["u64","bool","u8"]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Push":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::GenX"}}}}},{"Instruction":{"gas_left":999999688,"instruction":"UNPACK_GENERIC","pc":4,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::GenX"}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999999656,"instruction":"ST_LOC","pc":5,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Write":{"location":{"Local":[0,3]},"root_value_after_write":{"RuntimeValue":{"value":0}}}}},{"Instruction":{"gas_left":999999624,"instruction":"ST_LOC","pc":6,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Effect":{"Write":{"location":{"Local":[0,2]},"root_value_after_write":{"RuntimeValue":{"value":true}}}}},{"Instruction":{"gas_left":999999592,"instruction":"ST_LOC","pc":7,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Write":{"location":{"Local":[0,1]},"root_value_after_write":{"RuntimeValue":{"value":1}}}}},{"Instruction":{"gas_left":999999560,"instruction":"MOVE_LOC","pc":8,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,3]},"moved":true,"root_value_read":{"RuntimeValue":{"value":0}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999999558,"instruction":"LD_U8","pc":9,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999999494,"instruction":"EQ","pc":10,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999492,"instruction":"BR_FALSE","pc":11,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999460,"instruction":"MOVE_LOC","pc":12,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,2]},"moved":true,"root_value_read":{"RuntimeValue":{"value":true}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999428,"instruction":"ST_LOC","pc":13,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Effect":{"Write":{"location":{"Local":[0,0]},"root_value_after_write":{"RuntimeValue":{"value":true}}}}},{"Instruction":{"gas_left":999999426,"instruction":"BRANCH","pc":14,"type_parameters":[]}},{"Instruction":{"gas_left":999999394,"instruction":"MOVE_LOC","pc":17,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":true,"root_value_read":{"RuntimeValue":{"value":true}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999392,"instruction":"BR_FALSE","pc":18,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999390,"instruction":"BRANCH","pc":19,"type_parameters":[]}},{"Instruction":{"gas_left":999998751,"instruction":"RET","pc":22,"type_parameters":[]}},{"CloseFrame":{"frame_id":0,"gas_left":999998751,"return_":[]}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__packs__test_pack_order.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__packs__test_pack_order.json new file mode 100644 index 00000000000000..5b176fc2625d86 --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__packs__test_pack_order.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":0,"frame_id":0,"function_name":"test_pack_order","is_native":false,"locals_types":[{"ref_type":null,"type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"packs","name":"X","type_args":[]}}}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"packs"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999999998,"instruction":"LD_U64","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999999996,"instruction":"LD_TRUE","pc":1,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999994,"instruction":"LD_U8","pc":2,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999999841,"instruction":"PACK","pc":3,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Push":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::X"}}}}},{"Instruction":{"gas_left":999999741,"instruction":"ST_LOC","pc":4,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::X"}}}}},{"Effect":{"Write":{"location":{"Local":[0,0]},"root_value_after_write":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::X"}}}}}},{"Instruction":{"gas_left":999999739,"instruction":"IMM_BORROW_LOC","pc":5,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::X"}}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::X"}}}}},{"Instruction":{"gas_left":999999737,"instruction":"IMM_BORROW_FIELD","pc":6,"type_parameters":[]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::X"}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Indexed":[{"Local":[0,0]},2]},"snapshot":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::X"}}}}},{"Instruction":{"gas_left":999999705,"instruction":"READ_REF","pc":7,"type_parameters":[]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Indexed":[{"Local":[0,0]},2]},"snapshot":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::X"}}}}},{"Effect":{"Read":{"location":{"Indexed":[{"Local":[0,0]},2]},"moved":false,"root_value_read":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::X"}}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999999703,"instruction":"LD_U8","pc":8,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999999639,"instruction":"EQ","pc":9,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999637,"instruction":"BR_FALSE","pc":10,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999635,"instruction":"BRANCH","pc":11,"type_parameters":[]}},{"Instruction":{"gas_left":999998996,"instruction":"RET","pc":16,"type_parameters":[]}},{"CloseFrame":{"frame_id":0,"gas_left":999998996,"return_":[]}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__packs__test_unpack_order.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__packs__test_unpack_order.json new file mode 100644 index 00000000000000..e1f6e8893c5399 --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__packs__test_unpack_order.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":1,"frame_id":0,"function_name":"test_unpack_order","is_native":false,"locals_types":[{"ref_type":null,"type_":"bool"},{"ref_type":null,"type_":"u64"},{"ref_type":null,"type_":"bool"},{"ref_type":null,"type_":"u8"}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"packs"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999999998,"instruction":"LD_U64","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999999996,"instruction":"LD_TRUE","pc":1,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999994,"instruction":"LD_U8","pc":2,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999999841,"instruction":"PACK","pc":3,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Push":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::X"}}}}},{"Instruction":{"gas_left":999999688,"instruction":"UNPACK","pc":4,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::X"}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999999656,"instruction":"ST_LOC","pc":5,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Write":{"location":{"Local":[0,3]},"root_value_after_write":{"RuntimeValue":{"value":0}}}}},{"Instruction":{"gas_left":999999624,"instruction":"ST_LOC","pc":6,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Effect":{"Write":{"location":{"Local":[0,2]},"root_value_after_write":{"RuntimeValue":{"value":true}}}}},{"Instruction":{"gas_left":999999592,"instruction":"ST_LOC","pc":7,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Write":{"location":{"Local":[0,1]},"root_value_after_write":{"RuntimeValue":{"value":1}}}}},{"Instruction":{"gas_left":999999560,"instruction":"MOVE_LOC","pc":8,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,3]},"moved":true,"root_value_read":{"RuntimeValue":{"value":0}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999999558,"instruction":"LD_U8","pc":9,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999999494,"instruction":"EQ","pc":10,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999492,"instruction":"BR_FALSE","pc":11,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999460,"instruction":"MOVE_LOC","pc":12,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,2]},"moved":true,"root_value_read":{"RuntimeValue":{"value":true}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999428,"instruction":"ST_LOC","pc":13,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Effect":{"Write":{"location":{"Local":[0,0]},"root_value_after_write":{"RuntimeValue":{"value":true}}}}},{"Instruction":{"gas_left":999999426,"instruction":"BRANCH","pc":14,"type_parameters":[]}},{"Instruction":{"gas_left":999999394,"instruction":"MOVE_LOC","pc":17,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":true,"root_value_read":{"RuntimeValue":{"value":true}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999392,"instruction":"BR_FALSE","pc":18,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999390,"instruction":"BRANCH","pc":19,"type_parameters":[]}},{"Instruction":{"gas_left":999998751,"instruction":"RET","pc":22,"type_parameters":[]}},{"CloseFrame":{"frame_id":0,"gas_left":999998751,"return_":[]}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__references__nested_struct_reference_mutation.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__references__nested_struct_reference_mutation.json new file mode 100644 index 00000000000000..ae31124c175af1 --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__references__nested_struct_reference_mutation.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":5,"frame_id":0,"function_name":"nested_struct_reference_mutation","is_native":false,"locals_types":[{"ref_type":null,"type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"Y","type_args":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"Y","type_args":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"Y","type_args":["u64"]}}]}}]}}}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"references"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999999998,"instruction":"LD_U64","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999999996,"instruction":"LD_U64","pc":1,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":2}}}},{"Instruction":{"gas_left":999999994,"instruction":"LD_U64","pc":2,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":3}}}},{"Instruction":{"gas_left":999999992,"instruction":"LD_U64","pc":3,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":4}}}},{"Instruction":{"gas_left":999999890,"instruction":"PACK_GENERIC","pc":4,"type_parameters":["u64"]}},{"Effect":{"Pop":{"RuntimeValue":{"value":4}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":3}}}},{"Effect":{"Push":{"RuntimeValue":{"value":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}}}}},{"Instruction":{"gas_left":999999734,"instruction":"PACK_GENERIC","pc":5,"type_parameters":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"Y","type_args":["u64"]}}]}},{"Effect":{"Pop":{"RuntimeValue":{"value":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":2}}}},{"Effect":{"Push":{"RuntimeValue":{"value":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}}}}},{"Instruction":{"gas_left":999999524,"instruction":"PACK_GENERIC","pc":6,"type_parameters":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"Y","type_args":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"Y","type_args":["u64"]}}]}}]}},{"Effect":{"Pop":{"RuntimeValue":{"value":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Push":{"RuntimeValue":{"value":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Instruction":{"gas_left":999999384,"instruction":"ST_LOC","pc":7,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Effect":{"Write":{"location":{"Local":[0,0]},"root_value_after_write":{"RuntimeValue":{"value":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}}},{"Instruction":{"gas_left":999999382,"instruction":"IMM_BORROW_LOC","pc":8,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Instruction":{"gas_left":999999380,"instruction":"IMM_BORROW_FIELD_GENERIC","pc":9,"type_parameters":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"Y","type_args":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"Y","type_args":["u64"]}}]}}]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Indexed":[{"Local":[0,0]},1]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Instruction":{"gas_left":999999378,"instruction":"IMM_BORROW_FIELD_GENERIC","pc":10,"type_parameters":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"Y","type_args":["u64"]}}]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Indexed":[{"Local":[0,0]},1]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Instruction":{"gas_left":999999376,"instruction":"IMM_BORROW_FIELD_GENERIC","pc":11,"type_parameters":["u64"]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Indexed":[{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},0]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Instruction":{"gas_left":999999344,"instruction":"READ_REF","pc":12,"type_parameters":[]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Indexed":[{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},0]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Effect":{"Read":{"location":{"Indexed":[{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":3}}}},{"Instruction":{"gas_left":999999342,"instruction":"LD_U64","pc":13,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":3}}}},{"Instruction":{"gas_left":999999278,"instruction":"EQ","pc":14,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":3}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":3}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999276,"instruction":"BR_FALSE","pc":15,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999274,"instruction":"BRANCH","pc":16,"type_parameters":[]}},{"Instruction":{"gas_left":999999271,"instruction":"MUT_BORROW_LOC","pc":23,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Instruction":{"gas_left":999999269,"instruction":"MUT_BORROW_FIELD_GENERIC","pc":24,"type_parameters":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"Y","type_args":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"Y","type_args":["u64"]}}]}}]}},{"Effect":{"Pop":{"MutRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Indexed":[{"Local":[0,0]},1]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Instruction":{"gas_left":999999269,"instruction":"CALL","pc":25,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":6,"frame_id":56,"function_name":"l0","is_native":false,"locals_types":[{"ref_type":"Mut","type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"Y","type_args":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"Y","type_args":["u64"]}}]}}}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"references"},"parameters":[{"MutRef":{"location":{"Indexed":[{"Local":[0,0]},1]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}],"return_types":[],"type_instantiation":[]},"gas_left":999999269}},{"Instruction":{"gas_left":999996987,"instruction":"MOVE_LOC","pc":0,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[56,0]},"moved":true,"root_value_read":{"MutRef":{"location":{"Indexed":[{"Local":[0,0]},1]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Indexed":[{"Local":[0,0]},1]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Instruction":{"gas_left":999996985,"instruction":"MUT_BORROW_FIELD_GENERIC","pc":1,"type_parameters":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"Y","type_args":["u64"]}}]}},{"Effect":{"Pop":{"MutRef":{"location":{"Indexed":[{"Local":[0,0]},1]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Instruction":{"gas_left":999996985,"instruction":"CALL","pc":2,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":7,"frame_id":64,"function_name":"l1","is_native":false,"locals_types":[{"ref_type":"Mut","type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"Y","type_args":["u64"]}}}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"references"},"parameters":[{"MutRef":{"location":{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}],"return_types":[],"type_instantiation":[]},"gas_left":999996985}},{"Instruction":{"gas_left":999994703,"instruction":"MOVE_LOC","pc":0,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[64,0]},"moved":true,"root_value_read":{"MutRef":{"location":{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Instruction":{"gas_left":999994701,"instruction":"MUT_BORROW_FIELD_GENERIC","pc":1,"type_parameters":["u64"]}},{"Effect":{"Pop":{"MutRef":{"location":{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Indexed":[{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},0]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Instruction":{"gas_left":999994701,"instruction":"CALL","pc":2,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":8,"frame_id":72,"function_name":"incr","is_native":false,"locals_types":[{"ref_type":"Mut","type_":"u64"}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"references"},"parameters":[{"MutRef":{"location":{"Indexed":[{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},0]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}],"return_types":[],"type_instantiation":[]},"gas_left":999994701}},{"Instruction":{"gas_left":999992419,"instruction":"COPY_LOC","pc":0,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[72,0]},"moved":false,"root_value_read":{"MutRef":{"location":{"Indexed":[{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},0]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Indexed":[{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},0]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Instruction":{"gas_left":999992387,"instruction":"READ_REF","pc":1,"type_parameters":[]}},{"Effect":{"Pop":{"MutRef":{"location":{"Indexed":[{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},0]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Effect":{"Read":{"location":{"Indexed":[{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":3}}}},{"Instruction":{"gas_left":999992385,"instruction":"LD_U64","pc":2,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999992383,"instruction":"ADD","pc":3,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":3}}}},{"Effect":{"Push":{"RuntimeValue":{"value":4}}}},{"Instruction":{"gas_left":999992367,"instruction":"MOVE_LOC","pc":4,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[72,0]},"moved":true,"root_value_read":{"MutRef":{"location":{"Indexed":[{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},0]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Indexed":[{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},0]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Instruction":{"gas_left":999992335,"instruction":"WRITE_REF","pc":5,"type_parameters":[]}},{"Effect":{"Pop":{"MutRef":{"location":{"Indexed":[{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},0]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":4}}}},{"Effect":{"Write":{"location":{"Indexed":[{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},0]},"root_value_after_write":{"RuntimeValue":{"value":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":4,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}}},{"Instruction":{"gas_left":999991696,"instruction":"RET","pc":6,"type_parameters":[]}},{"CloseFrame":{"frame_id":72,"gas_left":999991696,"return_":[]}},{"Instruction":{"gas_left":999991057,"instruction":"RET","pc":3,"type_parameters":[]}},{"CloseFrame":{"frame_id":64,"gas_left":999991057,"return_":[]}},{"Instruction":{"gas_left":999990418,"instruction":"RET","pc":3,"type_parameters":[]}},{"CloseFrame":{"frame_id":56,"gas_left":999990418,"return_":[]}},{"Instruction":{"gas_left":999990416,"instruction":"IMM_BORROW_LOC","pc":26,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":4,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":4,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Instruction":{"gas_left":999990414,"instruction":"IMM_BORROW_FIELD_GENERIC","pc":27,"type_parameters":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"Y","type_args":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"Y","type_args":["u64"]}}]}}]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":4,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Indexed":[{"Local":[0,0]},1]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":4,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Instruction":{"gas_left":999990412,"instruction":"IMM_BORROW_FIELD_GENERIC","pc":28,"type_parameters":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"Y","type_args":["u64"]}}]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Indexed":[{"Local":[0,0]},1]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":4,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":4,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Instruction":{"gas_left":999990410,"instruction":"IMM_BORROW_FIELD_GENERIC","pc":29,"type_parameters":["u64"]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":4,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Indexed":[{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},0]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":4,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Instruction":{"gas_left":999990378,"instruction":"READ_REF","pc":30,"type_parameters":[]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Indexed":[{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},0]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":4,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Effect":{"Read":{"location":{"Indexed":[{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":4,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":4}}}},{"Instruction":{"gas_left":999990376,"instruction":"LD_U64","pc":31,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":4}}}},{"Instruction":{"gas_left":999990312,"instruction":"EQ","pc":32,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":4}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":4}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999990310,"instruction":"BR_FALSE","pc":33,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999990308,"instruction":"BRANCH","pc":34,"type_parameters":[]}},{"Instruction":{"gas_left":999989669,"instruction":"RET","pc":41,"type_parameters":[]}},{"CloseFrame":{"frame_id":0,"gas_left":999989669,"return_":[]}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__references__pass_mut_assign_in_other_fn.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__references__pass_mut_assign_in_other_fn.json new file mode 100644 index 00000000000000..765d28809cbb8a --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__references__pass_mut_assign_in_other_fn.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":0,"frame_id":0,"function_name":"pass_mut_assign_in_other_fn","is_native":false,"locals_types":[{"ref_type":null,"type_":"u64"}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"references"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999999998,"instruction":"LD_U64","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999999966,"instruction":"ST_LOC","pc":1,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Write":{"location":{"Local":[0,0]},"root_value_after_write":{"RuntimeValue":{"value":0}}}}},{"Instruction":{"gas_left":999999963,"instruction":"MUT_BORROW_LOC","pc":2,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":0}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Local":[0,0]},"snapshot":0}}}},{"Instruction":{"gas_left":999999961,"instruction":"LD_U64","pc":3,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999999959,"instruction":"LD_U64","pc":4,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":2}}}},{"Instruction":{"gas_left":999999959,"instruction":"CALL","pc":5,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":1,"frame_id":14,"function_name":"assign_add","is_native":false,"locals_types":[{"ref_type":"Mut","type_":"u64"},{"ref_type":null,"type_":"u64"},{"ref_type":null,"type_":"u64"}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"references"},"parameters":[{"MutRef":{"location":{"Local":[0,0]},"snapshot":0}},{"RuntimeValue":{"value":1}},{"RuntimeValue":{"value":2}}],"return_types":[],"type_instantiation":[]},"gas_left":999999959}},{"Instruction":{"gas_left":999995395,"instruction":"MOVE_LOC","pc":0,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[14,1]},"moved":true,"root_value_read":{"RuntimeValue":{"value":1}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999995363,"instruction":"MOVE_LOC","pc":1,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[14,2]},"moved":true,"root_value_read":{"RuntimeValue":{"value":2}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":2}}}},{"Instruction":{"gas_left":999995361,"instruction":"ADD","pc":2,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":2}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Push":{"RuntimeValue":{"value":3}}}},{"Instruction":{"gas_left":999995345,"instruction":"MOVE_LOC","pc":3,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[14,0]},"moved":true,"root_value_read":{"MutRef":{"location":{"Local":[0,0]},"snapshot":0}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Local":[0,0]},"snapshot":0}}}},{"Instruction":{"gas_left":999995313,"instruction":"WRITE_REF","pc":4,"type_parameters":[]}},{"Effect":{"Pop":{"MutRef":{"location":{"Local":[0,0]},"snapshot":0}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":3}}}},{"Effect":{"Write":{"location":{"Local":[0,0]},"root_value_after_write":{"RuntimeValue":{"value":3}}}}},{"Instruction":{"gas_left":999994674,"instruction":"RET","pc":5,"type_parameters":[]}},{"CloseFrame":{"frame_id":14,"gas_left":999994674,"return_":[]}},{"Instruction":{"gas_left":999994642,"instruction":"MOVE_LOC","pc":6,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":true,"root_value_read":{"RuntimeValue":{"value":3}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":3}}}},{"Instruction":{"gas_left":999994640,"instruction":"LD_U64","pc":7,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":3}}}},{"Instruction":{"gas_left":999994576,"instruction":"EQ","pc":8,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":3}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":3}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999994574,"instruction":"BR_FALSE","pc":9,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999994572,"instruction":"BRANCH","pc":10,"type_parameters":[]}},{"Instruction":{"gas_left":999993933,"instruction":"RET","pc":13,"type_parameters":[]}},{"CloseFrame":{"frame_id":0,"gas_left":999993933,"return_":[]}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__references__test_struct_borrow.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__references__test_struct_borrow.json new file mode 100644 index 00000000000000..6076e89f6399ab --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__references__test_struct_borrow.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":2,"frame_id":0,"function_name":"test_struct_borrow","is_native":false,"locals_types":[{"ref_type":null,"type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"X","type_args":[]}}}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"references"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999999998,"instruction":"LD_U64","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999999996,"instruction":"LD_FALSE","pc":1,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":false}}}},{"Instruction":{"gas_left":999999894,"instruction":"PACK","pc":2,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":false}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Push":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":false},"type":"0x1::references::X"}}}}},{"Instruction":{"gas_left":999999826,"instruction":"ST_LOC","pc":3,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":false},"type":"0x1::references::X"}}}}},{"Effect":{"Write":{"location":{"Local":[0,0]},"root_value_after_write":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":false},"type":"0x1::references::X"}}}}}},{"Instruction":{"gas_left":999999824,"instruction":"IMM_BORROW_LOC","pc":4,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":false},"type":"0x1::references::X"}}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"pos0":1,"pos1":false},"type":"0x1::references::X"}}}}},{"Instruction":{"gas_left":999999822,"instruction":"IMM_BORROW_FIELD","pc":5,"type_parameters":[]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"pos0":1,"pos1":false},"type":"0x1::references::X"}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Indexed":[{"Local":[0,0]},0]},"snapshot":{"fields":{"pos0":1,"pos1":false},"type":"0x1::references::X"}}}}},{"Instruction":{"gas_left":999999790,"instruction":"READ_REF","pc":6,"type_parameters":[]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Indexed":[{"Local":[0,0]},0]},"snapshot":{"fields":{"pos0":1,"pos1":false},"type":"0x1::references::X"}}}}},{"Effect":{"Read":{"location":{"Indexed":[{"Local":[0,0]},0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":false},"type":"0x1::references::X"}}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999999788,"instruction":"LD_U64","pc":7,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999999724,"instruction":"EQ","pc":8,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999722,"instruction":"BR_FALSE","pc":9,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999720,"instruction":"BRANCH","pc":10,"type_parameters":[]}},{"Instruction":{"gas_left":999999081,"instruction":"RET","pc":13,"type_parameters":[]}},{"CloseFrame":{"frame_id":0,"gas_left":999999081,"return_":[]}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__references__test_vector_mut_borrow.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__references__test_vector_mut_borrow.json new file mode 100644 index 00000000000000..10cba16aeb1d34 --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__references__test_vector_mut_borrow.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":3,"frame_id":0,"function_name":"test_vector_mut_borrow","is_native":false,"locals_types":[{"ref_type":null,"type_":"u64"},{"ref_type":"Mut","type_":"u64"},{"ref_type":null,"type_":{"vector":"u64"}}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"references"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999999998,"instruction":"LD_U64","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999999966,"instruction":"ST_LOC","pc":1,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Write":{"location":{"Local":[0,0]},"root_value_after_write":{"RuntimeValue":{"value":1}}}}},{"Instruction":{"gas_left":999999963,"instruction":"MUT_BORROW_LOC","pc":2,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":1}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Local":[0,0]},"snapshot":1}}}},{"Instruction":{"gas_left":999999947,"instruction":"ST_LOC","pc":3,"type_parameters":[]}},{"Effect":{"Pop":{"MutRef":{"location":{"Local":[0,0]},"snapshot":1}}}},{"Effect":{"Write":{"location":{"Local":[0,1]},"root_value_after_write":{"MutRef":{"location":{"Local":[0,0]},"snapshot":1}}}}},{"Instruction":{"gas_left":999999945,"instruction":"LD_U64","pc":4,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":2}}}},{"Instruction":{"gas_left":999999929,"instruction":"COPY_LOC","pc":5,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,1]},"moved":false,"root_value_read":{"MutRef":{"location":{"Local":[0,0]},"snapshot":1}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Local":[0,0]},"snapshot":1}}}},{"Instruction":{"gas_left":999999897,"instruction":"WRITE_REF","pc":6,"type_parameters":[]}},{"Effect":{"Pop":{"MutRef":{"location":{"Local":[0,0]},"snapshot":1}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":2}}}},{"Effect":{"Write":{"location":{"Local":[0,0]},"root_value_after_write":{"RuntimeValue":{"value":2}}}}},{"Instruction":{"gas_left":999999895,"instruction":"LD_U64","pc":7,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":3}}}},{"Instruction":{"gas_left":999999879,"instruction":"COPY_LOC","pc":8,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,1]},"moved":false,"root_value_read":{"MutRef":{"location":{"Local":[0,0]},"snapshot":2}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Local":[0,0]},"snapshot":2}}}},{"Instruction":{"gas_left":999999847,"instruction":"WRITE_REF","pc":9,"type_parameters":[]}},{"Effect":{"Pop":{"MutRef":{"location":{"Local":[0,0]},"snapshot":2}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":3}}}},{"Effect":{"Write":{"location":{"Local":[0,0]},"root_value_after_write":{"RuntimeValue":{"value":3}}}}},{"Instruction":{"gas_left":999999831,"instruction":"COPY_LOC","pc":10,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,1]},"moved":false,"root_value_read":{"MutRef":{"location":{"Local":[0,0]},"snapshot":3}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Local":[0,0]},"snapshot":3}}}},{"Instruction":{"gas_left":999999799,"instruction":"READ_REF","pc":11,"type_parameters":[]}},{"Effect":{"Pop":{"MutRef":{"location":{"Local":[0,0]},"snapshot":3}}}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":3}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":3}}}},{"Instruction":{"gas_left":999999714,"instruction":"VEC_PACK","pc":12,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":3}}}},{"Effect":{"Push":{"RuntimeValue":{"value":[3]}}}},{"Instruction":{"gas_left":999999698,"instruction":"ST_LOC","pc":13,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":[3]}}}},{"Effect":{"Write":{"location":{"Local":[0,2]},"root_value_after_write":{"RuntimeValue":{"value":[3]}}}}},{"Instruction":{"gas_left":999999696,"instruction":"LD_U64","pc":14,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":4}}}},{"Instruction":{"gas_left":999999693,"instruction":"MUT_BORROW_LOC","pc":15,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,2]},"moved":false,"root_value_read":{"RuntimeValue":{"value":[3]}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Local":[0,2]},"snapshot":[3]}}}},{"Instruction":{"gas_left":999999691,"instruction":"LD_U64","pc":16,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999997788,"instruction":"VEC_MUT_BORROW","pc":17,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Pop":{"MutRef":{"location":{"Local":[0,2]},"snapshot":[3]}}}},{"Effect":{"Push":{"MutRef":{"location":{"Indexed":[{"Local":[0,2]},0]},"snapshot":[3]}}}},{"Instruction":{"gas_left":999997756,"instruction":"WRITE_REF","pc":18,"type_parameters":[]}},{"Effect":{"Pop":{"MutRef":{"location":{"Indexed":[{"Local":[0,2]},0]},"snapshot":[3]}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":4}}}},{"Effect":{"Write":{"location":{"Indexed":[{"Local":[0,2]},0]},"root_value_after_write":{"RuntimeValue":{"value":[4]}}}}},{"Instruction":{"gas_left":999997754,"instruction":"IMM_BORROW_LOC","pc":19,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,2]},"moved":false,"root_value_read":{"RuntimeValue":{"value":[4]}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Local":[0,2]},"snapshot":[4]}}}},{"Instruction":{"gas_left":999997752,"instruction":"LD_U64","pc":20,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999996417,"instruction":"VEC_IMM_BORROW","pc":21,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Pop":{"ImmRef":{"location":{"Local":[0,2]},"snapshot":[4]}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Indexed":[{"Local":[0,2]},0]},"snapshot":[4]}}}},{"Instruction":{"gas_left":999996385,"instruction":"READ_REF","pc":22,"type_parameters":[]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Indexed":[{"Local":[0,2]},0]},"snapshot":[4]}}}},{"Effect":{"Read":{"location":{"Indexed":[{"Local":[0,2]},0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":[4]}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":4}}}},{"Instruction":{"gas_left":999996383,"instruction":"LD_U64","pc":23,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":4}}}},{"Instruction":{"gas_left":999996319,"instruction":"EQ","pc":24,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":4}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":4}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999996317,"instruction":"BR_FALSE","pc":25,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999996315,"instruction":"BRANCH","pc":26,"type_parameters":[]}},{"Instruction":{"gas_left":999996299,"instruction":"MOVE_LOC","pc":31,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,1]},"moved":true,"root_value_read":{"MutRef":{"location":{"Local":[0,0]},"snapshot":3}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Local":[0,0]},"snapshot":3}}}},{"Instruction":{"gas_left":999996267,"instruction":"READ_REF","pc":32,"type_parameters":[]}},{"Effect":{"Pop":{"MutRef":{"location":{"Local":[0,0]},"snapshot":3}}}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":3}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":3}}}},{"Instruction":{"gas_left":999996265,"instruction":"LD_U64","pc":33,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":3}}}},{"Instruction":{"gas_left":999996201,"instruction":"EQ","pc":34,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":3}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":3}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999996199,"instruction":"BR_FALSE","pc":35,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999996197,"instruction":"BRANCH","pc":36,"type_parameters":[]}},{"Instruction":{"gas_left":999995558,"instruction":"RET","pc":39,"type_parameters":[]}},{"CloseFrame":{"frame_id":0,"gas_left":999995558,"return_":[]}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__references__test_vector_mut_borrow_pop.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__references__test_vector_mut_borrow_pop.json new file mode 100644 index 00000000000000..40468e125fc3d8 --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/new_traces/0x1__references__test_vector_mut_borrow_pop.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":4,"frame_id":0,"function_name":"test_vector_mut_borrow_pop","is_native":false,"locals_types":[{"ref_type":null,"type_":"u64"},{"ref_type":"Mut","type_":"u64"},{"ref_type":null,"type_":{"vector":"u64"}}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"references"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999999998,"instruction":"LD_U64","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999999966,"instruction":"ST_LOC","pc":1,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Write":{"location":{"Local":[0,0]},"root_value_after_write":{"RuntimeValue":{"value":1}}}}},{"Instruction":{"gas_left":999999963,"instruction":"MUT_BORROW_LOC","pc":2,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":1}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Local":[0,0]},"snapshot":1}}}},{"Instruction":{"gas_left":999999947,"instruction":"ST_LOC","pc":3,"type_parameters":[]}},{"Effect":{"Pop":{"MutRef":{"location":{"Local":[0,0]},"snapshot":1}}}},{"Effect":{"Write":{"location":{"Local":[0,1]},"root_value_after_write":{"MutRef":{"location":{"Local":[0,0]},"snapshot":1}}}}},{"Instruction":{"gas_left":999999945,"instruction":"LD_U64","pc":4,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":2}}}},{"Instruction":{"gas_left":999999929,"instruction":"COPY_LOC","pc":5,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,1]},"moved":false,"root_value_read":{"MutRef":{"location":{"Local":[0,0]},"snapshot":1}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Local":[0,0]},"snapshot":1}}}},{"Instruction":{"gas_left":999999897,"instruction":"WRITE_REF","pc":6,"type_parameters":[]}},{"Effect":{"Pop":{"MutRef":{"location":{"Local":[0,0]},"snapshot":1}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":2}}}},{"Effect":{"Write":{"location":{"Local":[0,0]},"root_value_after_write":{"RuntimeValue":{"value":2}}}}},{"Instruction":{"gas_left":999999895,"instruction":"LD_U64","pc":7,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":3}}}},{"Instruction":{"gas_left":999999879,"instruction":"COPY_LOC","pc":8,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,1]},"moved":false,"root_value_read":{"MutRef":{"location":{"Local":[0,0]},"snapshot":2}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Local":[0,0]},"snapshot":2}}}},{"Instruction":{"gas_left":999999847,"instruction":"WRITE_REF","pc":9,"type_parameters":[]}},{"Effect":{"Pop":{"MutRef":{"location":{"Local":[0,0]},"snapshot":2}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":3}}}},{"Effect":{"Write":{"location":{"Local":[0,0]},"root_value_after_write":{"RuntimeValue":{"value":3}}}}},{"Instruction":{"gas_left":999999831,"instruction":"MOVE_LOC","pc":10,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,1]},"moved":true,"root_value_read":{"MutRef":{"location":{"Local":[0,0]},"snapshot":3}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Local":[0,0]},"snapshot":3}}}},{"Instruction":{"gas_left":999999799,"instruction":"READ_REF","pc":11,"type_parameters":[]}},{"Effect":{"Pop":{"MutRef":{"location":{"Local":[0,0]},"snapshot":3}}}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":3}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":3}}}},{"Instruction":{"gas_left":999999714,"instruction":"VEC_PACK","pc":12,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":3}}}},{"Effect":{"Push":{"RuntimeValue":{"value":[3]}}}},{"Instruction":{"gas_left":999999698,"instruction":"ST_LOC","pc":13,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":[3]}}}},{"Effect":{"Write":{"location":{"Local":[0,2]},"root_value_after_write":{"RuntimeValue":{"value":[3]}}}}},{"Instruction":{"gas_left":999999696,"instruction":"LD_U64","pc":14,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":4}}}},{"Instruction":{"gas_left":999999693,"instruction":"MUT_BORROW_LOC","pc":15,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,2]},"moved":false,"root_value_read":{"RuntimeValue":{"value":[3]}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Local":[0,2]},"snapshot":[3]}}}},{"Instruction":{"gas_left":999999691,"instruction":"LD_U64","pc":16,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999997788,"instruction":"VEC_MUT_BORROW","pc":17,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Pop":{"MutRef":{"location":{"Local":[0,2]},"snapshot":[3]}}}},{"Effect":{"Push":{"MutRef":{"location":{"Indexed":[{"Local":[0,2]},0]},"snapshot":[3]}}}},{"Instruction":{"gas_left":999997756,"instruction":"WRITE_REF","pc":18,"type_parameters":[]}},{"Effect":{"Pop":{"MutRef":{"location":{"Indexed":[{"Local":[0,2]},0]},"snapshot":[3]}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":4}}}},{"Effect":{"Write":{"location":{"Indexed":[{"Local":[0,2]},0]},"root_value_after_write":{"RuntimeValue":{"value":[4]}}}}},{"Instruction":{"gas_left":999997754,"instruction":"IMM_BORROW_LOC","pc":19,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,2]},"moved":false,"root_value_read":{"RuntimeValue":{"value":[4]}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Local":[0,2]},"snapshot":[4]}}}},{"Instruction":{"gas_left":999997752,"instruction":"LD_U64","pc":20,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999996417,"instruction":"VEC_IMM_BORROW","pc":21,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Pop":{"ImmRef":{"location":{"Local":[0,2]},"snapshot":[4]}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Indexed":[{"Local":[0,2]},0]},"snapshot":[4]}}}},{"Instruction":{"gas_left":999996385,"instruction":"READ_REF","pc":22,"type_parameters":[]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Indexed":[{"Local":[0,2]},0]},"snapshot":[4]}}}},{"Effect":{"Read":{"location":{"Indexed":[{"Local":[0,2]},0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":[4]}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":4}}}},{"Instruction":{"gas_left":999996383,"instruction":"LD_U64","pc":23,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":4}}}},{"Instruction":{"gas_left":999996319,"instruction":"EQ","pc":24,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":4}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":4}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999996317,"instruction":"BR_FALSE","pc":25,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999996315,"instruction":"BRANCH","pc":26,"type_parameters":[]}},{"Instruction":{"gas_left":999996312,"instruction":"MUT_BORROW_LOC","pc":29,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,2]},"moved":false,"root_value_read":{"RuntimeValue":{"value":[4]}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Local":[0,2]},"snapshot":[4]}}}},{"Instruction":{"gas_left":999996084,"instruction":"VEC_POP_BACK","pc":30,"type_parameters":[]}},{"Effect":{"Pop":{"MutRef":{"location":{"Local":[0,2]},"snapshot":[4]}}}},{"Effect":{"Push":{"RuntimeValue":{"value":4}}}},{"Instruction":{"gas_left":999996082,"instruction":"LD_U64","pc":31,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":4}}}},{"Instruction":{"gas_left":999996018,"instruction":"EQ","pc":32,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":4}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":4}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999996016,"instruction":"BR_FALSE","pc":33,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999996014,"instruction":"BRANCH","pc":34,"type_parameters":[]}},{"Instruction":{"gas_left":999995375,"instruction":"RET","pc":37,"type_parameters":[]}},{"CloseFrame":{"frame_id":0,"gas_left":999995375,"return_":[]}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__calls__test_call_order.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__calls__test_call_order.json new file mode 100644 index 00000000000000..925a0e8a072b2d --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__calls__test_call_order.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":0,"frame_id":0,"function_name":"test_call_order","is_native":false,"locals_types":[],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"calls"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999999998,"instruction":"LD_U64","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999999996,"instruction":"LD_TRUE","pc":1,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999994,"instruction":"LD_U8","pc":2,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999999994,"instruction":"CALL","pc":3,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":1,"frame_id":8,"function_name":"f_test_call_order","is_native":false,"locals_types":[{"ref_type":null,"type_":"u64"},{"ref_type":null,"type_":"bool"},{"ref_type":null,"type_":"u8"}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"calls"},"parameters":[{"RuntimeValue":{"value":1}},{"RuntimeValue":{"value":true}},{"RuntimeValue":{"value":1}}],"return_types":[],"type_instantiation":[]},"gas_left":999999994}},{"Instruction":{"gas_left":999994823,"instruction":"RET","pc":0,"type_parameters":[]}},{"CloseFrame":{"frame_id":8,"gas_left":999994823,"return_":[]}},{"Instruction":{"gas_left":999994184,"instruction":"RET","pc":4,"type_parameters":[]}},{"CloseFrame":{"frame_id":0,"gas_left":999994184,"return_":[]}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__calls__test_call_return_order.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__calls__test_call_return_order.json new file mode 100644 index 00000000000000..7a997c124db28f --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__calls__test_call_return_order.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":4,"frame_id":0,"function_name":"test_call_return_order","is_native":false,"locals_types":[],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"calls"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":1000000000,"instruction":"CALL","pc":0,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":3,"frame_id":2,"function_name":"f_test_return_order","is_native":false,"locals_types":[],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"calls"},"parameters":[],"return_types":[{"ref_type":null,"type_":"u64"},{"ref_type":null,"type_":"bool"},{"ref_type":null,"type_":"u8"}],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999998865,"instruction":"LD_U64","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999998863,"instruction":"LD_TRUE","pc":1,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999998861,"instruction":"LD_U8","pc":2,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999998222,"instruction":"RET","pc":3,"type_parameters":[]}},{"CloseFrame":{"frame_id":2,"gas_left":999998222,"return_":[{"RuntimeValue":{"value":1}},{"RuntimeValue":{"value":true}},{"RuntimeValue":{"value":0}}]}},{"Instruction":{"gas_left":999998222,"instruction":"CALL","pc":1,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":1,"frame_id":12,"function_name":"f_test_call_order","is_native":false,"locals_types":[{"ref_type":null,"type_":"u64"},{"ref_type":null,"type_":"bool"},{"ref_type":null,"type_":"u8"}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"calls"},"parameters":[{"RuntimeValue":{"value":1}},{"RuntimeValue":{"value":true}},{"RuntimeValue":{"value":0}}],"return_types":[],"type_instantiation":[]},"gas_left":999998222}},{"Instruction":{"gas_left":999993051,"instruction":"RET","pc":0,"type_parameters":[]}},{"CloseFrame":{"frame_id":12,"gas_left":999993051,"return_":[]}},{"Instruction":{"gas_left":999992412,"instruction":"RET","pc":2,"type_parameters":[]}},{"CloseFrame":{"frame_id":0,"gas_left":999992412,"return_":[]}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__calls__test_complex_nested_calls.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__calls__test_complex_nested_calls.json new file mode 100644 index 00000000000000..bc9e09f22d0276 --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__calls__test_complex_nested_calls.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":5,"frame_id":0,"function_name":"test_complex_nested_calls","is_native":false,"locals_types":[],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"calls"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":1000000000,"instruction":"CALL","pc":0,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":6,"frame_id":2,"function_name":"f","is_native":false,"locals_types":[{"ref_type":null,"type_":"u64"}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"calls"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999998867,"instruction":"CALL","pc":0,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":7,"frame_id":4,"function_name":"k","is_native":false,"locals_types":[],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"calls"},"parameters":[],"return_types":[{"ref_type":null,"type_":"u64"}],"type_instantiation":[]},"gas_left":999998867}},{"Instruction":{"gas_left":999997732,"instruction":"LD_U64","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999997093,"instruction":"RET","pc":1,"type_parameters":[]}},{"CloseFrame":{"frame_id":4,"gas_left":999997093,"return_":[{"RuntimeValue":{"value":1}}]}},{"Instruction":{"gas_left":999997091,"instruction":"LD_U64","pc":1,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999997089,"instruction":"ADD","pc":2,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Push":{"RuntimeValue":{"value":2}}}},{"Instruction":{"gas_left":999997057,"instruction":"ST_LOC","pc":3,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":2}}}},{"Effect":{"Write":{"location":{"Local":[2,0]},"root_value_after_write":{"RuntimeValue":{"value":2}}}}},{"Instruction":{"gas_left":999997025,"instruction":"COPY_LOC","pc":4,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[2,0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":2}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":2}}}},{"Instruction":{"gas_left":999997023,"instruction":"LD_U64","pc":5,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999997021,"instruction":"GT","pc":6,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":2}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999997019,"instruction":"BR_FALSE","pc":7,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999996987,"instruction":"MOVE_LOC","pc":8,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[2,0]},"moved":true,"root_value_read":{"RuntimeValue":{"value":2}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":2}}}},{"Instruction":{"gas_left":999996987,"instruction":"CALL","pc":9,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":8,"frame_id":33,"function_name":"g","is_native":false,"locals_types":[{"ref_type":null,"type_":"u64"},{"ref_type":null,"type_":"u8"}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"calls"},"parameters":[{"RuntimeValue":{"value":2}}],"return_types":[],"type_instantiation":[]},"gas_left":999996987}},{"Instruction":{"gas_left":999994689,"instruction":"MOVE_LOC","pc":0,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[33,0]},"moved":true,"root_value_read":{"RuntimeValue":{"value":2}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":2}}}},{"Instruction":{"gas_left":999994686,"instruction":"CAST_U8","pc":1,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":2}}}},{"Effect":{"Push":{"RuntimeValue":{"value":2}}}},{"Instruction":{"gas_left":999994654,"instruction":"ST_LOC","pc":2,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":2}}}},{"Effect":{"Write":{"location":{"Local":[33,1]},"root_value_after_write":{"RuntimeValue":{"value":2}}}}},{"Instruction":{"gas_left":999994604,"instruction":"LD_CONST","pc":3,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":[1,2,3]}}}},{"Instruction":{"gas_left":999994602,"instruction":"POP","pc":4,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":[1,2,3]}}}},{"Instruction":{"gas_left":999994586,"instruction":"LD_CONST","pc":5,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999994584,"instruction":"LD_TRUE","pc":6,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999994482,"instruction":"PACK","pc":7,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Push":{"RuntimeValue":{"value":{"fields":{"x":1,"y":true},"type":"0x1::calls::X"}}}}},{"Instruction":{"gas_left":999994480,"instruction":"LD_TRUE","pc":8,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999994324,"instruction":"PACK_GENERIC","pc":9,"type_parameters":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"calls","name":"X","type_args":[]}},"bool"]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":{"fields":{"x":1,"y":true},"type":"0x1::calls::X"}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":{"fields":{"x":{"fields":{"x":1,"y":true},"type":"0x1::calls::X"},"y":true},"type":"0x1::calls::Y<0x1::calls::X, bool>"}}}}},{"Instruction":{"gas_left":999994324,"instruction":"CALL_GENERIC","pc":10,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":10,"frame_id":62,"function_name":"i","is_native":false,"locals_types":[{"ref_type":null,"type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"calls","name":"Y","type_args":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"calls","name":"X","type_args":[]}},"bool"]}}},{"ref_type":null,"type_":"u64"},{"ref_type":null,"type_":"u8"},{"ref_type":"Mut","type_":"u8"}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"calls"},"parameters":[{"RuntimeValue":{"value":{"fields":{"x":{"fields":{"x":1,"y":true},"type":"0x1::calls::X"},"y":true},"type":"0x1::calls::Y<0x1::calls::X, bool>"}}}],"return_types":[{"ref_type":null,"type_":"u8"}],"type_instantiation":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"calls","name":"X","type_args":[]}},"bool"]},"gas_left":999994324}},{"Instruction":{"gas_left":999991888,"instruction":"MOVE_LOC","pc":0,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[62,0]},"moved":true,"root_value_read":{"RuntimeValue":{"value":{"fields":{"x":{"fields":{"x":1,"y":true},"type":"0x1::calls::X"},"y":true},"type":"0x1::calls::Y<0x1::calls::X, bool>"}}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":{"fields":{"x":{"fields":{"x":1,"y":true},"type":"0x1::calls::X"},"y":true},"type":"0x1::calls::Y<0x1::calls::X, bool>"}}}}},{"Instruction":{"gas_left":999991732,"instruction":"UNPACK_GENERIC","pc":1,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":{"fields":{"x":{"fields":{"x":1,"y":true},"type":"0x1::calls::X"},"y":true},"type":"0x1::calls::Y<0x1::calls::X, bool>"}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":{"fields":{"x":1,"y":true},"type":"0x1::calls::X"}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999991730,"instruction":"POP","pc":2,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999991728,"instruction":"POP","pc":3,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":{"fields":{"x":1,"y":true},"type":"0x1::calls::X"}}}}},{"Instruction":{"gas_left":999991726,"instruction":"LD_U64","pc":4,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999991694,"instruction":"ST_LOC","pc":5,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Write":{"location":{"Local":[62,1]},"root_value_after_write":{"RuntimeValue":{"value":1}}}}},{"Instruction":{"gas_left":999991692,"instruction":"IMM_BORROW_LOC","pc":6,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[62,1]},"moved":false,"root_value_read":{"RuntimeValue":{"value":1}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Local":[62,1]},"snapshot":1}}}},{"Instruction":{"gas_left":999991660,"instruction":"READ_REF","pc":7,"type_parameters":[]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Local":[62,1]},"snapshot":1}}}},{"Effect":{"Read":{"location":{"Local":[62,1]},"moved":false,"root_value_read":{"RuntimeValue":{"value":1}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999991658,"instruction":"POP","pc":8,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999991656,"instruction":"LD_U8","pc":9,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999991624,"instruction":"ST_LOC","pc":10,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Write":{"location":{"Local":[62,2]},"root_value_after_write":{"RuntimeValue":{"value":1}}}}},{"Instruction":{"gas_left":999991621,"instruction":"MUT_BORROW_LOC","pc":11,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[62,2]},"moved":false,"root_value_read":{"RuntimeValue":{"value":1}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Local":[62,2]},"snapshot":1}}}},{"Instruction":{"gas_left":999991605,"instruction":"ST_LOC","pc":12,"type_parameters":[]}},{"Effect":{"Pop":{"MutRef":{"location":{"Local":[62,2]},"snapshot":1}}}},{"Effect":{"Write":{"location":{"Local":[62,3]},"root_value_after_write":{"MutRef":{"location":{"Local":[62,2]},"snapshot":1}}}}},{"Instruction":{"gas_left":999991603,"instruction":"LD_U8","pc":13,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":2}}}},{"Instruction":{"gas_left":999991587,"instruction":"COPY_LOC","pc":14,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[62,3]},"moved":false,"root_value_read":{"MutRef":{"location":{"Local":[62,2]},"snapshot":1}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Local":[62,2]},"snapshot":1}}}},{"Instruction":{"gas_left":999991555,"instruction":"WRITE_REF","pc":15,"type_parameters":[]}},{"Effect":{"Pop":{"MutRef":{"location":{"Local":[62,2]},"snapshot":1}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":2}}}},{"Effect":{"Write":{"location":{"Local":[62,2]},"root_value_after_write":{"RuntimeValue":{"value":2}}}}},{"Instruction":{"gas_left":999991539,"instruction":"MOVE_LOC","pc":16,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[62,3]},"moved":true,"root_value_read":{"MutRef":{"location":{"Local":[62,2]},"snapshot":2}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Local":[62,2]},"snapshot":2}}}},{"Instruction":{"gas_left":999991507,"instruction":"READ_REF","pc":17,"type_parameters":[]}},{"Effect":{"Pop":{"MutRef":{"location":{"Local":[62,2]},"snapshot":2}}}},{"Effect":{"Read":{"location":{"Local":[62,2]},"moved":false,"root_value_read":{"RuntimeValue":{"value":2}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":2}}}},{"Instruction":{"gas_left":999990868,"instruction":"RET","pc":18,"type_parameters":[]}},{"CloseFrame":{"frame_id":62,"gas_left":999990868,"return_":[{"RuntimeValue":{"value":2}}]}},{"Instruction":{"gas_left":999990868,"instruction":"CALL","pc":11,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":9,"frame_id":118,"function_name":"h","is_native":false,"locals_types":[{"ref_type":null,"type_":"u8"}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"calls"},"parameters":[{"RuntimeValue":{"value":2}}],"return_types":[],"type_instantiation":[]},"gas_left":999990868}},{"Instruction":{"gas_left":999987963,"instruction":"RET","pc":0,"type_parameters":[]}},{"CloseFrame":{"frame_id":118,"gas_left":999987963,"return_":[]}},{"Instruction":{"gas_left":999987931,"instruction":"MOVE_LOC","pc":12,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[33,1]},"moved":true,"root_value_read":{"RuntimeValue":{"value":2}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":2}}}},{"Instruction":{"gas_left":999987931,"instruction":"CALL","pc":13,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":9,"frame_id":125,"function_name":"h","is_native":false,"locals_types":[{"ref_type":null,"type_":"u8"}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"calls"},"parameters":[{"RuntimeValue":{"value":2}}],"return_types":[],"type_instantiation":[]},"gas_left":999987931}},{"Instruction":{"gas_left":999985026,"instruction":"RET","pc":0,"type_parameters":[]}},{"CloseFrame":{"frame_id":125,"gas_left":999985026,"return_":[]}},{"Instruction":{"gas_left":999984387,"instruction":"RET","pc":14,"type_parameters":[]}},{"CloseFrame":{"frame_id":33,"gas_left":999984387,"return_":[]}},{"Instruction":{"gas_left":999983748,"instruction":"RET","pc":10,"type_parameters":[]}},{"CloseFrame":{"frame_id":2,"gas_left":999983748,"return_":[]}},{"Instruction":{"gas_left":999983109,"instruction":"RET","pc":1,"type_parameters":[]}},{"CloseFrame":{"frame_id":0,"gas_left":999983109,"return_":[]}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__calls__test_return_order.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__calls__test_return_order.json new file mode 100644 index 00000000000000..da67d038efda7f --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__calls__test_return_order.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":2,"frame_id":0,"function_name":"test_return_order","is_native":false,"locals_types":[{"ref_type":null,"type_":"u64"},{"ref_type":null,"type_":"bool"},{"ref_type":null,"type_":"u8"}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"calls"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":1000000000,"instruction":"CALL","pc":0,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":3,"frame_id":2,"function_name":"f_test_return_order","is_native":false,"locals_types":[],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"calls"},"parameters":[],"return_types":[{"ref_type":null,"type_":"u64"},{"ref_type":null,"type_":"bool"},{"ref_type":null,"type_":"u8"}],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999998865,"instruction":"LD_U64","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999998863,"instruction":"LD_TRUE","pc":1,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999998861,"instruction":"LD_U8","pc":2,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999998222,"instruction":"RET","pc":3,"type_parameters":[]}},{"CloseFrame":{"frame_id":2,"gas_left":999998222,"return_":[{"RuntimeValue":{"value":1}},{"RuntimeValue":{"value":true}},{"RuntimeValue":{"value":0}}]}},{"Instruction":{"gas_left":999998190,"instruction":"ST_LOC","pc":1,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Write":{"location":{"Local":[0,2]},"root_value_after_write":{"RuntimeValue":{"value":0}}}}},{"Instruction":{"gas_left":999998158,"instruction":"ST_LOC","pc":2,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Effect":{"Write":{"location":{"Local":[0,1]},"root_value_after_write":{"RuntimeValue":{"value":true}}}}},{"Instruction":{"gas_left":999998126,"instruction":"ST_LOC","pc":3,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Write":{"location":{"Local":[0,0]},"root_value_after_write":{"RuntimeValue":{"value":1}}}}},{"Instruction":{"gas_left":999998094,"instruction":"MOVE_LOC","pc":4,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,2]},"moved":true,"root_value_read":{"RuntimeValue":{"value":0}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999998092,"instruction":"LD_U8","pc":5,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999998028,"instruction":"EQ","pc":6,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999998026,"instruction":"BR_FALSE","pc":7,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999998024,"instruction":"BRANCH","pc":8,"type_parameters":[]}},{"Instruction":{"gas_left":999997992,"instruction":"MOVE_LOC","pc":11,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,1]},"moved":true,"root_value_read":{"RuntimeValue":{"value":true}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999997990,"instruction":"BR_FALSE","pc":12,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999997988,"instruction":"BRANCH","pc":13,"type_parameters":[]}},{"Instruction":{"gas_left":999997349,"instruction":"RET","pc":16,"type_parameters":[]}},{"CloseFrame":{"frame_id":0,"gas_left":999997349,"return_":[]}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__errors__aborter.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__errors__aborter.json new file mode 100644 index 00000000000000..689f2c8ec07bf7 --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__errors__aborter.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":0,"frame_id":0,"function_name":"aborter","is_native":false,"locals_types":[],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"errors"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999999998,"instruction":"LD_U64","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":2}}}},{"Instruction":{"gas_left":999999996,"instruction":"ABORT","pc":1,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":2}}}},{"Effect":{"ExecutionError":"ABORTED"}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__errors__bad_cast.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__errors__bad_cast.json new file mode 100644 index 00000000000000..c68db2b6df2955 --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__errors__bad_cast.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":3,"frame_id":0,"function_name":"bad_cast","is_native":false,"locals_types":[],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"errors"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999999998,"instruction":"LD_U64","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":256}}}},{"Instruction":{"gas_left":999999995,"instruction":"CAST_U8","pc":1,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":256}}}},{"Effect":{"ExecutionError":"ARITHMETIC_ERROR"}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__errors__div_0.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__errors__div_0.json new file mode 100644 index 00000000000000..d901830856afa2 --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__errors__div_0.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":1,"frame_id":0,"function_name":"div_0","is_native":false,"locals_types":[],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"errors"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999999998,"instruction":"LD_U64","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999999996,"instruction":"LD_U64","pc":1,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999999992,"instruction":"DIV","pc":2,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"ExecutionError":"ARITHMETIC_ERROR"}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__errors__fail_during_abort.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__errors__fail_during_abort.json new file mode 100644 index 00000000000000..2b27b5e5b212dc --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__errors__fail_during_abort.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":6,"frame_id":0,"function_name":"fail_during_abort","is_native":false,"locals_types":[],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"errors"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999999998,"instruction":"LD_U64","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999999996,"instruction":"LD_U64","pc":1,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999999992,"instruction":"DIV","pc":2,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"ExecutionError":"ARITHMETIC_ERROR"}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__errors__overshift_l.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__errors__overshift_l.json new file mode 100644 index 00000000000000..61d23d2759dfc7 --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__errors__overshift_l.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":4,"frame_id":0,"function_name":"overshift_l","is_native":false,"locals_types":[],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"errors"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999999998,"instruction":"LD_U8","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999999996,"instruction":"LD_U8","pc":1,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":20}}}},{"Instruction":{"gas_left":999999993,"instruction":"SHL","pc":2,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":20}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"ExecutionError":"ARITHMETIC_ERROR"}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__errors__overshift_r.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__errors__overshift_r.json new file mode 100644 index 00000000000000..4222baf2612553 --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__errors__overshift_r.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":5,"frame_id":0,"function_name":"overshift_r","is_native":false,"locals_types":[],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"errors"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999999998,"instruction":"LD_U8","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999999996,"instruction":"LD_U8","pc":1,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":20}}}},{"Instruction":{"gas_left":999999993,"instruction":"SHL","pc":2,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":20}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"ExecutionError":"ARITHMETIC_ERROR"}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__errors__underflow.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__errors__underflow.json new file mode 100644 index 00000000000000..e0a985da8d255e --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__errors__underflow.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":2,"frame_id":0,"function_name":"underflow","is_native":false,"locals_types":[],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"errors"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999999998,"instruction":"LD_U64","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999999996,"instruction":"LD_U64","pc":1,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":10}}}},{"Instruction":{"gas_left":999999994,"instruction":"SUB","pc":2,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":10}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"ExecutionError":"ARITHMETIC_ERROR"}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__natives__get_orig_type_name_test.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__natives__get_orig_type_name_test.json new file mode 100644 index 00000000000000..dc92e46114e19c --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__natives__get_orig_type_name_test.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":1,"frame_id":0,"function_name":"get_orig_type_name_test","is_native":false,"locals_types":[{"ref_type":null,"type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"type_name","name":"TypeName","type_args":[]}}}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"natives"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":1000000000,"instruction":"CALL_GENERIC","pc":0,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":1,"frame_id":2,"function_name":"get_with_original_ids","is_native":true,"locals_types":[],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"type_name"},"parameters":[],"return_types":[{"ref_type":null,"type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"type_name","name":"TypeName","type_args":[]}}}],"type_instantiation":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"natives","name":"X","type_args":[]}}]},"gas_left":1000000000}},{"Effect":{"Push":{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"CloseFrame":{"frame_id":2,"gas_left":999998834,"return_":[{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}]}},{"Instruction":{"gas_left":999998674,"instruction":"ST_LOC","pc":1,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Effect":{"Write":{"location":{"Local":[0,0]},"root_value_after_write":{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}}},{"Instruction":{"gas_left":999998672,"instruction":"IMM_BORROW_LOC","pc":2,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Instruction":{"gas_left":999998672,"instruction":"CALL","pc":3,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":3,"frame_id":12,"function_name":"borrow_string","is_native":false,"locals_types":[{"ref_type":"Imm","type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"type_name","name":"TypeName","type_args":[]}}}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"type_name"},"parameters":[{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}],"return_types":[{"ref_type":"Imm","type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"ascii","name":"String","type_args":[]}}}],"type_instantiation":[]},"gas_left":999998672}},{"Instruction":{"gas_left":999996390,"instruction":"MOVE_LOC","pc":0,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[12,0]},"moved":true,"root_value_read":{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Instruction":{"gas_left":999996388,"instruction":"IMM_BORROW_FIELD","pc":1,"type_parameters":[]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Indexed":[{"Local":[0,0]},0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Instruction":{"gas_left":999995749,"instruction":"RET","pc":2,"type_parameters":[]}},{"CloseFrame":{"frame_id":12,"gas_left":999995749,"return_":[{"ImmRef":{"location":{"Indexed":[{"Local":[0,0]},0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}]}},{"Instruction":{"gas_left":999995747,"instruction":"POP","pc":4,"type_parameters":[]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Indexed":[{"Local":[0,0]},0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Instruction":{"gas_left":999995587,"instruction":"MOVE_LOC","pc":5,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":true,"root_value_read":{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Instruction":{"gas_left":999995587,"instruction":"CALL","pc":6,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":6,"frame_id":27,"function_name":"into_string","is_native":false,"locals_types":[{"ref_type":null,"type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"type_name","name":"TypeName","type_args":[]}}}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"type_name"},"parameters":[{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}],"return_types":[{"ref_type":null,"type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"ascii","name":"String","type_args":[]}}}],"type_instantiation":[]},"gas_left":999995587}},{"Instruction":{"gas_left":999993319,"instruction":"IMM_BORROW_LOC","pc":0,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[27,0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Local":[27,0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Instruction":{"gas_left":999993317,"instruction":"IMM_BORROW_FIELD","pc":1,"type_parameters":[]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Local":[27,0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Indexed":[{"Local":[27,0]},0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Instruction":{"gas_left":999993161,"instruction":"READ_REF","pc":2,"type_parameters":[]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Indexed":[{"Local":[27,0]},0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Effect":{"Read":{"location":{"Indexed":[{"Local":[27,0]},0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}}}}},{"Instruction":{"gas_left":999992522,"instruction":"RET","pc":3,"type_parameters":[]}},{"CloseFrame":{"frame_id":27,"gas_left":999992522,"return_":[{"RuntimeValue":{"value":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}}}]}},{"Instruction":{"gas_left":999992520,"instruction":"POP","pc":7,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}}}}},{"Instruction":{"gas_left":999991881,"instruction":"RET","pc":8,"type_parameters":[]}},{"CloseFrame":{"frame_id":0,"gas_left":999991881,"return_":[]}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__natives__get_type_name_test.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__natives__get_type_name_test.json new file mode 100644 index 00000000000000..2c8e76ffa4fe29 --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__natives__get_type_name_test.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":0,"frame_id":0,"function_name":"get_type_name_test","is_native":false,"locals_types":[{"ref_type":null,"type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"type_name","name":"TypeName","type_args":[]}}}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"natives"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":1000000000,"instruction":"CALL_GENERIC","pc":0,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":0,"frame_id":2,"function_name":"get","is_native":true,"locals_types":[],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"type_name"},"parameters":[],"return_types":[{"ref_type":null,"type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"type_name","name":"TypeName","type_args":[]}}}],"type_instantiation":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"natives","name":"X","type_args":[]}}]},"gas_left":1000000000}},{"Effect":{"Push":{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"CloseFrame":{"frame_id":2,"gas_left":999998834,"return_":[{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}]}},{"Instruction":{"gas_left":999998674,"instruction":"ST_LOC","pc":1,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Effect":{"Write":{"location":{"Local":[0,0]},"root_value_after_write":{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}}},{"Instruction":{"gas_left":999998672,"instruction":"IMM_BORROW_LOC","pc":2,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Instruction":{"gas_left":999998672,"instruction":"CALL","pc":3,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":3,"frame_id":12,"function_name":"borrow_string","is_native":false,"locals_types":[{"ref_type":"Imm","type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"type_name","name":"TypeName","type_args":[]}}}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"type_name"},"parameters":[{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}],"return_types":[{"ref_type":"Imm","type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"ascii","name":"String","type_args":[]}}}],"type_instantiation":[]},"gas_left":999998672}},{"Instruction":{"gas_left":999996390,"instruction":"MOVE_LOC","pc":0,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[12,0]},"moved":true,"root_value_read":{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Instruction":{"gas_left":999996388,"instruction":"IMM_BORROW_FIELD","pc":1,"type_parameters":[]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Indexed":[{"Local":[0,0]},0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Instruction":{"gas_left":999995749,"instruction":"RET","pc":2,"type_parameters":[]}},{"CloseFrame":{"frame_id":12,"gas_left":999995749,"return_":[{"ImmRef":{"location":{"Indexed":[{"Local":[0,0]},0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}]}},{"Instruction":{"gas_left":999995747,"instruction":"POP","pc":4,"type_parameters":[]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Indexed":[{"Local":[0,0]},0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Instruction":{"gas_left":999995587,"instruction":"MOVE_LOC","pc":5,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":true,"root_value_read":{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Instruction":{"gas_left":999995587,"instruction":"CALL","pc":6,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":6,"frame_id":27,"function_name":"into_string","is_native":false,"locals_types":[{"ref_type":null,"type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"type_name","name":"TypeName","type_args":[]}}}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"type_name"},"parameters":[{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}],"return_types":[{"ref_type":null,"type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"ascii","name":"String","type_args":[]}}}],"type_instantiation":[]},"gas_left":999995587}},{"Instruction":{"gas_left":999993319,"instruction":"IMM_BORROW_LOC","pc":0,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[27,0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Local":[27,0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Instruction":{"gas_left":999993317,"instruction":"IMM_BORROW_FIELD","pc":1,"type_parameters":[]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Local":[27,0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Indexed":[{"Local":[27,0]},0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Instruction":{"gas_left":999993161,"instruction":"READ_REF","pc":2,"type_parameters":[]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Indexed":[{"Local":[27,0]},0]},"snapshot":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}},{"Effect":{"Read":{"location":{"Indexed":[{"Local":[27,0]},0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":{"fields":{"name":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}},"type":"0x1::type_name::TypeName"}}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}}}}},{"Instruction":{"gas_left":999992522,"instruction":"RET","pc":3,"type_parameters":[]}},{"CloseFrame":{"frame_id":27,"gas_left":999992522,"return_":[{"RuntimeValue":{"value":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}}}]}},{"Instruction":{"gas_left":999992520,"instruction":"POP","pc":7,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":{"fields":{"bytes":[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,58,58,110,97,116,105,118,101,115,58,58,88]},"type":"0x1::ascii::String"}}}}},{"Instruction":{"gas_left":999991881,"instruction":"RET","pc":8,"type_parameters":[]}},{"CloseFrame":{"frame_id":0,"gas_left":999991881,"return_":[]}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__packs__test_gen_pack_order.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__packs__test_gen_pack_order.json new file mode 100644 index 00000000000000..ace8cfe264562d --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__packs__test_gen_pack_order.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":2,"frame_id":0,"function_name":"test_gen_pack_order","is_native":false,"locals_types":[{"ref_type":null,"type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"packs","name":"GenX","type_args":["u64","bool","u8"]}}}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"packs"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999999998,"instruction":"LD_U64","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999999996,"instruction":"LD_TRUE","pc":1,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999994,"instruction":"LD_U8","pc":2,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999999841,"instruction":"PACK_GENERIC","pc":3,"type_parameters":["u64","bool","u8"]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Push":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::GenX"}}}}},{"Instruction":{"gas_left":999999741,"instruction":"ST_LOC","pc":4,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::GenX"}}}}},{"Effect":{"Write":{"location":{"Local":[0,0]},"root_value_after_write":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::GenX"}}}}}},{"Instruction":{"gas_left":999999739,"instruction":"IMM_BORROW_LOC","pc":5,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::GenX"}}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::GenX"}}}}},{"Instruction":{"gas_left":999999737,"instruction":"IMM_BORROW_FIELD_GENERIC","pc":6,"type_parameters":["u64","bool","u8"]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::GenX"}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Indexed":[{"Local":[0,0]},2]},"snapshot":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::GenX"}}}}},{"Instruction":{"gas_left":999999705,"instruction":"READ_REF","pc":7,"type_parameters":[]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Indexed":[{"Local":[0,0]},2]},"snapshot":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::GenX"}}}}},{"Effect":{"Read":{"location":{"Indexed":[{"Local":[0,0]},2]},"moved":false,"root_value_read":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::GenX"}}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999999703,"instruction":"LD_U8","pc":8,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999999639,"instruction":"EQ","pc":9,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999637,"instruction":"BR_FALSE","pc":10,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999635,"instruction":"BRANCH","pc":11,"type_parameters":[]}},{"Instruction":{"gas_left":999998996,"instruction":"RET","pc":16,"type_parameters":[]}},{"CloseFrame":{"frame_id":0,"gas_left":999998996,"return_":[]}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__packs__test_gen_unpack_order.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__packs__test_gen_unpack_order.json new file mode 100644 index 00000000000000..0d2facae5bfd9b --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__packs__test_gen_unpack_order.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":3,"frame_id":0,"function_name":"test_gen_unpack_order","is_native":false,"locals_types":[{"ref_type":null,"type_":"bool"},{"ref_type":null,"type_":"u64"},{"ref_type":null,"type_":"bool"},{"ref_type":null,"type_":"u8"}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"packs"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999999998,"instruction":"LD_U64","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999999996,"instruction":"LD_TRUE","pc":1,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999994,"instruction":"LD_U8","pc":2,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999999841,"instruction":"PACK_GENERIC","pc":3,"type_parameters":["u64","bool","u8"]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Push":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::GenX"}}}}},{"Instruction":{"gas_left":999999688,"instruction":"UNPACK_GENERIC","pc":4,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::GenX"}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999999656,"instruction":"ST_LOC","pc":5,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Write":{"location":{"Local":[0,3]},"root_value_after_write":{"RuntimeValue":{"value":0}}}}},{"Instruction":{"gas_left":999999624,"instruction":"ST_LOC","pc":6,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Effect":{"Write":{"location":{"Local":[0,2]},"root_value_after_write":{"RuntimeValue":{"value":true}}}}},{"Instruction":{"gas_left":999999592,"instruction":"ST_LOC","pc":7,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Write":{"location":{"Local":[0,1]},"root_value_after_write":{"RuntimeValue":{"value":1}}}}},{"Instruction":{"gas_left":999999560,"instruction":"MOVE_LOC","pc":8,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,3]},"moved":true,"root_value_read":{"RuntimeValue":{"value":0}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999999558,"instruction":"LD_U8","pc":9,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999999494,"instruction":"EQ","pc":10,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999492,"instruction":"BR_FALSE","pc":11,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999460,"instruction":"MOVE_LOC","pc":12,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,2]},"moved":true,"root_value_read":{"RuntimeValue":{"value":true}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999428,"instruction":"ST_LOC","pc":13,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Effect":{"Write":{"location":{"Local":[0,0]},"root_value_after_write":{"RuntimeValue":{"value":true}}}}},{"Instruction":{"gas_left":999999426,"instruction":"BRANCH","pc":14,"type_parameters":[]}},{"Instruction":{"gas_left":999999394,"instruction":"MOVE_LOC","pc":17,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":true,"root_value_read":{"RuntimeValue":{"value":true}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999392,"instruction":"BR_FALSE","pc":18,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999390,"instruction":"BRANCH","pc":19,"type_parameters":[]}},{"Instruction":{"gas_left":999998751,"instruction":"RET","pc":22,"type_parameters":[]}},{"CloseFrame":{"frame_id":0,"gas_left":999998751,"return_":[]}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__packs__test_pack_order.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__packs__test_pack_order.json new file mode 100644 index 00000000000000..5b176fc2625d86 --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__packs__test_pack_order.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":0,"frame_id":0,"function_name":"test_pack_order","is_native":false,"locals_types":[{"ref_type":null,"type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"packs","name":"X","type_args":[]}}}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"packs"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999999998,"instruction":"LD_U64","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999999996,"instruction":"LD_TRUE","pc":1,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999994,"instruction":"LD_U8","pc":2,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999999841,"instruction":"PACK","pc":3,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Push":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::X"}}}}},{"Instruction":{"gas_left":999999741,"instruction":"ST_LOC","pc":4,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::X"}}}}},{"Effect":{"Write":{"location":{"Local":[0,0]},"root_value_after_write":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::X"}}}}}},{"Instruction":{"gas_left":999999739,"instruction":"IMM_BORROW_LOC","pc":5,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::X"}}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::X"}}}}},{"Instruction":{"gas_left":999999737,"instruction":"IMM_BORROW_FIELD","pc":6,"type_parameters":[]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::X"}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Indexed":[{"Local":[0,0]},2]},"snapshot":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::X"}}}}},{"Instruction":{"gas_left":999999705,"instruction":"READ_REF","pc":7,"type_parameters":[]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Indexed":[{"Local":[0,0]},2]},"snapshot":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::X"}}}}},{"Effect":{"Read":{"location":{"Indexed":[{"Local":[0,0]},2]},"moved":false,"root_value_read":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::X"}}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999999703,"instruction":"LD_U8","pc":8,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999999639,"instruction":"EQ","pc":9,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999637,"instruction":"BR_FALSE","pc":10,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999635,"instruction":"BRANCH","pc":11,"type_parameters":[]}},{"Instruction":{"gas_left":999998996,"instruction":"RET","pc":16,"type_parameters":[]}},{"CloseFrame":{"frame_id":0,"gas_left":999998996,"return_":[]}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__packs__test_unpack_order.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__packs__test_unpack_order.json new file mode 100644 index 00000000000000..e1f6e8893c5399 --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__packs__test_unpack_order.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":1,"frame_id":0,"function_name":"test_unpack_order","is_native":false,"locals_types":[{"ref_type":null,"type_":"bool"},{"ref_type":null,"type_":"u64"},{"ref_type":null,"type_":"bool"},{"ref_type":null,"type_":"u8"}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"packs"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999999998,"instruction":"LD_U64","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999999996,"instruction":"LD_TRUE","pc":1,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999994,"instruction":"LD_U8","pc":2,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999999841,"instruction":"PACK","pc":3,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Push":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::X"}}}}},{"Instruction":{"gas_left":999999688,"instruction":"UNPACK","pc":4,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":true,"pos2":0},"type":"0x1::packs::X"}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999999656,"instruction":"ST_LOC","pc":5,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Write":{"location":{"Local":[0,3]},"root_value_after_write":{"RuntimeValue":{"value":0}}}}},{"Instruction":{"gas_left":999999624,"instruction":"ST_LOC","pc":6,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Effect":{"Write":{"location":{"Local":[0,2]},"root_value_after_write":{"RuntimeValue":{"value":true}}}}},{"Instruction":{"gas_left":999999592,"instruction":"ST_LOC","pc":7,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Write":{"location":{"Local":[0,1]},"root_value_after_write":{"RuntimeValue":{"value":1}}}}},{"Instruction":{"gas_left":999999560,"instruction":"MOVE_LOC","pc":8,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,3]},"moved":true,"root_value_read":{"RuntimeValue":{"value":0}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999999558,"instruction":"LD_U8","pc":9,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999999494,"instruction":"EQ","pc":10,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999492,"instruction":"BR_FALSE","pc":11,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999460,"instruction":"MOVE_LOC","pc":12,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,2]},"moved":true,"root_value_read":{"RuntimeValue":{"value":true}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999428,"instruction":"ST_LOC","pc":13,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Effect":{"Write":{"location":{"Local":[0,0]},"root_value_after_write":{"RuntimeValue":{"value":true}}}}},{"Instruction":{"gas_left":999999426,"instruction":"BRANCH","pc":14,"type_parameters":[]}},{"Instruction":{"gas_left":999999394,"instruction":"MOVE_LOC","pc":17,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":true,"root_value_read":{"RuntimeValue":{"value":true}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999392,"instruction":"BR_FALSE","pc":18,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999390,"instruction":"BRANCH","pc":19,"type_parameters":[]}},{"Instruction":{"gas_left":999998751,"instruction":"RET","pc":22,"type_parameters":[]}},{"CloseFrame":{"frame_id":0,"gas_left":999998751,"return_":[]}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__references__nested_struct_reference_mutation.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__references__nested_struct_reference_mutation.json new file mode 100644 index 00000000000000..ae31124c175af1 --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__references__nested_struct_reference_mutation.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":5,"frame_id":0,"function_name":"nested_struct_reference_mutation","is_native":false,"locals_types":[{"ref_type":null,"type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"Y","type_args":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"Y","type_args":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"Y","type_args":["u64"]}}]}}]}}}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"references"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999999998,"instruction":"LD_U64","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999999996,"instruction":"LD_U64","pc":1,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":2}}}},{"Instruction":{"gas_left":999999994,"instruction":"LD_U64","pc":2,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":3}}}},{"Instruction":{"gas_left":999999992,"instruction":"LD_U64","pc":3,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":4}}}},{"Instruction":{"gas_left":999999890,"instruction":"PACK_GENERIC","pc":4,"type_parameters":["u64"]}},{"Effect":{"Pop":{"RuntimeValue":{"value":4}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":3}}}},{"Effect":{"Push":{"RuntimeValue":{"value":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}}}}},{"Instruction":{"gas_left":999999734,"instruction":"PACK_GENERIC","pc":5,"type_parameters":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"Y","type_args":["u64"]}}]}},{"Effect":{"Pop":{"RuntimeValue":{"value":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":2}}}},{"Effect":{"Push":{"RuntimeValue":{"value":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}}}}},{"Instruction":{"gas_left":999999524,"instruction":"PACK_GENERIC","pc":6,"type_parameters":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"Y","type_args":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"Y","type_args":["u64"]}}]}}]}},{"Effect":{"Pop":{"RuntimeValue":{"value":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Push":{"RuntimeValue":{"value":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Instruction":{"gas_left":999999384,"instruction":"ST_LOC","pc":7,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Effect":{"Write":{"location":{"Local":[0,0]},"root_value_after_write":{"RuntimeValue":{"value":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}}},{"Instruction":{"gas_left":999999382,"instruction":"IMM_BORROW_LOC","pc":8,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Instruction":{"gas_left":999999380,"instruction":"IMM_BORROW_FIELD_GENERIC","pc":9,"type_parameters":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"Y","type_args":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"Y","type_args":["u64"]}}]}}]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Indexed":[{"Local":[0,0]},1]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Instruction":{"gas_left":999999378,"instruction":"IMM_BORROW_FIELD_GENERIC","pc":10,"type_parameters":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"Y","type_args":["u64"]}}]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Indexed":[{"Local":[0,0]},1]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Instruction":{"gas_left":999999376,"instruction":"IMM_BORROW_FIELD_GENERIC","pc":11,"type_parameters":["u64"]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Indexed":[{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},0]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Instruction":{"gas_left":999999344,"instruction":"READ_REF","pc":12,"type_parameters":[]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Indexed":[{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},0]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Effect":{"Read":{"location":{"Indexed":[{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":3}}}},{"Instruction":{"gas_left":999999342,"instruction":"LD_U64","pc":13,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":3}}}},{"Instruction":{"gas_left":999999278,"instruction":"EQ","pc":14,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":3}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":3}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999276,"instruction":"BR_FALSE","pc":15,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999274,"instruction":"BRANCH","pc":16,"type_parameters":[]}},{"Instruction":{"gas_left":999999271,"instruction":"MUT_BORROW_LOC","pc":23,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Instruction":{"gas_left":999999269,"instruction":"MUT_BORROW_FIELD_GENERIC","pc":24,"type_parameters":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"Y","type_args":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"Y","type_args":["u64"]}}]}}]}},{"Effect":{"Pop":{"MutRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Indexed":[{"Local":[0,0]},1]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Instruction":{"gas_left":999999269,"instruction":"CALL","pc":25,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":6,"frame_id":56,"function_name":"l0","is_native":false,"locals_types":[{"ref_type":"Mut","type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"Y","type_args":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"Y","type_args":["u64"]}}]}}}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"references"},"parameters":[{"MutRef":{"location":{"Indexed":[{"Local":[0,0]},1]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}],"return_types":[],"type_instantiation":[]},"gas_left":999999269}},{"Instruction":{"gas_left":999996987,"instruction":"MOVE_LOC","pc":0,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[56,0]},"moved":true,"root_value_read":{"MutRef":{"location":{"Indexed":[{"Local":[0,0]},1]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Indexed":[{"Local":[0,0]},1]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Instruction":{"gas_left":999996985,"instruction":"MUT_BORROW_FIELD_GENERIC","pc":1,"type_parameters":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"Y","type_args":["u64"]}}]}},{"Effect":{"Pop":{"MutRef":{"location":{"Indexed":[{"Local":[0,0]},1]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Instruction":{"gas_left":999996985,"instruction":"CALL","pc":2,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":7,"frame_id":64,"function_name":"l1","is_native":false,"locals_types":[{"ref_type":"Mut","type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"Y","type_args":["u64"]}}}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"references"},"parameters":[{"MutRef":{"location":{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}],"return_types":[],"type_instantiation":[]},"gas_left":999996985}},{"Instruction":{"gas_left":999994703,"instruction":"MOVE_LOC","pc":0,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[64,0]},"moved":true,"root_value_read":{"MutRef":{"location":{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Instruction":{"gas_left":999994701,"instruction":"MUT_BORROW_FIELD_GENERIC","pc":1,"type_parameters":["u64"]}},{"Effect":{"Pop":{"MutRef":{"location":{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Indexed":[{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},0]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Instruction":{"gas_left":999994701,"instruction":"CALL","pc":2,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":8,"frame_id":72,"function_name":"incr","is_native":false,"locals_types":[{"ref_type":"Mut","type_":"u64"}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"references"},"parameters":[{"MutRef":{"location":{"Indexed":[{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},0]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}],"return_types":[],"type_instantiation":[]},"gas_left":999994701}},{"Instruction":{"gas_left":999992419,"instruction":"COPY_LOC","pc":0,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[72,0]},"moved":false,"root_value_read":{"MutRef":{"location":{"Indexed":[{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},0]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Indexed":[{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},0]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Instruction":{"gas_left":999992387,"instruction":"READ_REF","pc":1,"type_parameters":[]}},{"Effect":{"Pop":{"MutRef":{"location":{"Indexed":[{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},0]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Effect":{"Read":{"location":{"Indexed":[{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":3}}}},{"Instruction":{"gas_left":999992385,"instruction":"LD_U64","pc":2,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999992383,"instruction":"ADD","pc":3,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":3}}}},{"Effect":{"Push":{"RuntimeValue":{"value":4}}}},{"Instruction":{"gas_left":999992367,"instruction":"MOVE_LOC","pc":4,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[72,0]},"moved":true,"root_value_read":{"MutRef":{"location":{"Indexed":[{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},0]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Indexed":[{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},0]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Instruction":{"gas_left":999992335,"instruction":"WRITE_REF","pc":5,"type_parameters":[]}},{"Effect":{"Pop":{"MutRef":{"location":{"Indexed":[{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},0]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":3,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":4}}}},{"Effect":{"Write":{"location":{"Indexed":[{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},0]},"root_value_after_write":{"RuntimeValue":{"value":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":4,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}}},{"Instruction":{"gas_left":999991696,"instruction":"RET","pc":6,"type_parameters":[]}},{"CloseFrame":{"frame_id":72,"gas_left":999991696,"return_":[]}},{"Instruction":{"gas_left":999991057,"instruction":"RET","pc":3,"type_parameters":[]}},{"CloseFrame":{"frame_id":64,"gas_left":999991057,"return_":[]}},{"Instruction":{"gas_left":999990418,"instruction":"RET","pc":3,"type_parameters":[]}},{"CloseFrame":{"frame_id":56,"gas_left":999990418,"return_":[]}},{"Instruction":{"gas_left":999990416,"instruction":"IMM_BORROW_LOC","pc":26,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":4,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":4,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Instruction":{"gas_left":999990414,"instruction":"IMM_BORROW_FIELD_GENERIC","pc":27,"type_parameters":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"Y","type_args":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"Y","type_args":["u64"]}}]}}]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":4,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Indexed":[{"Local":[0,0]},1]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":4,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Instruction":{"gas_left":999990412,"instruction":"IMM_BORROW_FIELD_GENERIC","pc":28,"type_parameters":[{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"Y","type_args":["u64"]}}]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Indexed":[{"Local":[0,0]},1]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":4,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":4,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Instruction":{"gas_left":999990410,"instruction":"IMM_BORROW_FIELD_GENERIC","pc":29,"type_parameters":["u64"]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":4,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Indexed":[{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},0]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":4,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Instruction":{"gas_left":999990378,"instruction":"READ_REF","pc":30,"type_parameters":[]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Indexed":[{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},0]},"snapshot":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":4,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}},{"Effect":{"Read":{"location":{"Indexed":[{"Indexed":[{"Indexed":[{"Local":[0,0]},1]},1]},0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":{"fields":{"x":1,"y":{"fields":{"x":2,"y":{"fields":{"x":4,"y":4},"type":"0x1::references::Y"}},"type":"0x1::references::Y<0x1::references::Y>"}},"type":"0x1::references::Y<0x1::references::Y<0x1::references::Y>>"}}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":4}}}},{"Instruction":{"gas_left":999990376,"instruction":"LD_U64","pc":31,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":4}}}},{"Instruction":{"gas_left":999990312,"instruction":"EQ","pc":32,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":4}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":4}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999990310,"instruction":"BR_FALSE","pc":33,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999990308,"instruction":"BRANCH","pc":34,"type_parameters":[]}},{"Instruction":{"gas_left":999989669,"instruction":"RET","pc":41,"type_parameters":[]}},{"CloseFrame":{"frame_id":0,"gas_left":999989669,"return_":[]}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__references__pass_mut_assign_in_other_fn.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__references__pass_mut_assign_in_other_fn.json new file mode 100644 index 00000000000000..765d28809cbb8a --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__references__pass_mut_assign_in_other_fn.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":0,"frame_id":0,"function_name":"pass_mut_assign_in_other_fn","is_native":false,"locals_types":[{"ref_type":null,"type_":"u64"}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"references"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999999998,"instruction":"LD_U64","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999999966,"instruction":"ST_LOC","pc":1,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Write":{"location":{"Local":[0,0]},"root_value_after_write":{"RuntimeValue":{"value":0}}}}},{"Instruction":{"gas_left":999999963,"instruction":"MUT_BORROW_LOC","pc":2,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":0}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Local":[0,0]},"snapshot":0}}}},{"Instruction":{"gas_left":999999961,"instruction":"LD_U64","pc":3,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999999959,"instruction":"LD_U64","pc":4,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":2}}}},{"Instruction":{"gas_left":999999959,"instruction":"CALL","pc":5,"type_parameters":[]}},{"OpenFrame":{"frame":{"binary_member_index":1,"frame_id":14,"function_name":"assign_add","is_native":false,"locals_types":[{"ref_type":"Mut","type_":"u64"},{"ref_type":null,"type_":"u64"},{"ref_type":null,"type_":"u64"}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"references"},"parameters":[{"MutRef":{"location":{"Local":[0,0]},"snapshot":0}},{"RuntimeValue":{"value":1}},{"RuntimeValue":{"value":2}}],"return_types":[],"type_instantiation":[]},"gas_left":999999959}},{"Instruction":{"gas_left":999995395,"instruction":"MOVE_LOC","pc":0,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[14,1]},"moved":true,"root_value_read":{"RuntimeValue":{"value":1}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999995363,"instruction":"MOVE_LOC","pc":1,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[14,2]},"moved":true,"root_value_read":{"RuntimeValue":{"value":2}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":2}}}},{"Instruction":{"gas_left":999995361,"instruction":"ADD","pc":2,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":2}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Push":{"RuntimeValue":{"value":3}}}},{"Instruction":{"gas_left":999995345,"instruction":"MOVE_LOC","pc":3,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[14,0]},"moved":true,"root_value_read":{"MutRef":{"location":{"Local":[0,0]},"snapshot":0}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Local":[0,0]},"snapshot":0}}}},{"Instruction":{"gas_left":999995313,"instruction":"WRITE_REF","pc":4,"type_parameters":[]}},{"Effect":{"Pop":{"MutRef":{"location":{"Local":[0,0]},"snapshot":0}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":3}}}},{"Effect":{"Write":{"location":{"Local":[0,0]},"root_value_after_write":{"RuntimeValue":{"value":3}}}}},{"Instruction":{"gas_left":999994674,"instruction":"RET","pc":5,"type_parameters":[]}},{"CloseFrame":{"frame_id":14,"gas_left":999994674,"return_":[]}},{"Instruction":{"gas_left":999994642,"instruction":"MOVE_LOC","pc":6,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":true,"root_value_read":{"RuntimeValue":{"value":3}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":3}}}},{"Instruction":{"gas_left":999994640,"instruction":"LD_U64","pc":7,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":3}}}},{"Instruction":{"gas_left":999994576,"instruction":"EQ","pc":8,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":3}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":3}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999994574,"instruction":"BR_FALSE","pc":9,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999994572,"instruction":"BRANCH","pc":10,"type_parameters":[]}},{"Instruction":{"gas_left":999993933,"instruction":"RET","pc":13,"type_parameters":[]}},{"CloseFrame":{"frame_id":0,"gas_left":999993933,"return_":[]}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__references__test_struct_borrow.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__references__test_struct_borrow.json new file mode 100644 index 00000000000000..6076e89f6399ab --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__references__test_struct_borrow.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":2,"frame_id":0,"function_name":"test_struct_borrow","is_native":false,"locals_types":[{"ref_type":null,"type_":{"struct":{"address":"0000000000000000000000000000000000000000000000000000000000000001","module":"references","name":"X","type_args":[]}}}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"references"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999999998,"instruction":"LD_U64","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999999996,"instruction":"LD_FALSE","pc":1,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":false}}}},{"Instruction":{"gas_left":999999894,"instruction":"PACK","pc":2,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":false}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Push":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":false},"type":"0x1::references::X"}}}}},{"Instruction":{"gas_left":999999826,"instruction":"ST_LOC","pc":3,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":false},"type":"0x1::references::X"}}}}},{"Effect":{"Write":{"location":{"Local":[0,0]},"root_value_after_write":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":false},"type":"0x1::references::X"}}}}}},{"Instruction":{"gas_left":999999824,"instruction":"IMM_BORROW_LOC","pc":4,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":false},"type":"0x1::references::X"}}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"pos0":1,"pos1":false},"type":"0x1::references::X"}}}}},{"Instruction":{"gas_left":999999822,"instruction":"IMM_BORROW_FIELD","pc":5,"type_parameters":[]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Local":[0,0]},"snapshot":{"fields":{"pos0":1,"pos1":false},"type":"0x1::references::X"}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Indexed":[{"Local":[0,0]},0]},"snapshot":{"fields":{"pos0":1,"pos1":false},"type":"0x1::references::X"}}}}},{"Instruction":{"gas_left":999999790,"instruction":"READ_REF","pc":6,"type_parameters":[]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Indexed":[{"Local":[0,0]},0]},"snapshot":{"fields":{"pos0":1,"pos1":false},"type":"0x1::references::X"}}}}},{"Effect":{"Read":{"location":{"Indexed":[{"Local":[0,0]},0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":{"fields":{"pos0":1,"pos1":false},"type":"0x1::references::X"}}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999999788,"instruction":"LD_U64","pc":7,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999999724,"instruction":"EQ","pc":8,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999722,"instruction":"BR_FALSE","pc":9,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999999720,"instruction":"BRANCH","pc":10,"type_parameters":[]}},{"Instruction":{"gas_left":999999081,"instruction":"RET","pc":13,"type_parameters":[]}},{"CloseFrame":{"frame_id":0,"gas_left":999999081,"return_":[]}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__references__test_vector_mut_borrow.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__references__test_vector_mut_borrow.json new file mode 100644 index 00000000000000..10cba16aeb1d34 --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__references__test_vector_mut_borrow.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":3,"frame_id":0,"function_name":"test_vector_mut_borrow","is_native":false,"locals_types":[{"ref_type":null,"type_":"u64"},{"ref_type":"Mut","type_":"u64"},{"ref_type":null,"type_":{"vector":"u64"}}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"references"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999999998,"instruction":"LD_U64","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999999966,"instruction":"ST_LOC","pc":1,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Write":{"location":{"Local":[0,0]},"root_value_after_write":{"RuntimeValue":{"value":1}}}}},{"Instruction":{"gas_left":999999963,"instruction":"MUT_BORROW_LOC","pc":2,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":1}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Local":[0,0]},"snapshot":1}}}},{"Instruction":{"gas_left":999999947,"instruction":"ST_LOC","pc":3,"type_parameters":[]}},{"Effect":{"Pop":{"MutRef":{"location":{"Local":[0,0]},"snapshot":1}}}},{"Effect":{"Write":{"location":{"Local":[0,1]},"root_value_after_write":{"MutRef":{"location":{"Local":[0,0]},"snapshot":1}}}}},{"Instruction":{"gas_left":999999945,"instruction":"LD_U64","pc":4,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":2}}}},{"Instruction":{"gas_left":999999929,"instruction":"COPY_LOC","pc":5,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,1]},"moved":false,"root_value_read":{"MutRef":{"location":{"Local":[0,0]},"snapshot":1}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Local":[0,0]},"snapshot":1}}}},{"Instruction":{"gas_left":999999897,"instruction":"WRITE_REF","pc":6,"type_parameters":[]}},{"Effect":{"Pop":{"MutRef":{"location":{"Local":[0,0]},"snapshot":1}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":2}}}},{"Effect":{"Write":{"location":{"Local":[0,0]},"root_value_after_write":{"RuntimeValue":{"value":2}}}}},{"Instruction":{"gas_left":999999895,"instruction":"LD_U64","pc":7,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":3}}}},{"Instruction":{"gas_left":999999879,"instruction":"COPY_LOC","pc":8,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,1]},"moved":false,"root_value_read":{"MutRef":{"location":{"Local":[0,0]},"snapshot":2}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Local":[0,0]},"snapshot":2}}}},{"Instruction":{"gas_left":999999847,"instruction":"WRITE_REF","pc":9,"type_parameters":[]}},{"Effect":{"Pop":{"MutRef":{"location":{"Local":[0,0]},"snapshot":2}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":3}}}},{"Effect":{"Write":{"location":{"Local":[0,0]},"root_value_after_write":{"RuntimeValue":{"value":3}}}}},{"Instruction":{"gas_left":999999831,"instruction":"COPY_LOC","pc":10,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,1]},"moved":false,"root_value_read":{"MutRef":{"location":{"Local":[0,0]},"snapshot":3}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Local":[0,0]},"snapshot":3}}}},{"Instruction":{"gas_left":999999799,"instruction":"READ_REF","pc":11,"type_parameters":[]}},{"Effect":{"Pop":{"MutRef":{"location":{"Local":[0,0]},"snapshot":3}}}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":3}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":3}}}},{"Instruction":{"gas_left":999999714,"instruction":"VEC_PACK","pc":12,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":3}}}},{"Effect":{"Push":{"RuntimeValue":{"value":[3]}}}},{"Instruction":{"gas_left":999999698,"instruction":"ST_LOC","pc":13,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":[3]}}}},{"Effect":{"Write":{"location":{"Local":[0,2]},"root_value_after_write":{"RuntimeValue":{"value":[3]}}}}},{"Instruction":{"gas_left":999999696,"instruction":"LD_U64","pc":14,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":4}}}},{"Instruction":{"gas_left":999999693,"instruction":"MUT_BORROW_LOC","pc":15,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,2]},"moved":false,"root_value_read":{"RuntimeValue":{"value":[3]}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Local":[0,2]},"snapshot":[3]}}}},{"Instruction":{"gas_left":999999691,"instruction":"LD_U64","pc":16,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999997788,"instruction":"VEC_MUT_BORROW","pc":17,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Pop":{"MutRef":{"location":{"Local":[0,2]},"snapshot":[3]}}}},{"Effect":{"Push":{"MutRef":{"location":{"Indexed":[{"Local":[0,2]},0]},"snapshot":[3]}}}},{"Instruction":{"gas_left":999997756,"instruction":"WRITE_REF","pc":18,"type_parameters":[]}},{"Effect":{"Pop":{"MutRef":{"location":{"Indexed":[{"Local":[0,2]},0]},"snapshot":[3]}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":4}}}},{"Effect":{"Write":{"location":{"Indexed":[{"Local":[0,2]},0]},"root_value_after_write":{"RuntimeValue":{"value":[4]}}}}},{"Instruction":{"gas_left":999997754,"instruction":"IMM_BORROW_LOC","pc":19,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,2]},"moved":false,"root_value_read":{"RuntimeValue":{"value":[4]}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Local":[0,2]},"snapshot":[4]}}}},{"Instruction":{"gas_left":999997752,"instruction":"LD_U64","pc":20,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999996417,"instruction":"VEC_IMM_BORROW","pc":21,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Pop":{"ImmRef":{"location":{"Local":[0,2]},"snapshot":[4]}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Indexed":[{"Local":[0,2]},0]},"snapshot":[4]}}}},{"Instruction":{"gas_left":999996385,"instruction":"READ_REF","pc":22,"type_parameters":[]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Indexed":[{"Local":[0,2]},0]},"snapshot":[4]}}}},{"Effect":{"Read":{"location":{"Indexed":[{"Local":[0,2]},0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":[4]}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":4}}}},{"Instruction":{"gas_left":999996383,"instruction":"LD_U64","pc":23,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":4}}}},{"Instruction":{"gas_left":999996319,"instruction":"EQ","pc":24,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":4}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":4}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999996317,"instruction":"BR_FALSE","pc":25,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999996315,"instruction":"BRANCH","pc":26,"type_parameters":[]}},{"Instruction":{"gas_left":999996299,"instruction":"MOVE_LOC","pc":31,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,1]},"moved":true,"root_value_read":{"MutRef":{"location":{"Local":[0,0]},"snapshot":3}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Local":[0,0]},"snapshot":3}}}},{"Instruction":{"gas_left":999996267,"instruction":"READ_REF","pc":32,"type_parameters":[]}},{"Effect":{"Pop":{"MutRef":{"location":{"Local":[0,0]},"snapshot":3}}}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":3}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":3}}}},{"Instruction":{"gas_left":999996265,"instruction":"LD_U64","pc":33,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":3}}}},{"Instruction":{"gas_left":999996201,"instruction":"EQ","pc":34,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":3}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":3}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999996199,"instruction":"BR_FALSE","pc":35,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999996197,"instruction":"BRANCH","pc":36,"type_parameters":[]}},{"Instruction":{"gas_left":999995558,"instruction":"RET","pc":39,"type_parameters":[]}},{"CloseFrame":{"frame_id":0,"gas_left":999995558,"return_":[]}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__references__test_vector_mut_borrow_pop.json b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__references__test_vector_mut_borrow_pop.json new file mode 100644 index 00000000000000..40468e125fc3d8 --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/saved_traces/0x1__references__test_vector_mut_borrow_pop.json @@ -0,0 +1 @@ +{"events":[{"OpenFrame":{"frame":{"binary_member_index":4,"frame_id":0,"function_name":"test_vector_mut_borrow_pop","is_native":false,"locals_types":[{"ref_type":null,"type_":"u64"},{"ref_type":"Mut","type_":"u64"},{"ref_type":null,"type_":{"vector":"u64"}}],"module":{"address":"0000000000000000000000000000000000000000000000000000000000000001","name":"references"},"parameters":[],"return_types":[],"type_instantiation":[]},"gas_left":1000000000}},{"Instruction":{"gas_left":999999998,"instruction":"LD_U64","pc":0,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":1}}}},{"Instruction":{"gas_left":999999966,"instruction":"ST_LOC","pc":1,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":1}}}},{"Effect":{"Write":{"location":{"Local":[0,0]},"root_value_after_write":{"RuntimeValue":{"value":1}}}}},{"Instruction":{"gas_left":999999963,"instruction":"MUT_BORROW_LOC","pc":2,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":1}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Local":[0,0]},"snapshot":1}}}},{"Instruction":{"gas_left":999999947,"instruction":"ST_LOC","pc":3,"type_parameters":[]}},{"Effect":{"Pop":{"MutRef":{"location":{"Local":[0,0]},"snapshot":1}}}},{"Effect":{"Write":{"location":{"Local":[0,1]},"root_value_after_write":{"MutRef":{"location":{"Local":[0,0]},"snapshot":1}}}}},{"Instruction":{"gas_left":999999945,"instruction":"LD_U64","pc":4,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":2}}}},{"Instruction":{"gas_left":999999929,"instruction":"COPY_LOC","pc":5,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,1]},"moved":false,"root_value_read":{"MutRef":{"location":{"Local":[0,0]},"snapshot":1}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Local":[0,0]},"snapshot":1}}}},{"Instruction":{"gas_left":999999897,"instruction":"WRITE_REF","pc":6,"type_parameters":[]}},{"Effect":{"Pop":{"MutRef":{"location":{"Local":[0,0]},"snapshot":1}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":2}}}},{"Effect":{"Write":{"location":{"Local":[0,0]},"root_value_after_write":{"RuntimeValue":{"value":2}}}}},{"Instruction":{"gas_left":999999895,"instruction":"LD_U64","pc":7,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":3}}}},{"Instruction":{"gas_left":999999879,"instruction":"COPY_LOC","pc":8,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,1]},"moved":false,"root_value_read":{"MutRef":{"location":{"Local":[0,0]},"snapshot":2}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Local":[0,0]},"snapshot":2}}}},{"Instruction":{"gas_left":999999847,"instruction":"WRITE_REF","pc":9,"type_parameters":[]}},{"Effect":{"Pop":{"MutRef":{"location":{"Local":[0,0]},"snapshot":2}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":3}}}},{"Effect":{"Write":{"location":{"Local":[0,0]},"root_value_after_write":{"RuntimeValue":{"value":3}}}}},{"Instruction":{"gas_left":999999831,"instruction":"MOVE_LOC","pc":10,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,1]},"moved":true,"root_value_read":{"MutRef":{"location":{"Local":[0,0]},"snapshot":3}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Local":[0,0]},"snapshot":3}}}},{"Instruction":{"gas_left":999999799,"instruction":"READ_REF","pc":11,"type_parameters":[]}},{"Effect":{"Pop":{"MutRef":{"location":{"Local":[0,0]},"snapshot":3}}}},{"Effect":{"Read":{"location":{"Local":[0,0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":3}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":3}}}},{"Instruction":{"gas_left":999999714,"instruction":"VEC_PACK","pc":12,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":3}}}},{"Effect":{"Push":{"RuntimeValue":{"value":[3]}}}},{"Instruction":{"gas_left":999999698,"instruction":"ST_LOC","pc":13,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":[3]}}}},{"Effect":{"Write":{"location":{"Local":[0,2]},"root_value_after_write":{"RuntimeValue":{"value":[3]}}}}},{"Instruction":{"gas_left":999999696,"instruction":"LD_U64","pc":14,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":4}}}},{"Instruction":{"gas_left":999999693,"instruction":"MUT_BORROW_LOC","pc":15,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,2]},"moved":false,"root_value_read":{"RuntimeValue":{"value":[3]}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Local":[0,2]},"snapshot":[3]}}}},{"Instruction":{"gas_left":999999691,"instruction":"LD_U64","pc":16,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999997788,"instruction":"VEC_MUT_BORROW","pc":17,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Pop":{"MutRef":{"location":{"Local":[0,2]},"snapshot":[3]}}}},{"Effect":{"Push":{"MutRef":{"location":{"Indexed":[{"Local":[0,2]},0]},"snapshot":[3]}}}},{"Instruction":{"gas_left":999997756,"instruction":"WRITE_REF","pc":18,"type_parameters":[]}},{"Effect":{"Pop":{"MutRef":{"location":{"Indexed":[{"Local":[0,2]},0]},"snapshot":[3]}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":4}}}},{"Effect":{"Write":{"location":{"Indexed":[{"Local":[0,2]},0]},"root_value_after_write":{"RuntimeValue":{"value":[4]}}}}},{"Instruction":{"gas_left":999997754,"instruction":"IMM_BORROW_LOC","pc":19,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,2]},"moved":false,"root_value_read":{"RuntimeValue":{"value":[4]}}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Local":[0,2]},"snapshot":[4]}}}},{"Instruction":{"gas_left":999997752,"instruction":"LD_U64","pc":20,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":0}}}},{"Instruction":{"gas_left":999996417,"instruction":"VEC_IMM_BORROW","pc":21,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":0}}}},{"Effect":{"Pop":{"ImmRef":{"location":{"Local":[0,2]},"snapshot":[4]}}}},{"Effect":{"Push":{"ImmRef":{"location":{"Indexed":[{"Local":[0,2]},0]},"snapshot":[4]}}}},{"Instruction":{"gas_left":999996385,"instruction":"READ_REF","pc":22,"type_parameters":[]}},{"Effect":{"Pop":{"ImmRef":{"location":{"Indexed":[{"Local":[0,2]},0]},"snapshot":[4]}}}},{"Effect":{"Read":{"location":{"Indexed":[{"Local":[0,2]},0]},"moved":false,"root_value_read":{"RuntimeValue":{"value":[4]}}}}},{"Effect":{"Push":{"RuntimeValue":{"value":4}}}},{"Instruction":{"gas_left":999996383,"instruction":"LD_U64","pc":23,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":4}}}},{"Instruction":{"gas_left":999996319,"instruction":"EQ","pc":24,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":4}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":4}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999996317,"instruction":"BR_FALSE","pc":25,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999996315,"instruction":"BRANCH","pc":26,"type_parameters":[]}},{"Instruction":{"gas_left":999996312,"instruction":"MUT_BORROW_LOC","pc":29,"type_parameters":[]}},{"Effect":{"Read":{"location":{"Local":[0,2]},"moved":false,"root_value_read":{"RuntimeValue":{"value":[4]}}}}},{"Effect":{"Push":{"MutRef":{"location":{"Local":[0,2]},"snapshot":[4]}}}},{"Instruction":{"gas_left":999996084,"instruction":"VEC_POP_BACK","pc":30,"type_parameters":[]}},{"Effect":{"Pop":{"MutRef":{"location":{"Local":[0,2]},"snapshot":[4]}}}},{"Effect":{"Push":{"RuntimeValue":{"value":4}}}},{"Instruction":{"gas_left":999996082,"instruction":"LD_U64","pc":31,"type_parameters":[]}},{"Effect":{"Push":{"RuntimeValue":{"value":4}}}},{"Instruction":{"gas_left":999996018,"instruction":"EQ","pc":32,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":4}}}},{"Effect":{"Pop":{"RuntimeValue":{"value":4}}}},{"Effect":{"Push":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999996016,"instruction":"BR_FALSE","pc":33,"type_parameters":[]}},{"Effect":{"Pop":{"RuntimeValue":{"value":true}}}},{"Instruction":{"gas_left":999996014,"instruction":"BRANCH","pc":34,"type_parameters":[]}},{"Instruction":{"gas_left":999995375,"instruction":"RET","pc":37,"type_parameters":[]}},{"CloseFrame":{"frame_id":0,"gas_left":999995375,"return_":[]}}],"version":1} \ No newline at end of file diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/sources/calls.move b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/sources/calls.move new file mode 100644 index 00000000000000..ead1f74736bd83 --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/sources/calls.move @@ -0,0 +1,75 @@ +module 0x1::calls { + const A: u64 = 1; + const B: vector = vector[1,2,3]; + + public struct X has drop { + x: u64, + y: bool, + } + + public struct Y has drop { + x: A, + y: B, + } + + #[test] + fun test_call_order() { + let a = 1u64; + let b = true; + let c = 1u8; + f_test_call_order(a, b, c); + } + + fun f_test_call_order(_x: u64, _b: bool, _c: u8) { } + + #[test] + fun test_return_order() { + let (a, b, c) = f_test_return_order(); + assert!(c == 0u8, a); + assert!(b, a); + } + + fun f_test_return_order(): (u64, bool, u8) { + (1, true, 0u8) + } + + #[test] + fun test_call_return_order() { + let (a, b, c) = f_test_return_order(); + f_test_call_order(a, b, c); + } + + #[test] + fun test_complex_nested_calls() { + f() + } + + fun f() { + let x = k() + 1; + if (x > 0) g(x) + } + + fun k(): u64 { + 1 + } + + fun g(x: u64) { + let y = x as u8; + let _ = B; + let x = X { x: A, y: true }; + let j = Y { x, y: true }; + h(i(j)); + h(y) + } + + fun h(_y: u8) { } + + fun i(y: Y): u8 { + let Y { x: _, y: _ } = y; + let x = &1; + let _h = *x; + let j = &mut 1; + *j = 2; + *j + } +} diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/sources/errors.move b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/sources/errors.move new file mode 100644 index 00000000000000..442cdfd188f0fe --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/sources/errors.move @@ -0,0 +1,44 @@ +module 0x1::errors { + #[test] + #[expected_failure] + fun aborter() { + let x = 1 + 1; + abort x + } + + #[test] + #[expected_failure] + fun div_0() { + 1/0; + } + + #[test] + #[expected_failure] + fun underflow() { + 1 - 10; + } + + #[test] + #[expected_failure] + fun bad_cast() { + 256u64 as u8; + } + + #[test] + #[expected_failure] + fun overshift_l() { + 1u8 << 20; + } + + #[test] + #[expected_failure] + fun overshift_r() { + 1u8 << 20; + } + + #[test] + #[expected_failure] + fun fail_during_abort() { + abort 1/0 + } +} diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/sources/natives.move b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/sources/natives.move new file mode 100644 index 00000000000000..d48eb04a24e77e --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/sources/natives.move @@ -0,0 +1,17 @@ +module 0x1::natives { + public struct X() has drop; + + #[test] + fun get_type_name_test() { + let x = std::type_name::get(); + let _t = x.borrow_string(); + let _t = x.into_string(); + } + + #[test] + fun get_orig_type_name_test() { + let x = std::type_name::get_with_original_ids(); + let _t = x.borrow_string(); + let _t = x.into_string(); + } +} diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/sources/references.move b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/sources/references.move new file mode 100644 index 00000000000000..c1451a4ad97fe5 --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/sources/references.move @@ -0,0 +1,74 @@ +module 0x1::references { + + #[test] + fun pass_mut_assign_in_other_fn() { + let x = 1; + let y = 2; + let mut res = 0; + assign_add(&mut res, x, y); + assert!(res == 3); + } + + fun assign_add(x: &mut u64, a: u64, b: u64) { + *x = a + b; + } + + public struct X(u64, bool) has drop; + + #[test] + fun test_struct_borrow() { + let x = &X(1, false); + assert!(x.0 == 1); + } + + #[test] + fun test_vector_mut_borrow() { + let x = &mut 1; + *x = 2; + *x = 3; + let mut y = vector[*x]; + *y.borrow_mut(0) = 4; + assert!(*y.borrow(0) == 4, 42); + assert!(*x == 3, 42) + } + + #[test] + fun test_vector_mut_borrow_pop() { + let x = &mut 1; + *x = 2; + *x = 3; + let mut y = vector[*x]; + *y.borrow_mut(0) = 4; + assert!(*y.borrow(0) == 4); + assert!(y.pop_back() == 4); + } + + public struct Y { + x: u64, + y: T, + } has drop; + + #[test] + fun nested_struct_reference_mutation() { + let mut y = Y { x: 1, y: Y { x: 2, y: Y { x: 3, y: 4 } } }; + + assert!(y.y.y.x == 3, y.y.y.x); + + let l0 = &mut y.y; + l0(l0); + assert!(y.y.y.x == 4, y.y.y.x); + } + + fun l0(x: &mut Y>){ + l1(&mut x.y); + } + + fun l1(x: &mut Y){ + incr(&mut x.x); + } + + fun incr(a: &mut u64) { + *a = *a + 1; + } +} + diff --git a/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/sources/structs.move b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/sources/structs.move new file mode 100644 index 00000000000000..93bbf2851810f7 --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_tests/tracing-unit-tests/sources/structs.move @@ -0,0 +1,44 @@ +module 0x1::packs { + + public struct X(u64, bool, u8) has drop; + + public struct GenX(A, B, C) has drop; + + #[test] + fun test_pack_order() { + let a = 1; + let b = true; + let c = 0u8; + let x = X(a, b, c); + assert!(x.2 == 0u8, x.0); + } + + #[test] + fun test_unpack_order() { + let a = 1; + let b = true; + let c = 0u8; + let x = X(a, b, c); + let X(a, b, c) = x; + assert!(c == 0u8 && b, a); + } + + #[test] + fun test_gen_pack_order() { + let a = 1u64; + let b = true; + let c = 0u8; + let x = GenX(a, b, c); + assert!(x.2 == 0u8, x.0); + } + + #[test] + fun test_gen_unpack_order() { + let a = 1u64; + let b = true; + let c = 0u8; + let x = GenX(a, b, c); + let GenX(a, b, c) = x; + assert!(c == 0u8 && b, a); + } +} diff --git a/external-crates/move/crates/move-cli/tests/tracing_testsuite.rs b/external-crates/move/crates/move-cli/tests/tracing_testsuite.rs new file mode 100644 index 00000000000000..cfe95ec02ac3ad --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/tracing_testsuite.rs @@ -0,0 +1,26 @@ +// Copyright (c) The Diem Core Contributors +// Copyright (c) The Move Contributors +// SPDX-License-Identifier: Apache-2.0 + +use std::path::Path; + +#[allow(unused_variables)] +fn run_all(args_path: &Path) -> datatest_stable::Result<()> { + #[cfg(feature = "gas-profiler")] + { + use move_cli::sandbox::commands::test; + use std::path::PathBuf; + let cli_exe = env!("CARGO_BIN_EXE_move"); + let use_temp_dir = !args_path.parent().unwrap().join("NO_TEMPDIR").exists(); + test::run_one( + args_path, + &PathBuf::from(cli_exe), + /* use_temp_dir */ use_temp_dir, + /* track_cov */ false, + )?; + } + Ok(()) +} + +// runs all the tests +datatest_stable::harness!(run_all, "tests/tracing_tests", r"args\.txt$"); diff --git a/external-crates/move/crates/move-trace-format/Cargo.toml b/external-crates/move/crates/move-trace-format/Cargo.toml new file mode 100644 index 00000000000000..8b0aad362d2823 --- /dev/null +++ b/external-crates/move/crates/move-trace-format/Cargo.toml @@ -0,0 +1,34 @@ +[package] +name = "move-trace-format" +version = "0.0.1" +authors = ["Move Core Contributors"] +description = "Move Trace Format" +license = "Apache-2.0" +edition = "2021" + +[dependencies] +anyhow.workspace = true +proptest = { workspace = true, optional = true } +proptest-derive = { workspace = true, optional = true } +ref-cast.workspace = true +variant_count.workspace = true +move-core-types.workspace = true +serde.workspace = true +arbitrary = { workspace = true, optional = true, features = ["derive"] } +enum-compat-util.workspace = true +move-proc-macros.workspace = true +move-binary-format.workspace = true + +# wasm support (requires js feature of getrandom) +getrandom = { workspace = true, features = ["js"], optional = true } +serde_json = { workspace = true, features = ["arbitrary_precision"] } + +[dev-dependencies] +proptest.workspace = true +proptest-derive.workspace = true +move-core-types = { workspace = true, features = ["fuzzing" ] } + +[features] +default = [] +fuzzing = ["proptest", "proptest-derive", "arbitrary", "move-core-types/fuzzing"] +wasm = ["getrandom"] diff --git a/external-crates/move/crates/move-trace-format/src/format.rs b/external-crates/move/crates/move-trace-format/src/format.rs new file mode 100644 index 00000000000000..4d4f9698cbd899 --- /dev/null +++ b/external-crates/move/crates/move-trace-format/src/format.rs @@ -0,0 +1,388 @@ +// Copyright (c) The Move Contributors +// SPDX-License-Identifier: Apache-2.0 + +// IDEA: Post trace analysis -- report when values are dropped. + +use crate::interface::{NopTracer, Tracer, Writer}; +use move_binary_format::{ + file_format::{Bytecode, FunctionDefinitionIndex as BinaryFunctionDefinitionIndex}, + file_format_common::instruction_opcode, +}; +use move_core_types::{ + annotated_value::MoveValue, + language_storage::{ModuleId, TypeTag}, +}; +use serde::Serialize; +use std::fmt::Display; + +/// An index into the trace. This should be used when referring to locations in the trace. +/// Otherwise, a `usize` should be used when referring to indices that are not in the trace. +pub type TraceIndex = usize; +pub type TraceVersion = u64; + +/// The current version of the trace format. +const TRACE_VERSION: TraceVersion = 1; + +/// A Location is a valid root for a reference. This can either be a local in a frame, a stack +/// value, or a reference into another location (e.g., vec[0][2]). +/// +/// Note that we track aliasing through the locations so you can always trace back to the root +/// value for the reference. +#[derive(Debug, Clone, Eq, PartialEq, Serialize)] +pub enum Location { + // Local index in a frame. The frame is identified by the index in the trace where it was created. + // The `usize` is the index into the locals of the frame. + Local(TraceIndex, usize), + // An indexed location. This is a reference into another location (e.g., due to a borrow field, + // or a reference into a vector). + Indexed(Box, usize), + // A global reference. + // Identified by the location in the trace where it was introduced. + Global(TraceIndex), +} + +/// A Read event. This represents a read from a location, with the value read and whether the value +/// was moved or not. +#[derive(Clone, Debug, Eq, PartialEq, Serialize)] +pub struct Read { + pub location: Location, + pub root_value_read: TraceValue, + pub moved: bool, +} + +/// A Write event. This represents a write to a location with the value written and a snapshot of +/// the value that was written. Note that the `root_value_after_write` is a snapshot of the +/// _entire_ (root) value that was written after the write. +#[derive(Clone, Debug, Eq, PartialEq, Serialize)] +pub struct Write { + pub location: Location, + pub root_value_after_write: TraceValue, +} + +/// A TraceValue is a value in the standard MoveValue domain + references. +/// References hold their own snapshot of the root value they point to, along with the rooted path to +/// the value that they reference within that snapshot. +#[derive(Clone, Debug, Eq, PartialEq, Serialize)] +pub enum TraceValue { + RuntimeValue { + value: MoveValue, + }, + ImmRef { + location: Location, + // Snapshot of the root value. + snapshot: Box, + }, + MutRef { + location: Location, + // Snapshot of the root value. + snapshot: Box, + }, +} + +#[derive(Clone, Debug, Eq, PartialEq, Serialize)] +pub enum RefType { + Imm, + Mut, +} + +/// Type tag with references. This is a type tag that also supports references. +/// if ref_type is None, this is a value type. If ref_type is Some, this is a reference type of the +/// given reference type. +#[derive(Clone, Debug, Eq, PartialEq, Serialize)] +pub struct TypeTagWithRefs { + pub type_: TypeTag, + pub ref_type: Option, +} + +/// A `Frame` represents a stack frame in the Move VM and a given instantiation of a function. +#[derive(Clone, Debug, Eq, PartialEq, Serialize)] +pub struct Frame { + // The frame id is the offset in the trace where this frame was opened. + pub frame_id: TraceIndex, + pub function_name: String, + pub module: ModuleId, + // External pointer out into the module -- the `FunctionDefinitionIndex` in the module. + pub binary_member_index: u16, + pub type_instantiation: Vec, + pub parameters: Vec, + pub return_types: Vec, + pub locals_types: Vec, + pub is_native: bool, +} + +/// An instruction effect is a single effect of an instruction. This can be a push/pop of a value +/// or a reference to a value, or a read/write of a value. +#[derive(Clone, Debug, Eq, PartialEq, Serialize)] +pub enum Effect { + // Pop a value off the stack (pre-effect only) + Pop(TraceValue), + // Read a value from a location (pre-effect only) + Read(Read), + + // Push a value on the stack (post-effect only) + Push(TraceValue), + // Write a value to a location (post-effect only) + Write(Write), + + // A data load Effect + DataLoad(DataLoad), + + // An execution error occured + ExecutionError(String), +} + +/// Represent a data load event. This is a load of a value from storage. We only record loads by +/// reference in the trace, and we snapshot the value at the reference location at the time of load +/// and record its global reference ID (i.e., the location in the trace at which it was loaded). +#[derive(Clone, Debug, Eq, PartialEq, Serialize)] +pub struct DataLoad { + pub ref_type: RefType, + pub location: Location, + pub snapshot: MoveValue, +} + +/// A TraceEvent is a single event in the Move VM, external events can also be interleaved in the +/// trace. MoveVM events, are well structured, and can be a frame event or an instruction event. +#[derive(Debug, Clone, Eq, PartialEq, Serialize)] +pub enum TraceEvent { + OpenFrame { + frame: Box, + gas_left: u64, + }, + CloseFrame { + frame_id: TraceIndex, + return_: Vec, + gas_left: u64, + }, + Instruction { + type_parameters: Vec, + pc: u16, + gas_left: u64, + instruction: Box, + }, + Effect(Box), + External(Box), +} + +#[derive(Serialize, Debug, Clone, Eq, PartialEq)] +pub struct MoveTrace { + pub version: TraceVersion, + pub events: Vec, +} + +/// The Move trace format. The custom tracer is not serialized, but the events are. +/// This is the format that the Move VM will output traces in, and the `tracer` can output +/// additional events to the trace. +pub struct MoveTraceBuilder { + pub tracer: Box, + + pub trace: MoveTrace, +} + +impl TraceValue { + pub fn snapshot(&self) -> &MoveValue { + match self { + TraceValue::ImmRef { snapshot, .. } | TraceValue::MutRef { snapshot, .. } => snapshot, + TraceValue::RuntimeValue { value } => value, + } + } + + pub fn value_mut(&mut self) -> Option<&mut MoveValue> { + match self { + TraceValue::RuntimeValue { value, .. } => Some(value), + _ => None, + } + } + + pub fn location(&self) -> Option<&Location> { + match self { + TraceValue::ImmRef { location, .. } | TraceValue::MutRef { location, .. } => { + Some(location) + } + _ => None, + } + } +} + +impl MoveTrace { + pub fn new() -> Self { + Self { + version: TRACE_VERSION, + events: vec![], + } + } + + pub fn to_json(&self) -> serde_json::Value { + serde_json::to_value(self).unwrap() + } +} + +impl MoveTraceBuilder { + /// Create a new `MoveTraceBuilder` with no additional tracing. + pub fn new() -> Self { + Self { + tracer: Box::new(NopTracer), + trace: MoveTrace::new(), + } + } + + /// Create a new `MoveTraceBuilder` with a custom `tracer`. + pub fn new_with_tracer(tracer: Box) -> Self { + Self { + tracer, + trace: MoveTrace::new(), + } + } + + /// Consume the `MoveTraceBuilder` and return the `MoveTrace` that has been built by it. + pub fn into_trace(self) -> MoveTrace { + self.trace + } + + /// Get the current offset in the `MoveTrace` that is being built. + pub fn current_trace_offset(&self) -> TraceIndex { + self.trace.events.len() + } + + /// Record an `OpenFrame` event in the trace. + pub fn open_frame( + &mut self, + frame_id: TraceIndex, + binary_member_index: BinaryFunctionDefinitionIndex, + name: String, + module: ModuleId, + parameters: Vec, + type_instantiation: Vec, + return_types: Vec, + locals_types: Vec, + is_native: bool, + gas_left: u64, + ) { + let frame = Box::new(Frame { + frame_id, + function_name: name, + module, + binary_member_index: binary_member_index.0, + type_instantiation, + parameters, + return_types, + locals_types, + is_native, + }); + self.push_event(TraceEvent::OpenFrame { frame, gas_left }); + } + + /// Record a `CloseFrame` event in the trace. + pub fn close_frame(&mut self, frame_id: TraceIndex, return_: Vec, gas_left: u64) { + self.push_event(TraceEvent::CloseFrame { + frame_id, + return_, + gas_left, + }); + } + + /// Record an `Instruction` event in the trace along with the effects of the instruction. + pub fn instruction( + &mut self, + instruction: &Bytecode, + type_parameters: Vec, + effects: Vec, + gas_left: u64, + pc: u16, + ) { + self.push_event(TraceEvent::Instruction { + type_parameters, + pc, + gas_left, + instruction: Box::new(format!("{:?}", instruction_opcode(instruction))), + }); + for effect in effects { + self.push_event(TraceEvent::Effect(Box::new(effect))); + } + } + + /// Push an `Effect` event to the trace. + pub fn effect(&mut self, effect: Effect) { + self.push_event(TraceEvent::Effect(Box::new(effect))); + } + + // All events pushed to the trace are first pushed, and then the tracer is notified of the + // event. + fn push_event(&mut self, event: TraceEvent) { + self.trace.events.push(event.clone()); + self.tracer.notify(&event, Writer(&mut self.trace)); + } +} + +impl Display for TraceValue { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + TraceValue::RuntimeValue { value } => { + write!(f, "{:#}", value) + } + TraceValue::ImmRef { location, snapshot } => { + write!(f, "&{} {:#}", location, snapshot) + } + TraceValue::MutRef { location, snapshot } => { + write!(f, "&mut {} {:#}", location, snapshot) + } + } + } +} + +impl Display for Location { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Location::Local(frame_idx, idx) => { + write!(f, "l{idx}@{frame_idx}") + } + Location::Indexed(loc, offset) => { + write!(f, "{loc}[{offset}]") + } + Location::Global(id) => { + write!(f, "g{}", id) + } + } + } +} + +impl Display for Effect { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Effect::Pop(value) => { + write!(f, "Pop {}", value) + } + Effect::Push(value) => { + write!(f, "Push {}", value) + } + Effect::Read(Read { + location, + root_value_read: value_read, + moved, + }) => { + let arrow = if *moved { "==>" } else { "-->" }; + write!(f, "{location} {arrow} {value_read}") + } + Effect::Write(Write { + location, + root_value_after_write: value_written, + }) => { + write!(f, "{location} <-- {value_written}") + } + Effect::ExecutionError(error_string) => { + write!(f, "ExecutionError: {error_string}") + } + Effect::DataLoad(DataLoad { + ref_type, + location, + snapshot, + }) => { + let ref_type = match ref_type { + RefType::Imm => "&", + RefType::Mut => "&mut", + }; + write!(f, "g{ref_type}{location} ~~> {snapshot}") + } + } + } +} diff --git a/external-crates/move/crates/move-trace-format/src/interface.rs b/external-crates/move/crates/move-trace-format/src/interface.rs new file mode 100644 index 00000000000000..c48791c0ce6453 --- /dev/null +++ b/external-crates/move/crates/move-trace-format/src/interface.rs @@ -0,0 +1,39 @@ +// Copyright (c) The Move Contributors +// SPDX-License-Identifier: Apache-2.0 + +use crate::format::{MoveTrace, TraceEvent, TraceVersion}; +use serde::Serialize; + +/// This is meant to be an internal tracing interface for the VM, and should only be implemented +/// and used if you are _sure_ that you want/need to use it. Generally you should use the output +/// trace format for any analysis or debugging purposes. This should only be used if you want to +/// add custom tracing data to the VM's traces that cannot be added using other means or +/// post-processing. +pub trait Tracer { + /// Notify the tracer of a new event in the VM. This is called for every event that is emitted, + /// and immediatlye _after_ the `event` has been added to the trace held inside of the `writer`. + fn notify(&mut self, event: &TraceEvent, writer: Writer<'_>); +} + +pub struct NopTracer; +impl Tracer for NopTracer { + fn notify(&mut self, _event: &TraceEvent, _writer: Writer<'_>) {} +} + +/// A writer that allows you to push custom events to the trace but encapsulates the trace so that +/// non-external events cannot be accidentally added. +pub struct Writer<'a>(pub(crate) &'a mut MoveTrace); + +impl<'a> Writer<'a> { + /// Emit an external event into the trace. + pub fn push(&mut self, e: T) { + self.0.events.push(TraceEvent::External(Box::new( + serde_json::to_value(e).unwrap(), + ))); + } + + /// Get the current version of the trace. + pub fn trace_version(&mut self) -> TraceVersion { + self.0.version + } +} diff --git a/external-crates/move/crates/move-trace-format/src/lib.rs b/external-crates/move/crates/move-trace-format/src/lib.rs new file mode 100644 index 00000000000000..5f307d24f1aedc --- /dev/null +++ b/external-crates/move/crates/move-trace-format/src/lib.rs @@ -0,0 +1,6 @@ +// Copyright (c) The Move Contributors +// SPDX-License-Identifier: Apache-2.0 + +pub mod format; +pub mod interface; +pub mod memory_tracer; diff --git a/external-crates/move/crates/move-trace-format/src/memory_tracer.rs b/external-crates/move/crates/move-trace-format/src/memory_tracer.rs new file mode 100644 index 00000000000000..910d6910cb7bb8 --- /dev/null +++ b/external-crates/move/crates/move-trace-format/src/memory_tracer.rs @@ -0,0 +1,196 @@ +// Copyright (c) The Move Contributors +// SPDX-License-Identifier: Apache-2.0 + +//! This module contains the implementation of the memory tracer. The memory tracer is a tracer +//! that takes a stream of trace events, and uses these events to create a snapshot of the memory +//! state (operand stack, locals, and globals) at each point in time during execution. +//! +//! The memory tracer then emits `External` events with the current VM state for every instruction, +//! and open/close frame event that is has built up. +//! +//! The memory tracer is useful for debugging, and as an example of how to build up this +//! state for more advanced analysis and also using the custom tracing trait. + +use crate::{ + format::{DataLoad, Effect, Location, Read, TraceEvent, TraceIndex, TraceValue, Write}, + interface::{Tracer, Writer}, +}; +use core::fmt; +use move_core_types::annotated_value::MoveValue; +use std::collections::BTreeMap; + +#[derive(Debug, Clone)] +pub struct TraceState { + // Tracks "global memory" state (i.e., references out in to global memory/references returned + // from native functions). + pub loaded_state: BTreeMap, + // The current state (i.e., values) of the VM's operand stack. + pub operand_stack: Vec, + // The current call stack indexed by frame id. Maps from the frame id to the current state of + // the frame's locals. The bool indicates if the frame is native or not. + pub call_stack: BTreeMap, bool)>, +} + +impl TraceState { + pub fn new() -> Self { + Self { + loaded_state: BTreeMap::new(), + operand_stack: vec![], + call_stack: BTreeMap::new(), + } + } + + /// Apply an event to the state machine and update the locals state accordingly. + fn apply_event(&mut self, event: &TraceEvent) { + match event { + TraceEvent::OpenFrame { frame, .. } => { + let mut locals = BTreeMap::new(); + for (i, p) in frame.parameters.iter().enumerate() { + // NB: parameters are passed directly, so we just pop to make sure they aren't also + // left on the operand stack. For the initial call, these pops may (should) fail, but that + // is fine as we already have the values in the parameter list. + self.operand_stack.pop(); + locals.insert(i, p.clone()); + } + + self.call_stack + .insert(frame.frame_id, (locals, frame.is_native)); + } + TraceEvent::CloseFrame { .. } => { + self.call_stack + .pop_last() + .expect("Unbalanced call stack in memory tracer -- this should never happen"); + } + TraceEvent::Effect(ef) => match &**ef { + Effect::ExecutionError(_) => (), + Effect::Push(value) => { + self.operand_stack.push(value.clone()); + } + Effect::Pop(_) => { + self.operand_stack.pop().expect( + "Tried to pop off the empty operand stack -- this should never happen", + ); + } + Effect::Read(Read { + location, + root_value_read: _, + moved, + }) => { + if *moved { + match location { + Location::Local(frame_idx, idx) => { + let frame = self.call_stack.get_mut(frame_idx).unwrap(); + frame.0.remove(idx); + } + Location::Indexed(..) => { + panic!("Cannot move from indexed location"); + } + Location::Global(..) => { + panic!("Cannot move from global location"); + } + } + } + } + Effect::Write(Write { + location, + root_value_after_write: value_written, + }) => match location { + Location::Local(frame_idx, idx) => { + let frame = self.call_stack.get_mut(frame_idx).unwrap(); + frame.0.insert(*idx, value_written.clone()); + } + Location::Indexed(location, _idx) => { + let val = self.get_mut_location(location); + *val = value_written.clone().snapshot().clone(); + } + Location::Global(id) => { + let val = self.loaded_state.get_mut(id).unwrap(); + *val = value_written.snapshot().clone(); + } + }, + Effect::DataLoad(DataLoad { + location, snapshot, .. + }) => { + let Location::Global(id) = location else { + unreachable!("Dataload by reference must have a global location"); + }; + self.loaded_state.insert(*id, snapshot.clone()); + } + }, + // External events are treated opaqeuly + TraceEvent::External(_) => (), + // Instructions + TraceEvent::Instruction { .. } => (), + } + } + + /// Given a reference "location" return a mutable reference to the value it points to so that + /// it can be updated. + fn get_mut_location(&mut self, location: &Location) -> &mut MoveValue { + match location { + Location::Local(frame_idx, idx) => { + let frame = self.call_stack.get_mut(frame_idx).unwrap(); + frame.0.get_mut(idx).unwrap().value_mut().unwrap() + } + Location::Indexed(loc, _offset) => self.get_mut_location(loc), + Location::Global(id) => self.loaded_state.get_mut(id).unwrap(), + } + } +} + +impl Tracer for TraceState { + fn notify(&mut self, event: &TraceEvent, mut write: Writer<'_>) { + self.apply_event(event); + // We only emit the state when we hit a non-effect internal event. This coincides with + // emitting the current state of the VM before each instruction/function call. + match event { + TraceEvent::Instruction { .. } + | TraceEvent::OpenFrame { .. } + | TraceEvent::CloseFrame { .. } => { + write.push(self.to_string()); + } + _ => (), + } + } +} + +impl fmt::Display for TraceState { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + if !self.loaded_state.is_empty() { + writeln!(f, "Loaded state:")?; + for (id, v) in &self.loaded_state { + writeln!( + f, + "\t{}: {}", + id, + format!("{:#}", v).replace('\n', "\n\t ") + )?; + } + } + + if !self.operand_stack.is_empty() { + writeln!(f, "Operand stack:")?; + for (i, v) in self.operand_stack.iter().enumerate() { + writeln!(f, "\t{}: {}", i, format!("{:#}", v).replace('\n', "\n\t "))?; + } + } + + if !self.call_stack.is_empty() { + writeln!(f, "Call stack:")?; + for (i, (frame, _)) in self.call_stack.iter() { + if !frame.is_empty() { + writeln!(f, "\tFrame {}:", i)?; + for (j, v) in frame.iter() { + writeln!( + f, + "\t\t{}: {}", + j, + format!("{:#}", v).replace('\n', "\n\t\t") + )?; + } + } + } + } + Ok(()) + } +} diff --git a/external-crates/move/crates/move-unit-test/Cargo.toml b/external-crates/move/crates/move-unit-test/Cargo.toml index 2d60a4cf9a0cf8..d6a3d543ffcf52 100644 --- a/external-crates/move/crates/move-unit-test/Cargo.toml +++ b/external-crates/move/crates/move-unit-test/Cargo.toml @@ -34,6 +34,7 @@ move-vm-test-utils.workspace = true move-binary-format.workspace = true move-model.workspace = true move-bytecode-utils.workspace = true +move-trace-format.workspace = true bcs.workspace = true rand.workspace = true diff --git a/external-crates/move/crates/move-unit-test/src/lib.rs b/external-crates/move/crates/move-unit-test/src/lib.rs index 9043af54dd6d9b..078768a017d260 100644 --- a/external-crates/move/crates/move-unit-test/src/lib.rs +++ b/external-crates/move/crates/move-unit-test/src/lib.rs @@ -32,6 +32,7 @@ const DEFAULT_RAND_ITERS: u64 = 10; const RAND_NUM_ITERS_FLAG: &str = "rand-num-iters"; const SEED_FLAG: &str = "seed"; +const TRACE_FLAG: &str = "trace-execution"; #[derive(Debug, Parser, Clone)] #[clap(author, version, about)] @@ -111,6 +112,10 @@ pub struct UnitTestingConfig { // WARNING: You should only use this flag for debugging and meta-testing purposes! #[clap(skip)] pub deterministic_generation: bool, + + // Enable tracing for tests + #[clap(long = TRACE_FLAG, value_name = "PATH")] + pub trace_execution: Option>, } fn format_module_id( @@ -141,6 +146,7 @@ impl UnitTestingConfig { rand_num_iters: Some(DEFAULT_RAND_ITERS), seed: None, deterministic_generation: false, + trace_execution: None, } } @@ -237,6 +243,11 @@ impl UnitTestingConfig { } writeln!(shared_writer.lock().unwrap(), "Running Move unit tests")?; + let trace_location = match &self.trace_execution { + Some(None) => Some("traces".to_string()), + Some(Some(path)) => Some(path.clone()), + None => None, + }; let mut test_runner = TestRunner::new( self.gas_limit.unwrap_or(DEFAULT_EXECUTION_BOUND), self.num_threads, @@ -244,6 +255,7 @@ impl UnitTestingConfig { self.seed, rand_num_iters, self.deterministic_generation, + trace_location, test_plan, native_function_table, cost_table, diff --git a/external-crates/move/crates/move-unit-test/src/test_reporter.rs b/external-crates/move/crates/move-unit-test/src/test_reporter.rs index 71ab7ae300d270..221b2953f2bd43 100644 --- a/external-crates/move/crates/move-unit-test/src/test_reporter.rs +++ b/external-crates/move/crates/move-unit-test/src/test_reporter.rs @@ -15,9 +15,11 @@ use move_core_types::{ vm_status::{StatusCode, StatusType}, }; use move_ir_types::location::Loc; +use move_trace_format::format::MoveTrace; use std::{ collections::{BTreeMap, BTreeSet}, io::{Result, Write}, + path::Path, sync::Mutex, time::Duration, }; @@ -40,7 +42,7 @@ pub enum FailureReason { Property(String), } -#[derive(Debug, Clone, Ord, PartialOrd, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct TestFailure { pub test_run_info: TestRunInfo, pub vm_error: Option, @@ -48,10 +50,11 @@ pub struct TestFailure { pub prng_seed: Option, } -#[derive(Debug, Clone, Ord, PartialOrd, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct TestRunInfo { pub elapsed_time: Duration, pub instructions_executed: u64, + pub trace: Option, } type TestRuns = BTreeMap>; @@ -68,11 +71,34 @@ pub struct TestResults { test_plan: TestPlan, } +fn write_string_to_file(filepath: &str, content: &str) -> std::io::Result<()> { + let path = Path::new(filepath); + if let Some(parent) = path.parent() { + std::fs::create_dir_all(parent)?; + } + let mut file = std::fs::File::create(path)?; + file.write_all(content.as_bytes())?; + Ok(()) +} + impl TestRunInfo { - pub fn new(elapsed_time: Duration, instructions_executed: u64) -> Self { + pub fn new( + elapsed_time: Duration, + instructions_executed: u64, + trace: Option, + ) -> Self { Self { elapsed_time, instructions_executed, + trace, + } + } + + pub fn save_trace(&self, path: &str) -> Result<()> { + if let Some(trace) = &self.trace { + write_string_to_file(path, &format!("{}", trace.to_json())) + } else { + Ok(()) } } } diff --git a/external-crates/move/crates/move-unit-test/src/test_runner.rs b/external-crates/move/crates/move-unit-test/src/test_runner.rs index 9cc5b87c9ca0f0..ee70b939a0bcf1 100644 --- a/external-crates/move/crates/move-unit-test/src/test_runner.rs +++ b/external-crates/move/crates/move-unit-test/src/test_runner.rs @@ -30,6 +30,7 @@ use move_core_types::{ u256::U256, vm_status::StatusCode, }; +use move_trace_format::format::MoveTraceBuilder; use move_vm_runtime::{move_vm::MoveVM, native_functions::NativeFunctionTable}; use move_vm_test_utils::{ gas_schedule::{unit_cost_schedule, CostTable, Gas, GasStatus}, @@ -51,6 +52,7 @@ pub struct SharedTestingConfig { prng_seed: Option, num_iters: u64, deterministic_generation: bool, + trace_location: Option, } pub struct TestRunner { @@ -114,6 +116,7 @@ impl TestRunner { prng_seed: Option, num_iters: u64, deterministic_generation: bool, + trace_location: Option, tests: TestPlan, // TODO: maybe we should require the clients to always pass in a list of native functions so // we don't have to make assumptions about their gas parameters. @@ -144,6 +147,7 @@ impl TestRunner { prng_seed, num_iters, deterministic_generation, + trace_location, }, num_threads, tests, @@ -248,6 +252,14 @@ impl SharedTestingConfig { ) { let move_vm = MoveVM::new(self.native_function_table.clone()).unwrap(); let extensions = extensions::new_extensions(); + + let mut move_tracer = MoveTraceBuilder::new(); + let tracer = if self.trace_location.is_some() { + Some(&mut move_tracer) + } else { + None + }; + let mut session = move_vm.new_session_with_extensions(&self.starting_storage_state, extensions); let mut gas_meter = GasStatus::new(&self.cost_table, Gas::new(self.execution_bound)); @@ -261,15 +273,16 @@ impl SharedTestingConfig { } // TODO: collect VM logs if the verbose flag (i.e, `self.verbose`) is set - let now = Instant::now(); - let serialized_return_values_result = session.execute_function_bypass_visibility( - &test_plan.module_id, - IdentStr::new(function_name).unwrap(), - vec![], // no ty args, at least for now - serialize_values(arguments.iter()), - &mut gas_meter, - ); + let serialized_return_values_result = session + .execute_function_bypass_visibility_with_tracer_if_enabled( + &test_plan.module_id, + IdentStr::new(function_name).unwrap(), + vec![], // no ty args, at least for now + serialize_values(arguments.iter()), + &mut gas_meter, + tracer, + ); let mut return_result = serialized_return_values_result.map(|res| { res.return_values .into_iter() @@ -281,6 +294,11 @@ impl SharedTestingConfig { err.remove_exec_state(); } } + let trace = if self.trace_location.is_some() { + Some(move_tracer.into_trace()) + } else { + None + }; let test_run_info = TestRunInfo::new( now.elapsed(), // TODO(Gas): This doesn't look quite right... @@ -289,6 +307,7 @@ impl SharedTestingConfig { .checked_sub(gas_meter.remaining_gas()) .unwrap() .into(), + trace, ); match session.finish_with_extensions().0 { Ok((cs, extensions)) => (Ok(cs), Ok(extensions), return_result, test_run_info), @@ -408,6 +427,25 @@ impl SharedTestingConfig { let (_cs_result, _ext_result, exec_result, test_run_info) = self.execute_via_move_vm(test_plan, function_name, arguments); + // Save the trace -- one per test -- for each test that we have traced (and if tracing is + // enabled). + if let Some(location) = &self.trace_location { + let trace_file_location = format!( + "{}/{}__{}{}.json", + location, + format_module_id(output.test_info, &output.test_plan.module_id).replace("::", "__"), + function_name, + if let Some(seed) = prng_seed { + format!("_seed_{}", seed) + } else { + "".to_string() + } + ); + if let Err(e) = test_run_info.save_trace(&trace_file_location) { + eprintln!("Unable to save trace to {trace_file_location} -- {:?}", e); + } + } + match exec_result { Err(err) => { let sub_status = err.sub_status().and_then(|status| { diff --git a/external-crates/move/crates/move-vm-runtime/Cargo.toml b/external-crates/move/crates/move-vm-runtime/Cargo.toml index aa26f0f8951114..df1bbe98ef77f0 100644 --- a/external-crates/move/crates/move-vm-runtime/Cargo.toml +++ b/external-crates/move/crates/move-vm-runtime/Cargo.toml @@ -26,6 +26,7 @@ move-vm-config.workspace = true move-vm-types.workspace = true move-binary-format.workspace = true move-vm-profiler.workspace = true +move-trace-format.workspace = true [dev-dependencies] anyhow.workspace = true diff --git a/external-crates/move/crates/move-vm-runtime/src/interpreter.rs b/external-crates/move/crates/move-vm-runtime/src/interpreter.rs index 943d1af403eb88..48e33daabf15fc 100644 --- a/external-crates/move/crates/move-vm-runtime/src/interpreter.rs +++ b/external-crates/move/crates/move-vm-runtime/src/interpreter.rs @@ -6,6 +6,7 @@ use crate::{ loader::{Function, Loader, Resolver}, native_functions::NativeContext, trace, + tracing2::tracer::VMTracer, }; use fail::fail_point; use move_binary_format::{ @@ -77,9 +78,9 @@ enum InstrRet { /// It mimics execution on a single thread, with an call stack and an operand stack. pub(crate) struct Interpreter { /// Operand stack, where Move `Value`s are stored for stack operations. - operand_stack: Stack, + pub(crate) operand_stack: Stack, /// The stack of active functions. - call_stack: CallStack, + pub(crate) call_stack: CallStack, /// Limits imposed at runtime runtime_limits_config: VMRuntimeLimitsConfig, } @@ -110,12 +111,24 @@ impl Interpreter { gas_meter: &mut impl GasMeter, extensions: &mut NativeContextExtensions, loader: &Loader, + tracer: &mut Option>, ) -> VMResult> { let mut interpreter = Interpreter { operand_stack: Stack::new(), call_stack: CallStack::new(), runtime_limits_config: loader.vm_config().runtime_limits_config.clone(), }; + #[cfg(feature = "gas-profiler")] + tracer.as_mut().map(|tracer| { + tracer.open_initial_frame( + &args, + &ty_args, + &function, + &loader, + gas_meter.remaining_gas().into(), + data_store.link_context(), + ) + }); profile_open_frame!(gas_meter, function.pretty_string()); if function.is_native() { @@ -141,12 +154,16 @@ impl Interpreter { .finish(Location::Module(function.module_id().clone())) })?; + #[cfg(feature = "gas-profiler")] + tracer.as_mut().map(|tracer| { + tracer.close_initial_frame(&return_values, gas_meter.remaining_gas().into()) + }); profile_close_frame!(gas_meter, function.pretty_string()); Ok(return_values.into_iter().collect()) } else { interpreter.execute_main( - loader, data_store, gas_meter, extensions, function, ty_args, args, + loader, data_store, gas_meter, extensions, function, ty_args, args, tracer, ) } } @@ -166,6 +183,7 @@ impl Interpreter { function: Arc, ty_args: Vec, args: Vec, + tracer: &mut Option>, ) -> VMResult> { let mut locals = Locals::new(function.local_count()); for (i, value) in args.into_iter().enumerate() { @@ -187,7 +205,7 @@ impl Interpreter { loop { let resolver = current_frame.resolver(link_context, loader); let exit_code = current_frame //self - .execute_code(&resolver, &mut self, gas_meter) + .execute_code(&resolver, &mut self, gas_meter, tracer) .map_err(|err| self.maybe_core_dump(err, ¤t_frame))?; match exit_code { ExitCode::Return => { @@ -201,6 +219,17 @@ impl Interpreter { .charge_drop_frame(non_ref_vals.into_iter()) .map_err(|e| self.set_location(e))?; + #[cfg(feature = "gas-profiler")] + tracer.as_mut().map(|tracer| { + tracer.close_frame( + ¤t_frame, + ¤t_frame.function, + &self, + &loader, + gas_meter.remaining_gas().into(), + link_context, + ) + }); profile_close_frame!(gas_meter, current_frame.function.pretty_string()); if let Some(frame) = self.call_stack.pop() { @@ -215,8 +244,20 @@ impl Interpreter { ExitCode::Call(fh_idx) => { let func = resolver.function_from_handle(fh_idx); #[cfg(feature = "gas-profiler")] - let func_name = func.pretty_string(); - profile_open_frame!(gas_meter, func_name.clone()); + tracer.as_mut().map(|tracer| { + tracer.open_frame( + &[], + &func, + ¤t_frame, + &self, + &loader, + gas_meter.remaining_gas().into(), + link_context, + ) + }); + #[cfg(feature = "gas-profiler")] + let func_clone = func.clone(); + profile_open_frame!(gas_meter, func_clone.pretty_string()); // Charge gas let module_id = func.module_id(); @@ -236,7 +277,18 @@ impl Interpreter { current_frame.pc += 1; // advance past the Call instruction in the caller - profile_close_frame!(gas_meter, func_name.clone()); + #[cfg(feature = "gas-profiler")] + tracer.as_mut().map(|tracer| { + tracer.close_frame( + ¤t_frame, + &func_clone, + &self, + &loader, + gas_meter.remaining_gas().into(), + link_context, + ) + }); + profile_close_frame!(gas_meter, func_clone.pretty_string()); continue; } let frame = self @@ -258,8 +310,20 @@ impl Interpreter { .map_err(|e| set_err_info!(current_frame, e))?; let func = resolver.function_from_instantiation(idx); #[cfg(feature = "gas-profiler")] - let func_name = func.pretty_string(); - profile_open_frame!(gas_meter, func_name.clone()); + tracer.as_mut().map(|tracer| { + tracer.open_frame( + &ty_args, + &func, + ¤t_frame, + &self, + &loader, + gas_meter.remaining_gas().into(), + link_context, + ) + }); + #[cfg(feature = "gas-profiler")] + let func_clone = func.clone(); + profile_open_frame!(gas_meter, func_clone.pretty_string()); // Charge gas let module_id = func.module_id(); @@ -278,7 +342,18 @@ impl Interpreter { if func.is_native() { self.call_native(&resolver, gas_meter, extensions, func, ty_args)?; current_frame.pc += 1; // advance past the Call instruction in the caller - profile_close_frame!(gas_meter, func_name.clone()); + #[cfg(feature = "gas-profiler")] + tracer.as_mut().map(|tracer| { + tracer.close_frame( + ¤t_frame, + &func_clone, + &self, + &loader, + gas_meter.remaining_gas().into(), + link_context, + ) + }); + profile_close_frame!(gas_meter, func_clone.pretty_string()); continue; } @@ -684,8 +759,8 @@ const OPERAND_STACK_SIZE_LIMIT: usize = 1024; const CALL_STACK_SIZE_LIMIT: usize = 1024; /// The operand stack. -struct Stack { - value: Vec, +pub(crate) struct Stack { + pub(crate) value: Vec, } impl Stack { @@ -743,7 +818,7 @@ impl Stack { /// A call stack. // #[derive(Debug)] -struct CallStack(Vec); +pub(crate) struct CallStack(pub(crate) Vec); impl CallStack { /// Create a new empty call stack. @@ -775,11 +850,11 @@ impl CallStack { /// A `Frame` is the execution context for a function. It holds the locals of the function and /// the function itself. // #[derive(Debug)] -struct Frame { - pc: u16, - locals: Locals, - function: Arc, - ty_args: Vec, +pub(crate) struct Frame { + pub(crate) pc: u16, + pub(crate) locals: Locals, + pub(crate) function: Arc, + pub(crate) ty_args: Vec, } /// An `ExitCode` from `execute_code_unit`. @@ -797,8 +872,9 @@ impl Frame { resolver: &Resolver, interpreter: &mut Interpreter, gas_meter: &mut impl GasMeter, + tracer: &mut Option>, ) -> VMResult { - self.execute_code_impl(resolver, interpreter, gas_meter) + self.execute_code_impl(resolver, interpreter, gas_meter, tracer) .map_err(|e| { let e = if resolver.loader().vm_config().error_execution_state { e.with_exec_state(interpreter.get_internal_state()) @@ -1354,11 +1430,13 @@ impl Frame { Ok(InstrRet::Ok) } + #[allow(unused_variables)] fn execute_code_impl( &mut self, resolver: &Resolver, interpreter: &mut Interpreter, gas_meter: &mut impl GasMeter, + tracer: &mut Option>, ) -> PartialVMResult { let code = self.function.code(); loop { @@ -1380,6 +1458,16 @@ impl Frame { ) }); + #[cfg(feature = "gas-profiler")] + tracer.as_mut().map(|tracer| { + tracer.open_instruction( + self, + interpreter, + resolver.loader(), + gas_meter.remaining_gas().into(), + ) + }); + profile_open_instr!(gas_meter, format!("{:?}", instruction)); let r = Self::execute_instruction( @@ -1391,11 +1479,21 @@ impl Frame { interpreter, gas_meter, instruction, - )?; + ); profile_close_instr!(gas_meter, format!("{:?}", instruction)); + #[cfg(feature = "gas-profiler")] + tracer.as_mut().map(|tracer| { + tracer.close_instruction( + self, + interpreter, + resolver.loader(), + gas_meter.remaining_gas().into(), + r.as_ref().err(), + ) + }); - match r { + match r? { InstrRet::Ok => (), InstrRet::ExitCode(exit_code) => { return Ok(exit_code); diff --git a/external-crates/move/crates/move-vm-runtime/src/lib.rs b/external-crates/move/crates/move-vm-runtime/src/lib.rs index 5aadd80fb1899a..c69f0d150582db 100644 --- a/external-crates/move/crates/move-vm-runtime/src/lib.rs +++ b/external-crates/move/crates/move-vm-runtime/src/lib.rs @@ -21,6 +21,7 @@ pub mod runtime; pub mod session; #[macro_use] mod tracing; +mod tracing2; // Only include debugging functionality in debug builds #[cfg(any(debug_assertions, feature = "debugging"))] diff --git a/external-crates/move/crates/move-vm-runtime/src/loader.rs b/external-crates/move/crates/move-vm-runtime/src/loader.rs index dd23015d2ab64f..73a2c3b23052fd 100644 --- a/external-crates/move/crates/move-vm-runtime/src/loader.rs +++ b/external-crates/move/crates/move-vm-runtime/src/loader.rs @@ -1339,7 +1339,7 @@ impl Loader { // Return an instantiated type given a generic and an instantiation. // Stopgap to avoid a recursion that is either taking too long or using too // much memory - fn subst(&self, ty: &Type, ty_args: &[Type]) -> PartialVMResult { + pub(crate) fn subst(&self, ty: &Type, ty_args: &[Type]) -> PartialVMResult { // Before instantiating the type, count the # of nodes of all type arguments plus // existing type instantiation. // If that number is larger than MAX_TYPE_INSTANTIATION_NODES, refuse to construct this type. @@ -1357,6 +1357,15 @@ impl Loader { ty.subst(ty_args) } + #[cfg(feature = "gas-profiler")] + pub(crate) fn make_type( + &self, + module: &CompiledModule, + tok: &SignatureToken, + ) -> PartialVMResult { + self.module_cache.read().make_type(module, tok) + } + // Verify the kind (constraints) of an instantiation. // Function invocations call this function to verify correctness of type arguments provided fn verify_ty_args<'a, I>(&self, constraints: I, ty_args: &[Type]) -> PartialVMResult<()> @@ -1386,7 +1395,7 @@ impl Loader { self.module_cache.read().function_at(idx) } - fn get_module( + pub(crate) fn get_module( &self, link_context: AccountAddress, runtime_id: &ModuleId, diff --git a/external-crates/move/crates/move-vm-runtime/src/runtime.rs b/external-crates/move/crates/move-vm-runtime/src/runtime.rs index 8a1a344f55b9fc..0d1bf880be58bc 100644 --- a/external-crates/move/crates/move-vm-runtime/src/runtime.rs +++ b/external-crates/move/crates/move-vm-runtime/src/runtime.rs @@ -9,6 +9,7 @@ use crate::{ native_extensions::NativeContextExtensions, native_functions::{NativeFunction, NativeFunctions}, session::{LoadedFunctionInstantiation, SerializedReturnValues, Session}, + tracing2::tracer::VMTracer, }; use move_binary_format::{ errors::{verification_error, Location, PartialVMError, PartialVMResult, VMResult}, @@ -25,6 +26,7 @@ use move_core_types::{ runtime_value::MoveTypeLayout, vm_status::StatusCode, }; +use move_trace_format::format::MoveTraceBuilder; use move_vm_config::runtime::VMConfig; use move_vm_types::{ data_store::DataStore, @@ -320,6 +322,7 @@ impl VMRuntime { data_store: &mut impl DataStore, gas_meter: &mut impl GasMeter, extensions: &mut NativeContextExtensions, + tracer: &mut Option>, ) -> VMResult { let arg_types = param_types .into_iter() @@ -351,6 +354,7 @@ impl VMRuntime { gas_meter, extensions, &self.loader, + tracer, )?; let serialized_return_values = self @@ -391,6 +395,7 @@ impl VMRuntime { gas_meter: &mut impl GasMeter, extensions: &mut NativeContextExtensions, bypass_declared_entry_check: bool, + tracer: Option<&mut MoveTraceBuilder>, ) -> VMResult { use move_binary_format::file_format::SignatureIndex; fn check_is_entry( @@ -442,6 +447,7 @@ impl VMRuntime { data_store, gas_meter, extensions, + &mut tracer.map(VMTracer::new), ) } @@ -511,6 +517,7 @@ impl VMRuntime { gas_meter, extensions, bypass_declared_entry_check, + None, ) } diff --git a/external-crates/move/crates/move-vm-runtime/src/session.rs b/external-crates/move/crates/move-vm-runtime/src/session.rs index 55dffafc284bf7..f968010ead4ad6 100644 --- a/external-crates/move/crates/move-vm-runtime/src/session.rs +++ b/external-crates/move/crates/move-vm-runtime/src/session.rs @@ -19,6 +19,7 @@ use move_core_types::{ resolver::MoveResolver, runtime_value::MoveTypeLayout, }; +use move_trace_format::format::MoveTraceBuilder; use move_vm_types::{ data_store::DataStore, gas::GasMeter, @@ -87,6 +88,7 @@ impl<'r, 'l, S: MoveResolver> Session<'r, 'l, S> { gas_meter, &mut self.native_extensions, bypass_declared_entry_check, + None, ) } @@ -119,6 +121,46 @@ impl<'r, 'l, S: MoveResolver> Session<'r, 'l, S> { gas_meter, &mut self.native_extensions, bypass_declared_entry_check, + None, + ) + } + + pub fn execute_function_bypass_visibility_with_tracer_if_enabled( + &mut self, + module: &ModuleId, + function_name: &IdentStr, + ty_args: Vec, + args: Vec>, + gas_meter: &mut impl GasMeter, + tracer: Option<&mut MoveTraceBuilder>, + ) -> VMResult { + move_vm_profiler::gas_profiler_feature_enabled! { + use move_vm_profiler::GasProfiler; + if gas_meter.get_profiler_mut().is_none() { + gas_meter.set_profiler(GasProfiler::init_default_cfg( + function_name.to_string(), + gas_meter.remaining_gas().into(), + )); + } + } + + let tracer = if cfg!(feature = "gas-profiler") { + tracer + } else { + None + }; + + let bypass_declared_entry_check = true; + self.runtime.execute_function( + module, + function_name, + ty_args, + args, + &mut self.data_cache, + gas_meter, + &mut self.native_extensions, + bypass_declared_entry_check, + tracer, ) } diff --git a/external-crates/move/crates/move-vm-runtime/src/tracing2/mod.rs b/external-crates/move/crates/move-vm-runtime/src/tracing2/mod.rs new file mode 100644 index 00000000000000..33ef32dba31b0c --- /dev/null +++ b/external-crates/move/crates/move-vm-runtime/src/tracing2/mod.rs @@ -0,0 +1 @@ +pub(crate) mod tracer; diff --git a/external-crates/move/crates/move-vm-runtime/src/tracing2/tracer.rs b/external-crates/move/crates/move-vm-runtime/src/tracing2/tracer.rs new file mode 100644 index 00000000000000..56cd9889f373b1 --- /dev/null +++ b/external-crates/move/crates/move-vm-runtime/src/tracing2/tracer.rs @@ -0,0 +1,1799 @@ +// Copyright (c) The Move Contributors +// SPDX-License-Identifier: Apache-2.0 + +#[cfg(not(feature = "gas-profiler"))] +pub(crate) use vm_tracer_noop::*; +mod vm_tracer_noop { + use move_trace_format::format::MoveTraceBuilder; + + #[allow(dead_code)] + pub(crate) struct VMTracer<'a> { + _phantom: std::marker::PhantomData<&'a ()>, + } + + impl<'a> VMTracer<'a> { + #[allow(dead_code)] + pub(crate) fn new(_trace: &'a mut MoveTraceBuilder) -> Self { + Self { + _phantom: std::marker::PhantomData, + } + } + } +} + +#[cfg(feature = "gas-profiler")] +pub(crate) use vm_tracer_impl::*; +#[cfg(feature = "gas-profiler")] +mod vm_tracer_impl { + use crate::{ + interpreter::{Frame, Interpreter}, + loader::{Function, Loader}, + }; + use move_binary_format::{ + errors::PartialVMError, + file_format::{ConstantPoolIndex, SignatureIndex}, + }; + use move_core_types::{ + account_address::AccountAddress, + annotated_value::{MoveTypeLayout, MoveValue}, + language_storage::TypeTag, + }; + use move_trace_format::format::{ + DataLoad, Effect as EF, Location, MoveTraceBuilder, Read, RefType, TraceIndex, TraceValue, + TypeTagWithRefs, Write, + }; + use move_vm_types::{loaded_data::runtime_types::Type, values::Value}; + use std::collections::BTreeMap; + + /// Internal state for the tracer. This is where the actual tracing logic is implemented. + pub(crate) struct VMTracer<'a> { + trace: &'a mut MoveTraceBuilder, + link_context: Option, + pc: Option, + active_frames: BTreeMap, + type_stack: Vec, + loaded_data: BTreeMap, + effects: Vec, + } + + /// Information about a frame that we keep during trace building + #[derive(Debug, Clone)] + struct FrameInfo { + frame_identifier: TraceIndex, + is_native: bool, + locals_types: Vec, + return_types: Vec, + } + + /// A type tag, and the move type layout and reference information for that type if it is + /// computable without error. Due to runtime value depth restrictions you can have a valid type + /// whose type layout is not computable at runtime without error. + #[derive(Debug, Clone)] + struct TagWithLayoutInfoOpt { + tag: TypeTag, + layout: (Option, Option), + } + + // Information about a function that we use for trace building + // All types are fully substituted + #[derive(Debug, Clone)] + struct FunctionTypeInfo { + ty_args: Vec, + local_types: Vec, + return_types: Vec, + } + + /// A runtime location can refer to the stack to make it easier to refer to values on the stack and + /// resolving them. However, the stack is not a valid location for a reference and all references + /// are rooted in a local or global so the Trace `Location` does not include the stack, and + /// only `Local`, `Global`, and `Indexed` locations. + #[derive(Debug, Clone)] + enum RuntimeLocation { + Stack(usize), + Local(TraceIndex, usize), + Indexed(Box, usize), + Global(TraceIndex), + } + + /// The reference information for a local. This is used to track the state of a local in a frame. + /// * It can be a value, in which case the reference type is `Value`. + /// * It can be a local that does not currently hold a value (is "empty"), in which case + /// we track the reference type and the type of the local, but we don't have a `RuntimeLocation` + /// for the reference. This is e.g., the case when we open a frame and the local is not + /// initialized yet. + /// * It can be a local that holds a value (is "filled"), in which case we track the reference type and the + /// location the reference resolves to. + #[derive(Debug, Clone)] + enum ReferenceType { + Value, + Empty { + ref_type: RefType, + }, + Filled { + ref_type: RefType, + location: RuntimeLocation, + }, + } + + /// A `RootedType` is a a type layout with reference information, where any reference type is + /// fully rooted back to a specific location. + #[derive(Debug, Clone)] + struct RootedType { + layout: MoveTypeLayout, + ref_type: Option<(RefType, RuntimeLocation)>, + } + + /// A `LocalType` layout where a reference type may not be rooted to a + /// specific location (or it may be rooted to a specific location if the location is filled with a + /// value at the time). Note the type layout may be `None` in the case where the type is not + /// calculable at runtime without error. + #[derive(Debug, Clone)] + struct LocalType { + layout: Option, + ref_type: ReferenceType, + } + + impl TagWithLayoutInfoOpt { + pub fn into_tag_with_refs(&self) -> TypeTagWithRefs { + TypeTagWithRefs { + type_: self.tag.clone(), + ref_type: self.layout.1.clone(), + } + } + } + + impl RuntimeLocation { + fn into_trace_location(&self) -> Location { + match self { + RuntimeLocation::Stack(_) => { + panic!("Cannot convert stack location to trace location") + } + RuntimeLocation::Local(fidx, lidx) => Location::Local(*fidx, *lidx), + RuntimeLocation::Indexed(loc, idx) => { + Location::Indexed(Box::new(loc.into_trace_location()), *idx) + } + RuntimeLocation::Global(id) => Location::Global(*id), + } + } + + fn into_runtime_location(loc: Location) -> Self { + match loc { + Location::Local(fidx, lidx) => RuntimeLocation::Local(fidx, lidx), + Location::Indexed(loc, idx) => RuntimeLocation::Indexed( + Box::new(RuntimeLocation::into_runtime_location(*loc)), + idx, + ), + Location::Global(id) => RuntimeLocation::Global(id), + } + } + } + + impl LocalType { + fn into_rooted_type(self) -> Option { + let ref_type = match self.ref_type { + ReferenceType::Value => None, + ReferenceType::Empty { .. } => panic!("Empty reference type"), + ReferenceType::Filled { ref_type, location } => Some((ref_type, location)), + }; + Some(RootedType { + layout: self.layout?, + ref_type, + }) + } + } + + impl RootedType { + fn into_local_type(self) -> LocalType { + let ref_type = match self.ref_type { + None => ReferenceType::Value, + Some((ref_type, location)) => ReferenceType::Filled { ref_type, location }, + }; + LocalType { + layout: Some(self.layout), + ref_type, + } + } + } + + impl<'a> VMTracer<'a> { + /// Emit an error event to the trace if `true` + fn emit_trace_error_if_err(&mut self, is_err: bool) { + if is_err { + self.trace.effect(EF::ExecutionError( + "!! TRACING ERROR !! Events below this may be incorrect.".to_string(), + )); + } + } + + fn current_frame(&self) -> Option<&FrameInfo> { + self.active_frames.last_key_value().map(|(_, v)| v) + } + + fn current_frame_mut(&mut self) -> Option<&mut FrameInfo> { + self.active_frames.last_entry().map(|e| e.into_mut()) + } + + /// Get the current locals type and reference state(s) + fn current_frame_locals(&self) -> Option<&[LocalType]> { + Some(self.current_frame()?.locals_types.as_slice()) + } + + /// Return the current frame identifier. This is trace index of the frame and is used to + /// identify reference locations rooted higher up the call stack. + fn current_frame_identifier(&self) -> Option { + Some(self.current_frame()?.frame_identifier) + } + + /// Given the trace index for a frame, return the index of the frame in the call stack. + fn trace_index_to_frame_index(&self, idx: TraceIndex) -> Option { + self.active_frames + .range(..=idx) + .into_iter() + .enumerate() + .last() + .map(|(i, _)| i) + } + + /// Register the pre-effects for the instruction (i.e., reads, pops.) + fn register_pre_effects(&mut self, effects: Vec) { + assert!(self.effects.is_empty()); + self.effects = effects; + } + + /// Register the post-effects for the instruction (i.e., pushes, writes) and return the total + /// effects for the instruction. + fn register_post_effects(&mut self, effects: Vec) -> Vec { + self.effects.extend(effects); + std::mem::take(&mut self.effects) + } + + /// Insert a local with a specifice runtime location into the current frame. + fn insert_local(&mut self, local_index: usize, local: RootedType) -> Option<()> { + *self + .current_frame_mut()? + .locals_types + .get_mut(local_index)? = local.into_local_type(); + Some(()) + } + + /// Invalidate a local in the current frame. This is used to mark a local as uninitialized and + /// remove its reference information. + fn invalidate_local(&mut self, local_index: usize) -> Option<()> { + let local = self + .current_frame_mut()? + .locals_types + .get_mut(local_index)?; + match &local.ref_type { + ReferenceType::Filled { ref_type, .. } => { + local.ref_type = ReferenceType::Empty { + ref_type: ref_type.clone(), + } + } + ReferenceType::Empty { .. } => (), + ReferenceType::Value => (), + }; + Some(()) + } + + /// Resolve a value on the stack to a TraceValue. References are fully rooted all the way back + /// to their location in a local. + fn resolve_stack_value( + &self, + frame: Option<&Frame>, + interpreter: &Interpreter, + stack_idx: usize, + ) -> Option { + if stack_idx >= interpreter.operand_stack.value.len() { + return None; + } + let offset = self.type_stack.len() - 1; + self.resolve_location( + &RuntimeLocation::Stack(offset - stack_idx), + frame, + interpreter, + ) + } + + /// Resolve a value in a local to a TraceValue. References are fully rooted all the way back to + /// their root location in a local. + fn resolve_local( + &self, + frame: &Frame, + interpreter: &Interpreter, + local_index: usize, + ) -> Option { + self.resolve_location( + &RuntimeLocation::Local(self.current_frame_identifier()?, local_index), + Some(frame), + interpreter, + ) + } + + /// Shared utility function that creates a TraceValue from a runtime location along with + /// grabbing the snapshot of the value. + fn make_trace_value( + &self, + location: RuntimeLocation, + ref_info: Option, + frame: Option<&Frame>, + interpreter: &Interpreter, + ) -> Option { + let value = self.root_location_snapshot(&location, frame, interpreter)?; + Some(match ref_info { + Some(RefType::Imm) => TraceValue::ImmRef { + location: location.into_trace_location(), + snapshot: Box::new(value), + }, + Some(RefType::Mut) => TraceValue::MutRef { + location: location.into_trace_location(), + snapshot: Box::new(value), + }, + None => TraceValue::RuntimeValue { value }, + }) + } + + /// Given a location, resolve it to the value it points to or the value itself in the case + /// where it's not a reference. + fn resolve_location( + &self, + loc: &RuntimeLocation, + frame: Option<&Frame>, + interpreter: &Interpreter, + ) -> Option { + Some(match loc { + RuntimeLocation::Stack(sidx) => { + let ty = self.type_stack.get(*sidx)?; + let ref_ty = ty.ref_type.as_ref().map(|(r, _)| r.clone()); + let location = ty + .ref_type + .as_ref() + .map(|(_, l)| l.clone()) + .unwrap_or_else(|| loc.clone()); + self.make_trace_value(location, ref_ty, frame, interpreter)? + } + RuntimeLocation::Local(fidx, lidx) => { + let ty = &self.active_frames.get(fidx)?.locals_types.get(*lidx)?; + let ref_ty = match &ty.ref_type { + ReferenceType::Value => None, + ReferenceType::Empty { ref_type } => Some(ref_type.clone()), + ReferenceType::Filled { ref_type, .. } => Some(ref_type.clone()), + }; + let location = match &ty.ref_type { + ReferenceType::Filled { location, .. } => location.clone(), + ReferenceType::Value => loc.clone(), + _ => panic!( + "We tried to access a local that was not initialized at {:?}", + loc + ), + }; + self.make_trace_value(location, ref_ty, frame, interpreter)? + } + RuntimeLocation::Indexed(location, _) => { + self.resolve_location(location, frame, interpreter)? + } + RuntimeLocation::Global(id) => self.loaded_data.get(id)?.clone(), + }) + } + + /// Snapshot the value at the root of a location. This is used to create the value snapshots + /// for TraceValue references. + fn root_location_snapshot( + &self, + loc: &RuntimeLocation, + frame: Option<&Frame>, + interpreter: &Interpreter, + ) -> Option { + Some(match loc { + RuntimeLocation::Local(fidx, loc_idx) => { + let local_ty = self + .active_frames + .get(fidx)? + .locals_types + .get(*loc_idx)? + .clone(); + let call_stack_index = self.trace_index_to_frame_index(*fidx)?; + match local_ty.ref_type { + ReferenceType::Value => { + let frame = if call_stack_index >= interpreter.call_stack.0.len() { + frame? + } else { + interpreter.call_stack.0.get(call_stack_index)? + }; + frame + .locals + .copy_loc(*loc_idx) + .ok()? + .as_annotated_move_value(&local_ty.layout?)? + } + ReferenceType::Empty { .. } => { + panic!("We tried to access a local that was not initialized") + } + ReferenceType::Filled { location, .. } => { + self.root_location_snapshot(&location, frame, interpreter)? + } + } + } + RuntimeLocation::Stack(stack_idx) => { + let ty = self.type_stack.get(*stack_idx)?; + match &ty.ref_type { + Some((_, location)) => { + self.root_location_snapshot(location, frame, interpreter)? + } + None => { + let value = interpreter.operand_stack.value.get(*stack_idx)?; + value.as_annotated_move_value(&ty.layout)? + } + } + } + RuntimeLocation::Indexed(loc, _) => { + self.root_location_snapshot(loc, frame, interpreter)? + } + RuntimeLocation::Global(id) => self.loaded_data.get(id)?.snapshot().clone(), + }) + } + + fn link_context(&self) -> AccountAddress { + self.link_context + .expect("Link context always set by this point") + } + + /// Load data returned by a native function into the tracer state. + /// We also emit a data load event for the data loaded from the native function. + fn load_data( + &mut self, + layout: &MoveTypeLayout, + reftype: &Option, + value: &Value, + ) -> Option<(RefType, RuntimeLocation)> { + let value = value.as_annotated_move_value(layout)?; + + let Some(ref_type) = reftype else { + return None; + }; + + // We treat any references coming out of a native as global reference. + // This generally works fine as long as you don't have a native function returning a + // mutable reference within a mutable reference passed-in. + let id = self.trace.current_trace_offset(); + + let location = RuntimeLocation::Global(id); + + self.trace.effect(EF::DataLoad(DataLoad { + ref_type: ref_type.clone(), + location: location.into_trace_location(), + snapshot: value.clone(), + })); + let trace_value = match &ref_type { + RefType::Imm => TraceValue::ImmRef { + location: location.into_trace_location(), + snapshot: Box::new(value), + }, + RefType::Mut => TraceValue::MutRef { + location: location.into_trace_location(), + snapshot: Box::new(value), + }, + }; + self.loaded_data.insert(id, trace_value); + Some((ref_type.clone(), location)) + } + + /// Handle (and load) any data returned by a native function. + fn handle_native_return( + &mut self, + function: &Function, + interpreter: &Interpreter, + ) -> Option<()> { + assert!(function.is_native()); + let trace_frame = self.current_frame()?.clone(); + assert!(trace_frame.is_native); + let len = interpreter.operand_stack.value.len(); + for (i, r_ty) in trace_frame.return_types.iter().cloned().enumerate() { + let r_ty = r_ty.layout; + let ref_type = self.load_data( + r_ty.0.as_ref()?, + &r_ty.1, + interpreter.operand_stack.value.get(len - i - 1)?, + ); + self.type_stack.push(RootedType { + layout: r_ty.0?, + ref_type, + }); + } + Some(()) + } + + //--------------------------------------------------------------------------- + // Core entry points for the tracer + //--------------------------------------------------------------------------- + + fn open_initial_frame_( + &mut self, + args: &[Value], + ty_args: &[Type], + function: &Function, + loader: &Loader, + remaining_gas: u64, + link_context: AccountAddress, + ) -> Option<()> { + self.link_context = Some(link_context); + + let function_type_info = + FunctionTypeInfo::new(function, loader, ty_args, link_context)?; + + assert!(function_type_info.local_types.len() == function.local_count()); + + let call_args: Vec<_> = args + .iter() + .zip(function_type_info.local_types.iter().cloned()) + .map(|(value, tag_with_layout_info_opt)| { + let (layout, ref_type) = tag_with_layout_info_opt.layout; + let move_value = value.as_annotated_move_value(&layout?)?; + assert!(ref_type.is_none()); + Some(TraceValue::RuntimeValue { value: move_value }) + }) + .collect::>()?; + + let locals_types = function_type_info + .local_types + .iter() + .cloned() + .map(|tag_with_layout_info_opt| { + let (layout, ref_type) = tag_with_layout_info_opt.layout; + LocalType { + layout, + ref_type: ref_type + .map(|r_type| match r_type { + RefType::Imm => ReferenceType::Empty { ref_type: r_type }, + RefType::Mut => ReferenceType::Empty { ref_type: r_type }, + }) + .unwrap_or(ReferenceType::Value), + } + }) + .collect(); + + let current_trace_offset = self.trace.current_trace_offset(); + self.active_frames.insert( + current_trace_offset, + FrameInfo { + frame_identifier: current_trace_offset, + is_native: function.is_native(), + locals_types, + return_types: function_type_info.return_types.clone(), + }, + ); + + self.trace.open_frame( + self.current_frame_identifier()?, + function.index(), + function.name().to_string(), + function.module_id().clone(), + call_args, + function_type_info.ty_args, + function_type_info + .return_types + .iter() + .map(|tag_with_layout_info_opt| tag_with_layout_info_opt.into_tag_with_refs()) + .collect(), + function_type_info + .local_types + .into_iter() + .map(|tag_with_layout_info_opt| tag_with_layout_info_opt.into_tag_with_refs()) + .collect(), + function.is_native(), + remaining_gas, + ); + Some(()) + } + + fn close_initial_frame_( + &mut self, + return_values: &[Value], + remaining_gas: u64, + ) -> Option<()> { + let current_frame_return_tys = self.current_frame()?.return_types.clone(); + let return_values: Vec<_> = return_values + .iter() + .zip(current_frame_return_tys.into_iter()) + .map(|(value, tag_with_layout_info_opt)| { + let (layout, ref_type) = tag_with_layout_info_opt.layout; + let move_value = value.as_annotated_move_value(&layout?)?; + assert!(ref_type.is_none()); + Some(TraceValue::RuntimeValue { value: move_value }) + }) + .collect::>()?; + self.trace.close_frame( + self.current_frame_identifier()?, + return_values, + remaining_gas, + ); + self.active_frames + .pop_last() + .expect("Unbalanced frame close"); + Some(()) + } + + fn open_frame_( + &mut self, + ty_args: &[Type], + function: &Function, + calling_frame: &Frame, + interpreter: &Interpreter, + loader: &Loader, + remaining_gas: u64, + link_context: AccountAddress, + ) -> Option<()> { + self.link_context = Some(link_context); + + let call_args = (0..function.arg_count()) + .rev() + .map(|i| self.resolve_stack_value(Some(calling_frame), interpreter, i)) + .collect::>>()?; + + let call_args_types = self + .type_stack + .split_off(self.type_stack.len() - function.arg_count()); + let function_type_info = + FunctionTypeInfo::new(function, loader, ty_args, link_context)?; + + let locals_types = function_type_info + .local_types + .iter() + .cloned() + .enumerate() + .map(|(i, tag_with_layout_info_opt)| { + // For any arguments, start them out with the correct locations + if let Some(a_layout) = call_args_types.get(i).cloned() { + let ref_type = match a_layout.ref_type { + Some((ref_type, location)) => { + ReferenceType::Filled { ref_type, location } + } + None => ReferenceType::Value, + }; + LocalType { + layout: Some(a_layout.layout), + ref_type, + } + } else { + let (layout, ref_type) = tag_with_layout_info_opt.layout; + let ref_type = ref_type + .map(|ref_type| ReferenceType::Empty { ref_type }) + .unwrap_or(ReferenceType::Value); + LocalType { layout, ref_type } + } + }) + .collect(); + + let current_trace_offset = self.trace.current_trace_offset(); + self.active_frames.insert( + current_trace_offset, + FrameInfo { + frame_identifier: current_trace_offset, + is_native: function.is_native(), + locals_types, + return_types: function_type_info.return_types.clone(), + }, + ); + + self.trace.open_frame( + self.current_frame_identifier()?, + function.index(), + function.name().to_string(), + function.module_id().clone(), + call_args, + function_type_info.ty_args, + function_type_info + .return_types + .iter() + .map(|tag_with_layout_info_opt| tag_with_layout_info_opt.into_tag_with_refs()) + .collect(), + function_type_info + .local_types + .into_iter() + .map(|tag_with_layout_info_opt| tag_with_layout_info_opt.into_tag_with_refs()) + .collect(), + function.is_native(), + remaining_gas, + ); + Some(()) + } + + fn close_frame_( + &mut self, + frame: &Frame, + function: &Function, + interpreter: &Interpreter, + _loader: &Loader, + remaining_gas: u64, + _link_context: AccountAddress, + ) -> Option<()> { + if function.is_native() { + self.handle_native_return(function, interpreter) + .expect("Native function return failed -- this should not happen."); + } + + let return_values = (0..function.return_type_count()) + .rev() + .map(|i| self.resolve_stack_value(Some(frame), interpreter, i)) + .collect::>>()?; + + // Note that when a native function frame closes the values returned by the native function + // are all pushed on the operand stack. + if function.is_native() { + for val in &return_values { + self.trace.effect(EF::Push(val.clone())); + } + } + + self.trace.close_frame( + self.current_frame_identifier()?, + return_values, + remaining_gas, + ); + self.active_frames + .pop_last() + .expect("Unbalanced frame close"); + Some(()) + } + + fn open_instruction_( + &mut self, + frame: &Frame, + interpreter: &Interpreter, + loader: &Loader, + _remaining_gas: u64, + ) -> Option<()> { + use move_binary_format::file_format::Bytecode as B; + + let pc = frame.pc; + self.pc = Some(pc); + + let popn = |n: usize| { + let mut effects = vec![]; + for i in 0..n { + let v = self.resolve_stack_value(Some(frame), interpreter, i)?; + effects.push(EF::Pop(v)); + } + Some(effects) + }; + + assert_eq!( + self.type_stack.len(), + interpreter.operand_stack.value.len(), + "Type stack and operand stack must be the same length {} {}", + frame.function.name(), + pc, + ); + + match &frame.function.code()[pc as usize] { + B::Nop + | B::Branch(_) + | B::Ret + | B::LdU8(_) + | B::LdU16(_) + | B::LdU32(_) + | B::LdU64(_) + | B::LdU128(_) + | B::LdU256(_) + | B::LdFalse + | B::LdTrue + | B::LdConst(_) => { + self.register_pre_effects(vec![]); + } + B::MutBorrowField(_) + | B::ImmBorrowField(_) + | B::MutBorrowFieldGeneric(_) + | B::ImmBorrowFieldGeneric(_) + | B::FreezeRef + | B::Not + | B::Abort + | B::Unpack(_) + | B::UnpackGeneric(_) + | B::CastU8 + | B::CastU16 + | B::CastU32 + | B::CastU64 + | B::CastU128 + | B::CastU256 + | B::Pop + | B::BrTrue(_) + | B::BrFalse(_) + | B::VecUnpack(_, _) + | B::VecLen(_) + | B::VecPopBack(_) + | B::VariantSwitch(_) + | B::UnpackVariantImmRef(_) + | B::UnpackVariantMutRef(_) + | B::UnpackVariantGenericImmRef(_) + | B::UnpackVariantGenericMutRef(_) + | B::UnpackVariant(_) + | B::UnpackVariantGeneric(_) => { + self.register_pre_effects(popn(1)?); + } + B::Add + | B::Sub + | B::Mul + | B::Mod + | B::Div + | B::BitOr + | B::BitAnd + | B::Xor + | B::Shl + | B::Shr + | B::Lt + | B::Gt + | B::Le + | B::Ge + | B::Eq + | B::Neq + | B::Or + | B::And + | B::WriteRef + | B::VecImmBorrow(_) + | B::VecMutBorrow(_) + | B::VecPushBack(_) => self.register_pre_effects(popn(2)?), + B::VecSwap(_) => self.register_pre_effects(popn(3)?), + B::VecPack(_, n) => self.register_pre_effects(popn(*n as usize)?), + i @ (B::MoveLoc(l) | B::CopyLoc(l)) => { + let v = self.resolve_local(frame, interpreter, *l as usize)?; + let effects = vec![EF::Read(Read { + location: Location::Local(self.current_frame_identifier()?, *l as usize), + root_value_read: v.clone(), + moved: matches!(i, B::MoveLoc(_)), + })]; + self.register_pre_effects(effects); + } + B::StLoc(lidx) => { + let ty = self.type_stack.last()?; + let v = self.resolve_stack_value(Some(frame), interpreter, 0)?; + self.insert_local(*lidx as usize, ty.clone())?; + let effects = vec![EF::Pop(v.clone())]; + self.register_pre_effects(effects); + } + B::ImmBorrowLoc(l_idx) | B::MutBorrowLoc(l_idx) => { + let val = self.resolve_local(frame, interpreter, *l_idx as usize)?; + let location = + Location::Local(self.current_frame_identifier()?, *l_idx as usize); + self.register_pre_effects(vec![EF::Read(Read { + location, + root_value_read: val, + moved: false, + })]); + } + // Handled by open frame + B::Call(_) | B::CallGeneric(_) => {} + B::Pack(sidx) => { + let resolver = frame.function.get_resolver(self.link_context(), loader); + let field_count = resolver.field_count(*sidx) as usize; + self.register_pre_effects(popn(field_count)?); + } + B::PackGeneric(sidx) => { + let resolver = frame.function.get_resolver(self.link_context(), loader); + let field_count = resolver.field_instantiation_count(*sidx) as usize; + self.register_pre_effects(popn(field_count)?); + } + B::PackVariant(vidx) => { + let resolver = frame.function.get_resolver(self.link_context(), loader); + let (field_count, _variant_tag) = resolver.variant_field_count_and_tag(*vidx); + self.register_pre_effects(popn(field_count as usize)?); + } + B::PackVariantGeneric(vidx) => { + let resolver = frame.function.get_resolver(self.link_context(), loader); + let (field_count, _variant_tag) = + resolver.variant_instantiantiation_field_count_and_tag(*vidx); + self.register_pre_effects(popn(field_count as usize)?); + } + B::ReadRef => { + let ref_value = self.resolve_stack_value(Some(frame), interpreter, 0)?; + let location = ref_value.location()?.clone(); + let runtime_location = RuntimeLocation::into_runtime_location(location.clone()); + let value = + self.resolve_location(&runtime_location, Some(frame), interpreter)?; + self.register_pre_effects(vec![ + EF::Pop(ref_value), + EF::Read(Read { + location, + root_value_read: value.clone(), + moved: false, + }), + ]); + } + + B::ExistsDeprecated(_) + | B::ExistsGenericDeprecated(_) + | B::MoveFromDeprecated(_) + | B::MoveFromGenericDeprecated(_) + | B::MoveToDeprecated(_) + | B::MoveToGenericDeprecated(_) + | B::MutBorrowGlobalDeprecated(_) + | B::MutBorrowGlobalGenericDeprecated(_) + | B::ImmBorrowGlobalDeprecated(_) + | B::ImmBorrowGlobalGenericDeprecated(_) => unreachable!(), + } + Some(()) + } + + fn close_instruction_( + &mut self, + frame: &Frame, + interpreter: &Interpreter, + loader: &Loader, + remaining_gas: u64, + ) -> Option<()> { + use move_binary_format::file_format::Bytecode as B; + + // NB: Do _not_ use the frames pc here, as it will be incremented by the interpreter to the + // next instruction already. + let pc = self + .pc + .expect("PC always set by this point by `open_instruction`"); + + // NB: At the start of this function (i.e., at this point) the operand stack in the VM, and + // the type stack in the tracer are _out of sync_. This is because the VM has already + // executed the instruction and we now need to manage the type transition of the + // instruction along with snapshoting the effects of the instruction's execution. + let instruction = &frame.function.code()[pc as usize]; + match instruction { + B::Pop | B::BrTrue(_) | B::BrFalse(_) => { + self.type_stack.pop()?; + let effects = self.register_post_effects(vec![]); + self.trace + .instruction(instruction, vec![], effects, remaining_gas, pc); + } + B::Branch(_) | B::Ret => { + let effects = self.register_post_effects(vec![]); + self.trace + .instruction(instruction, vec![], effects, remaining_gas, pc); + } + i @ (B::LdU8(_) + | B::LdU16(_) + | B::LdU32(_) + | B::LdU64(_) + | B::LdU128(_) + | B::LdU256(_) + | B::LdFalse + | B::LdTrue + | B::LdConst(_)) => { + let layout = match i { + B::LdU8(_) => MoveTypeLayout::U8, + B::LdU16(_) => MoveTypeLayout::U16, + B::LdU32(_) => MoveTypeLayout::U32, + B::LdU64(_) => MoveTypeLayout::U64, + B::LdU128(_) => MoveTypeLayout::U128, + B::LdU256(_) => MoveTypeLayout::U256, + B::LdTrue => MoveTypeLayout::Bool, + B::LdFalse => MoveTypeLayout::Bool, + B::LdConst(const_idx) => get_constant_type_layout( + &frame.function, + loader, + self.link_context(), + *const_idx, + )?, + _ => unreachable!(), + }; + let a_layout = RootedType { + layout, + ref_type: None, + }; + self.type_stack.push(a_layout); + + let value = self.resolve_stack_value(Some(frame), interpreter, 0)?; + let effects = vec![EF::Push(value)]; + let effects = self.register_post_effects(effects); + self.trace + .instruction(instruction, vec![], effects, remaining_gas, pc); + } + i @ (B::MoveLoc(l) | B::CopyLoc(l)) => { + let local_annot_type = self + .current_frame_locals()? + .get(*l as usize)? + .clone() + .into_rooted_type()?; + self.type_stack.push(local_annot_type); + if matches!(i, B::MoveLoc(_)) { + self.invalidate_local(*l as usize)?; + } + // This was pushed on the stack during execution so read it off from there. + let v = self.resolve_stack_value(Some(frame), interpreter, 0)?; + let effects = self.register_post_effects(vec![EF::Push(v.clone())]); + self.trace + .instruction(instruction, vec![], effects, remaining_gas, pc); + } + i @ (B::CastU8 + | B::CastU16 + | B::CastU32 + | B::CastU64 + | B::CastU128 + | B::CastU256) => { + let layout = match i { + B::CastU8 => MoveTypeLayout::U8, + B::CastU16 => MoveTypeLayout::U16, + B::CastU32 => MoveTypeLayout::U32, + B::CastU64 => MoveTypeLayout::U64, + B::CastU128 => MoveTypeLayout::U128, + B::CastU256 => MoveTypeLayout::U256, + _ => unreachable!(), + }; + let annot_layout = RootedType { + layout, + ref_type: None, + }; + self.type_stack.pop()?; + self.type_stack.push(annot_layout); + + let value = self.resolve_stack_value(Some(frame), interpreter, 0)?; + let effects = vec![EF::Push(value.clone())]; + let effects = self.register_post_effects(effects); + self.trace + .instruction(instruction, vec![], effects, remaining_gas, pc); + } + B::StLoc(lidx) => { + let ty = self.type_stack.pop()?; + self.insert_local(*lidx as usize, ty.clone())?; + let v = self.resolve_local(frame, interpreter, *lidx as usize)?; + let effects = self.register_post_effects(vec![EF::Write(Write { + location: Location::Local(self.current_frame_identifier()?, *lidx as usize), + root_value_after_write: v.clone(), + })]); + self.trace + .instruction(instruction, vec![], effects, remaining_gas, pc); + } + B::Add + | B::Sub + | B::Mul + | B::Mod + | B::Div + | B::BitOr + | B::BitAnd + | B::Xor + | B::Shl + | B::Shr => { + self.type_stack.pop()?; + // NB in the case of shift left and shift right the second operand is the resultant + // value type. + let a_ty = self.type_stack.pop()?; + self.type_stack.push(a_ty); + + let result = self.resolve_stack_value(Some(frame), interpreter, 0)?; + let effects = self.register_post_effects(vec![EF::Push(result)]); + self.trace + .instruction(instruction, vec![], effects, remaining_gas, pc); + } + B::Lt | B::Gt | B::Le | B::Ge => { + self.type_stack.pop()?; + self.type_stack.pop()?; + let a_layout = RootedType { + layout: MoveTypeLayout::Bool, + ref_type: None, + }; + self.type_stack.push(a_layout); + + let value = self.resolve_stack_value(Some(frame), interpreter, 0)?; + let effects = self.register_post_effects(vec![EF::Push(value)]); + self.trace + .instruction(instruction, vec![], effects, remaining_gas, pc); + } + B::Call(_) | B::CallGeneric(_) => { + // NB: We don't register effects for calls as they will be handled by + // open_frame. + self.trace + .instruction(instruction, vec![], vec![], remaining_gas, pc); + } + B::Pack(sidx) => { + let resolver = frame.function.get_resolver(self.link_context(), loader); + let field_count = resolver.field_count(*sidx) as usize; + let struct_type = resolver.get_struct_type(*sidx); + let stack_len = self.type_stack.len(); + let _ = self.type_stack.split_off(stack_len - field_count); + let ty = loader.type_to_fully_annotated_layout(&struct_type).ok()?; + let a_layout = RootedType { + layout: ty, + ref_type: None, + }; + self.type_stack.push(a_layout); + + let value = self.resolve_stack_value(Some(frame), interpreter, 0)?; + let effects = self.register_post_effects(vec![EF::Push(value)]); + self.trace + .instruction(instruction, vec![], effects, remaining_gas, pc); + } + B::PackGeneric(sidx) => { + let resolver = frame.function.get_resolver(self.link_context(), loader); + let field_count = resolver.field_instantiation_count(*sidx) as usize; + let struct_type = resolver + .instantiate_struct_type(*sidx, &frame.ty_args) + .ok()?; + let stack_len = self.type_stack.len(); + let _ = self.type_stack.split_off(stack_len - field_count); + let ty = loader.type_to_fully_annotated_layout(&struct_type).ok()?; + let a_layout = RootedType { + layout: ty, + ref_type: None, + }; + self.type_stack.push(a_layout); + + let value = self.resolve_stack_value(Some(frame), interpreter, 0)?; + let effects = self.register_post_effects(vec![EF::Push(value)]); + let TypeTag::Struct(s_type) = loader.type_to_type_tag(&struct_type).ok()? + else { + panic!("Expected struct, got {:#?}", struct_type); + }; + self.trace.instruction( + instruction, + s_type.type_params, + effects, + remaining_gas, + pc, + ); + } + B::Unpack(_) | B::UnpackGeneric(_) => { + let ty = self.type_stack.pop()?; + let MoveTypeLayout::Struct(s) = ty.layout else { + panic!("Expected struct, got {:#?}", ty.layout); + }; + let field_tys = s.fields.iter().map(|t| t.layout.clone()); + for field_ty in field_tys { + self.type_stack.push(RootedType { + layout: field_ty.clone(), + ref_type: None, + }); + } + + let mut effects = vec![]; + for i in (0..s.fields.len()).rev() { + let value = self.resolve_stack_value(Some(frame), interpreter, i)?; + effects.push(EF::Push(value)); + } + + let effects = self.register_post_effects(effects); + self.trace + .instruction(instruction, vec![], effects, remaining_gas, pc); + } + B::Eq | B::Neq => { + self.type_stack.pop()?; + self.type_stack.pop()?; + let a_layout = RootedType { + layout: MoveTypeLayout::Bool, + ref_type: None, + }; + self.type_stack.push(a_layout); + let value = self.resolve_stack_value(Some(frame), interpreter, 0)?; + let effects = self.register_post_effects(vec![EF::Push(value)]); + self.trace + .instruction(instruction, vec![], effects, remaining_gas, pc); + } + B::Or | B::And => { + self.type_stack.pop()?; + self.type_stack.pop()?; + let a_layout = RootedType { + layout: MoveTypeLayout::Bool, + ref_type: None, + }; + self.type_stack.push(a_layout); + let value = self.resolve_stack_value(Some(frame), interpreter, 0)?; + let effects = self.register_post_effects(vec![EF::Push(value)]); + self.trace + .instruction(instruction, vec![], effects, remaining_gas, pc); + } + B::Not => { + let a_ty = self.type_stack.pop()?; + self.type_stack.push(a_ty); + let value = self.resolve_stack_value(Some(frame), interpreter, 0)?; + let effects = self.register_post_effects(vec![EF::Push(value)]); + self.trace + .instruction(instruction, vec![], effects, remaining_gas, pc); + } + B::Nop => { + self.trace + .instruction(instruction, vec![], vec![], remaining_gas, pc); + } + B::Abort => { + self.type_stack.pop()?; + let effects = self.register_post_effects(vec![]); + self.trace + .instruction(instruction, vec![], effects, remaining_gas, pc); + } + B::ReadRef => { + let ref_ty = self.type_stack.pop()?; + let a_layout = RootedType { + layout: ref_ty.layout.clone(), + ref_type: None, + }; + self.type_stack.push(a_layout); + + let value = self.resolve_stack_value(Some(frame), interpreter, 0)?; + let effects = self.register_post_effects(vec![EF::Push(value)]); + self.trace + .instruction(instruction, vec![], effects, remaining_gas, pc); + } + i @ (B::ImmBorrowLoc(l_idx) | B::MutBorrowLoc(l_idx)) => { + let non_imm_ty = self.current_frame_locals()?.get(*l_idx as usize)?.clone(); + let ref_type = match i { + B::ImmBorrowLoc(_) => RefType::Imm, + B::MutBorrowLoc(_) => RefType::Mut, + _ => unreachable!(), + }; + let a_layout = RootedType { + layout: non_imm_ty.layout?.clone(), + ref_type: Some(( + ref_type, + RuntimeLocation::Local( + self.current_frame_identifier()?, + *l_idx as usize, + ), + )), + }; + self.type_stack.push(a_layout); + + let val = self.resolve_stack_value(Some(frame), interpreter, 0)?; + let effects = self.register_post_effects(vec![EF::Push(val)]); + self.trace + .instruction(instruction, vec![], effects, remaining_gas, pc); + } + B::WriteRef => { + let reference_ty = self.type_stack.pop()?; + let _value_ty = self.type_stack.pop()?; + let location = reference_ty.ref_type.as_ref()?.1.clone(); + let root_value_after_write = self + .resolve_location(&location, Some(frame), interpreter)? + .clone(); + let effects = self.register_post_effects(vec![EF::Write(Write { + location: location.into_trace_location(), + root_value_after_write, + })]); + self.trace + .instruction(instruction, vec![], effects, remaining_gas, pc); + } + B::FreezeRef => { + let mut reference_ty = self.type_stack.pop()?; + reference_ty.ref_type.as_mut()?.0 = RefType::Imm; + self.type_stack.push(reference_ty); + let reference_val = self.resolve_stack_value(Some(frame), interpreter, 0)?; + let effects = self.register_post_effects(vec![EF::Push(reference_val)]); + self.trace + .instruction(instruction, vec![], effects, remaining_gas, pc); + } + i @ (B::MutBorrowField(fhidx) | B::ImmBorrowField(fhidx)) => { + let value_ty = self.type_stack.pop()?; + + let MoveTypeLayout::Struct(slayout) = &value_ty.layout else { + panic!("Expected struct, got {:?}", value_ty.layout) + }; + let resolver = frame.function.get_resolver(self.link_context(), loader); + let field_offset = resolver.field_offset(*fhidx); + let field_layout = slayout.fields.get(field_offset)?.layout.clone(); + + let location = value_ty.ref_type.as_ref()?.1.clone(); + let field_location = + RuntimeLocation::Indexed(Box::new(location.clone()), field_offset); + + let ref_type = match i { + B::MutBorrowField(_) => RefType::Mut, + B::ImmBorrowField(_) => RefType::Imm, + _ => unreachable!(), + }; + let a_layout = RootedType { + layout: field_layout, + ref_type: Some((ref_type, field_location)), + }; + self.type_stack.push(a_layout); + let value = self.resolve_stack_value(Some(frame), interpreter, 0)?; + let effects = self.register_post_effects(vec![EF::Push(value)]); + self.trace + .instruction(instruction, vec![], effects, remaining_gas, pc); + } + i @ (B::MutBorrowFieldGeneric(fhidx) | B::ImmBorrowFieldGeneric(fhidx)) => { + let value_ty = self.type_stack.pop()?; + + let MoveTypeLayout::Struct(slayout) = &value_ty.layout else { + panic!("Expected struct, got {:?}", value_ty.layout) + }; + let resolver = frame.function.get_resolver(self.link_context(), loader); + let field_offset = resolver.field_instantiation_offset(*fhidx); + let field_layout = slayout.fields.get(field_offset)?.layout.clone(); + let location = value_ty.ref_type.as_ref()?.1.clone(); + let field_location = + RuntimeLocation::Indexed(Box::new(location.clone()), field_offset); + + let ref_type = match i { + B::MutBorrowFieldGeneric(_) => RefType::Mut, + B::ImmBorrowFieldGeneric(_) => RefType::Imm, + _ => unreachable!(), + }; + let a_layout = RootedType { + layout: field_layout, + ref_type: Some((ref_type, field_location)), + }; + self.type_stack.push(a_layout); + let value = self.resolve_stack_value(Some(frame), interpreter, 0)?; + let effects = self.register_post_effects(vec![EF::Push(value)]); + let ty_args = slayout.type_.type_params.clone(); + self.trace + .instruction(instruction, ty_args, effects, remaining_gas, pc); + } + + B::VecPack(tok, n) => { + let resolver = frame.function.get_resolver(self.link_context(), loader); + let ty = resolver + .instantiate_single_type(*tok, &frame.ty_args) + .ok()?; + let ty = loader.type_to_fully_annotated_layout(&ty).ok()?; + let ty = MoveTypeLayout::Vector(Box::new(ty)); + let stack_len = self.type_stack.len(); + let _ = self.type_stack.split_off(stack_len - *n as usize); + let a_layout = RootedType { + layout: ty, + ref_type: None, + }; + self.type_stack.push(a_layout); + let val = self.resolve_stack_value(Some(frame), interpreter, 0)?; + let effects = self.register_post_effects(vec![EF::Push(val)]); + self.trace + .instruction(instruction, vec![], effects, remaining_gas, pc); + } + i @ (B::VecImmBorrow(_) | B::VecMutBorrow(_)) => { + let ref_type = match i { + B::VecImmBorrow(_) => RefType::Imm, + B::VecMutBorrow(_) => RefType::Mut, + _ => unreachable!(), + }; + self.type_stack.pop()?; + let ref_ty = self.type_stack.pop()?; + let MoveTypeLayout::Vector(ty) = ref_ty.layout else { + panic!("Expected vector, got {:?}", ref_ty.layout,); + }; + let EF::Pop(TraceValue::RuntimeValue { + value: MoveValue::U64(i), + }) = &self.effects[0] + else { + unreachable!(); + }; + let location = + RuntimeLocation::Indexed(Box::new(ref_ty.ref_type?.1.clone()), *i as usize); + let a_layout = RootedType { + layout: (*ty).clone(), + ref_type: Some((ref_type, location)), + }; + self.type_stack.push(a_layout); + let val = self.resolve_stack_value(Some(frame), interpreter, 0)?; + let effects = self.register_post_effects(vec![EF::Push(val)]); + self.trace + .instruction(instruction, vec![], effects, remaining_gas, pc); + } + B::VecLen(_) => { + self.type_stack.pop()?; + let a_layout = RootedType { + layout: MoveTypeLayout::U64, + ref_type: None, + }; + self.type_stack.push(a_layout); + let len = self.resolve_stack_value(Some(frame), interpreter, 0)?; + let effects = self.register_post_effects(vec![EF::Push(len)]); + self.trace + .instruction(instruction, vec![], effects, remaining_gas, pc); + } + B::VecPushBack(_) => { + self.type_stack.pop()?; + self.type_stack.pop()?; + let EF::Pop(reference_val) = &self.effects[1] else { + unreachable!(); + }; + let location = reference_val.location()?.clone(); + let runtime_location = RuntimeLocation::into_runtime_location(location.clone()); + let snap = + self.resolve_location(&runtime_location, Some(frame), interpreter)?; + let effects = self.register_post_effects(vec![EF::Write(Write { + location, + root_value_after_write: snap, + })]); + self.trace + .instruction(instruction, vec![], effects, remaining_gas, pc); + } + B::VecPopBack(_) => { + let reference_ty = self.type_stack.pop()?; + let MoveTypeLayout::Vector(ty) = reference_ty.layout else { + panic!("Expected vector, got {:?}", reference_ty.layout); + }; + let a_layout = RootedType { + layout: (*ty).clone(), + ref_type: None, + }; + self.type_stack.push(a_layout); + let v = self.resolve_stack_value(Some(frame), interpreter, 0)?; + let effects = self.register_post_effects(vec![EF::Push(v)]); + self.trace + .instruction(instruction, vec![], effects, remaining_gas, pc); + } + B::VecUnpack(_, n) => { + let ty = self.type_stack.pop()?; + let MoveTypeLayout::Vector(ty) = ty.layout else { + panic!("Expected vector, got {:?}", ty.layout); + }; + for _ in 0..*n { + let a_layout = RootedType { + layout: (*ty).clone(), + ref_type: None, + }; + self.type_stack.push(a_layout); + } + let mut effects = vec![]; + for i in (0..*n).rev() { + let value = + self.resolve_stack_value(Some(frame), interpreter, i as usize)?; + effects.push(EF::Push(value)); + } + let effects = self.register_post_effects(effects); + self.trace + .instruction(instruction, vec![], effects, remaining_gas, pc); + } + B::VecSwap(_) => { + self.type_stack.pop()?; + self.type_stack.pop()?; + let v_ref = self.type_stack.pop()?; + let location = v_ref.ref_type.as_ref()?.1.clone(); + let snap = self.resolve_location(&location, Some(frame), interpreter)?; + let effects = self.register_post_effects(vec![EF::Write(Write { + location: location.into_trace_location(), + root_value_after_write: snap, + })]); + self.trace + .instruction(instruction, vec![], effects, remaining_gas, pc); + } + B::PackVariant(vidx) => { + let resolver = frame.function.get_resolver(self.link_context(), loader); + let (field_count, _variant_tag) = resolver.variant_field_count_and_tag(*vidx); + let stack_len = self.type_stack.len(); + let _ = self.type_stack.split_off(stack_len - field_count as usize); + let ty = loader + .type_to_fully_annotated_layout(&resolver.get_enum_type(*vidx)) + .ok()?; + let a_layout = RootedType { + layout: ty, + ref_type: None, + }; + self.type_stack.push(a_layout); + let val = self.resolve_stack_value(Some(frame), interpreter, 0)?; + let effects = self.register_post_effects(vec![EF::Push(val)]); + self.trace + .instruction(instruction, vec![], effects, remaining_gas, pc); + } + B::PackVariantGeneric(vidx) => { + let resolver = frame.function.get_resolver(self.link_context(), loader); + let (field_count, _variant_tag) = + resolver.variant_instantiantiation_field_count_and_tag(*vidx); + let stack_len = self.type_stack.len(); + let _ = self.type_stack.split_off(stack_len - field_count as usize); + let ty = loader + .type_to_fully_annotated_layout( + &resolver.instantiate_enum_type(*vidx, &frame.ty_args).ok()?, + ) + .ok()?; + let a_layout = RootedType { + layout: ty, + ref_type: None, + }; + self.type_stack.push(a_layout); + let val = self.resolve_stack_value(Some(frame), interpreter, 0)?; + let effects = self.register_post_effects(vec![EF::Push(val)]); + self.trace + .instruction(instruction, vec![], effects, remaining_gas, pc); + } + i @ (B::UnpackVariant(_) | B::UnpackVariantGeneric(_)) => { + let ty = self.type_stack.pop()?; + let resolver = frame.function.get_resolver(self.link_context(), loader); + let (field_count, tag) = match i { + B::UnpackVariant(vidx) => resolver.variant_field_count_and_tag(*vidx), + B::UnpackVariantGeneric(vidx) => { + resolver.variant_instantiantiation_field_count_and_tag(*vidx) + } + _ => unreachable!(), + }; + let MoveTypeLayout::Enum(e) = ty.layout else { + panic!("Expected enum, got {:#?}", ty.layout); + }; + let variant_layout = e.variants.iter().find(|v| v.0 .1 == tag)?; + let mut effects = vec![]; + for f_layout in variant_layout.1.iter() { + let a_layout = RootedType { + layout: f_layout.layout.clone(), + ref_type: None, + }; + self.type_stack.push(a_layout); + } + for i in 0..field_count { + let value = + self.resolve_stack_value(Some(frame), interpreter, i as usize)?; + effects.push(EF::Push(value)); + } + let effects = self.register_post_effects(effects); + self.trace + .instruction(instruction, vec![], effects, remaining_gas, pc); + } + i @ (B::UnpackVariantImmRef(_) + | B::UnpackVariantMutRef(_) + | B::UnpackVariantGenericImmRef(_) + | B::UnpackVariantGenericMutRef(_)) => { + let ty = self.type_stack.pop()?; + let resolver = frame.function.get_resolver(self.link_context(), loader); + let ((field_count, tag), ref_type) = match i { + B::UnpackVariantImmRef(vidx) => { + (resolver.variant_field_count_and_tag(*vidx), RefType::Imm) + } + B::UnpackVariantMutRef(vidx) => { + (resolver.variant_field_count_and_tag(*vidx), RefType::Mut) + } + B::UnpackVariantGenericImmRef(vidx) => ( + resolver.variant_instantiantiation_field_count_and_tag(*vidx), + RefType::Imm, + ), + B::UnpackVariantGenericMutRef(vidx) => ( + resolver.variant_instantiantiation_field_count_and_tag(*vidx), + RefType::Mut, + ), + _ => unreachable!(), + }; + let MoveTypeLayout::Enum(e) = ty.layout else { + panic!("Expected enum, got {:#?}", ty.layout); + }; + let variant_layout = e.variants.iter().find(|v| v.0 .1 == tag)?; + let location = ty.ref_type.as_ref()?.1.clone(); + + let mut effects = vec![]; + for (i, f_layout) in variant_layout.1.iter().enumerate() { + let location = RuntimeLocation::Indexed(Box::new(location.clone()), i); + let a_layout = RootedType { + layout: f_layout.layout.clone(), + ref_type: Some((ref_type.clone(), location)), + }; + self.type_stack.push(a_layout); + } + for i in 0..field_count { + let value = + self.resolve_stack_value(Some(frame), interpreter, i as usize)?; + effects.push(EF::Push(value)); + } + let effects = self.register_post_effects(effects); + self.trace + .instruction(instruction, vec![], effects, remaining_gas, pc); + } + B::VariantSwitch(_) => { + self.type_stack.pop()?; + let effects = self.register_post_effects(vec![]); + self.trace + .instruction(instruction, vec![], effects, remaining_gas, pc); + } + B::ExistsDeprecated(_) + | B::ExistsGenericDeprecated(_) + | B::MoveFromDeprecated(_) + | B::MoveFromGenericDeprecated(_) + | B::MoveToDeprecated(_) + | B::MoveToGenericDeprecated(_) + | B::MutBorrowGlobalDeprecated(_) + | B::MutBorrowGlobalGenericDeprecated(_) + | B::ImmBorrowGlobalDeprecated(_) + | B::ImmBorrowGlobalGenericDeprecated(_) => unreachable!(), + } + + // At this point the type stack and the operand stack should be in sync. + assert_eq!(self.type_stack.len(), interpreter.operand_stack.value.len()); + Some(()) + } + } + + /// The (public crate) API for the VM tracer. + impl<'a> VMTracer<'a> { + pub(crate) fn new(trace: &'a mut MoveTraceBuilder) -> Self { + Self { + trace, + link_context: None, + pc: None, + active_frames: BTreeMap::new(), + type_stack: vec![], + loaded_data: BTreeMap::new(), + effects: vec![], + } + } + + pub(crate) fn open_initial_frame( + &mut self, + args: &[Value], + ty_args: &[Type], + function: &Function, + loader: &Loader, + remaining_gas: u64, + link_context: AccountAddress, + ) { + let opt = self.open_initial_frame_( + args, + ty_args, + function, + loader, + remaining_gas, + link_context, + ); + self.emit_trace_error_if_err(opt.is_none()); + } + + pub(crate) fn close_initial_frame(&mut self, return_values: &[Value], remaining_gas: u64) { + let opt = self.close_initial_frame_(return_values, remaining_gas); + self.emit_trace_error_if_err(opt.is_none()); + } + + pub(crate) fn open_frame( + &mut self, + ty_args: &[Type], + function: &Function, + calling_frame: &Frame, + interpreter: &Interpreter, + loader: &Loader, + remaining_gas: u64, + link_context: AccountAddress, + ) { + let opt = self.open_frame_( + ty_args, + function, + calling_frame, + interpreter, + loader, + remaining_gas, + link_context, + ); + self.emit_trace_error_if_err(opt.is_none()) + } + + pub(crate) fn close_frame( + &mut self, + frame: &Frame, + function: &Function, + interpreter: &Interpreter, + loader: &Loader, + remaining_gas: u64, + link_context: AccountAddress, + ) { + let opt = self.close_frame_( + frame, + function, + interpreter, + loader, + remaining_gas, + link_context, + ); + self.emit_trace_error_if_err(opt.is_none()) + } + + pub(crate) fn open_instruction( + &mut self, + frame: &Frame, + interpreter: &Interpreter, + loader: &Loader, + remaining_gas: u64, + ) { + let opt = self.open_instruction_(frame, interpreter, loader, remaining_gas); + self.emit_trace_error_if_err(opt.is_none()); + } + + pub(crate) fn close_instruction( + &mut self, + frame: &Frame, + interpreter: &Interpreter, + loader: &Loader, + remaining_gas: u64, + err: Option<&PartialVMError>, + ) { + if self + .close_instruction_(frame, interpreter, loader, remaining_gas) + .is_none() + { + // If we fail to close the instruction, we need to emit an error event. + // This can be the case where the instruction itself failed -- e.g. with a division by + // zero, invalid cast, etc. + let error_string = match err { + Some(err) => format!("{:?}", err.major_status()), + None => "VM tracer failed to close instruction but interpreter was OK -- this is most likely a bug in the tracer".to_string(), + }; + let pc = self + .pc + .expect("PC always set by this point by `open_instruction`"); + let instruction = &frame.function.code()[pc as usize]; + let effects = self.register_post_effects(vec![EF::ExecutionError(error_string)]); + // TODO: type params here? + self.trace + .instruction(instruction, vec![], effects, remaining_gas, pc); + } else if let Some(err) = err { + self.trace + .effect(EF::ExecutionError(format!("{:?}", err.major_status()))); + } + } + } + + impl FunctionTypeInfo { + /// Resolve a function to all of its type information (type arguments, local types, and return + /// types). + fn new( + function: &Function, + loader: &Loader, + ty_args: &[Type], + link_context: AccountAddress, + ) -> Option { + // Split a `Type` into its inner type and reference type. + let deref_ty = |ty: Type| -> (Type, Option) { + match ty { + Type::Reference(r) => (*r, Some(RefType::Imm)), + Type::MutableReference(t) => (*t, Some(RefType::Mut)), + Type::TyParam(_) => unreachable!("Type parameters should be fully substituted"), + _ => (ty, None), + } + }; + + let (module, _) = loader.get_module(link_context, function.module_id()); + let fdef = module.function_def_at(function.index()); + let f_handle = module.function_handle_at(fdef.function); + let get_types_for_sig = |si: SignatureIndex| -> Option> { + let signatures = &module.signature_at(si).0; + signatures + .iter() + .map(|tok| { + let ty = loader.make_type(&module, tok).ok()?; + let subst_ty = loader.subst(&ty, ty_args).ok()?; + let (ty, ref_type) = deref_ty(subst_ty); + let tag = loader.type_to_type_tag(&ty).ok()?; + // NB: This may fail if the type represents a value greater than the max + // value depth. + let type_layout = loader.type_to_fully_annotated_layout(&ty).ok(); + let layout = (type_layout, ref_type); + Some(TagWithLayoutInfoOpt { tag, layout }) + }) + .collect::>>() + }; + let mut local_types = get_types_for_sig(f_handle.parameters.clone())?; + + if let Some(code) = fdef.code.as_ref() { + local_types.extend(get_types_for_sig(code.locals.clone())?); + } + + let return_types = { + let signatures = &module.signature_at(f_handle.return_).0; + signatures + .iter() + .map(|tok| { + let ty = loader.make_type(&module, tok).ok()?; + let subst_ty = loader.subst(&ty, ty_args).ok()?; + let (ty, ref_type) = deref_ty(subst_ty); + let tag = loader.type_to_type_tag(&ty).ok()?; + let type_layout = loader.type_to_fully_annotated_layout(&ty).ok(); + let layout = (type_layout, ref_type); + Some(TagWithLayoutInfoOpt { tag, layout }) + }) + .collect::>>()? + }; + + let ty_args = ty_args + .iter() + .cloned() + .map(|ty| { + let (ty, ref_type) = deref_ty(ty); + assert!(ref_type.is_none()); + loader.type_to_type_tag(&ty).ok() + }) + .collect::>()?; + + Some(FunctionTypeInfo { + ty_args, + local_types, + return_types, + }) + } + } + + /// Get the type layout of a constant. + fn get_constant_type_layout( + function: &Function, + loader: &Loader, + link_context: AccountAddress, + const_idx: ConstantPoolIndex, + ) -> Option { + let (module, _loaded_module) = loader.get_module(link_context, function.module_id()); + let constant = module.constant_at(const_idx); + let ty = loader.make_type(&module, &constant.type_).ok()?; + loader.type_to_fully_annotated_layout(&ty).ok() + } +} diff --git a/external-crates/move/crates/move-vm-types/src/values/values_impl.rs b/external-crates/move/crates/move-vm-types/src/values/values_impl.rs index aab6897fdc2444..d1828d75ebf600 100644 --- a/external-crates/move/crates/move-vm-types/src/values/values_impl.rs +++ b/external-crates/move/crates/move-vm-types/src/values/values_impl.rs @@ -10,6 +10,8 @@ use move_binary_format::{ errors::*, file_format::{Constant, SignatureToken, VariantTag}, }; +#[cfg(feature = "gas-profiler")] +use move_core_types::annotated_value as A; use move_core_types::{ account_address::AccountAddress, effects::Op, @@ -4202,4 +4204,140 @@ impl Value { pub fn as_move_value(&self, layout: &MoveTypeLayout) -> MoveValue { self.0.as_move_value(layout) } + + #[cfg(feature = "gas-profiler")] + pub fn as_annotated_move_value(&self, layout: &A::MoveTypeLayout) -> Option { + self.0.as_annotated_move_value(layout) + } +} + +#[cfg(feature = "gas-profiler")] +impl ValueImpl { + /// Converts the value to an annotated move value. This is only needed for tracing and care + /// should be taken when using this function as it can possibly inflate the size of the value. + fn as_annotated_move_value(&self, layout: &A::MoveTypeLayout) -> Option { + use move_core_types::annotated_value::MoveTypeLayout as L; + use move_core_types::annotated_value::MoveValue; + Some(match (layout, self) { + (L::U8, ValueImpl::U8(x)) => MoveValue::U8(*x), + (L::U16, ValueImpl::U16(x)) => MoveValue::U16(*x), + (L::U32, ValueImpl::U32(x)) => MoveValue::U32(*x), + (L::U64, ValueImpl::U64(x)) => MoveValue::U64(*x), + (L::U128, ValueImpl::U128(x)) => MoveValue::U128(*x), + (L::U256, ValueImpl::U256(x)) => MoveValue::U256(*x), + (L::Bool, ValueImpl::Bool(x)) => MoveValue::Bool(*x), + (L::Address, ValueImpl::Address(x)) => MoveValue::Address(*x), + (l, ValueImpl::Container(c)) => return c.as_annotated_move_value(l), + ( + _, + ValueImpl::ContainerRef( + ContainerRef::Local(c) | ContainerRef::Global { container: c, .. }, + ), + ) => return c.as_annotated_move_value(layout), + ( + _, + ValueImpl::IndexedRef(IndexedRef { + container_ref: + ContainerRef::Local(c) | ContainerRef::Global { container: c, .. }, + idx, + }), + ) => { + use Container::*; + let idx = *idx; + let res = match c { + Locals(r) | Vec(r) | Struct(r) => r.borrow()[idx].copy_value().unwrap(), + Variant(r) => r.borrow().1[idx].copy_value().unwrap(), + VecU8(r) => ValueImpl::U8(r.borrow()[idx]), + VecU16(r) => ValueImpl::U16(r.borrow()[idx]), + VecU32(r) => ValueImpl::U32(r.borrow()[idx]), + VecU64(r) => ValueImpl::U64(r.borrow()[idx]), + VecU128(r) => ValueImpl::U128(r.borrow()[idx]), + VecU256(r) => ValueImpl::U256(r.borrow()[idx]), + VecBool(r) => ValueImpl::Bool(r.borrow()[idx]), + VecAddress(r) => ValueImpl::Address(r.borrow()[idx]), + }; + return res.as_annotated_move_value(layout); + } + (_layout, _val) => return None, + }) + } +} + +#[cfg(feature = "gas-profiler")] +impl Container { + fn as_annotated_move_value(&self, layout: &A::MoveTypeLayout) -> Option { + use move_core_types::annotated_value::MoveTypeLayout as L; + Some(match (layout, self) { + (L::Enum(A::MoveEnumLayout { type_, variants }), Container::Variant(r)) => { + let (tag, values) = &*r.borrow(); + let tag = *tag; + let ((name, _), field_layouts) = + variants.iter().find(|((_, t), _)| *t == tag).unwrap(); + let mut fields = vec![]; + for (v, field_layout) in values.iter().zip(field_layouts) { + fields.push(( + field_layout.name.clone(), + v.as_annotated_move_value(&field_layout.layout)?, + )); + } + A::MoveValue::Variant(A::MoveVariant { + tag, + fields, + type_: type_.clone(), + variant_name: name.clone(), + }) + } + (L::Struct(struct_layout), Container::Struct(r)) => { + let mut fields = vec![]; + for (v, field_layout) in r.borrow().iter().zip(struct_layout.fields.iter()) { + fields.push(( + field_layout.name.clone(), + v.as_annotated_move_value(&field_layout.layout)?, + )); + } + A::MoveValue::Struct(A::MoveStruct::new(struct_layout.type_.clone(), fields)) + } + + (L::Vector(inner_layout), c) => A::MoveValue::Vector(match c { + Container::VecU8(r) => r.borrow().iter().map(|u| A::MoveValue::U8(*u)).collect(), + Container::VecU16(r) => r.borrow().iter().map(|u| A::MoveValue::U16(*u)).collect(), + Container::VecU32(r) => r.borrow().iter().map(|u| A::MoveValue::U32(*u)).collect(), + Container::VecU64(r) => r.borrow().iter().map(|u| A::MoveValue::U64(*u)).collect(), + Container::VecU128(r) => { + r.borrow().iter().map(|u| A::MoveValue::U128(*u)).collect() + } + Container::VecU256(r) => { + r.borrow().iter().map(|u| A::MoveValue::U256(*u)).collect() + } + Container::VecBool(r) => { + r.borrow().iter().map(|u| A::MoveValue::Bool(*u)).collect() + } + Container::VecAddress(r) => r + .borrow() + .iter() + .map(|u| A::MoveValue::Address(*u)) + .collect(), + Container::Vec(r) => r + .borrow() + .iter() + .map(|v| v.as_annotated_move_value(&**inner_layout)) + .collect::>()?, + Container::Struct(_) | Container::Variant { .. } | Container::Locals(_) => { + return None + } + }), + + (L::Signer, Container::Struct(r)) => { + let v = r.borrow(); + if v.len() != 1 { + return None; + } + match &v[0] { + ValueImpl::Address(a) => A::MoveValue::Signer(*a), + _ => return None, + } + } + (_layout, _val) => return None, + }) + } } diff --git a/external-crates/tests.sh b/external-crates/tests.sh index efa26a5bc46956..7fa5a0531ff9a3 100755 --- a/external-crates/tests.sh +++ b/external-crates/tests.sh @@ -3,3 +3,5 @@ echo "Running Move tests in external-crates" cd move echo "Excluding prover Move tests" cargo nextest run -E '!package(move-prover) and !test(prove) and !test(run_all::simple_build_with_docs/args.txt) and !test(run_test::nested_deps_bad_parent/Move.toml)' --workspace --no-fail-fast +echo "Running tracing-specific tests" +cargo nextest run -p move-cli --features gas-profiler