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

feat: add support for Geth built-in tracer and config #2121

Merged
merged 12 commits into from
Feb 7, 2023

Conversation

KuTuGu
Copy link
Contributor

@KuTuGu KuTuGu commented Feb 7, 2023

Motivation

Now only callTracer is supported, add more build-in tracer and config support.

Solution

  • feat: support other geth build-in tracers
  • feat: support geth tracer config
  • refactor: reconstructs the layout of geth tracer
  • test: add unit tests for default, legacy, and tracer config

Refs: #2064

PR Checklist

  • Added Tests
  • Added Documentation
  • Updated the changelog
  • Breaking changes

#[serde(default, deserialize_with = "from_int_or_hex")]
pub gas: U256,
#[serde(default, deserialize_with = "from_int_or_hex", rename = "gasUsed")]
pub gas_used: U256,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The gas and gas_used fields are not compatible with the legacy format. Should we change it to Option, and which might be a break change?
For now, to be compatible with previous versions, I've only added a default handling, which returns U256::zero() instead of None.

Copy link
Owner

Choose a reason for hiding this comment

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

default is fine w me

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

thanks,

left some nits.

Comment on lines +16 to +17
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
pub struct PreStateMode(pub BTreeMap<Address, AccountState>);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this should probably b #[serde(transparent)]?

https://serde.rs/container-attrs.html#transparent

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems transparent is enabled for newtype by default?

Copy link
Collaborator

Choose a reason for hiding this comment

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

TIL

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

lgtm

@gakonst gakonst merged commit 14be402 into gakonst:master Feb 7, 2023
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.

3 participants