-
Notifications
You must be signed in to change notification settings - Fork 11.3k
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
Enable tracing in the execution layer #21165
Changes from 10 commits
c71c190
c3f6693
c5d0520
38b3896
fac0398
f628be8
163ddeb
8720ed2
cef8735
f60a4c1
6ccdaf6
d6662c0
343f263
bb76c6b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -617,6 +617,7 @@ mod test { | |
kind, | ||
signer, | ||
genesis_digest, | ||
None, | ||
); | ||
|
||
assert_eq!(&effects, genesis.effects()); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -217,6 +217,12 @@ impl MoveTrace { | |
} | ||
} | ||
|
||
impl Default for MoveTrace { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have this clippy note disabled in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Fwiw, I got clippy complaining about it in CI... |
||
fn default() -> Self { | ||
Self::new() | ||
} | ||
} | ||
|
||
impl MoveTraceBuilder { | ||
/// Create a new `MoveTraceBuilder` with no additional tracing. | ||
pub fn new() -> Self { | ||
|
@@ -314,6 +320,12 @@ impl MoveTraceBuilder { | |
} | ||
} | ||
|
||
impl Default for MoveTraceBuilder { | ||
fn default() -> Self { | ||
Self::new() | ||
} | ||
} | ||
|
||
impl Display for TraceValue { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
match self { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -138,6 +138,12 @@ impl TraceState { | |
} | ||
} | ||
|
||
impl Default for TraceState { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
fn default() -> Self { | ||
Self::new() | ||
} | ||
} | ||
|
||
impl Tracer for TraceState { | ||
fn notify(&mut self, event: &TraceEvent, mut write: Writer<'_>) { | ||
self.apply_event(event); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ mod checked { | |
|
||
use crate::execution_mode::{self, ExecutionMode}; | ||
use move_binary_format::CompiledModule; | ||
use move_trace_format::format::MoveTraceBuilder; | ||
use move_vm_runtime::move_vm::MoveVM; | ||
use std::{collections::HashSet, sync::Arc}; | ||
use sui_types::balance::{ | ||
|
@@ -92,6 +93,7 @@ mod checked { | |
metrics: Arc<LimitsMetrics>, | ||
enable_expensive_checks: bool, | ||
certificate_deny_set: &HashSet<TransactionDigest>, | ||
trace_builder_opt: Option<&mut MoveTraceBuilder>, | ||
) -> ( | ||
InnerTemporaryStore, | ||
SuiGasStatus, | ||
|
@@ -145,6 +147,7 @@ mod checked { | |
deny_cert, | ||
contains_deleted_input, | ||
cancelled_objects, | ||
trace_builder_opt, | ||
); | ||
|
||
let status = if let Err(error) = &execution_result { | ||
|
@@ -262,6 +265,7 @@ mod checked { | |
tx_context, | ||
&mut gas_charger, | ||
pt, | ||
None, | ||
) | ||
.map_err(|(e, _)| e)?; | ||
temporary_store.update_object_version_and_prev_tx(); | ||
|
@@ -281,6 +285,7 @@ mod checked { | |
deny_cert: bool, | ||
contains_deleted_input: bool, | ||
cancelled_objects: Option<(Vec<ObjectID>, SequenceNumber)>, | ||
trace_builder_opt: Option<&mut MoveTraceBuilder>, | ||
) -> ( | ||
GasCostSummary, | ||
Result<Mode::ExecutionResults, ExecutionError>, | ||
|
@@ -340,6 +345,7 @@ mod checked { | |
gas_charger, | ||
protocol_config, | ||
metrics.clone(), | ||
trace_builder_opt, | ||
) | ||
}; | ||
|
||
|
@@ -566,6 +572,7 @@ mod checked { | |
gas_charger: &mut GasCharger, | ||
protocol_config: &ProtocolConfig, | ||
metrics: Arc<LimitsMetrics>, | ||
trace_builder_opt: Option<&mut MoveTraceBuilder>, | ||
) -> ResultWithTimings<Mode::ExecutionResults, ExecutionError> { | ||
let result = match transaction_kind { | ||
TransactionKind::ChangeEpoch(change_epoch) => { | ||
|
@@ -651,6 +658,7 @@ mod checked { | |
tx_ctx, | ||
gas_charger, | ||
pt, | ||
trace_builder_opt, | ||
) | ||
} | ||
TransactionKind::EndOfEpochTransaction(txns) => { | ||
|
@@ -903,6 +911,7 @@ mod checked { | |
tx_ctx, | ||
gas_charger, | ||
advance_epoch_pt, | ||
None, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would anything go wrong if we added support for tracing system transactions? In the context of Replay that should be possible, and it's something that would certainly help us debug issues during reconfiguration etc. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did not think that replay tool will be able to handle these but I guess everything that's executed from |
||
); | ||
|
||
#[cfg(msim)] | ||
|
@@ -932,6 +941,7 @@ mod checked { | |
tx_ctx, | ||
gas_charger, | ||
advance_epoch_safe_mode_pt, | ||
None, | ||
) | ||
.map_err(|(e, _)| e) | ||
.expect("Advance epoch with safe mode must succeed"); | ||
|
@@ -1002,6 +1012,7 @@ mod checked { | |
tx_ctx, | ||
gas_charger, | ||
publish_pt, | ||
None, | ||
) | ||
.map_err(|(e, _)| e) | ||
.expect("System Package Publish must succeed"); | ||
|
@@ -1071,6 +1082,7 @@ mod checked { | |
tx_ctx, | ||
gas_charger, | ||
pt, | ||
None, | ||
) | ||
.map_err(|(e, _)| e)?; | ||
Ok(()) | ||
|
@@ -1214,6 +1226,7 @@ mod checked { | |
tx_ctx, | ||
gas_charger, | ||
pt, | ||
None, | ||
) | ||
.map_err(|(e, _)| e)?; | ||
Ok(()) | ||
|
@@ -1282,6 +1295,7 @@ mod checked { | |
tx_ctx, | ||
gas_charger, | ||
pt, | ||
None, | ||
) | ||
.map_err(|(e, _)| e)?; | ||
Ok(()) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,7 @@ mod checked { | |
identifier::IdentStr, | ||
language_storage::{ModuleId, StructTag, TypeTag}, | ||
}; | ||
use move_trace_format::format::MoveTraceBuilder; | ||
use move_vm_runtime::native_extensions::NativeContextExtensions; | ||
use move_vm_runtime::{ | ||
move_vm::MoveVM, | ||
|
@@ -963,6 +964,7 @@ mod checked { | |
function_name: &IdentStr, | ||
ty_args: Vec<Type>, | ||
args: Vec<impl Borrow<[u8]>>, | ||
tracer: Option<&mut MoveTraceBuilder>, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should the tracer be part of the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure how useful it would be as I am not sure it will be used anywhere else other than runtime's |
||
) -> VMResult<SerializedReturnValues> { | ||
let gas_status = self.gas_charger.move_gas_status_mut(); | ||
let mut data_store = SuiDataStore::new(&self.linkage_view, &self.new_packages); | ||
|
@@ -974,7 +976,7 @@ mod checked { | |
&mut data_store, | ||
gas_status, | ||
&mut self.native_extensions, | ||
None, | ||
tracer, | ||
) | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit of a "my bad" situation here -- I don't think
move-trace-format
needs all these different crates (or at least doesn't use them). So I think removing them from themove-trace-format
crate should allow you to remove them here and just import themove-trace-format
crate.