public SmartContractBlockDefinition(
            IBlockBufferGenerator blockBufferGenerator,
            ICoinView coinView,
            IConsensusManager consensusManager,
            IDateTimeProvider dateTimeProvider,
            IContractExecutorFactory executorFactory,
            ILoggerFactory loggerFactory,
            ITxMempool mempool,
            MempoolSchedulerLock mempoolLock,
            MinerSettings minerSettings,
            Network network,
            ISenderRetriever senderRetriever,
            IStateRepositoryRoot stateRoot)
            : base(consensusManager, dateTimeProvider, loggerFactory, mempool, mempoolLock, minerSettings, network)
        {
            this.coinView        = coinView;
            this.executorFactory = executorFactory;
            this.logger          = loggerFactory.CreateLogger(this.GetType());
            this.senderRetriever = senderRetriever;
            this.stateRoot       = stateRoot;
            this.refundOutputs   = new List <TxOut>();
            this.receipts        = new List <Receipt>();

            // When building smart contract blocks, we will be generating and adding both transactions to the block and txouts to the coinbase.
            // At the moment, these generated objects aren't accounted for in the block size and weight accounting.
            // This means that if blocks started getting full, this miner could start generating blocks greater than the max consensus block size.
            // To avoid this without significantly overhauling the BlockDefinition, for now we just lower the block size by a percentage buffer.
            // If in the future blocks are being built over the size limit and you need an easy fix, just increase the size of this buffer.
            this.Options = blockBufferGenerator.GetOptionsWithBuffer(this.Options);
        }
 public SmartContractPowConsensusRuleEngine(
     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)
     : base(network, loggerFactory, dateTimeProvider, chain, nodeDeployments, consensusSettings, checkpoints, utxoSet, chainState, invalidBlockHashStore, nodeStats)
 {
     this.CallDataSerializer = callDataSerializer;
     this.ExecutorFactory    = executorFactory;
     this.OriginalStateRoot  = originalStateRoot;
     this.ReceiptRepository  = receiptRepository;
     this.SenderRetriever    = senderRetriever;
 }
Exemplo n.º 3
0
 public SmartContractPosCoinviewRule(Network network, IStateRepositoryRoot stateRepositoryRoot,
                                     IContractExecutorFactory executorFactory, ICallDataSerializer callDataSerializer,
                                     ISenderRetriever senderRetriever, IReceiptRepository receiptRepository, ICoinView coinView,
                                     IStakeChain stakeChain, IStakeValidator stakeValidator)
     : base(network, stateRepositoryRoot, executorFactory, callDataSerializer, senderRetriever, receiptRepository, coinView)
 {
     this.consensus      = network.Consensus;
     this.stakeChain     = stakeChain;
     this.stakeValidator = stakeValidator;
 }
Exemplo n.º 4
0
 public SmartContractPoACoinviewRule(
     IStateRepositoryRoot stateRepositoryRoot,
     IContractExecutorFactory executorFactory,
     ICallDataSerializer callDataSerializer,
     ISenderRetriever senderRetriever,
     IReceiptRepository receiptRepository,
     ICoinView coinView)
 {
     this.stateRepositoryRoot = stateRepositoryRoot;
     this.executorFactory     = executorFactory;
     this.callDataSerializer  = callDataSerializer;
     this.senderRetriever     = senderRetriever;
     this.receiptRepository   = receiptRepository;
     this.coinView            = coinView;
 }
 public TestFederatedPegBlockDefinition(
     IBlockBufferGenerator blockBufferGenerator,
     ICoinView coinView,
     IConsensusManager consensusManager,
     IDateTimeProvider dateTimeProvider,
     IContractExecutorFactory executorFactory,
     ILoggerFactory loggerFactory,
     ITxMempool mempool,
     MempoolSchedulerLock mempoolLock,
     Network network,
     ISenderRetriever senderRetriever,
     IStateRepositoryRoot stateRoot,
     MinerSettings minerSettings)
     : base(blockBufferGenerator, coinView, consensusManager, dateTimeProvider, executorFactory, loggerFactory, mempool, mempoolLock, network, senderRetriever, stateRoot, minerSettings)
 {
 }
Exemplo n.º 6
0
 public SmartContractPoABlockDefinition(
     IBlockBufferGenerator blockBufferGenerator,
     ICoinView coinView,
     IConsensusManager consensusManager,
     IDateTimeProvider dateTimeProvider,
     IContractExecutorFactory executorFactory,
     ILoggerFactory loggerFactory,
     ITxMempool mempool,
     MempoolSchedulerLock mempoolLock,
     Network network,
     ISenderRetriever senderRetriever,
     IStateRepositoryRoot stateRoot)
     : base(blockBufferGenerator, coinView, consensusManager, dateTimeProvider, executorFactory, loggerFactory, mempool, mempoolLock, new MinerSettings(NodeSettings.Default(network)), network, senderRetriever, stateRoot)
 {
     // TODO: Fix gross MinerSettings injection ^^
 }
 public SignedContractPoARuleRegistration(Network network,
                                          IStateRepositoryRoot stateRepositoryRoot,
                                          IContractExecutorFactory executorFactory,
                                          ICallDataSerializer callDataSerializer,
                                          ISenderRetriever senderRetriever,
                                          IReceiptRepository receiptRepository,
                                          ICoinView coinView)
 {
     this.network             = network;
     this.stateRepositoryRoot = stateRepositoryRoot;
     this.executorFactory     = executorFactory;
     this.callDataSerializer  = callDataSerializer;
     this.senderRetriever     = senderRetriever;
     this.receiptRepository   = receiptRepository;
     this.coinView            = coinView;
 }
 protected SmartContractCoinviewRule(Network network,
                                     IStateRepositoryRoot stateRepositoryRoot,
                                     IContractExecutorFactory executorFactory,
                                     ICallDataSerializer callDataSerializer,
                                     ISenderRetriever senderRetriever,
                                     IReceiptRepository receiptRepository,
                                     ICoinView coinView)
 {
     this.network             = network;
     this.stateRepositoryRoot = stateRepositoryRoot;
     this.executorFactory     = executorFactory;
     this.callDataSerializer  = callDataSerializer;
     this.senderRetriever     = senderRetriever;
     this.receiptRepository   = receiptRepository;
     this.coinView            = coinView;
 }
 public SmartContractCoinViewRuleLogic(IStateRepositoryRoot stateRepositoryRoot,
                                       IContractExecutorFactory executorFactory,
                                       ICallDataSerializer callDataSerializer,
                                       ISenderRetriever senderRetriever,
                                       IReceiptRepository receiptRepository,
                                       ICoinView coinView)
 {
     this.stateRepositoryRoot = stateRepositoryRoot;
     this.executorFactory     = executorFactory;
     this.callDataSerializer  = callDataSerializer;
     this.senderRetriever     = senderRetriever;
     this.receiptRepository   = receiptRepository;
     this.coinView            = coinView;
     this.refundCounter       = 1;
     this.blockTxsProcessed   = new List <Transaction>();
     this.receipts            = new List <Receipt>();
 }
 /// <inheritdoc />
 public FederatedPegBlockDefinition(
     IBlockBufferGenerator blockBufferGenerator,
     ICoinView coinView,
     IConsensusManager consensusManager,
     IDateTimeProvider dateTimeProvider,
     IContractExecutorFactory executorFactory,
     ILoggerFactory loggerFactory,
     ITxMempool mempool,
     MempoolSchedulerLock mempoolLock,
     Network network,
     ISenderRetriever senderRetriever,
     IStateRepositoryRoot stateRoot,
     IFederationGatewaySettings federationGatewaySettings)
     : base(blockBufferGenerator, coinView, consensusManager, dateTimeProvider, executorFactory, loggerFactory, mempool, mempoolLock, network, senderRetriever, stateRoot)
 {
     this.payToMultisigScript = federationGatewaySettings.MultiSigAddress.ScriptPubKey;
     this.payToMemberScript   = PayToPubkeyTemplate.Instance.GenerateScriptPubKey(new PubKey(federationGatewaySettings.PublicKey));
 }
Exemplo n.º 11
0
 public TestFederatedPegBlockDefinition(
     IBlockBufferGenerator blockBufferGenerator,
     ICoinView coinView,
     IConsensusManager consensusManager,
     IDateTimeProvider dateTimeProvider,
     IContractExecutorFactory executorFactory,
     ILoggerFactory loggerFactory,
     ITxMempool mempool,
     MempoolSchedulerLock mempoolLock,
     Network network,
     ISenderRetriever senderRetriever,
     IStateRepositoryRoot stateRoot,
     IBlockExecutionResultCache executionCache,
     ICallDataSerializer callDataSerializer,
     MinerSettings minerSettings,
     NodeDeployments nodeDeployments)
     : base(blockBufferGenerator, coinView, consensusManager, dateTimeProvider, executorFactory, loggerFactory, mempool, mempoolLock, network, senderRetriever, stateRoot, executionCache, callDataSerializer, minerSettings, nodeDeployments)
 {
 }
 public SmartContractPoARuleRegistration(Network network,
                                         IStateRepositoryRoot stateRepositoryRoot,
                                         IContractExecutorFactory executorFactory,
                                         ICallDataSerializer callDataSerializer,
                                         ISenderRetriever senderRetriever,
                                         IReceiptRepository receiptRepository,
                                         ICoinView coinView,
                                         IEnumerable <IContractTransactionValidationLogic> validationRules)
 {
     this.baseRuleRegistration = new PoAConsensusRulesRegistration();
     this.network             = network;
     this.stateRepositoryRoot = stateRepositoryRoot;
     this.executorFactory     = executorFactory;
     this.callDataSerializer  = callDataSerializer;
     this.senderRetriever     = senderRetriever;
     this.receiptRepository   = receiptRepository;
     this.coinView            = coinView;
     this.validationRules     = validationRules;
 }
Exemplo n.º 13
0
 public SmartContractPoACoinviewRule(
     IStateRepositoryRoot stateRepositoryRoot,
     IContractExecutorFactory executorFactory,
     ICallDataSerializer callDataSerializer,
     ISenderRetriever senderRetriever,
     IReceiptRepository receiptRepository,
     ICoinView coinView,
     IBlockExecutionResultCache executionCache,
     ILoggerFactory loggerFactory)
 {
     this.stateRepositoryRoot = stateRepositoryRoot;
     this.executorFactory     = executorFactory;
     this.callDataSerializer  = callDataSerializer;
     this.senderRetriever     = senderRetriever;
     this.receiptRepository   = receiptRepository;
     this.coinView            = coinView;
     this.executionCache      = executionCache;
     this.loggerFactory       = loggerFactory;
 }
 public SmartContractPosRuleRegistration(Network network,
                                         IStateRepositoryRoot stateRepositoryRoot,
                                         IContractExecutorFactory executorFactory,
                                         ICallDataSerializer callDataSerializer,
                                         ISenderRetriever senderRetriever,
                                         IReceiptRepository receiptRepository,
                                         ICoinView coinView,
                                         IStakeChain stakeChain,
                                         IStakeValidator stakeValidator)
 {
     this.network             = network;
     this.stateRepositoryRoot = stateRepositoryRoot;
     this.executorFactory     = executorFactory;
     this.callDataSerializer  = callDataSerializer;
     this.senderRetriever     = senderRetriever;
     this.receiptRepository   = receiptRepository;
     this.coinView            = coinView;
     this.stakeChain          = stakeChain;
     this.stakeValidator      = stakeValidator;
 }
Exemplo n.º 15
0
 public SmartContractPoABlockDefinition(
     IBlockBufferGenerator blockBufferGenerator,
     ICoinView coinView,
     IConsensusManager consensusManager,
     IDateTimeProvider dateTimeProvider,
     IContractExecutorFactory executorFactory,
     ILoggerFactory loggerFactory,
     ITxMempool mempool,
     MempoolSchedulerLock mempoolLock,
     Network network,
     ISenderRetriever senderRetriever,
     IStateRepositoryRoot stateRoot,
     IBlockExecutionResultCache executionCache,
     ICallDataSerializer callDataSerializer,
     MinerSettings minerSettings)
     : base(blockBufferGenerator, coinView, consensusManager, dateTimeProvider, executorFactory, loggerFactory, mempool,
            mempoolLock, minerSettings, network, senderRetriever, stateRoot, executionCache, callDataSerializer)
 {
     // TODO: Fix gross MinerSettings injection ^^
 }
Exemplo n.º 16
0
        /// <inheritdoc />
        public FederatedPegBlockDefinition(
            IBlockBufferGenerator blockBufferGenerator,
            ICoinView coinView,
            IConsensusManager consensusManager,
            IDateTimeProvider dateTimeProvider,
            IContractExecutorFactory executorFactory,
            ILoggerFactory loggerFactory,
            ITxMempool mempool,
            MempoolSchedulerLock mempoolLock,
            Network network,
            ISenderRetriever senderRetriever,
            IStateRepositoryRoot stateRoot,
            ICoinbaseSplitter premineSplitter,
            MinerSettings minerSettings,
            FederatedPegSettings federatedPegSettings)
            : base(blockBufferGenerator, coinView, consensusManager, dateTimeProvider, executorFactory, loggerFactory, mempool, mempoolLock, network, senderRetriever, stateRoot, minerSettings)
        {
            this.payToMultisigScript = federatedPegSettings.MultiSigAddress.ScriptPubKey;

            this.premineSplitter = premineSplitter;
        }
Exemplo n.º 17
0
 public SmartContractCollateralPoARuleRegistration(Network network, IStateRepositoryRoot stateRepositoryRoot, IContractExecutorFactory executorFactory,
                                                   ICallDataSerializer callDataSerializer, ISenderRetriever senderRetriever, IReceiptRepository receiptRepository, ICoinView coinView,
                                                   IEnumerable <IContractTransactionPartialValidationRule> partialTxValidationRules, IEnumerable <IContractTransactionFullValidationRule> fullTxValidationRules,
                                                   IInitialBlockDownloadState ibdState, ISlotsManager slotsManager, ICollateralChecker collateralChecker, IDateTimeProvider dateTime, CheckCollateralFullValidationRule checkCollateralFullValidationRule)
     : base(network, stateRepositoryRoot, executorFactory, callDataSerializer, senderRetriever, receiptRepository, coinView, partialTxValidationRules, fullTxValidationRules)
 {
     this.ibdState          = ibdState;
     this.slotsManager      = slotsManager;
     this.collateralChecker = collateralChecker;
     this.checkCollateralFullValidationRule = checkCollateralFullValidationRule;
     this.dateTime = dateTime;
 }
Exemplo n.º 18
0
 public SmartContractPowCoinviewRule(Network network, IStateRepositoryRoot stateRepositoryRoot,
                                     IContractExecutorFactory executorFactory, ICallDataSerializer callDataSerializer,
                                     ISenderRetriever senderRetriever, IReceiptRepository receiptRepository, ICoinView coinView)
     : base(network, stateRepositoryRoot, executorFactory, callDataSerializer, senderRetriever, receiptRepository, coinView)
 {
 }
 public SmartContractPowCoinviewRule(Network network, IStateRepositoryRoot stateRepositoryRoot,
                                     IContractExecutorFactory executorFactory, ICallDataSerializer callDataSerializer,
                                     ISenderRetriever senderRetriever, IReceiptRepository receiptRepository, ICoinView coinView, IBlockExecutionResultCache executionCache, ILoggerFactory loggerFactory)
     : base(network, stateRepositoryRoot, executorFactory, callDataSerializer, senderRetriever, receiptRepository, coinView, executionCache, loggerFactory)
 {
 }