public void Sets_clique_block_producer_properly()
        {
            CliqueConfig        cliqueConfig = new CliqueConfig();
            IBlockTree          blockTree    = Substitute.For <IBlockTree>();
            CliqueBlockProducer producer     = new CliqueBlockProducer(
                Substitute.For <ITxPool>(),
                Substitute.For <IBlockchainProcessor>(),
                blockTree,
                Substitute.For <ITimestamper>(),
                Substitute.For <ICryptoRandom>(),
                Substitute.For <IStateProvider>(),
                Substitute.For <ISnapshotManager>(),
                new CliqueSealer(new BasicWallet(TestItem.PrivateKeyA), cliqueConfig, Substitute.For <ISnapshotManager>(), TestItem.PrivateKeyA.Address, NullLogManager.Instance),
                TestItem.AddressA,
                cliqueConfig,
                NullLogManager.Instance);

            SnapshotManager snapshotManager = new SnapshotManager(CliqueConfig.Default, new MemDb(), Substitute.For <IBlockTree>(), NullEthereumEcdsa.Instance, LimboLogs.Instance);

            CliqueBridge bridge = new CliqueBridge(producer, snapshotManager, blockTree);

            Assert.DoesNotThrow(() => bridge.CastVote(TestItem.AddressB, true));
            Assert.DoesNotThrow(() => bridge.UncastVote(TestItem.AddressB));
            Assert.DoesNotThrow(() => bridge.CastVote(TestItem.AddressB, false));
            Assert.DoesNotThrow(() => bridge.UncastVote(TestItem.AddressB));
        }
Beispiel #2
0
        public void Sets_clique_block_producer_properly()
        {
            CliqueConfig        cliqueConfig = new CliqueConfig();
            IBlockTree          blockTree    = Substitute.For <IBlockTree>();
            Signer              signer       = new Signer(ChainId.Ropsten, TestItem.PrivateKeyA, LimboLogs.Instance);
            CliqueBlockProducer producer     = new CliqueBlockProducer(
                Substitute.For <ITxSource>(),
                Substitute.For <IBlockchainProcessor>(),
                Substitute.For <IStateProvider>(),
                blockTree,
                Substitute.For <ITimestamper>(),
                Substitute.For <ICryptoRandom>(),
                Substitute.For <ISnapshotManager>(),
                new CliqueSealer(signer, cliqueConfig, Substitute.For <ISnapshotManager>(), LimboLogs.Instance),
                new TargetAdjustedGasLimitCalculator(GoerliSpecProvider.Instance, new MiningConfig()),
                cliqueConfig,
                LimboLogs.Instance);

            SnapshotManager snapshotManager = new SnapshotManager(CliqueConfig.Default, new MemDb(), Substitute.For <IBlockTree>(), NullEthereumEcdsa.Instance, LimboLogs.Instance);

            CliqueBridge bridge = new CliqueBridge(producer, snapshotManager, blockTree);

            Assert.DoesNotThrow(() => bridge.CastVote(TestItem.AddressB, true));
            Assert.DoesNotThrow(() => bridge.UncastVote(TestItem.AddressB));
            Assert.DoesNotThrow(() => bridge.CastVote(TestItem.AddressB, false));
            Assert.DoesNotThrow(() => bridge.UncastVote(TestItem.AddressB));
        }
        public void Sets_clique_block_producer_properly()
        {
            CliqueConfig        cliqueConfig = new CliqueConfig();
            IBlockTree          blockTree    = Substitute.For <IBlockTree>();
            CliqueBlockProducer producer     = new CliqueBlockProducer(
                Substitute.For <ITransactionPool>(),
                Substitute.For <IBlockchainProcessor>(),
                blockTree,
                Substitute.For <IStateProvider>(),
                Substitute.For <ITimestamp>(),
                Substitute.For <ICryptoRandom>(),
                new CliqueSealEngine(cliqueConfig, Substitute.For <IEthereumSigner>(), TestObject.PrivateKeyA, new MemDb(), blockTree, NullLogManager.Instance),
                cliqueConfig,
                TestObject.AddressA,
                NullLogManager.Instance);

            CliqueBridge bridge = new CliqueBridge(producer, blockTree);

            Assert.DoesNotThrow(() => bridge.CastVote(TestObject.AddressB, true));
            Assert.DoesNotThrow(() => bridge.UncastVote(TestObject.AddressB));
            Assert.DoesNotThrow(() => bridge.CastVote(TestObject.AddressB, false));
            Assert.DoesNotThrow(() => bridge.UncastVote(TestObject.AddressB));
        }