mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
Remove TXCREATE
TXCREATE was removed from mega-eof and now causes validation tests to fail. Remove it from go-ethereum.
This commit is contained in:
parent
a484bfacf0
commit
71528b30a4
4 changed files with 0 additions and 74 deletions
|
|
@ -87,9 +87,6 @@ func NewEVMTxContext(msg *Message) vm.TxContext {
|
|||
if msg.BlobGasFeeCap != nil {
|
||||
ctx.BlobFeeCap = new(big.Int).Set(msg.BlobGasFeeCap)
|
||||
}
|
||||
if msg.InitCodes != nil {
|
||||
ctx.InitCodes = msg.InitCodes
|
||||
}
|
||||
return ctx
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import (
|
|||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/tracing"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/params"
|
||||
"github.com/holiman/uint256"
|
||||
)
|
||||
|
|
@ -650,14 +649,6 @@ func enableEOF(jt *JumpTable) {
|
|||
memorySize: memoryEOFCreate,
|
||||
immediate: 1,
|
||||
}
|
||||
jt[TXCREATE] = &operation{
|
||||
execute: opTXCreate,
|
||||
constantGas: params.Create2Gas,
|
||||
dynamicGas: gasEOFCreate,
|
||||
minStack: minStack(5, 1),
|
||||
maxStack: maxStack(5, 1),
|
||||
memorySize: memoryEOFCreate,
|
||||
}
|
||||
jt[RETURNCONTRACT] = &operation{
|
||||
execute: opReturnContract,
|
||||
constantGas: GasZeroStep,
|
||||
|
|
@ -923,64 +914,6 @@ func opEOFCreate(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) (
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
func opTXCreate(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) {
|
||||
if interpreter.readOnly {
|
||||
return nil, ErrWriteProtection
|
||||
}
|
||||
var (
|
||||
value = scope.Stack.pop()
|
||||
salt = scope.Stack.pop()
|
||||
offset, size = scope.Stack.pop(), scope.Stack.pop()
|
||||
txInitCodeHash = scope.Stack.pop()
|
||||
input = scope.Memory.GetCopy(int64(offset.Uint64()), int64(size.Uint64()))
|
||||
gas = scope.Contract.Gas
|
||||
)
|
||||
// Reuse last popped value from stack
|
||||
stackvalue := txInitCodeHash
|
||||
|
||||
var initCode []byte
|
||||
for _, code := range interpreter.evm.InitCodes {
|
||||
if interpreter.hasher == nil {
|
||||
interpreter.hasher = crypto.NewKeccakState()
|
||||
} else {
|
||||
interpreter.hasher.Reset()
|
||||
}
|
||||
interpreter.hasher.Write(code)
|
||||
interpreter.hasher.Read(interpreter.hasherBuf[:])
|
||||
if interpreter.hasherBuf.Cmp(txInitCodeHash.Bytes32()) == 0 {
|
||||
initCode = code
|
||||
}
|
||||
}
|
||||
if len(initCode) == 0 {
|
||||
stackvalue.Clear()
|
||||
scope.Stack.push(&stackvalue)
|
||||
}
|
||||
|
||||
// Additional hashing charge
|
||||
hashingCharge := params.InitCodeWordGas * ((uint64(len(initCode)) + 31) / 32)
|
||||
scope.Contract.UseGas(hashingCharge, interpreter.evm.Config.Tracer, tracing.GasChangeCallContractCreation2)
|
||||
// Apply EIP150
|
||||
gas -= gas / 64
|
||||
scope.Contract.UseGas(gas, interpreter.evm.Config.Tracer, tracing.GasChangeCallContractCreation2)
|
||||
scope.InitCodeMode = true
|
||||
res, addr, returnGas, suberr := interpreter.evm.EOFCreate(scope.Contract, input, initCode, gas, &value, &salt)
|
||||
if suberr != nil {
|
||||
stackvalue.Clear()
|
||||
} else {
|
||||
stackvalue.SetBytes(addr.Bytes())
|
||||
}
|
||||
scope.Stack.push(&stackvalue)
|
||||
|
||||
scope.Contract.RefundGas(returnGas, interpreter.evm.Config.Tracer, tracing.GasChangeCallLeftOverRefunded)
|
||||
|
||||
if suberr == ErrExecutionReverted {
|
||||
interpreter.returnData = res // set REVERT data to return data buffer
|
||||
return res, nil
|
||||
}
|
||||
interpreter.returnData = nil // clear dirty return data buffer
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func opReturnContract(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) {
|
||||
if !scope.InitCodeMode {
|
||||
return nil, errors.New("returncontract in non-initcode mode")
|
||||
|
|
|
|||
|
|
@ -95,7 +95,6 @@ type TxContext struct {
|
|||
BlobHashes []common.Hash // Provides information for BLOBHASH
|
||||
BlobFeeCap *big.Int // Is used to zero the blobbasefee if NoBaseFee is set
|
||||
AccessEvents *state.AccessEvents // Capture all state accesses for this tx
|
||||
InitCodes [][]byte // Provides information for TXCREATE
|
||||
}
|
||||
|
||||
// EVM is the Ethereum Virtual Machine base object and provides
|
||||
|
|
|
|||
|
|
@ -229,7 +229,6 @@ const (
|
|||
SWAPN OpCode = 0xe7
|
||||
EXCHANGE OpCode = 0xe8
|
||||
EOFCREATE OpCode = 0xec
|
||||
TXCREATE OpCode = 0xed
|
||||
RETURNCONTRACT OpCode = 0xee
|
||||
)
|
||||
|
||||
|
|
@ -430,7 +429,6 @@ var opCodeToString = [256]string{
|
|||
SWAPN: "SWAPN",
|
||||
EXCHANGE: "EXCHANGE",
|
||||
EOFCREATE: "EOFCREATE",
|
||||
TXCREATE: "TXCREATE",
|
||||
RETURNCONTRACT: "RETURNCONTRACT",
|
||||
|
||||
// 0xf0 range - closures.
|
||||
|
|
@ -615,7 +613,6 @@ var stringToOp = map[string]OpCode{
|
|||
"SWAPN": SWAPN,
|
||||
"EXCHANGE": EXCHANGE,
|
||||
"EOFCREATE": EOFCREATE,
|
||||
"TXCREATE": TXCREATE,
|
||||
"RETURNCONTRACT": RETURNCONTRACT,
|
||||
"CREATE": CREATE,
|
||||
"CREATE2": CREATE2,
|
||||
|
|
|
|||
Loading…
Reference in a new issue