Skip to content
This repository was archived by the owner on Jun 6, 2025. It is now read-only.

Commit a013692

Browse files
authored
tx_pool: update the transaction validation logic to whitelist deployer v2 (#361)
Update the transaction validation logic to use the whitelist deployer v2 after Antenna hardfork.
1 parent b968f44 commit a013692

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

core/tx_pool.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ type TxPool struct {
250250
eip2718 bool // Fork indicator whether we are using EIP-2718 type transactions.
251251
eip1559 bool // Fork indicator whether we are using EIP-1559 type transactions.
252252
odysseus bool // Fork indicator whether we are in the Odysseus stage.
253+
antenna bool // Fork indicator whether we are in Antenna stage.
253254

254255
currentState *state.StateDB // Current state in the blockchain head
255256
pendingNonces *txNoncer // Pending state tracking virtual nonces
@@ -653,7 +654,17 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error {
653654

654655
// Contract creation transaction
655656
if tx.To() == nil && pool.chainconfig.Consortium != nil {
656-
whitelisted := state.IsWhitelistedDeployer(pool.currentState, from)
657+
var whitelisted bool
658+
if pool.antenna {
659+
whitelisted = state.IsWhitelistedDeployerV2(
660+
pool.currentState,
661+
from,
662+
pool.chain.CurrentBlock().Time(),
663+
pool.chainconfig.WhiteListDeployerContractV2Address,
664+
)
665+
} else {
666+
whitelisted = state.IsWhitelistedDeployer(pool.currentState, from)
667+
}
657668
if !whitelisted {
658669
return ErrUnauthorizedDeployer
659670
}
@@ -1333,6 +1344,7 @@ func (pool *TxPool) reset(oldHead, newHead *types.Header) {
13331344
pool.eip2718 = pool.chainconfig.IsBerlin(next)
13341345
pool.eip1559 = pool.chainconfig.IsLondon(next)
13351346
pool.odysseus = pool.chainconfig.IsOdysseus(next)
1347+
pool.antenna = pool.chainconfig.IsAntenna(next)
13361348
}
13371349

13381350
// promoteExecutables moves transactions that have become processable from the

0 commit comments

Comments
 (0)