From 55ef3ca9d3b520984b0c1f5731be2598af84bda8 Mon Sep 17 00:00:00 2001 From: racytech Date: Thu, 23 Nov 2023 00:21:08 +0600 Subject: [PATCH] RETURNCONTRACT todos and notes --- core/vm/eips.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/vm/eips.go b/core/vm/eips.go index 254d51bbdf1..b17cb947184 100644 --- a/core/vm/eips.go +++ b/core/vm/eips.go @@ -668,9 +668,13 @@ func opReturnContract(pc *uint64, interpreter *EVMInterpreter, scope *ScopeConte auxData = scope.Memory.GetPtr(int64(auxDataOffset.Uint64()), int64(auxDataSize.Uint64())) ) var c Container + // NOTE(racytech): UnmarshalBinary checks for correct EOF format + // but it decodes entire container, which is a bit expensive. Do we need that? + // Can we do better? if err := c.UnmarshalBinary(deployContainer); err != nil { return nil, fmt.Errorf("%w: %v", ErrInvalidEOFInitcode, err) } - c.Data = append(c.Data, auxData...) + // TODO(racytech): make sure this one refers to the same underlying slice as Container.SubContainer[deployContainerIdx] + deployContainer = append(deployContainer, auxData...) return nil, nil }