-
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
Plugable EVM tracing #883
Plugable EVM tracing #883
Conversation
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.
Great that we can avoid having production runtime include unnecessary code but I don't believe this PR is the best way to achieve this.
@@ -31,6 +31,7 @@ pub struct Cli { | |||
pub run: cumulus_client_cli::RunCmd, | |||
|
|||
/// Enable EVM tracing module on a non-authority node. | |||
#[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.
Instead of adding options one by one, and having #[cfg(feature = "evm-tracing")]]
over each, you should create a struct and flatten it. Perfect example is few lines above for the cumulus_client_cli
.
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.
Preprocessor conditions makes it possible to exclude tracing dependencies from production client.
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 is correct. However, I didn't comment that at all.
My comment relates to having many feature checks and I suggest to add only one instead and use the flatten macro.
@@ -168,6 +176,7 @@ impl RelayChainCli { | |||
} | |||
|
|||
/// EVM tracing CLI flags. | |||
#[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.
Why not move all evm-tracing
related type into a separate module?
The code would be much cleaner.
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.
I didn’t change anything here, just add few preprocessor conditions; all comments are fair for 5.0 without this PR.
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.
I commented what you changed - adding the feature check 🤷♂️.
|
||
#[cfg(not(feature = "evm-tracing"))] | ||
if config.chain_spec.is_astar() { | ||
start_astar_node(config, polkadot_config, collator_options, para_id, cli.enable_evm_rpc) | ||
.await | ||
.map(|r| r.0) | ||
.map_err(Into::into) |
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 isn't clean nor is it scalable - why not instead introduce a new struct/type, like AdditionalConfiguration
which would aggregate all additional config types?
That way you keep a single entry point for the start_xyz_node
function. If we need to add additional ones in the future, how will that look like otherwise?
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 point for refactoring the service.
}) | ||
) | ||
}).await | ||
} |
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.
We've discussed in the team that service code is already too complex as it is. Adding additional 1000+ lines of C/P code with slight modification looks like another giant leap in the wrong direction.
We should carefully rethink this approach - the solution which you're basing this PR on didn't include this code in production for a reason.
Merging this, as it is, makes further development and maintenance of this code even more difficult than before.
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.
Up to me it not grown complexity, good point is have full refactoring instead of trying to deal with complexity in this PR.
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.
Ok, then we have differing opinions. Mine is based on doing the uplifts roughly for the last year.
And with this code, it looks like that will be even more complex now that it was before.
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.
Let's get it merged to remove the unconditional EVM tracing code from runtimes 👍
Pull Request Summary
This PR introduce EVM tracing as optional feature. Using runtime overriding it makes possible to enable tracing on runtimes that don't have tracing runtime API.
New rust features:
evm-tracing
on runtimes: enable tracing runtime API when build with specified feature - used for tracing runtimesevm-tracing
on collator: enable tracing RPC and host functions required for tracing runtimes.Usage:
tracing
node and runtime--wasm-runtime-overrides
flag to substitute tracing runtime instead of productionCheck list