Skip to content

Commit 7119c79

Browse files
committed
chore(test-forks): include sibling BPO forks in --until ranges
1 parent 852715c commit 7119c79

2 files changed

Lines changed: 70 additions & 0 deletions

File tree

packages/testing/src/execution_testing/forks/helpers.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,34 @@ def get_last_descendants(
195195
return resulting_forks
196196

197197

198+
def get_bpo_sibling_forks(
199+
forks: Set[Type[BaseFork]] | FrozenSet[Type[BaseFork]],
200+
forks_until: Set[Type[BaseFork]],
201+
) -> Set[Type[BaseFork]]:
202+
"""
203+
Return BPO forks that branch off an ancestor of an `--until` fork.
204+
205+
BPO (Blob Parameter Only) forks form a chain hanging off the fork
206+
they extend (e.g. the `BPO3`/`BPO4`/`BPO5` chain branches off `BPO2`).
207+
A later fork such as `Amsterdam` descends from that same `BPO2` on a
208+
parallel branch, so an ancestry-based `--until=Amsterdam` range never
209+
reaches the BPO chain. Return those siblings so filling until such a
210+
fork still exercises the blob-parameter paths the BPO forks cover.
211+
"""
212+
siblings: Set[Type[BaseFork]] = set()
213+
for fork_until in forks_until:
214+
if issubclass(fork_until, TransitionBaseClass):
215+
continue
216+
for fork in forks:
217+
if not fork.bpo_fork():
218+
continue
219+
if fork <= fork_until or fork >= fork_until:
220+
continue
221+
if fork.non_bpo_ancestor() <= fork_until:
222+
siblings.add(fork)
223+
return siblings
224+
225+
198226
def get_selected_fork_set(
199227
*,
200228
single_fork: Set[Type[BaseFork]],
@@ -225,6 +253,7 @@ def get_selected_fork_set(
225253
for fork_until in forks_until:
226254
if issubclass(fork_until, TransitionBaseClass):
227255
selected_fork_set.discard(fork_until.transitions_to())
256+
selected_fork_set |= get_bpo_sibling_forks(ALL_FORKS, forks_until)
228257
selected_fork_set_with_transitions: Set[
229258
Type[BaseFork | TransitionBaseClass]
230259
] = set() | selected_fork_set

packages/testing/src/execution_testing/forks/tests/test_forks.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
BPO2,
1414
BPO3,
1515
BPO4,
16+
BPO5,
1617
Amsterdam,
1718
Berlin,
1819
Cancun,
@@ -682,6 +683,46 @@ def test_transition_from_normal_until(self) -> None:
682683
assert BPO1ToBPO2AtTime15k in result
683684
assert BPO2ToAmsterdamAtTime15k not in result
684685

686+
def test_until_amsterdam_includes_bpo_siblings(self) -> None:
687+
"""`--until=Amsterdam` pulls in the parallel BPO branch."""
688+
result = get_selected_fork_set(
689+
single_fork=set(),
690+
forks_from=set(),
691+
forks_until={Amsterdam},
692+
)
693+
normal = self._normal_forks(result)
694+
assert {BPO1, BPO2, BPO3, BPO4, BPO5, Amsterdam} <= normal
695+
assert BPO2ToBPO3AtTime15k in result
696+
assert BPO3ToBPO4AtTime15k in result
697+
698+
def test_from_osaka_until_amsterdam_spans_bpo_branch(self) -> None:
699+
"""`--from=Osaka --until=Amsterdam` spans the full BPO branch."""
700+
result = get_selected_fork_set(
701+
single_fork=set(),
702+
forks_from={Osaka},
703+
forks_until={Amsterdam},
704+
)
705+
assert self._normal_forks(result) == {
706+
Osaka,
707+
BPO1,
708+
BPO2,
709+
BPO3,
710+
BPO4,
711+
BPO5,
712+
Amsterdam,
713+
}
714+
715+
def test_until_bpo2_excludes_later_bpo_siblings(self) -> None:
716+
"""`--until=BPO2` must not pull in the later BPO branch."""
717+
result = get_selected_fork_set(
718+
single_fork=set(),
719+
forks_from=set(),
720+
forks_until={BPO2},
721+
)
722+
normal = self._normal_forks(result)
723+
assert {BPO1, BPO2} <= normal
724+
assert not ({BPO3, BPO4, BPO5} & normal)
725+
685726

686727
def test_blob_constants() -> None: # noqa: D103
687728
assert Osaka.get_blob_constant("AMOUNT_CELL_PROOFS") == 128

0 commit comments

Comments
 (0)