core/vm: added RETURNDATALOAD opcode

This commit is contained in:
Marius van der Wijden 2024-09-26 14:13:37 +02:00
parent bb1885c78e
commit c7db447b1f
1 changed files with 9 additions and 1 deletions

View File

@ -306,7 +306,15 @@ func opExchange(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([
// opReturnDataLoad implements the RETURNDATALOAD opcode // opReturnDataLoad implements the RETURNDATALOAD opcode
func opReturnDataLoad(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) { func opReturnDataLoad(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) {
panic("not implemented") var (
offset = scope.Stack.pop()
)
offset64, overflow := offset.Uint64WithOverflow()
if overflow {
offset64 = math.MaxUint64
}
scope.Stack.push(offset.SetBytes(getData(interpreter.returnData, offset64, 32)))
return nil, nil
} }
// opExtCall implements the EOFCREATE opcode // opExtCall implements the EOFCREATE opcode