Skip to content

Commit

Permalink
core/vm: fix eofcreate auxdata
Browse files Browse the repository at this point in the history
  • Loading branch information
MariusVanDerWijden committed Sep 26, 2024
1 parent af120cc commit f6dd3c8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/vm/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64,
}
evm.Context.Transfer(evm.StateDB, caller.Address(), address, value)

ret, err = evm.initNewContract(contract, address, value, isInitcodeEOF)
ret, err = evm.initNewContract(contract, address, value, input, isInitcodeEOF)
if err != nil && (evm.chainRules.IsHomestead || err != ErrCodeStoreOutOfGas) {
evm.StateDB.RevertToSnapshot(snapshot)
if err != ErrExecutionReverted {
Expand All @@ -533,15 +533,15 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64,

// initNewContract runs a new contract's creation code, performs checks on the
// resulting code that is to be deployed, and consumes necessary gas.
func (evm *EVM) initNewContract(contract *Contract, address common.Address, value *uint256.Int, isInitcodeEOF bool) ([]byte, error) {
func (evm *EVM) initNewContract(contract *Contract, address common.Address, value *uint256.Int, input []byte, isInitcodeEOF bool) ([]byte, error) {
// Charge the contract creation init gas in verkle mode
if evm.chainRules.IsEIP4762 {
if !contract.UseGas(evm.AccessEvents.ContractCreateInitGas(address, value.Sign() != 0), evm.Config.Tracer, tracing.GasChangeWitnessContractInit) {
return nil, ErrOutOfGas
}
}

ret, err := evm.interpreter.Run(contract, nil, false, contract.IsDeployment)
ret, err := evm.interpreter.Run(contract, input, false, contract.IsDeployment)
if err != nil {
return ret, err
}
Expand Down Expand Up @@ -609,7 +609,7 @@ func (evm *EVM) Create2(caller ContractRef, code []byte, gas uint64, endowment *
func (evm *EVM) EOFCreate(caller ContractRef, input []byte, subcontainer []byte, gas uint64, endowment *uint256.Int, salt *uint256.Int) (ret []byte, contractAddr common.Address, leftOverGas uint64, err error) {
codeAndHash := &codeAndHash{code: subcontainer}
contractAddr = crypto.CreateAddress2(caller.Address(), salt.Bytes32(), codeAndHash.Hash().Bytes())
return evm.create(caller, codeAndHash, gas, endowment, contractAddr, CREATE2, input, true)
return evm.create(caller, codeAndHash, gas, endowment, contractAddr, EOFCREATE, input, true)
}

// ChainConfig returns the environment's chain configuration
Expand Down

0 comments on commit f6dd3c8

Please sign in to comment.