Skip to content

Commit

Permalink
build fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ak88 committed Aug 19, 2024
1 parent bf81101 commit 3d94703
Show file tree
Hide file tree
Showing 62 changed files with 137 additions and 219 deletions.
2 changes: 1 addition & 1 deletion src/Nethermind/Nethermind.AuRa.Test/AuRaSealerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public async Task seal_can_recover_address()

block = await _auRaSealer.SealBlock(block, CancellationToken.None);

EthereumEcdsa ecdsa = new(BlockchainIds.Morden, LimboLogs.Instance);
EthereumEcdsa ecdsa = new(BlockchainIds.Morden);
Signature signature = new(block.Header.AuRaSignature);
signature.V += Signature.VOffset;
Address? recoveredAddress = ecdsa.RecoverAddress(signature, block.Header.CalculateHash(RlpBehaviors.ForSealing));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ public class TxPermissionContractBlockchainWithBlocks : TxPermissionContractBloc
{
protected override async Task AddBlocksOnStart()
{
EthereumEcdsa ecdsa = new(ChainSpec.ChainId, LimboLogs.Instance);
EthereumEcdsa ecdsa = new(ChainSpec.ChainId);

await AddBlock(
SignTransactions(ecdsa, TestItem.PrivateKeyA, 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void Test()
LimboLogs.Instance);
StateReader stateReader = new(trieStore, dbProvider.GetDb<IDb>(DbNames.State), LimboLogs.Instance);
BlockhashProvider blockhashProvider = new(blockTree, specProvider, stateProvider, LimboLogs.Instance);
CodeInfoRepository codeInfoRepository = new();
CodeInfoRepository codeInfoRepository = new(1);
VirtualMachine virtualMachine = new(
blockhashProvider,
specProvider,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public PersistentReceiptStorageTests(bool useCompactReceipts)
public void SetUp()
{
MainnetSpecProvider specProvider = MainnetSpecProvider.Instance;
EthereumEcdsa ethereumEcdsa = new(specProvider.ChainId, LimboLogs.Instance);
EthereumEcdsa ethereumEcdsa = new(specProvider.ChainId);
_receiptConfig = new ReceiptConfig();
_receiptsRecovery = new(ethereumEcdsa, specProvider);
_receiptsDb = new TestMemColumnsDb<ReceiptsColumns>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private ReceiptsIterator CreateIterator(TxReceipt[] receipts, Block block)
Span<byte> span = stream.AsSpan();
TestMemDb blockDb = new TestMemDb();
ReceiptsRecovery recovery = new ReceiptsRecovery(
new EthereumEcdsa(MainnetSpecProvider.Instance.ChainId, LimboLogs.Instance),
new EthereumEcdsa(MainnetSpecProvider.Instance.ChainId),
MainnetSpecProvider.Instance,
false
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class ReceiptsRecoveryTests
public void Setup()
{
MainnetSpecProvider specProvider = MainnetSpecProvider.Instance;
EthereumEcdsa ethereumEcdsa = new(specProvider.ChainId, LimboLogs.Instance);
EthereumEcdsa ethereumEcdsa = new(specProvider.ChainId);

_receiptsRecovery = new ReceiptsRecovery(ethereumEcdsa, specProvider);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Nethermind/Nethermind.Blockchain.Test/ReorgTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void Setup()
WorldState stateProvider = new(trieStore, memDbProvider.CodeDb, LimboLogs.Instance);
StateReader stateReader = new(trieStore, memDbProvider.CodeDb, LimboLogs.Instance);
ISpecProvider specProvider = MainnetSpecProvider.Instance;
EthereumEcdsa ecdsa = new(1, LimboLogs.Instance);
EthereumEcdsa ecdsa = new(1);
ITransactionComparerProvider transactionComparerProvider =
new TransactionComparerProvider(specProvider, _blockTree);

Expand All @@ -57,7 +57,7 @@ public void Setup()
LimboLogs.Instance,
transactionComparerProvider.GetDefaultComparer());
BlockhashProvider blockhashProvider = new(_blockTree, specProvider, stateProvider, LimboLogs.Instance);
CodeInfoRepository codeInfoRepository = new();
CodeInfoRepository codeInfoRepository = new(1);
VirtualMachine virtualMachine = new(
blockhashProvider,
specProvider,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ private class On
private readonly ILogger _logger;
private static readonly ITimestamper _timestamper = Timestamper.Default;
private readonly CliqueConfig _cliqueConfig;
private readonly EthereumEcdsa _ethereumEcdsa = new(BlockchainIds.Goerli, LimboLogs.Instance);
private readonly EthereumEcdsa _ethereumEcdsa = new(BlockchainIds.Goerli);
private readonly Dictionary<PrivateKey, ILogManager> _logManagers = new();
private readonly Dictionary<PrivateKey, ISnapshotManager> _snapshotManager = new();
private readonly Dictionary<PrivateKey, BlockTree> _blockTrees = new();
Expand Down Expand Up @@ -128,7 +128,7 @@ public On CreateNode(PrivateKey privateKey, bool withGenesisAlreadyProcessed = f
_genesis.Header.Hash = _genesis.Header.CalculateHash();
_genesis3Validators.Header.Hash = _genesis3Validators.Header.CalculateHash();

CodeInfoRepository codeInfoRepository = new();
CodeInfoRepository codeInfoRepository = new(1);
TransactionProcessor transactionProcessor = new(goerliSpecProvider, stateProvider,
new VirtualMachine(blockhashProvider, specProvider, codeInfoRepository, nodeLogManager),
codeInfoRepository,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public void Setup_chain()

private CliqueSealer BuildSealer(int currentBlock, IDb db)
{
IEthereumEcdsa ecdsa = new EthereumEcdsa(BlockchainIds.Goerli, LimboLogs.Instance);
IEthereumEcdsa ecdsa = new EthereumEcdsa(BlockchainIds.Goerli);
CliqueConfig config = new();
int currentSignerIndex = (currentBlock % _signers.Count);
_currentSigner = _signers[currentSignerIndex];
Expand Down
2 changes: 1 addition & 1 deletion src/Nethermind/Nethermind.Clique.Test/CliqueTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void Setup_chain()
MemDb db = new();
CliqueConfig config = new();

_ecdsa = new EthereumEcdsa(BlockchainIds.Goerli, LimboLogs.Instance);
_ecdsa = new EthereumEcdsa(BlockchainIds.Goerli);
_snapshotManager = new SnapshotManager(config, db, _blockTree, _ecdsa, LimboLogs.Instance);
_clique = new CliqueSealer(new Signer(BlockchainIds.Goerli, key, LimboLogs.Instance), config, _snapshotManager, LimboLogs.Instance);
_sealValidator = new CliqueSealValidator(config, _snapshotManager, LimboLogs.Instance);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public void Recognises_signer_turn()
Block genesis = CliqueTests.GetGenesis();
Snapshot snapshot = snapshotManager.GetOrCreateSnapshot(0, genesis.Hash);
// Here we use a random chain id, should be test independent.
SnapshotManager manager = new(CliqueConfig.Default, _snapshotDb, _blockTree, new EthereumEcdsa(BlockchainIds.GenericNonRealNetwork, LimboLogs.Instance), LimboLogs.Instance);
SnapshotManager manager = new(CliqueConfig.Default, _snapshotDb, _blockTree, new EthereumEcdsa(BlockchainIds.GenericNonRealNetwork), LimboLogs.Instance);
// Block 1
Assert.IsTrue(manager.IsInTurn(snapshot, 1, _signer1));
Assert.IsFalse(manager.IsInTurn(snapshot, 1, _signer2));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ private AddingTxEventArgs CheckTxPosdaoRules(AddingTxEventArgs args)
if (tx.Signature is not null)
{
IReleaseSpec spec = _specProvider.GetSpec(args.Block.Header);
EthereumEcdsa ecdsa = new(_specProvider.ChainId, LimboLogs.Instance);
EthereumEcdsa ecdsa = new(_specProvider.ChainId);
Address txSenderAddress = ecdsa.RecoverAddress(tx, !spec.ValidateChainId);
if (tx.SenderAddress != txSenderAddress)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public ReadOnlyTxProcessingEnv(
IWorldState? worldStateToWarmUp = null
) : base(worldStateManager, readOnlyBlockTree, specProvider, logManager, worldStateToWarmUp)
{
CodeInfoRepository = new CodeInfoRepository((worldStateToWarmUp as IPreBlockCaches)?.Caches.PrecompileCache);
CodeInfoRepository = new CodeInfoRepository(1,(worldStateToWarmUp as IPreBlockCaches)?.Caches.PrecompileCache);
Machine = new VirtualMachine(BlockhashProvider, specProvider, CodeInfoRepository, logManager);
BlockTree = readOnlyBlockTree ?? throw new ArgumentNullException(nameof(readOnlyBlockTree));
BlockhashProvider = new BlockhashProvider(BlockTree, specProvider, StateProvider, logManager);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ protected virtual async Task<TestBlockchain> Build(ISpecProvider? specProvider =
Timestamper = new ManualTimestamper(new DateTime(2020, 2, 15, 12, 50, 30, DateTimeKind.Utc));
JsonSerializer = new EthereumJsonSerializer();
SpecProvider = CreateSpecProvider(specProvider ?? MainnetSpecProvider.Instance);
EthereumEcdsa = new EthereumEcdsa(SpecProvider.ChainId, LogManager);
EthereumEcdsa = new EthereumEcdsa(SpecProvider.ChainId);
DbProvider = await CreateDbProvider();
TrieStore = new TrieStore(StateDb, LogManager);
State = new WorldState(TrieStore, DbProvider.CodeDb, LogManager, new PreBlockCaches());
Expand Down Expand Up @@ -184,7 +184,7 @@ protected virtual async Task<TestBlockchain> Build(ISpecProvider? specProvider =
NonceManager = new NonceManager(chainHeadInfoProvider.AccountStateProvider);

_trieStoreWatcher = new TrieStoreBoundaryWatcher(WorldStateManager, BlockTree, LogManager);
CodeInfoRepository codeInfoRepository = new();
CodeInfoRepository codeInfoRepository = new(1);
ReceiptStorage = new InMemoryReceiptStorage(blockTree: BlockTree);
VirtualMachine virtualMachine = new(new BlockhashProvider(BlockTree, SpecProvider, State, LogManager), SpecProvider, codeInfoRepository, LogManager);
TxProcessor = new TransactionProcessor(SpecProvider, State, virtualMachine, codeInfoRepository, LogManager);
Expand All @@ -206,7 +206,7 @@ protected virtual async Task<TestBlockchain> Build(ISpecProvider? specProvider =
SealEngine = new SealEngine(sealer, Always.Valid);

BloomStorage bloomStorage = new(new BloomConfig(), new MemDb(), new InMemoryDictionaryFileStoreFactory());
ReceiptsRecovery receiptsRecovery = new(new EthereumEcdsa(SpecProvider.ChainId, LimboLogs.Instance), SpecProvider);
ReceiptsRecovery receiptsRecovery = new(new EthereumEcdsa(SpecProvider.ChainId), SpecProvider);
LogFinder = new LogFinder(BlockTree, ReceiptStorage, ReceiptStorage, bloomStorage, LimboLogs.Instance, receiptsRecovery);
BeaconBlockRootHandler = new BeaconBlockRootHandler();
BlockProcessor = CreateBlockProcessor();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ public static void ExtendTree(IBlockTree blockTree, long newChainLength)

public BlockTreeBuilder WithTransactions(IReceiptStorage receiptStorage, Func<Block, Transaction, IEnumerable<LogEntry>>? logsForBlockBuilder = null)
{
_ecdsa = new EthereumEcdsa(BlockTree.ChainId, LimboLogs.Instance);
_ecdsa = new EthereumEcdsa(BlockTree.ChainId);
_receiptStorage = receiptStorage;
_logCreationFunction = logsForBlockBuilder;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public TransactionBuilder<T> Signed(IEthereumEcdsa ecdsa, PrivateKey privateKey,
public TransactionBuilder<T> Signed(PrivateKey? privateKey = null)
{
privateKey ??= TestItem.IgnoredPrivateKey;
EthereumEcdsa ecdsa = new(TestObjectInternal.ChainId ?? TestBlockchainIds.ChainId, LimboLogs.Instance);
EthereumEcdsa ecdsa = new(TestObjectInternal.ChainId ?? TestBlockchainIds.ChainId);

return Signed(ecdsa, privateKey, isEip155Enabled: true);
}
Expand All @@ -274,7 +274,7 @@ public TransactionBuilder<T> SignedAndResolved(IEthereumEcdsa ecdsa, PrivateKey
public TransactionBuilder<T> SignedAndResolved(PrivateKey? privateKey = null)
{
privateKey ??= TestItem.IgnoredPrivateKey;
EthereumEcdsa ecdsa = new(TestObjectInternal.ChainId ?? TestBlockchainIds.ChainId, LimboLogs.Instance);
EthereumEcdsa ecdsa = new(TestObjectInternal.ChainId ?? TestBlockchainIds.ChainId);
ecdsa.Sign(privateKey, TestObjectInternal, true);
TestObjectInternal.SenderAddress = privateKey.Address;
return this;
Expand Down
14 changes: 7 additions & 7 deletions src/Nethermind/Nethermind.Core.Test/Crypto/EthereumEcdsaTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class EthereumEcdsaTests
[TestCaseSource(nameof(TestCaseSources))]
public void Signature_verify_test((string Name, Transaction Tx) testCase)
{
EthereumEcdsa ecdsa = new(BlockchainIds.Sepolia, LimboLogs.Instance);
EthereumEcdsa ecdsa = new(BlockchainIds.Sepolia);
ecdsa.Verify(testCase.Tx.SenderAddress!, testCase.Tx);
}

Expand All @@ -35,7 +35,7 @@ public void Signature_verify_test((string Name, Transaction Tx) testCase)
[TestCase(false)]
public void Signature_test_sepolia(bool eip155)
{
EthereumEcdsa ecdsa = new(BlockchainIds.Sepolia, LimboLogs.Instance);
EthereumEcdsa ecdsa = new(BlockchainIds.Sepolia);
PrivateKey key = Build.A.PrivateKey.TestObject;
Transaction tx = Build.A.Transaction.TestObject;
ecdsa.Sign(key, tx, eip155);
Expand All @@ -47,7 +47,7 @@ public void Signature_test_sepolia(bool eip155)
[TestCase(false)]
public void Signature_test_sepolia_1559(bool eip155)
{
EthereumEcdsa ecdsa = new(BlockchainIds.Sepolia, LimboLogs.Instance);
EthereumEcdsa ecdsa = new(BlockchainIds.Sepolia);
PrivateKey key = Build.A.PrivateKey.TestObject;
Transaction tx = Build.A.Transaction.WithType(TxType.EIP1559).TestObject;
ecdsa.Sign(key, tx, eip155);
Expand All @@ -59,7 +59,7 @@ public void Signature_test_sepolia_1559(bool eip155)
[TestCase(false)]
public void Signature_test_olympic(bool isEip155Enabled)
{
EthereumEcdsa ecdsa = new(BlockchainIds.Mainnet, LimboLogs.Instance);
EthereumEcdsa ecdsa = new(BlockchainIds.Mainnet);
PrivateKey key = Build.A.PrivateKey.TestObject;
Transaction tx = Build.A.Transaction.TestObject;
ecdsa.Sign(key, tx, isEip155Enabled);
Expand All @@ -71,7 +71,7 @@ public void Signature_test_olympic(bool isEip155Enabled)
public void Sign_generic_network()
{
// maybe make random id so it captures the idea that signature should work irrespective of chain
EthereumEcdsa ecdsa = new(BlockchainIds.GenericNonRealNetwork, LimboLogs.Instance);
EthereumEcdsa ecdsa = new(BlockchainIds.GenericNonRealNetwork);
PrivateKey key = Build.A.PrivateKey.TestObject;
Transaction tx = Build.A.Transaction.TestObject;
ecdsa.Sign(key, tx, true);
Expand All @@ -88,7 +88,7 @@ public static IEnumerable<AuthorizationTuple> AuthorityTupleTestCaseSources()
[TestCaseSource(nameof(AuthorityTupleTestCaseSources))]
public void RecoverAddress_AuthorizationTupleOfDifferentSize_RecoversAddressCorrectly(AuthorizationTuple authorization)
{
EthereumEcdsa ecdsa = new(BlockchainIds.GenericNonRealNetwork, LimboLogs.Instance);
EthereumEcdsa ecdsa = new(BlockchainIds.GenericNonRealNetwork);

Address? authority = ecdsa.RecoverAddress(authorization);

Expand All @@ -102,7 +102,7 @@ private static AuthorizationTuple CreateAuthorizationTuple(ulong chainId, Addres
Span<byte> code = stackalloc byte[rlp.Length + 1];
code[0] = Eip7702Constants.Magic;
rlp.Data.AsSpan().CopyTo(code.Slice(1));
EthereumEcdsa ecdsa = new(1, new OneLoggerLogManager(NullLogger.Instance));
EthereumEcdsa ecdsa = new(1);
PrivateKey signer = Build.A.PrivateKey.TestObject;
Signature sig = ecdsa.Sign(signer, Keccak.Compute(code));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public BlockDecoderTests()
.WithData(new byte[] { (byte)i })
.WithNonce((UInt256)i)
.WithValue((UInt256)i)
.Signed(new EthereumEcdsa(TestBlockchainIds.ChainId, LimboLogs.Instance), TestItem.PrivateKeyA, true)
.Signed(new EthereumEcdsa(TestBlockchainIds.ChainId), TestItem.PrivateKeyA, true)
.TestObject;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void Roundtrip_ExecutionPayloadForm_for_shard_blobs((Transaction Tx, stri
rlpStream.Position = 0;
Transaction? decoded = _txDecoder.Decode(rlpStream);
decoded!.SenderAddress =
new EthereumEcdsa(TestBlockchainIds.ChainId, LimboLogs.Instance).RecoverAddress(decoded);
new EthereumEcdsa(TestBlockchainIds.ChainId).RecoverAddress(decoded);
decoded.Hash = decoded.CalculateHash();
decoded.Should().BeEquivalentTo(testCase.Tx, testCase.Description);
}
Expand All @@ -55,7 +55,7 @@ public void Roundtrip_ValueDecoderContext_ExecutionPayloadForm_for_shard_blobs((
rlpStream.Position = 0;
Transaction? decoded = _txDecoder.Decode(ref decoderContext);
decoded!.SenderAddress =
new EthereumEcdsa(TestBlockchainIds.ChainId, LimboLogs.Instance).RecoverAddress(decoded);
new EthereumEcdsa(TestBlockchainIds.ChainId).RecoverAddress(decoded);
decoded.Hash = decoded.CalculateHash();
decoded.Should().BeEquivalentTo(testCase.Tx, testCase.Description);
}
Expand Down
Loading

0 comments on commit 3d94703

Please sign in to comment.