Skip to content

Commit

Permalink
test cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ak88 committed Sep 4, 2024
1 parent 6380314 commit cf58cd2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 27 deletions.
23 changes: 0 additions & 23 deletions src/Nethermind/Ethereum.Test.Base/BlockchainTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@
using Nethermind.Trie.Pruning;
using Nethermind.TxPool;
using NUnit.Framework;
using Nethermind.Specs;
using Nethermind.Evm.Tracing;
using Nethermind.Evm.Tracing.GethStyle.Custom.Native.Call;
using Nethermind.Evm.Tracing.GethStyle;

namespace Ethereum.Test.Base
{
Expand Down Expand Up @@ -218,27 +214,8 @@ protected async Task<EthereumTestResult> RunTest(BlockchainTest test, Stopwatch?
Assert.Fail($"null hash in {test.Name} block {i}");
}

TestBlockJson testBlockJson = test.Blocks[i];


try
{

for (var y = 0; y < correctRlp[i].Block.Transactions.Length; y++)
{
Transaction tx = correctRlp[i].Block.Transactions[y];

//var txTracer = new NativeCallTracer(new Transaction(), GethTraceOptions.Default);
//txProcessor.Trace(tx, new BlockExecutionContext(correctRlp[i].Block.Header), txTracer);



Address address = ecdsa.RecoverAddress(tx);
if (stateProvider.GetBalance(address) == 0)
{
throw new InvalidOperationException("Test tx sender is unfunded.");
}
}
// TODO: mimic the actual behaviour where block goes through validating sync manager?
correctRlp[i].Block.Header.IsPostMerge = correctRlp[i].Block.Difficulty == 0;
if (!test.SealEngineUsed || blockValidator.ValidateSuggestedBlock(correctRlp[i].Block, out _))
Expand Down
15 changes: 11 additions & 4 deletions src/Nethermind/Ethereum.Test.Base/JsonToEthereumTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ public static Transaction Convert(PostStateJson postStateJson, TransactionJson t
new Address(i.Address),
ParseFromHex(i.Nonce),
ParseFromHex(i.V),
new UInt256(Bytes.FromHexString(i.R)),
new UInt256(Bytes.FromHexString(i.S)))).ToArray();
Bytes.FromHexString(i.R),
Bytes.FromHexString(i.S))).ToArray();
if (transaction.AuthorizationList.Any())
{
transaction.Type = TxType.SetCode;
Expand All @@ -180,12 +180,19 @@ public static Transaction Convert(PostStateJson postStateJson, TransactionJson t
static ulong ParseFromHex(string i)
{
Span<byte> bytes = stackalloc byte[8];
var bytes1 = Bytes.FromHexString(i);
var bytes1 = Bytes.FromHexString(i).AsSpan();
if (bytes1.Length <= 8)
{
bytes1.Reverse();
bytes1.CopyTo(bytes);
}
return BitConverter.ToUInt64(bytes);
else
{
throw new InvalidDataException("Transaction json contains an invalid value for uint64.");
}

var result = BitConverter.ToUInt64(bytes);
return result;
}
}

Expand Down

0 comments on commit cf58cd2

Please sign in to comment.