-
Notifications
You must be signed in to change notification settings - Fork 414
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
EVM tracing support #802
EVM tracing support #802
Conversation
00843ea
to
0fa613c
Compare
/// Maximum number of logs in a query. | ||
#[clap(long, default_value = "10000")] | ||
pub max_past_logs: u32, | ||
|
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.
Good docs page will be needed for this.
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.
Agree, parameters should be explained in details.
bin/collator/src/cli.rs
Outdated
} | ||
} | ||
|
||
pub struct TracingConfig { |
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.
How about EvmTracingConfig
? It's more precise.
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.
Done
bin/collator/src/rpc.rs
Outdated
pub mod tracing; | ||
|
||
#[derive(Clone)] | ||
pub struct TracingConfig { |
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.
EvmTracingConfig
perhaps?
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.
Definitely, let me fix it.
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.
Renamed
if let Some(trace_filter_requester) = tracing_config.tracing_requesters.trace { | ||
io.merge( | ||
Trace::new( | ||
client, | ||
trace_filter_requester, | ||
tracing_config.trace_filter_max_count, | ||
) | ||
.into_rpc(), | ||
)?; | ||
} | ||
|
||
if let Some(debug_requester) = tracing_config.tracing_requesters.debug { | ||
io.merge(Debug::new(debug_requester).into_rpc())?; | ||
} |
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.
Haven't checked the code in details, but can't we just reuse the existing function and add the highlighted part only to this method?
Something like:
fn create_full_tracing(...) -> Result<...> {
let io = create_full(...)?;
// the code you added
}
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.
Good to have.
I planed to remove one of this function when all runtimes will implement Debug runtime API.
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.
Fixed
runtime/local/src/lib.rs
Outdated
@@ -1467,4 +1467,70 @@ impl_runtime_apis! { | |||
Executive::try_execute_block(block, state_root_check, select).expect("execute-block failed") | |||
} | |||
} | |||
|
|||
#[cfg(feature = "evm-tracing")] |
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.
Could you please explain why is this feature flag used?
Not sure I understand given it's runtime code.
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.
Technically we can build runtime without this feature, because it’s still experimental. But in near future it could be moved to default or removed.
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.
Removed this feature
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.
Ethereum doesn't allow Debug RPCs by default. Node operators need to configure to intentionally allow Debug APIs being exposed.
https://geth.ethereum.org/docs/interacting-with-geth/rpc
The default whitelist allows access to the eth, net and web3 namespaces. To enable access to other APIs like debugging (debug), they must be configured using the --http.api flag. Enabling these APIs over HTTP is not recommended because access to these methods increases the attack surface.
I think we should do the same at least by having a new flag, otherwise all public node operators need some measurements to block these RPCs in front of node processes.
I just noticed it's already implemented so.
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.
Checked the delta & LGTM but perhaps @shunsukew or @0x7CFE who invested more time into EVM tracing can provide better feedback.
@shunsukew @0x7CFE please take a look |
Co-authored-by: Shunsuke Watanabe <[email protected]>
Co-authored-by: Shunsuke Watanabe <[email protected]>
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.
Was that intentional that spec version was updated only for local runtime?
@@ -1448,6 +1448,70 @@ impl_runtime_apis! { | |||
} | |||
} | |||
|
|||
impl moonbeam_rpc_primitives_debug::DebugRuntimeApi<Block> for Runtime { |
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.
Looks like this impl is mostly copypaste? Maybe we should extract it into a single module, used by all runtimes?
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.
That’s right, usually multi-runtimes projects create something like common
module with shared implementations. Problem here it’s under macros and move it outside makes code more and more sophisticated.
@0x7CFE please point me to spec version you mean. |
* EVM tracing support (#802) * Added EVM tracing into local runtime * Added tracing CLI * Compilation fixes * Added EVM tracing host functions * Added EVM tracing into parachain runtimes * TracingConfig -> EvmTracingConfig * Compilation fixes * Fix clippy errors * Fix formatting * Updated dependencies in Cargo.lock * Updated Cargo.lock * Update bin/collator/src/local/service.rs Co-authored-by: Shunsuke Watanabe <[email protected]> * Update bin/collator/src/parachain/service.rs Co-authored-by: Shunsuke Watanabe <[email protected]> * Bump astar/shiden runtime specs Co-authored-by: Shunsuke Watanabe <[email protected]> * Fix srtool build * [CI] temporary disable aarch64 target * [CI] fix binaries upload for release pipeline * Fix CI errors * Update rust toolchain version to 2023-01-11 * Update Cargo.lock * Added txpool rpc support (#855) * Added txpool rpc support * Fix licensing * Bump dependencies & runtime versions * Remove outdated migrations from runtimes * Sort review comments --------- Co-authored-by: Shunsuke Watanabe <[email protected]>
Pull Request Summary
This PR based on Moonbeam great job with EVM tracing support. As base used EVM tracing module from PureStake repositories, adopted and improved to suits Astar requirements and code base.
Tracing modules PR: AstarNetwork/astar-frame#120
Check list