test: Add a logs expectation to the state_transition fixture#1574
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1574 +/- ##
=======================================
Coverage 97.38% 97.38%
=======================================
Files 163 163
Lines 14622 14634 +12
Branches 3395 3401 +6
=======================================
+ Hits 14240 14252 +12
Misses 280 280
Partials 102 102
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
The state_transition fixture could assert state, gas, and trace, but not emitted logs. Add an optional Expectation::logs, compared field-by-field (count, address, data, topics, and order) in the runner, with a LOG1 smoke test pinning the mechanism.
068f291 to
f8e5a2b
Compare
There was a problem hiding this comment.
Pull request overview
This PR extends the state_transition unit-test fixture to optionally assert emitted transaction logs, enabling state-transition tests to validate receipt log count and per-log fields (address, data, topics) in order.
Changes:
- Add
Expectation::logs(std::optional<std::vector<Log>>) to thestate_transitionfixture API. - Implement receipt log comparison in the runner (
TearDown()) whenexpect.logsis set. - Add a
LOG1-based smoke test to pin the new log-expectation mechanism.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test/unittests/state_transition.hpp | Extends the fixture expectations with an optional logs field. |
| test/unittests/state_transition.cpp | Adds receipt log assertions when expect.logs is provided. |
| test/unittests/state_transition_tx_test.cpp | Introduces a smoke test that emits a log and asserts it via expect.logs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The state_transition fixture could assert state, gas, and trace, but not emitted logs. Add an optional Expectation::logs, compared field-by-field (count, address, data, topics, and order) in the runner, with a LOG1 smoke test pinning the mechanism.