Skip to content

Conversation

Abeeujah
Copy link
Contributor

@Abeeujah Abeeujah commented Sep 22, 2025

Closes #1637

Introduced changes

Block number and RPC version for ignored tests is no longer being checked

  • fork_config returns None for ignored tests
  • should_be_run IgnoredFilter::Ignored match arm asserts that test case is ignored.

Checklist

  • Linked relevant issue
  • Updated relevant documentation
  • Added relevant tests
  • Performed self-review of the code
  • Added changes to CHANGELOG.md

@Abeeujah Abeeujah requested a review from a team as a code owner September 22, 2025 10:56
Comment on lines 126 to 129
IgnoredFilter::Ignored => {
assert!(ignored);
true
}
Copy link
Member

Choose a reason for hiding this comment

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

Don't think we should be including this change, it's technically true given our current logic, but I think it's safer to still check if the test is ignored here since it's not very expensive.

Comment on lines 35 to 40
fork_config: if case.config.ignored {
None
} else {
resolve_fork_config(case.config.fork_config, block_number_map, fork_targets)
.await?
},
Copy link
Member

Choose a reason for hiding this comment

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

This isn't correct, in case forge is run with --ignored or --include-ignored, they will not have their configs resolved.

We should probably split separate the steps test_target_with_config and resolve_config and call them as separate methods, not as a part of test_package_with_config_resolved.

Then we can pass TestsFilter to resolve_config and call resolve_fork_config based on if should_be_run is true for a test case.

Copy link
Member

Choose a reason for hiding this comment

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

We could probably make do without splitting from test_package_with_config_resolved and just passing TestFilter to the method, but it seems a bit weird to me to use test filter without we even did any kind of filtering with it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Passing tests_filter to test_package_with_config_resolved would require marking the ignored_filter field pub, that looks like a change that would be needing approval?

Filtering is being done there, tests which the fork config should be resolved or not is going to be dependent on the tests_filter argument being passed there, if it wasn't for that, then we'll be running into the issue described above, unless there's another way to resolve that.

Comment on lines 39 to 44
fork_config: if ignored && matches!(ignored_filter, IgnoredFilter::NotIgnored) {
None
} else {
resolve_fork_config(case.config.fork_config, block_number_map, fork_targets)
.await?
},
Copy link
Member

Choose a reason for hiding this comment

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

We are duplicating the filtering logic here, why not use TestsFilter.should_be_run instead?
If the test isn't going to be run for whatever reason (including being ignored), then we don't need to resolve fork config for it.

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 tried using TestsFilter.should_be_run but it expects test_case: &TestCaseWithResolvedConfig while in this scenario, the test case being filtered is TestCase<TestCaseConfig> that's why I did that, also worth mentioning that TestsFilter.should_be_run would require me sharing the whole TestsFilter instance instead of just the needed ignored_filter field.

Copy link
Member

Choose a reason for hiding this comment

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

I tried using TestsFilter.should_be_run but it expects test_case: &TestCaseWithResolvedConfig while in this scenario, the test case being filtered is TestCase

What could be done in that case is we should introduce a trait that both TestCaseConfig and TestCaseResolvedConfig that contains one method like is_ignored. Then should_be_run and relevant TestCaseFilter can be made generic, so they take TestCase<T> where T implements the introduced trait.

This way it can be reused between both test_case types and logic can be shared.

also worth mentioning that TestsFilter.should_be_run would require me sharing the whole TestsFilter instance instead of just the needed ignored_filter field.

Passing a reference to it to the function doesn't incur any significant cost

@Abeeujah Abeeujah requested a review from cptartur September 26, 2025 16:48
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.

Don't fetch block numbers nor check rpc version for ignored tests when no --ignored nor --include-ignored flag is specified
2 participants