mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
re-disable create2 following pushback
This commit is contained in:
parent
66d5f67616
commit
14a34fcc4a
2 changed files with 8 additions and 10 deletions
|
|
@ -429,6 +429,11 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64,
|
||||||
if !evm.Context.CanTransfer(evm.StateDB, caller.Address(), value) {
|
if !evm.Context.CanTransfer(evm.StateDB, caller.Address(), value) {
|
||||||
return nil, common.Address{}, gas, ErrInsufficientBalance
|
return nil, common.Address{}, gas, ErrInsufficientBalance
|
||||||
}
|
}
|
||||||
|
nonce := evm.StateDB.GetNonce(caller.Address())
|
||||||
|
if nonce+1 < nonce {
|
||||||
|
return nil, common.Address{}, gas, ErrNonceUintOverflow
|
||||||
|
}
|
||||||
|
evm.StateDB.SetNonce(caller.Address(), nonce+1)
|
||||||
// We add this to the access list _before_ taking a snapshot. Even if the creation fails,
|
// We add this to the access list _before_ taking a snapshot. Even if the creation fails,
|
||||||
// the access-list change should not be rolled back
|
// the access-list change should not be rolled back
|
||||||
if evm.chainRules.IsBerlin {
|
if evm.chainRules.IsBerlin {
|
||||||
|
|
@ -439,16 +444,6 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64,
|
||||||
if evm.StateDB.GetNonce(address) != 0 || (contractHash != (common.Hash{}) && contractHash != types.EmptyCodeHash) {
|
if evm.StateDB.GetNonce(address) != 0 || (contractHash != (common.Hash{}) && contractHash != types.EmptyCodeHash) {
|
||||||
return nil, common.Address{}, 0, ErrContractAddressCollision
|
return nil, common.Address{}, 0, ErrContractAddressCollision
|
||||||
}
|
}
|
||||||
// Increment caller's nonce (unless specific case)
|
|
||||||
if evm.TxContext.Is5806 && (contractHash == (common.Hash{}) || contractHash == types.EmptyCodeHash) && typ == CREATE2 {
|
|
||||||
// skip nonce increment
|
|
||||||
} else {
|
|
||||||
nonce := evm.StateDB.GetNonce(caller.Address())
|
|
||||||
if nonce+1 < nonce {
|
|
||||||
return nil, common.Address{}, gas, ErrNonceUintOverflow
|
|
||||||
}
|
|
||||||
evm.StateDB.SetNonce(caller.Address(), nonce+1)
|
|
||||||
}
|
|
||||||
// Create a new account on the state
|
// Create a new account on the state
|
||||||
snapshot := evm.StateDB.Snapshot()
|
snapshot := evm.StateDB.Snapshot()
|
||||||
evm.StateDB.CreateAccount(address)
|
evm.StateDB.CreateAccount(address)
|
||||||
|
|
|
||||||
|
|
@ -620,6 +620,9 @@ func opCreate(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]b
|
||||||
}
|
}
|
||||||
|
|
||||||
func opCreate2(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) {
|
func opCreate2(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) {
|
||||||
|
if interpreter.evm.TxContext.Is5806 && (scope.Contract.CodeHash == (common.Hash{}) || scope.Contract.CodeHash == types.EmptyCodeHash) {
|
||||||
|
return nil, ErrEip5806Write
|
||||||
|
}
|
||||||
if interpreter.readOnly {
|
if interpreter.readOnly {
|
||||||
return nil, ErrWriteProtection
|
return nil, ErrWriteProtection
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue