Esempio n. 1
0
 public void Setup()
 {
     _mergeConfig = new MergeConfig()
     {
         Enabled = true, BlockAuthorAccount = TestItem.AddressA.ToString()
     };
     _context = Build.ContextWithMocks();
     _context.ConfigProvider.GetConfig <IMergeConfig>().Returns(_mergeConfig);
     _context.ConfigProvider.GetConfig <ISyncConfig>().Returns(new SyncConfig());
     _context.MemDbFactory            = new MemDbFactory();
     _context.BlockProducerEnvFactory = new BlockProducerEnvFactory(
         _context.DbProvider !,
         _context.BlockTree !,
         _context.ReadOnlyTrieStore !,
         _context.SpecProvider !,
         _context.BlockValidator !,
         _context.RewardCalculatorSource !,
         _context.ReceiptStorage !,
         _context.BlockPreprocessor !,
         _context.TxPool !,
         _context.TransactionComparerProvider,
         new MiningConfig(),
         _context.LogManager !);
     _plugin = new MergePlugin();
 }
Esempio n. 2
0
 public void Setup()
 {
     _mergeConfig = new MergeConfig()
     {
         Enabled = true, BlockAuthorAccount = TestItem.AddressA.ToString()
     };
     _context = Build.ContextWithMocks();
     _context.ConfigProvider.GetConfig <IMergeConfig>().Returns(_mergeConfig);
     _context.ConfigProvider.GetConfig <ISyncConfig>().Returns(new SyncConfig());
     _context.MemDbFactory = new MemDbFactory();
     _plugin = new MergePlugin();
 }
Esempio n. 3
0
        public void Init_vault_plugin_does_not_throw_exception(bool enabled)
        {
            VaultConfig vaultConfig = new() { Enabled = enabled };

            Runner.Ethereum.Api.NethermindApi context = Build.ContextWithMocks();
            context.ConfigProvider.GetConfig <VaultConfig>().Returns(vaultConfig);
            context.MemDbFactory = new MemDbFactory();
            VaultPlugin plugin = new();

            Assert.DoesNotThrowAsync(async() => { await plugin.Init(context); });
            Assert.DoesNotThrow(() => { plugin.InitBlockchain(); });
            Assert.DoesNotThrow(() => { plugin.InitNetworkProtocol(); });
            Assert.DoesNotThrowAsync(async() => { await plugin.InitRpcModules(); });
        }
    }
        public void Setup()
        {
            _mergeConfig = new MergeConfig()
            {
                Enabled = true
            };
            MiningConfig?  miningConfig  = new() { Enabled = true };
            IJsonRpcConfig jsonRpcConfig = new JsonRpcConfig()
            {
                Enabled = true, EnabledModules = new[] { "engine" }
            };

            _context = Build.ContextWithMocks();
            _context.SealEngineType = SealEngineType.Clique;
            _context.ConfigProvider.GetConfig <IMergeConfig>().Returns(_mergeConfig);
            _context.ConfigProvider.GetConfig <ISyncConfig>().Returns(new SyncConfig());
            _context.ConfigProvider.GetConfig <IMiningConfig>().Returns(miningConfig);
            _context.ConfigProvider.GetConfig <IJsonRpcConfig>().Returns(jsonRpcConfig);
            _context.BlockProcessingQueue?.IsEmpty.Returns(true);
            _context.MemDbFactory            = new MemDbFactory();
            _context.BlockProducerEnvFactory = new BlockProducerEnvFactory(
                _context.DbProvider !,
                _context.BlockTree !,
                _context.ReadOnlyTrieStore !,
                _context.SpecProvider !,
                _context.BlockValidator !,
                _context.RewardCalculatorSource !,
                _context.ReceiptStorage !,
                _context.BlockPreprocessor !,
                _context.TxPool !,
                _context.TransactionComparerProvider,
                miningConfig,
                _context.LogManager !);
            _context.ChainSpec !.Clique = new CliqueParameters()
            {
                Epoch  = CliqueConfig.Default.Epoch,
                Period = CliqueConfig.Default.BlockPeriod
            };
            _plugin = new MergePlugin();

            _consensusPlugin = new();
        }