Skip to content

Commit

Permalink
Merge pull request #120 from ironbeer/fix-create-error
Browse files Browse the repository at this point in the history
Fixed error when `new` is used in internal tx
  • Loading branch information
tak1827 authored Dec 6, 2024
2 parents 377cbe3 + 87f3e71 commit f9f501e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core/vm/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64,
// 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()) {
if evm.depth == 0 && 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 = 1 // Patch version component of the current release
VersionPatch = 2 // Patch version component of the current release
VersionMeta = "" // Version metadata to append to the version string
)

Expand Down

0 comments on commit f9f501e

Please sign in to comment.