Skip to content

feat(fork): select Base upgrade via BASE_UPGRADE env - #215

Merged
rayyan224 merged 1 commit into
mainfrom
feat/fork-base-upgrade-selection
Sep 2, 2026
Merged

feat(fork): select Base upgrade via BASE_UPGRADE env#215
rayyan224 merged 1 commit into
mainfrom
feat/fork-base-upgrade-selection

Conversation

@rayyan224

Copy link
Copy Markdown
Collaborator

What

The fork-test harness (script/fork/__main__.py) hardcoded a bare --base when
launching anvil, so it always registered anvil's default upgrade. This adds
an optional BASE_UPGRADE env var that, when set, is forwarded as
--base <upgrade> (e.g. --base beryl).

Unset/empty preserves today's behavior (bare --base → default upgrade), so
existing callers are unaffected.

Why

anvil's --base flag can now pin a specific historical upgrade at runtime. That
lets a single current base-anvil revision test the latest precompile
implementation against each frozen historical base-std suite, instead of pinning
a distinct anvil revision per hardfork. This harness change is what actually
selects the upgrade at launch; CI passes the fork to test via BASE_UPGRADE.

Changes

  • script/fork/__main__.py: read BASE_UPGRADE, thread it into
    anvil_running(...), build the --base [<upgrade>] argv conditionally, and
    log the selected upgrade.
  • script/fork/README.md: document BASE_UPGRADE in the Environment table.

How to test

Requires patched anvil/forge built from a base-anvil revision that supports
--base <upgrade>:

BASE_UPGRADE=beryl ANVIL_BIN=<…/anvil> FORGE_BIN=<…/forge> ANVIL_LOG=/tmp/a.log \
  make fork-tests ARGS="--match-test <any>"
  • [run-fork-tests] base upgrade: beryl appears and anvil boots.
  • Repeat with BASE_UPGRADE=cobalt and with it unset (unset → default, unchanged).
  • An invalid value makes anvil exit during startup and the harness reports the
    environment error — confirming the value is actually forwarded.

The fork harness hardcoded a bare `--base`, always registering base-anvil's
default upgrade. Read an optional BASE_UPGRADE env var and forward it as
`--base <upgrade>` so a single current base-anvil revision can be tested
against each frozen historical suite. Unset preserves today's behavior.

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

Interface Coverage

✅ All interface functions have test coverage.

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

📊 Forge Coverage (src/lib/)

🟡 ≥95% across all metrics — some metrics below 99%.

File Lines Stmts Branches Funcs
🟡 B20FactoryLib.sol 97.70% 98.00% 100.00% 95.00%
🔴 test/lib/ForceFeeder.sol 0.00% 0.00% 100.00% 0.00%
🔴 test/lib/PrecompileProbe.sol 0.00% 0.00% 0.00% 0.00%
🟢 MockActivationRegistry.sol 100.00% 100.00% 100.00% 100.00%
🟢 MockActivationRegistryStorage.sol 100.00% 100.00% 100.00% 100.00%
🟢 MockB20.sol 100.00% 100.00% 100.00% 100.00%
🟢 MockB20Asset.sol 100.00% 100.00% 100.00% 100.00%
🟡 MockB20Factory.sol 98.96% 99.10% 100.00% 100.00%
🟢 MockB20Stablecoin.sol 100.00% 100.00% 100.00% 100.00%
🟢 MockB20Storage.sol 100.00% 100.00% 100.00% 100.00%
🟡 MockPolicyRegistry.sol 100.00% 99.54% 97.67% 100.00%
🟢 MockPolicyRegistryStorage.sol 100.00% 100.00% 100.00% 100.00%
Total 97.07% 97.52% 98.16% 97.00%

Full report: download artifact. To browse locally: make coverage (runs forge coverage + genhtml + opens the HTML report).

@rayyan224
rayyan224 merged commit 4571b32 into main Sep 2, 2026
10 checks passed
@rayyan224
rayyan224 deleted the feat/fork-base-upgrade-selection branch September 2, 2026 19:08
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

⚠️ Fork tests: 48 failed, 701 passed

These failures indicate divergences where base/base needs to catch up to the base-std spec. This check is advisory and does not block merging.

Failing tests
  • test_policyId_success_zeroByDefault(uint8): UnsupportedPolicyType(0xedb5da348cfb67af08746d3afd1be81034b50d5c8576f31aff688f39dfd540ed); counterexample: calldata=0x11a5c8f40000000000000000000000000000000000000000000000000000000000000003 args=[3]
  • test_seizeWithMemo_revertOrder_receiver_beats_balance(address,address): UnsupportedPolicyType(0xedb5da348cfb67af08746d3afd1be81034b50d5c8576f31aff688f39dfd540ed); counterexample: calldata=0xc375ac630000000000000000000000000000000000000000000000000000000095d89b410000000000000000000000000000000000000000000000000000000000001241 args=[0x0000000000000000000000000000000095D89B41, 0x0000000000000000000000000000000000001241]
  • test_seizeWithMemo_revert_insufficientBalance(address,address,uint256): UnsupportedPolicyType(0xedb5da348cfb67af08746d3afd1be81034b50d5c8576f31aff688f39dfd540ed); counterexample: calldata=0x033c5005000000000000000000000000000000000000000000000000000000004ddf9da1000000000000000000000000000000000000000000000000000000000000075b00000000000000000000000000000000000000000000000000000000724e9c52 args=[0x000000000000000000000000000000004Ddf9dA1, 0x000000000000000000000000000000000000075b, 1917754450 [1.917e9]]
  • test_seizeWithMemo_revert_invalidReceiver(address,uint256): UnsupportedPolicyType(0xedb5da348cfb67af08746d3afd1be81034b50d5c8576f31aff688f39dfd540ed); counterexample: calldata=0x92e9b388000000000000000000000000b0dd1190b28aa0e7a21d30ab16ee5795ae365df90000000000000000000000000000000000000000000000000003f1bdff63f27f args=[0xB0dD1190B28aa0e7A21D30ab16EE5795Ae365dF9, 1110223265985151 [1.11e15]]
  • test_seizeWithMemo_revert_receiverPolicyForbids(address,address,uint256): UnsupportedPolicyType(0xedb5da348cfb67af08746d3afd1be81034b50d5c8576f31aff688f39dfd540ed); counterexample: calldata=0x05a3631f00000000000000000000000033f66ef940d84ccca585725b0f11d99d2eca66200000000000000000000000007934f7f05d9aca0df7ebf29498def70079d15cd800000000000172493ecc9c91ea78092baf8ddeea5fbc4724ad3ce1efb2c62745 args=[0x33f66Ef940D84ccca585725b0F11D99D2ECa6620, 0x7934f7F05D9aCa0Df7eBf29498dEF70079d15cD8, 595026844635984100354705014876643017112963712114586674151171909 [5.95e62]]
  • test_seizeWithMemo_revert_selfSeize(address,uint256): UnsupportedPolicyType(0xedb5da348cfb67af08746d3afd1be81034b50d5c8576f31aff688f39dfd540ed); counterexample: calldata=0xffbeec220000000000000000000000001fd1c767bca3a3cf2af699f25c4b8e4fe06afd120000000000000000000000000000000000000000000000001f686eff17c5b194 args=[0x1Fd1c767BCa3A3Cf2aF699f25c4b8E4fE06AFD12, 2263180854648222100 [2.263e18]]
  • test_seizeWithMemo_revert_whenSeizePaused(address,address,uint256): UnsupportedPolicyType(0xedb5da348cfb67af08746d3afd1be81034b50d5c8576f31aff688f39dfd540ed); counterexample: calldata=0x83c47ba4000000000000000000000000fb6bd99e584ec87d32f83a6e3e8863f1bb6c79d500000000000000000000000055c326f591c1b7080a1117932b0033262ceb7a3e0000000000000000000000000000000000000000000000000000000000000001 args=[0xfb6Bd99E584Ec87D32F83A6E3e8863f1Bb6C79D5, 0x55C326f591C1b7080A1117932b0033262Ceb7a3e, 1]
  • test_seizeWithMemo_revert_zeroFrom(address,uint256): UnsupportedPolicyType(0xedb5da348cfb67af08746d3afd1be81034b50d5c8576f31aff688f39dfd540ed); counterexample: calldata=0xdf1bcb7a0000000000000000000000005b3aea4e55dedf634e14b4717ac11ee7df46c430000000000000010083612ffdde022b54af45f087c11ecf99656aa8053562253c args=[0x5B3Aea4E55DEdf634E14b4717AC11eE7df46c430, 1610159463622676736977685616690144870839810050507736535409980 [1.61e60]]
  • test_seizeWithMemo_success_configuredReceiverPolicyAllows(address,address,uint256): UnsupportedPolicyType(0xedb5da348cfb67af08746d3afd1be81034b50d5c8576f31aff688f39dfd540ed); counterexample: calldata=0xd1038b0d0000000000000000000000001af668fb8da59a044c059fff8659b266ab0dbd15000000000000000000000000b059b1ac9af7b0c5d89391f759ec98357d00e035fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc args=[0x1aF668FB8da59A044C059fFf8659b266Ab0DbD15, 0xb059b1ac9af7B0C5d89391F759ec98357D00E035, 115792089237316195423570985008687907853269984665640564039457584007913129639932 [1.157e77]]
  • test_seizeWithMemo_success_emitsEvents(address,address,uint256,bytes32): UnsupportedPolicyType(0xedb5da348cfb67af08746d3afd1be81034b50d5c8576f31aff688f39dfd540ed); counterexample: calldata=0x984936cb00000000000000000000000056ac34fc3f8cb98395b55aebc9f281595ec05c3500000000000000000000000008123ca4d737f5935beb6251cb1c3b495db9bc700000000000000000000000000000000000000000000002d2f99091b002e67a24870ee5f8a2e125c24f2578ddf3e6b8645bea8d2a288fa1188bce957c3e30c21b args=[0x56AC34fc3f8CB98395b55Aebc9f281595ec05C35, 0x08123ca4d737F5935BeB6251cb1C3B495Db9bC70, 13336532254715535587876 [1.333e22], 0x870ee5f8a2e125c24f2578ddf3e6b8645bea8d2a288fa1188bce957c3e30c21b]
  • test_seizeWithMemo_success_ignoresReceiverPolicy(address,address,uint256): UnsupportedPolicyType(0xedb5da348cfb67af08746d3afd1be81034b50d5c8576f31aff688f39dfd540ed); counterexample: calldata=0x6358be6c00000000000000000000000040a19227fc2184bd07242e3b64d113b29282dd27000000000000000000000000447a48216b272195f65ec6fc534e3e90ca23ac7c000000000000029c85834d89deb30c91e707e9d58369c9e4acc8ec5532d32310 args=[0x40A19227fC2184bd07242E3b64d113b29282Dd27, 0x447A48216B272195f65ec6fC534e3e90CA23aC7c, 4196377686067123589458522626064125223440898035915190235767568 [4.196e60]]
  • test_seizeWithMemo_success_movesBalance(address,address,uint256): UnsupportedPolicyType(0xedb5da348cfb67af08746d3afd1be81034b50d5c8576f31aff688f39dfd540ed); counterexample: calldata=0xc4ab022a000000000000000000000000de58863930e869974328bb7f7c144ccd3995a5cd00000000000000000000000011b61efc71dee7b9d134a9afa1f9e708a5231b40000000000000000000000000000000000000000000000000000000000001439e args=[0xDE58863930e869974328bb7f7c144Ccd3995a5cd, 0x11B61Efc71DeE7B9D134a9aFA1F9e708a5231B40, 82846 [8.284e4]]
  • test_seizeWithMemo_success_noAllowanceRequired(address,address,uint256): UnsupportedPolicyType(0xedb5da348cfb67af08746d3afd1be81034b50d5c8576f31aff688f39dfd540ed); counterexample: calldata=0xdc26e1f5000000000000000000000000f97b08ab35a8cb22f96c183f863fc7f9fa169942000000000000000000000000d5045886c7de1dfaaa39edc1a41b183f48d15dee0000000000000000000000cf0a5dfafcd282ba57a9498a330f92289469a0a0e4 args=[0xf97B08aB35A8cb22f96c183F863fc7f9fA169942, 0xD5045886c7DE1DFAAA39eDC1A41b183F48D15dEE, 302590024668611061872675279231319522322022788014308 [3.025e50]]
  • test_seizeWithMemo_success_unsetReceiverPolicyAllowsAnyDestination(address,address,uint256): UnsupportedPolicyType(0xedb5da348cfb67af08746d3afd1be81034b50d5c8576f31aff688f39dfd540ed); counterexample: calldata=0x47ad42e200000000000000000000000086f8fd81650e9adc845211ccd3c0b0992b572b7800000000000000000000000091b452f3c25ee78b3f4678a1d962e2144bba45c50000000000000000000000000000000000000000000000000000000000000002 args=[0x86F8fd81650e9aDC845211cCD3C0b0992b572B78, 0x91b452F3c25Ee78B3f4678A1d962E2144bBa45C5, 2]
  • test_updatePolicy_revert_policyNotFound(uint8,uint64): Error != expected error: UnsupportedPolicyType(0xedb5da348cfb67af08746d3afd1be81034b50d5c8576f31aff688f39dfd540ed) != PolicyNotFound(216176217249948775 [2.161e17]); counterexample: calldata=0x74fd7f39000000000000000000000000000000000000000000000000000000000000001b00000000000000000000000000000000000000000000000000031fce122467b3 args=[27, 879394858231731 [8.793e14]]
  • test_updatePolicy_success_builtinAllow(uint8): UnsupportedPolicyType(0xedb5da348cfb67af08746d3afd1be81034b50d5c8576f31aff688f39dfd540ed); counterexample: calldata=0xde997e8b0000000000000000000000000000000000000000000000000000000000000021 args=[33]
  • test_updatePolicy_success_builtinReject(uint8): UnsupportedPolicyType(0xedb5da348cfb67af08746d3afd1be81034b50d5c8576f31aff688f39dfd540ed); counterexample: calldata=0x56f5b9080000000000000000000000000000000000000000000000000000000000000015 args=[21]
  • test_updatePolicy_success_emitsPolicyUpdated(uint8,uint64): log != expected log; counterexample: calldata=0x59afa2fa000000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000001694add7e2a3f2ab args=[15, 1627116508119560875 [1.627e18]]
  • test_updatePolicy_success_writesSlot(uint8,uint64): UnsupportedPolicyType(0xedb5da348cfb67af08746d3afd1be81034b50d5c8576f31aff688f39dfd540ed); counterexample: calldata=0x9746e8e100000000000000000000000000000000000000000000000000000000000000ff0000000000000000000000000000000000000000000000000000000000000d6d args=[255, 3437]
    [FAIL: SEIZE_HOLDER_POLICY() must not resolve (renamed to SEIZE_EXEMPT_POLICY)] test_seizeHolderPolicy_revert_selectorRemoved() (gas: 8601)
    [FAIL: UnsupportedPolicyType(0xedb5da348cfb67af08746d3afd1be81034b50d5c8576f31aff688f39dfd540ed)] test_b20Layout_success_populatedSnapshotMatchesAllSlots() (gas: 618346)
    [FAIL: UnsupportedPolicyType(0xedb5da348cfb67af08746d3afd1be81034b50d5c8576f31aff688f39dfd540ed)] test_seizePolicyIdsSlot_success_decodesExemptLane() (gas: 12527)
    [FAIL: custom error 0xfeb346ec] test_SEIZE_EXEMPT_POLICY_success_matchesExpected() (gas: 5185)
    [FAIL: custom error 0xfeb346ec] test_seizeExemptPolicy_success_renamedFromSeizeHolder() (gas: 5187)

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.

1 participant