Skip to content
This repository has been archived by the owner on Feb 18, 2025. It is now read-only.

Commit

Permalink
core/vm, core/txpool: Skip check for contract deployer after Venoki
Browse files Browse the repository at this point in the history
  • Loading branch information
chiphamskymavis committed Feb 13, 2025
1 parent 3667968 commit 1da164e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
5 changes: 4 additions & 1 deletion core/txpool/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,12 @@ func ValidateTransactionWithState(tx *types.Transaction, signer types.Signer, op
}

if opts.Config != nil {
// The whitelisted deployer logic is not affective after Venoki
if tx.To() == nil && opts.Config.Consortium != nil {
var whitelisted bool
if opts.Config.IsAntenna(opts.Head.Number) {
if opts.Config.IsVenoki(opts.Head.Number) {
whitelisted = true
} else if opts.Config.IsAntenna(opts.Head.Number) {
whitelisted = state.IsWhitelistedDeployerV2(
opts.State,
from,
Expand Down
22 changes: 12 additions & 10 deletions core/vm/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -528,16 +528,18 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64,
}
}

// Handle latest hardfork firstly.
if evm.chainRules.IsAntenna {
if !evm.StateDB.ValidDeployerV2(caller.Address(), evm.Context.Time, evm.ChainConfig().WhiteListDeployerContractV2Address) {
captureTraceEarly(ErrExecutionReverted)
return nil, common.Address{}, gas, ErrExecutionReverted
}
} else if evm.chainRules.IsOdysseusFork {
if !evm.StateDB.ValidDeployer(caller.Address()) {
captureTraceEarly(ErrExecutionReverted)
return nil, common.Address{}, gas, ErrExecutionReverted
// After Venoki, no need to check for whitelisted deployer anymore
if !evm.chainRules.IsVenoki {
if evm.chainRules.IsAntenna {
if !evm.StateDB.ValidDeployerV2(caller.Address(), evm.Context.Time, evm.ChainConfig().WhiteListDeployerContractV2Address) {
captureTraceEarly(ErrExecutionReverted)
return nil, common.Address{}, gas, ErrExecutionReverted
}
} else if evm.chainRules.IsOdysseusFork {
if !evm.StateDB.ValidDeployer(caller.Address()) {
captureTraceEarly(ErrExecutionReverted)
return nil, common.Address{}, gas, ErrExecutionReverted
}
}
}

Expand Down

0 comments on commit 1da164e

Please sign in to comment.