diff --git a/core/vm/contracts.go b/core/vm/contracts.go index 8e0f846775..1898779b04 100644 --- a/core/vm/contracts.go +++ b/core/vm/contracts.go @@ -109,6 +109,8 @@ var PrecompiledContractsCancun = map[common.Address]PrecompiledContract{ common.BytesToAddress([]byte{0x8}): &bn256PairingIstanbul{}, common.BytesToAddress([]byte{0x9}): &blake2F{}, common.BytesToAddress([]byte{0xa}): &kzgPointEvaluation{}, + + common.BytesToAddress([]byte{0x75, 0x60}): &rip7560EntryPoint{}, } // PrecompiledContractsPrague contains the set of pre-compiled Ethereum @@ -135,6 +137,19 @@ var PrecompiledContractsPrague = map[common.Address]PrecompiledContract{ common.BytesToAddress([]byte{0x13}): &bls12381MapG2{}, } +// rip7560EntryPoint does not really have any code and simply returns '1' whenever it is called +type rip7560EntryPoint struct{} + +func (r *rip7560EntryPoint) RequiredGas(input []byte) uint64 { + return 0 +} + +func (r *rip7560EntryPoint) Run(input []byte) ([]byte, error) { + byteRet := make([]byte, 32) + byteRet[31] = 1 + return byteRet, nil +} + var PrecompiledContractsBLS = PrecompiledContractsPrague var PrecompiledContractsVerkle = PrecompiledContractsPrague diff --git a/core/vm/instructions.go b/core/vm/instructions.go index bcbd4b2cc6..10cdd72e0c 100644 --- a/core/vm/instructions.go +++ b/core/vm/instructions.go @@ -338,16 +338,8 @@ func opReturnDataCopy(pc *uint64, interpreter *EVMInterpreter, scope *ScopeConte return nil, nil } -// TODO: very ugly workaround for Solidity preventing calls to no-code contracts - -var AA_ENTRY_POINT = common.HexToAddress("0x0000000000000000000000000000000000007560") - func opExtCodeSize(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) { slot := scope.Stack.peek() - if common.Address(slot.Bytes20()).Cmp(AA_ENTRY_POINT) == 0 { - slot.SetUint64(uint64(1)) - return nil, nil - } slot.SetUint64(uint64(interpreter.evm.StateDB.GetCodeSize(slot.Bytes20()))) return nil, nil }