Skip to content

core/txpool/validation_etc_test.go — Version Comparison

v1.17.3 v1.17.4
Branch etc/v1.17.3-full-node etc/v1.17.4-full-node
Delta +176 -0 +187 -0

Diff between branches

diff --git a/core/txpool/validation_etc_test.go b/core/txpool/validation_etc_test.go
index c4ef6bf34..d046d1f92 100644
--- a/core/txpool/validation_etc_test.go
+++ b/core/txpool/validation_etc_test.go
@@ -131,10 +131,10 @@ func TestValidateTransactionAcceptsLegacyOnETCMystique(t *testing.T) {
 }

 // TestMakeSignerSkipsLondonOnETC verifies that types.MakeSigner does not
-// pick the London signer (which understands DynamicFeeTx) for an ETC chain
-// post-Mystique, instead falling back to the EIP-2930 (Berlin) signer.
-// This prevents an attacker from getting a valid sender recovery for a
-// type-0x02 transaction on ETC.
+// pick the London signer (which understands DynamicFeeTx) for a perpetual
+// PoW chain post-Mystique, instead falling back to the EIP-2930 (Berlin)
+// signer. This prevents an attacker from getting a valid sender recovery
+// for a type-0x02 transaction on ETC-style chains.
 func TestMakeSignerSkipsLondonOnETC(t *testing.T) {
    postMystique := new(big.Int).Add(params.ClassicChainConfig.LondonBlock, big.NewInt(1))
    got := types.MakeSigner(params.ClassicChainConfig, postMystique, 0)
@@ -147,14 +147,25 @@ func TestMakeSignerSkipsLondonOnETC(t *testing.T) {
        t.Fatal("MakeSigner on ETC post-Mystique unexpectedly equals London signer")
    }

-   // And confirm that for a non-Classic chain that activates London, the
-   // London signer IS selected.
+   // A devnet-style chain — the same perpetual PoW config under a custom
+   // chain ID — keeps the Berlin signer too: the gate derives from the
+   // config shape, not from chain IDs 61/63.
+   devnetCfg := *params.ClassicChainConfig
+   devnetCfg.ChainID = big.NewInt(9999)
+   gotDevnet := types.MakeSigner(&devnetCfg, postMystique, 0)
+   if !gotDevnet.Equal(types.NewEIP2930Signer(devnetCfg.ChainID)) {
+       t.Fatalf("MakeSigner on custom-chain-ID PoW post-Mystique = %T, want EIP2930 (Berlin) signer", gotDevnet)
+   }
+
+   // And confirm that a merge-track chain (TTD set) that activates London
+   // DOES select the London signer.
    ethCfg := *params.ClassicChainConfig
-   ethCfg.ChainID = big.NewInt(1) // not 61/63 → not classic
+   ethCfg.ChainID = big.NewInt(1)
+   ethCfg.TerminalTotalDifficulty = big.NewInt(0)
    postLondon := new(big.Int).Add(ethCfg.LondonBlock, big.NewInt(1))
    gotETH := types.MakeSigner(&ethCfg, postLondon, 0)
    if !gotETH.Equal(types.NewLondonSigner(ethCfg.ChainID)) {
-       t.Fatalf("MakeSigner on non-ETC post-London = %T, want London signer", gotETH)
+       t.Fatalf("MakeSigner on merge-track post-London = %T, want London signer", gotETH)
    }
 }
← Back to Version Comparison