Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public long DataGasCost(in ReadOnlyMemory<byte> inputData, IReleaseSpec releaseS

public (ReadOnlyMemory<byte>, bool) Run(in ReadOnlyMemory<byte> inputData, IReleaseSpec releaseSpec)
{
return (inputData, true);
return (inputData.ToArray(), true);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not enturely sure why, but IdentityPrecompile isn't really used so shouldn't really matter

}
}
}
9 changes: 5 additions & 4 deletions src/Nethermind/Nethermind.Evm/VirtualMachine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ namespace Nethermind.Evm;

using System.Collections.Frozen;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;

using Int256;
Expand Down Expand Up @@ -139,7 +140,7 @@ internal readonly ref struct CallResult
public static CallResult StackOverflowException => new(EvmExceptionType.StackOverflow); // TODO: use these to avoid CALL POP attacks
public static CallResult StackUnderflowException => new(EvmExceptionType.StackUnderflow); // TODO: use these to avoid CALL POP attacks
public static CallResult InvalidCodeException => new(EvmExceptionType.InvalidCode);
public static CallResult Empty => new(Array.Empty<byte>(), null);
public static CallResult Empty => new(default, null);

public CallResult(EvmState stateToExecute)
{
Expand All @@ -159,7 +160,7 @@ private CallResult(EvmExceptionType exceptionType)
ExceptionType = exceptionType;
}

public CallResult(byte[] output, bool? precompileSuccess, bool shouldRevert = false, EvmExceptionType exceptionType = EvmExceptionType.None)
public CallResult(ReadOnlyMemory<byte> output, bool? precompileSuccess, bool shouldRevert = false, EvmExceptionType exceptionType = EvmExceptionType.None)
{
StateToExecute = null;
Output = output;
Expand Down Expand Up @@ -690,7 +691,7 @@ private CallResult ExecutePrecompile(EvmState state, IReleaseSpec spec)
try
{
(ReadOnlyMemory<byte> output, bool success) = precompile.Run(callData, spec);
CallResult callResult = new(output.ToArray(), success, !success);
CallResult callResult = new(output, success, !success);
return callResult;
}
catch (DllNotFoundException exception)
Expand All @@ -701,7 +702,7 @@ private CallResult ExecutePrecompile(EvmState state, IReleaseSpec spec)
catch (Exception exception)
{
if (_logger.IsError) _logger.Error($"Precompiled contract ({precompile.GetType()}) execution exception", exception);
CallResult callResult = new(Array.Empty<byte>(), false, true);
CallResult callResult = new(default, false, true);
return callResult;
}
}
Expand Down