public TestPoAMiner( IConsensusManager consensusManager, IDateTimeProvider dateTimeProvider, Network network, INodeLifetime nodeLifetime, ILoggerFactory loggerFactory, IInitialBlockDownloadState ibdState, BlockDefinition blockDefinition, ISlotsManager slotsManager, IConnectionManager connectionManager, PoABlockHeaderValidator poaHeaderValidator, IFederationManager federationManager, IIntegrityValidator integrityValidator, IWalletManager walletManager, INodeStats nodeStats, VotingManager votingManager, PoAMinerSettings poAMinerSettings, IAsyncProvider asyncProvider) : base(consensusManager, dateTimeProvider, network, nodeLifetime, loggerFactory, ibdState, blockDefinition, slotsManager, connectionManager, poaHeaderValidator, federationManager, integrityValidator, walletManager, nodeStats, votingManager, poAMinerSettings, asyncProvider) { this.timeProvider = dateTimeProvider as EditableTimeProvider; this.cancellation = new CancellationTokenSource(); this.slotsManager = slotsManager; this.consensusManager = consensusManager; }
public SmartContractPoARuleEngine( ICallDataSerializer callDataSerializer, ConcurrentChain chain, ICheckpoints checkpoints, ConsensusSettings consensusSettings, IDateTimeProvider dateTimeProvider, IContractExecutorFactory executorFactory, ILoggerFactory loggerFactory, Network network, NodeDeployments nodeDeployments, IStateRepositoryRoot originalStateRoot, IReceiptRepository receiptRepository, ISenderRetriever senderRetriever, ICoinView utxoSet, IChainState chainState, IInvalidBlockHashStore invalidBlockHashStore, INodeStats nodeStats, SlotsManager slotsManager, PoABlockHeaderValidator poaHeaderValidator) : base(network, loggerFactory, dateTimeProvider, chain, nodeDeployments, consensusSettings, checkpoints, utxoSet, chainState, invalidBlockHashStore, nodeStats, slotsManager, poaHeaderValidator) { this.CallDataSerializer = callDataSerializer; this.ExecutorFactory = executorFactory; this.OriginalStateRoot = originalStateRoot; this.ReceiptRepository = receiptRepository; this.SenderRetriever = senderRetriever; }
public PoAHeaderSignatureTests() { string testRootPath = Path.Combine(Path.GetTempPath(), this.GetType().Name); var dataFolder = new DataFolder(testRootPath); this.tool = new KeyTool(dataFolder); this.validator = new PoABlockHeaderValidator(new ExtendedLoggerFactory()); }
/// <inheritdoc /> public override void Initialize() { base.Initialize(); var engine = this.Parent as PoAConsensusRuleEngine; this.slotsManager = engine.SlotsManager; this.validator = engine.poaHeaderValidator; }
public CollateralPoAMiner(IConsensusManager consensusManager, IDateTimeProvider dateTimeProvider, Network network, INodeLifetime nodeLifetime, ILoggerFactory loggerFactory, IInitialBlockDownloadState ibdState, BlockDefinition blockDefinition, ISlotsManager slotsManager, IConnectionManager connectionManager, PoABlockHeaderValidator poaHeaderValidator, IFederationManager federationManager, IIntegrityValidator integrityValidator, IWalletManager walletManager, INodeStats nodeStats, VotingManager votingManager, PoAMinerSettings poAMinerSettings, ICollateralChecker collateralChecker, IAsyncProvider asyncProvider) : base(consensusManager, dateTimeProvider, network, nodeLifetime, loggerFactory, ibdState, blockDefinition, slotsManager, connectionManager, poaHeaderValidator, federationManager, integrityValidator, walletManager, nodeStats, votingManager, poAMinerSettings, asyncProvider) { this.collateralChecker = collateralChecker; this.encoder = new CollateralHeightCommitmentEncoder(); }
public CollateralPoAMiner(IConsensusManager consensusManager, IDateTimeProvider dateTimeProvider, Network network, INodeLifetime nodeLifetime, ILoggerFactory loggerFactory, IInitialBlockDownloadState ibdState, BlockDefinition blockDefinition, ISlotsManager slotsManager, IConnectionManager connectionManager, JoinFederationRequestMonitor joinFederationRequestMonitor, PoABlockHeaderValidator poaHeaderValidator, IFederationManager federationManager, IIntegrityValidator integrityValidator, IWalletManager walletManager, ChainIndexer chainIndexer, INodeStats nodeStats, VotingManager votingManager, PoAMinerSettings poAMinerSettings, ICollateralChecker collateralChecker, IAsyncProvider asyncProvider, ICounterChainSettings counterChainSettings, IIdleFederationMembersKicker idleFederationMembersKicker) : base(consensusManager, dateTimeProvider, network, nodeLifetime, loggerFactory, ibdState, blockDefinition, slotsManager, connectionManager, poaHeaderValidator, federationManager, integrityValidator, walletManager, nodeStats, votingManager, poAMinerSettings, asyncProvider, idleFederationMembersKicker) { this.counterChainNetwork = counterChainSettings.CounterChainNetwork; this.collateralChecker = collateralChecker; this.encoder = new CollateralHeightCommitmentEncoder(this.logger); this.chainIndexer = chainIndexer; this.joinFederationRequestMonitor = joinFederationRequestMonitor; }
/// <inheritdoc /> public override void Initialize() { base.Initialize(); var engine = this.Parent as PoAConsensusRuleEngine; // TODO: Consider adding these via a constructor on this rule. this.slotsManager = engine.SlotsManager; this.federationHistory = engine.FederationHistory; this.validator = engine.PoaHeaderValidator; this.chainState = engine.ChainState; this.network = this.Parent.Network; this.maxReorg = this.network.Consensus.MaxReorgLength; }
/// <inheritdoc /> public override void Initialize() { base.Initialize(); PoAConsensusRuleEngine engine = this.Parent as PoAConsensusRuleEngine; this.slotsManager = engine.SlotsManager; this.validator = engine.PoaHeaderValidator; this.votingManager = engine.VotingManager; this.federationManager = engine.FederationManager; this.chainState = engine.ChainState; this.maxReorg = this.Parent.Network.Consensus.MaxReorgLength; this.votingEnabled = ((PoAConsensusOptions)this.Parent.Network.Consensus.Options).VotingEnabled; }
/// <inheritdoc /> public override void Initialize() { base.Initialize(); var engine = this.Parent as PoAConsensusRuleEngine; // TODO: Consider adding these via a constructor on this rule. this.slotsManager = engine.SlotsManager; this.federationHistory = engine.FederationHistory; this.validator = engine.PoaHeaderValidator; var lastCheckPoint = engine.Network.Checkpoints.LastOrDefault(); this.lastCheckPoint = (lastCheckPoint.Value != null) ? new HashHeightPair(lastCheckPoint.Value.Hash, lastCheckPoint.Key) : null; }
public PoATestsBase(TestPoANetwork network = null) { this.loggerFactory = new LoggerFactory(); this.signals = new Signals.Signals(this.loggerFactory, null); this.network = network == null ? new TestPoANetwork() : network; this.consensusOptions = this.network.ConsensusOptions; this.dBreezeSerializer = new DBreezeSerializer(this.network.Consensus.ConsensusFactory); this.ChainIndexer = new ChainIndexer(this.network); IDateTimeProvider timeProvider = new DateTimeProvider(); this.consensusSettings = new ConsensusSettings(NodeSettings.Default(this.network)); this.federationManager = CreateFederationManager(this, this.network, this.loggerFactory, this.signals); this.chainIndexerMock = new Mock <ChainIndexer>(); var header = new BlockHeader(); this.chainIndexerMock.Setup(x => x.Tip).Returns(new ChainedHeader(header, header.GetHash(), 0)); this.slotsManager = new SlotsManager(this.network, this.federationManager, this.chainIndexerMock.Object, this.loggerFactory); this.poaHeaderValidator = new PoABlockHeaderValidator(this.loggerFactory); this.asyncProvider = new AsyncProvider(this.loggerFactory, this.signals, new Mock <INodeLifetime>().Object); var dataFolder = new DataFolder(TestBase.CreateTestDir(this)); var finalizedBlockRepo = new FinalizedBlockInfoRepository(new KeyValueRepository(dataFolder, this.dBreezeSerializer), this.loggerFactory, this.asyncProvider); finalizedBlockRepo.LoadFinalizedBlockInfoAsync(this.network).GetAwaiter().GetResult(); this.resultExecutorMock = new Mock <IPollResultExecutor>(); this.votingManager = new VotingManager(this.federationManager, this.loggerFactory, this.slotsManager, this.resultExecutorMock.Object, new NodeStats(timeProvider, this.loggerFactory), dataFolder, this.dBreezeSerializer, this.signals, finalizedBlockRepo, this.network); this.votingManager.Initialize(); this.chainState = new ChainState(); this.rulesEngine = new PoAConsensusRuleEngine(this.network, this.loggerFactory, new DateTimeProvider(), this.ChainIndexer, new NodeDeployments(this.network, this.ChainIndexer), this.consensusSettings, new Checkpoints(this.network, this.consensusSettings), new Mock <ICoinView>().Object, this.chainState, new InvalidBlockHashStore(timeProvider), new NodeStats(timeProvider, this.loggerFactory), this.slotsManager, this.poaHeaderValidator, this.votingManager, this.federationManager, this.asyncProvider, new ConsensusRulesContainer()); List <ChainedHeader> headers = ChainedHeadersHelper.CreateConsecutiveHeaders(50, null, false, null, this.network); this.currentHeader = headers.Last(); }
public PoATestsBase(TestPoANetwork network = null) { this.loggerFactory = new LoggerFactory(); this.signals = new Signals.Signals(this.loggerFactory, null); this.network = network ?? new TestPoANetwork(); this.consensusOptions = this.network.ConsensusOptions; this.dBreezeSerializer = new DBreezeSerializer(this.network.Consensus.ConsensusFactory); this.ChainIndexer = new ChainIndexer(this.network); IDateTimeProvider dateTimeProvider = new DateTimeProvider(); this.consensusSettings = new ConsensusSettings(NodeSettings.Default(this.network)); (this.federationManager, this.federationHistory) = CreateFederationManager(this, this.network, this.loggerFactory, this.signals); this.slotsManager = new SlotsManager(this.network, this.federationManager, this.federationHistory, this.ChainIndexer); this.poaHeaderValidator = new PoABlockHeaderValidator(this.loggerFactory); this.asyncProvider = new AsyncProvider(this.loggerFactory, this.signals); var dataFolder = new DataFolder(TestBase.CreateTestDir(this)); this.resultExecutorMock = new Mock <IPollResultExecutor>(); this.votingManager = new VotingManager(this.federationManager, this.resultExecutorMock.Object, new NodeStats(dateTimeProvider, NodeSettings.Default(this.network), new Mock <IVersionProvider>().Object), dataFolder, this.dBreezeSerializer, this.signals, this.network, this.ChainIndexer, null); this.votingManager.Initialize(this.federationHistory); this.chainState = new ChainState(); this.rulesEngine = new PoAConsensusRuleEngine(this.network, this.loggerFactory, new DateTimeProvider(), this.ChainIndexer, new NodeDeployments(this.network, this.ChainIndexer), this.consensusSettings, new Checkpoints(this.network, this.consensusSettings), new Mock <ICoinView>().Object, this.chainState, new InvalidBlockHashStore(dateTimeProvider), new NodeStats(dateTimeProvider, NodeSettings.Default(this.network), new Mock <IVersionProvider>().Object), this.slotsManager, this.poaHeaderValidator, this.votingManager, this.federationManager, this.asyncProvider, new ConsensusRulesContainer(), this.federationHistory); List <ChainedHeader> headers = ChainedHeadersHelper.CreateConsecutiveHeaders(50, null, false, null, this.network); this.currentHeader = headers.Last(); }
public PoARulesTestsBase(PoANetwork network = null) { this.loggerFactory = new LoggerFactory(); this.network = network == null ? new PoANetwork() : network; this.consensusOptions = this.network.ConsensusOptions; this.chain = new ConcurrentChain(this.network); IDateTimeProvider timeProvider = new DateTimeProvider(); this.consensusSettings = new ConsensusSettings(NodeSettings.Default(this.network)); this.slotsManager = new SlotsManager(this.network, new FederationManager(NodeSettings.Default(this.network), this.network, this.loggerFactory), this.loggerFactory); this.poaHeaderValidator = new PoABlockHeaderValidator(this.loggerFactory); this.rulesEngine = new PoAConsensusRuleEngine(this.network, this.loggerFactory, new DateTimeProvider(), this.chain, new NodeDeployments(this.network, this.chain), this.consensusSettings, new Checkpoints(this.network, this.consensusSettings), new Mock <ICoinView>().Object, new ChainState(), new InvalidBlockHashStore(timeProvider), new NodeStats(timeProvider), this.slotsManager, this.poaHeaderValidator); List <ChainedHeader> headers = ChainedHeadersHelper.CreateConsecutiveHeaders(50, null, false, null, this.network); this.currentHeader = headers.Last(); }