Skip to content
This repository was archived by the owner on Jun 9, 2026. It is now read-only.

test: treat libevm errors as test failures#115

Open
JonathanOppenheimer wants to merge 39 commits into
mainfrom
JonathanOppenheimer/enhance-libevm-logging
Open

test: treat libevm errors as test failures#115
JonathanOppenheimer wants to merge 39 commits into
mainfrom
JonathanOppenheimer/enhance-libevm-logging

Conversation

@JonathanOppenheimer

@JonathanOppenheimer JonathanOppenheimer commented Jan 28, 2026

Copy link
Copy Markdown
Contributor

Closes ava-labs/avalanchego#5271!

For context, we decided that libevm warnings should be treated as warnings. I added the new logger in the suggested places - let me know if we think it would be useful in any additional places!

This PR:

  • Adds EnableLibEVMTBLogger to redirect libevm/geth logs to testing.TB during tests, failing on errors
  • Enables it across all test packages (sae, saexec, txgossip) so libevm errors are never silently swallowed

Additionally, this PR should not be merged until ava-labs/libevm#269 is merged.

@JonathanOppenheimer JonathanOppenheimer self-assigned this Jan 28, 2026
@JonathanOppenheimer JonathanOppenheimer added the testing Related to testing efforts label Jan 28, 2026
Comment thread .gitignore
Comment on lines +3 to +4
# Test binaries
*.test

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I generated a bunch of sae.test etc. I don't want to commit them and assume we don't want them here.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

How did you manage to do that? Something's weird and this shouldn't be necessary.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Just go test -c

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I can remove this from the .gitignore if you want

Comment thread .gitignore
Comment on lines +3 to +4
# Test binaries
*.test

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

How did you manage to do that? Something's weird and this shouldn't be necessary.

Comment thread blocks/blockstest/blocks_test.go Outdated
Comment thread blocks/blockstest/blocks_test.go Outdated
@JonathanOppenheimer JonathanOppenheimer force-pushed the JonathanOppenheimer/enhance-libevm-logging branch from 53bc942 to 82f0ef0 Compare January 30, 2026 18:06
Comment thread sae/rpc_test.go Outdated
Comment thread sae/worstcase_test.go Outdated
Comment thread saexec/saexec.go Outdated
@StephenButtolph

Copy link
Copy Markdown
Contributor

Lets change this to error the test if an error happens rather than a warn, as geth doesn't seem to care too much about warns.

Signed-off-by: Jonathan Oppenheimer <147infiniti@gmail.com>
Comment thread saexec/saexec_test.go Outdated
Comment thread txgossip/txgossip_test.go Outdated
Comment thread sae/vm_test.go Outdated

mempoolConf := legacypool.DefaultConfig // copies
mempoolConf.Journal = "/dev/null"
mempoolConf.Journal = filepath.Join(tb.TempDir(), "transactions.rlp")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Was there a test failure after this? It didn't write to the journal?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't think this is actually necessary and a vestige of prior iterations of this PR. removed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

actually this seems to be semi necessary

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For some reason sae/TestWorstCase fails without this.

JonathanOppenheimer and others added 3 commits March 10, 2026 10:49
Co-authored-by: Austin Larson <78000745+alarso16@users.noreply.github.com>
Signed-off-by: Jonathan Oppenheimer <147infiniti@gmail.com>
Co-authored-by: Austin Larson <78000745+alarso16@users.noreply.github.com>
Signed-off-by: Jonathan Oppenheimer <147infiniti@gmail.com>
Comment thread saetest/logging.go Outdated
Comment thread saetest/logging.go Outdated
Comment thread saetest/logging.go Outdated
Comment thread saexec/saexec_test.go Outdated
Comment thread saexec/saexec_test.go Outdated
Comment thread saexec/saexec_test.go Outdated
Comment thread saexec/saexec_test.go

@powerslider powerslider left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overall LGTM! Added a slight simplification for the libevm logger.

@JonathanOppenheimer

Copy link
Copy Markdown
Contributor Author

Overall LGTM! Added a slight simplification for the libevm logger.

thanks tsvetan!

JonathanOppenheimer and others added 3 commits March 16, 2026 12:08
Co-authored-by: Tsvetan Dimitrov <tsvetan.dimitrov23@gmail.com>
Signed-off-by: Jonathan Oppenheimer <147infiniti@gmail.com>
@JonathanOppenheimer JonathanOppenheimer force-pushed the JonathanOppenheimer/enhance-libevm-logging branch from 910457e to d94ee19 Compare March 16, 2026 16:30
@JonathanOppenheimer

Copy link
Copy Markdown
Contributor Author

Overall LGTM! Added a slight simplification for the libevm logger.

thanks tsvetan!

@powerslider -- it doesn't appear your suggestion works - it still races. I'll revert the past 3 commits unless you object.

powerslider and others added 2 commits March 23, 2026 13:54
- Guard `log.SetDefault` with an `atomic.Bool` so only the first call
takes effect. This removes the need for the `withoutGlobalLogger` option
machinery in `newSUT` while preventing data races from parallel fuzz
sub-tests each calling `EnableLibEVMTBLogger` via `newSUT`.
- `FuzzOpCodes` now calls `EnableLibEVMTerminalLogger(f)` before
`f.Fuzz()` since Go forbids `testing.F.Logf` inside fuzz targets.
Sub-tests' calls to `EnableLibEVMTBLogger` are no-ops.


Signed-off-by: Tsvetan Dimitrov (tsvetan.dimitrov@avalabs.org)

---------

Signed-off-by: Tsvetan Dimitrov (tsvetan.dimitrov23@gmail.com)
Signed-off-by: Jonathan Oppenheimer <147infiniti@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

low priority testing Related to testing efforts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Test Logger with libevm

5 participants