Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VM 2 Tracing #20848

Open
wants to merge 2 commits into
base: tzakian/vm-rebase1
Choose a base branch
from
Open

VM 2 Tracing #20848

wants to merge 2 commits into from

Conversation

cgswords
Copy link
Contributor

Description

Add tracing to VM rewrite

Test plan

Old tests still pass


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):
  • gRPC:
  • JSON-RPC:
  • GraphQL:
  • CLI:
  • Rust SDK:

@cgswords cgswords requested a review from tnowacki January 10, 2025 01:08
Copy link

vercel bot commented Jan 10, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sui-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 17, 2025 7:22pm
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Jan 17, 2025 7:22pm
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Jan 17, 2025 7:22pm

@cgswords cgswords temporarily deployed to sui-typescript-aws-kms-test-env January 10, 2025 01:08 — with GitHub Actions Inactive
Copy link
Contributor

@tzakian tzakian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing! No real issues, although I did spot a small bug in the current tracing implementation that is replicated here around closing frames/OOG errors.

vtables: &'vm_cache VMDispatchTables,
vm_config: Arc<VMConfig>,
extensions: &'native mut NativeContextExtensions<'native_lifetimes>,
// TODO: consider making this `Option<&mut VMTracer<'_>>` and passing it like that everywhere?
tracer: &'tracer mut Option<VMTracer<'trace_builder>>,
Copy link
Contributor

@tzakian tzakian Feb 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment lower down, but I kinda like the way this turned out at the entry points so I'd be in favor of keeping it as-is here.

@@ -161,9 +181,17 @@ fn step(

profile_close_frame!(
gas_meter,
arena::to_ref(current_frame.function).pretty_string()
state.call_stack.current_frame.function().pretty_string()
Copy link
Contributor

@tzakian tzakian Feb 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a bug in the current tracer as well, but I think above you'll need to do something like

let err = gas_meter.charge_drop_frame(...).map_err(|e| ..);
profile_close_frame!( ...);
trace(..., err.as_ref().err());
err?;

Otherwise if the charge for the drop frame causes an OOG you wont see it in the trace.

@@ -75,3 +87,5 @@ macro_rules! set_err_info {
}

pub(crate) use set_err_info;

use super::tracing::tracer::VMTracer;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems a weird place for this use (and the above one too). Move to top of the file?

@@ -163,6 +209,7 @@ impl<'extensions> MoveVM<'extensions> {
function_name: &IdentStr,
type_arguments: Vec<Type>,
serialized_args: Vec<impl Borrow<[u8]>>,
tracer: Option<&mut MoveTraceBuilder>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this. I think this assuages the comment higher about whether we wanted &mut Option<VMTracer> or Option<&mut VMTracer> -- I think I like it the way it is here.

}

/// Similar to execute_entry_function, but it bypasses visibility checks and accepts a tracer
pub fn execute_function_bypass_visibility_with_tracer_if_enabled(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for this PR, but thoughts on eventually rolling this into one function execute_function_bypass_visibility?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants