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

cmd/evm: don't reuse state between evm benchmark iterations. ensure benchmark errors are included in output. #30780

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

jwasinger
Copy link
Contributor

@jwasinger jwasinger commented Nov 21, 2024

Reusing state between benchmark iterations resulted in inconsistent results across runs, which surfaced in #30778 .

If these errors are triggered again, they should be printed to output. To ensure that the code invoking testing.Benchmark() can catch and output these errors, and then exit: I replace calls to t.B.Fatalf with setting an error which is consumed by the calling code.

The same consistency checks should probably be applied to the state test benchmarker. I am figuring that out now.

closes #30778 .

cmd/evm/runner.go Outdated Show resolved Hide resolved
@@ -82,24 +82,33 @@ type execStats struct {
GasUsed uint64 `json:"gasUsed"` // the amount of gas used during execution
}

func timedExec(bench bool, execFunc func() ([]byte, uint64, error)) ([]byte, execStats, error) {
func timedExec(bench bool, execFunc func() ([]byte, uint64, error)) (output []byte, stats execStats, execErr error, benchErr error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of adding more returns... so we wanted to do Fatalf, which essentually stops everything. How about doing a panic instead of returning the benchErr? More or less the same as b.Fatalf?

Copy link
Contributor

Choose a reason for hiding this comment

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

I just think it's getting a bit unwieldy, this is supposed to be a neat little helper

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 agree that a panic is fine here: this error case indicates that something is wrong with our implementation.

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.

evm run --bench segfaults in Fatalf
2 participants