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

Add missing code to tracer extension #377

Closed
wants to merge 4 commits into from

Conversation

tgmichel
Copy link
Contributor

@tgmichel tgmichel commented Apr 21, 2021

What does it do?

Refactors the runner trace_call and trace_create in a single trace function.

And adds missing:

  • Handling for precompile on call contexts.
  • Record transaction cost.
  • Fee handling and account pre-checks.

What important points reviewers should know?

For missing precompile handling we have 2 options:

  • PR a new accessor on the EVM repo, and use it to access the evm::StackExecutor::precompile.
  • Pass EvmConfig::Precompile::execute to the executor wrapper in our side.

I decided to use the latter because we have access to it, and in both cases we are using the same PrecompileSet.

Is there something left for follow-up PRs?

EVM side is really not compatible with tracing. We enabled some accessors there to be able to mock it's internals, but we still need to duplicate a bunch of code on our side to make sure we behave trace in the same way that the original call was executed.

This PR is a clear demonstration that @nanocryk 's hook is better solution to avoid this type of situations.

Checklist

  • Does it require a purge of the network?
  • You bumped the runtime version if there are breaking changes in the runtime ?
  • Does it require changes in documentation/tutorials ?

@tgmichel tgmichel changed the title Add missing handling for precompile Add missing precompile handling in StackExecutorWrapper Apr 21, 2021
@tgmichel tgmichel changed the title Add missing precompile handling in StackExecutorWrapper Add missing precompile handling in StackExecutorWrapper Apr 21, 2021
@tgmichel tgmichel requested a review from nanocryk April 21, 2021 08:58
@tgmichel tgmichel changed the title Add missing precompile handling in StackExecutorWrapper Add missing code to tracer extension Apr 22, 2021
if let Some(ret) = (precompile)(address, &data, Some(gas_limit), &context) {
return match ret {
Ok((s, out, cost)) => {
let _ = self
Copy link
Collaborator

Choose a reason for hiding this comment

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

@notlesh isn't this also what you recently fixed ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is, however in our wrapper we need to do exactly what the evm is doing, even if it's wrong! Otherwise the trace won't be replicating the original transaction behaviour.

Of course once the PR is merged we can include that change in our wrapper. Once again, this can be avoided with the hook.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, it looks like it should effectively do the same thing.

@nanocryk
Copy link
Contributor

nanocryk commented May 4, 2021

This PR is a clear demonstration that @nanocryk 's hook is better solution to avoid this type of situations.
Here is the hook PR getting rid of the custom runner/wrapper : #387 . If it get merged this PR (377) is no longer needed.

@tgmichel
Copy link
Contributor Author

tgmichel commented May 6, 2021

Won't do, we want to go for the hook.

@tgmichel tgmichel closed this May 6, 2021
@tgmichel tgmichel deleted the tgm-executor-wrapper-precompiles branch July 6, 2021 13:28
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.

4 participants