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

fix gasometer tracing #74

Merged
merged 8 commits into from
Oct 26, 2021
Merged

Conversation

zjb0807
Copy link
Contributor

@zjb0807 zjb0807 commented Oct 25, 2021

Closes: #73

@sorpaas
Copy link
Member

sorpaas commented Oct 25, 2021

Can you also add CI build for feature tracing?

gasometer/src/lib.rs Outdated Show resolved Hide resolved
@zjb0807
Copy link
Contributor Author

zjb0807 commented Oct 25, 2021

Can you also add CI build for feature tracing?

cargo build -p evm-gasometer --features tracing

The command not working, so I create a new workspace.

@sorpaas
Copy link
Member

sorpaas commented Oct 25, 2021

The command not working, so I create a new workspace.

Why? What's the error?

#[cfg(feature = "tracing")]
pub fn snapshot(&self) -> Snapshot {
match self.inner.as_ref() {
Ok(inner) => Snapshot {
Copy link
Member

Choose a reason for hiding this comment

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

You can use ok().map(...).unwrap_or_default()

Copy link
Member

Choose a reason for hiding this comment

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

Wait, but what's the meaning of Default here? Shouldn't we propagate the error?

Copy link
Member

Choose a reason for hiding this comment

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

Please also fix this. Either change it to expect if you don't think errors will ever be returned, or properly handle the errors.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think should not handle errors in the event, otherwise, it will return a different result than without tracing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Default means an error, but ignore it and let other checks deal with it

Copy link
Member

Choose a reason for hiding this comment

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

Can you change the Snapshot struct to an enum representing either the current value, or a specific OutOfGas variant? You can also change all instances of Snapshot to Option<Snapshot>.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed all instances of Snapshot to Option.
Does this satisfy the requirement?

Can you change the Snapshot struct to an enum representing either the current value, or a specific OutOfGas variant?

I'm not sure how to implement this

@zjb0807
Copy link
Contributor Author

zjb0807 commented Oct 25, 2021

Why? What's the error?

No error was returned, I feel it is a problem with the workspace. You can try this command.
Do you have any other better suggestions?

@sorpaas
Copy link
Member

sorpaas commented Oct 25, 2021

I can't reproduce the error at all. It works fine for me.

@zjb0807
Copy link
Contributor Author

zjb0807 commented Oct 25, 2021

I can't reproduce the error at all. It works fine for me.

Please try this:

cd gasometer
cargo build --features tracing

@sorpaas
Copy link
Member

sorpaas commented Oct 25, 2021

You missed some feature declarations. This has nothing to do with workspaces.

Comment on lines +40 to +41
"evm-gasometer/tracing",
"evm-runtime/tracing"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have modified it.
But I think the original way is better. People can enable tracing for evm/evm-gasometer/evm-runtime separately.

@sorpaas sorpaas merged commit 58895a8 into rust-ethereum:master Oct 26, 2021
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.

gasometer failed with tracing
3 participants