Skip to content

Commit

Permalink
Merge pull request #119 from ironbeer/fix-create2-error
Browse files Browse the repository at this point in the history
Exclude CREATE2 from EVM access control
  • Loading branch information
ironbeer authored Dec 5, 2024
2 parents 2ee4602 + 938f1b7 commit 377cbe3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions core/vm/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,9 +437,11 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64,
return nil, common.Address{}, gas, ErrNonceUintOverflow
}
evm.StateDB.SetNonce(caller.Address(), nonce+1)
// Fail if the caller is not allowed to create
// Need to check after nonce increment to evict failed tx from the pool
if !IsAllowedToCreate(evm.StateDB, caller.Address()) {
// Fail if the caller is not allowed to create. Limited to `CREATE`
// because this check targets raw transactions from EOA, and `CREATE2`
// within internal transactions is excluded.
// Need to check after nonce increment to evict failed tx from the pool.
if typ == CREATE && !IsAllowedToCreate(evm.StateDB, caller.Address()) {
return nil, common.Address{}, 0, ErrUnauthorizedCreate
}
// We add this to the access list _before_ taking a snapshot. Even if the creation fails,
Expand Down
2 changes: 1 addition & 1 deletion params/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
const (
VersionMajor = 1 // Major version component of the current release
VersionMinor = 7 // Minor version component of the current release
VersionPatch = 0 // Patch version component of the current release
VersionPatch = 1 // Patch version component of the current release
VersionMeta = "" // Version metadata to append to the version string
)

Expand Down

0 comments on commit 377cbe3

Please sign in to comment.