From c7db447b1faa44bf68f95b9eb69bdad6719a987e Mon Sep 17 00:00:00 2001 From: Marius van der Wijden Date: Thu, 26 Sep 2024 14:13:37 +0200 Subject: [PATCH] core/vm: added RETURNDATALOAD opcode --- core/vm/eof_instructions.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/core/vm/eof_instructions.go b/core/vm/eof_instructions.go index df20864268..acf9506360 100644 --- a/core/vm/eof_instructions.go +++ b/core/vm/eof_instructions.go @@ -306,7 +306,15 @@ func opExchange(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([ // opReturnDataLoad implements the RETURNDATALOAD opcode 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