public NdmSubprotocolFactory( IMessageSerializationService?messageSerializationService, INodeStatsManager?nodeStatsManager, ILogManager?logManager, IAccountService?accountService, IConsumerService?consumerService, INdmConsumerChannelManager?ndmConsumerChannelManager, IEcdsa?ecdsa, IWallet?wallet, INdmFaucet?faucet, PublicKey?nodeId, Address?providerAddress, Address?consumerAddress, bool verifySignature = true) { if (nodeStatsManager == null) { throw new ArgumentNullException(nameof(nodeStatsManager)); } MessageSerializationService = messageSerializationService ?? throw new ArgumentNullException(nameof(messageSerializationService)); NodeStatsManager = nodeStatsManager ?? throw new ArgumentNullException(nameof(nodeStatsManager)); LogManager = logManager ?? throw new ArgumentNullException(nameof(logManager)); AccountService = accountService ?? throw new ArgumentNullException(nameof(accountService)); ConsumerService = consumerService ?? throw new ArgumentNullException(nameof(consumerService)); NdmConsumerChannelManager = ndmConsumerChannelManager ?? throw new ArgumentNullException(nameof(ndmConsumerChannelManager)); Ecdsa = ecdsa ?? throw new ArgumentNullException(nameof(ecdsa)); Wallet = wallet ?? throw new ArgumentNullException(nameof(wallet)); Faucet = faucet ?? throw new ArgumentNullException(nameof(faucet)); NodeId = nodeId ?? throw new ArgumentNullException(nameof(nodeId)); ProviderAddress = providerAddress; ConsumerAddress = consumerAddress; VerifySignature = verifySignature; AccountService.AddressChanged += (_, e) => ConsumerAddress = e.NewAddress; }
public RegisterUserCommandHandler(IUserRepository userRepository, IValidator <RegisterUserCommand> validator, IEcdsa ecdsa, IAesEncryptor encryptor) { _userRepository = userRepository; _validator = validator; _ecdsa = ecdsa; _encryptor = encryptor; }
public NeighborsMessageSerializer( IEcdsa ecdsa, IPrivateKeyGenerator privateKeyGenerator, IDiscoveryMessageFactory messageFactory, INodeIdResolver nodeIdResolver) : base(ecdsa, privateKeyGenerator, messageFactory, nodeIdResolver) { }
public ParityModule(IEcdsa ecdsa, ITxPool txPool, IBlockFinder blockFinder, IReceiptFinder receiptFinder, ILogManager logManager) { _ecdsa = ecdsa ?? throw new ArgumentNullException(nameof(ecdsa)); _txPool = txPool ?? throw new ArgumentNullException(nameof(txPool)); _blockFinder = blockFinder ?? throw new ArgumentNullException(nameof(blockFinder)); _receiptFinder = receiptFinder ?? throw new ArgumentNullException(nameof(receiptFinder)); }
public ParityModule(IEcdsa ecdsa, ITxPool txPool, IBlockTree blockTree, IReceiptStorage receiptStorage, ILogManager logManager) { _ecdsa = ecdsa ?? throw new ArgumentNullException(nameof(ecdsa)); _txPool = txPool ?? throw new ArgumentNullException(nameof(txPool)); _blockFinder = new BlockFinder(blockTree ?? throw new ArgumentNullException(nameof(blockTree))); _receiptStorage = receiptStorage ?? throw new ArgumentNullException(nameof(receiptStorage)); }
public SignShareFileCommandHandler(IShareRepository shareRepository, IUserRepository userRepository, IFileRepository fileRepository, IAesEncryptor encryptor, IEcdsa ecdsa) { _shareRepository = shareRepository; _userRepository = userRepository; _fileRepository = fileRepository; _encryptor = encryptor; _ecdsa = ecdsa; }
protected DiscoveryMsgSerializerBase(IEcdsa ecdsa, IPrivateKeyGenerator nodeKey, INodeIdResolver nodeIdResolver) { _ecdsa = ecdsa ?? throw new ArgumentNullException(nameof(ecdsa)); _privateKey = nodeKey.Generate(); _nodeIdResolver = nodeIdResolver ?? throw new ArgumentNullException(nameof(nodeIdResolver)); }
public ReceiptProcessor(IProviderSessionRepository sessionRepository, IAbiEncoder abiEncoder, IEcdsa ecdsa, ILogManager logManager) { _sessionRepository = sessionRepository; _abiEncoder = abiEncoder; _ecdsa = ecdsa; _logger = logManager.GetClassLogger(); }
protected DiscoveryMessageSerializerBase( IEcdsa ecdsa, IPrivateKeyGenerator privateKeyGenerator, IDiscoveryMessageFactory messageFactory, INodeIdResolver nodeIdResolver) { _ecdsa = ecdsa ?? throw new ArgumentNullException(nameof(ecdsa)); _privateKey = privateKeyGenerator.Generate(); _messageFactory = messageFactory ?? throw new ArgumentNullException(nameof(messageFactory)); _nodeIdResolver = nodeIdResolver ?? throw new ArgumentNullException(nameof(nodeIdResolver)); }
public DiscoveryMsgSerializersProvider(IMessageSerializationService msgSerializationService, IEcdsa ecdsa, IPrivateKeyGenerator privateKeyGenerator, INodeIdResolver nodeIdResolver) { _msgSerializationService = msgSerializationService; _pingMsgSerializer = new PingMsgSerializer(ecdsa, privateKeyGenerator, nodeIdResolver); _pongMsgSerializer = new PongMsgSerializer(ecdsa, privateKeyGenerator, nodeIdResolver); _findNodeMsgSerializer = new FindNodeMsgSerializer(ecdsa, privateKeyGenerator, nodeIdResolver); _neighborsMsgSerializer = new NeighborsMsgSerializer(ecdsa, privateKeyGenerator, nodeIdResolver); _enrRequestMsgSerializer = new EnrRequestMsgSerializer(ecdsa, privateKeyGenerator, nodeIdResolver); _enrResponseMsgSerializer = new EnrResponseMsgSerializer(ecdsa, privateKeyGenerator, nodeIdResolver); }
public void SetUp() { _sessionRepository = Substitute.For <IProviderSessionRepository>(); _encoder = Substitute.For <IAbiEncoder>(); _signer = Substitute.For <IEcdsa>(); _peer = Substitute.For <INdmProviderPeer>(); _publicKey = new PublicKey(new byte[64]); _session = new ProviderSession(Keccak.Zero, Keccak.Zero, Keccak.Zero, _publicKey.Address, _publicKey, TestItem.AddressB, TestItem.PublicKeyB, 0, 0); _session.SetDataAvailability(DataAvailability.Available); _session.Start(0); _processor = new ReceiptProcessor(_sessionRepository, _encoder, _signer, LimboLogs.Instance); }
public HandshakeService( IMessageSerializationService messageSerializationService, IEciesCipher eciesCipher, ICryptoRandom cryptoRandom, IEcdsa ecdsa, PrivateKey privateKey, ILogManager logManager) { _logger = logManager?.GetClassLogger() ?? throw new ArgumentNullException(nameof(logManager)); _messageSerializationService = messageSerializationService ?? throw new ArgumentNullException(nameof(messageSerializationService)); _eciesCipher = eciesCipher ?? throw new ArgumentNullException(nameof(eciesCipher)); _privateKey = privateKey ?? throw new ArgumentNullException(nameof(privateKey)); _cryptoRandom = cryptoRandom ?? throw new ArgumentNullException(nameof(cryptoRandom)); _ecdsa = ecdsa ?? throw new ArgumentNullException(nameof(ecdsa)); _ephemeralGenerator = new PrivateKeyGenerator(_cryptoRandom); }
public void Setup() { _session = Substitute.For <ISession>(); _nodeStatsManager = Substitute.For <INodeStatsManager>(); _messageSerializationService = Substitute.For <IMessageSerializationService>(); _ecdsa = Substitute.For <IEcdsa>(); _wallet = Substitute.For <IWallet>(); _faucet = Substitute.For <INdmFaucet>(); _configuredNodeId = TestItem.PublicKeyA; _consumerService = Substitute.For <IConsumerService>(); _ndmConsumerChannelManager = Substitute.For <INdmConsumerChannelManager>(); _configuredProviderAddress = TestItem.AddressA; _configuredConsumerAddress = TestItem.AddressB; _verifySignature = false; InitSubprotocol(); }
public ParityModule( IEcdsa ecdsa, ITxPool txPool, IBlockFinder blockFinder, IReceiptFinder receiptFinder, IEnode enode, ISignerStore signerStore, IKeyStore keyStore, ILogManager logManager) { _ecdsa = ecdsa ?? throw new ArgumentNullException(nameof(ecdsa)); _txPool = txPool ?? throw new ArgumentNullException(nameof(txPool)); _blockFinder = blockFinder ?? throw new ArgumentNullException(nameof(blockFinder)); _receiptFinder = receiptFinder ?? throw new ArgumentNullException(nameof(receiptFinder)); _enode = enode ?? throw new ArgumentNullException(nameof(enode)); _signerStore = signerStore ?? throw new ArgumentNullException(nameof(signerStore)); _keyStore = keyStore ?? throw new ArgumentNullException(nameof(keyStore)); }
public DiscoveryMsgSerializersProvider( IMessageSerializationService messageSerializationService, IEcdsa ecdsa, IPrivateKeyGenerator privateKeyGenerator, IDiscoveryMessageFactory messageFactory, INodeIdResolver nodeIdResolver) { PingMessageSerializer pingSerializer = new PingMessageSerializer(ecdsa, privateKeyGenerator, messageFactory, nodeIdResolver); PongMessageSerializer pongSerializer = new PongMessageSerializer(ecdsa, privateKeyGenerator, messageFactory, nodeIdResolver); FindNodeMessageSerializer findNodeSerializer = new FindNodeMessageSerializer(ecdsa, privateKeyGenerator, messageFactory, nodeIdResolver); NeighborsMessageSerializer neighborsSerializer = new NeighborsMessageSerializer(ecdsa, privateKeyGenerator, messageFactory, nodeIdResolver); _messageSerializationService = messageSerializationService; _pingMessageSerializer = pingSerializer; _pongMessageSerializer = pongSerializer; _findNodeMessageSerializer = findNodeSerializer; _neighborsMessageSerializer = neighborsSerializer; }
public void Setup() { _messageSerializationService = Substitute.For <IMessageSerializationService>(); _nodeStatsManager = Substitute.For <INodeStatsManager>(); _logManager = Substitute.For <ILogManager>(); _accountService = Substitute.For <IAccountService>(); _consumerService = Substitute.For <IConsumerService>(); _ndmConsumerChannelManager = Substitute.For <INdmConsumerChannelManager>(); _ecdsa = Substitute.For <IEcdsa>(); _wallet = Substitute.For <IWallet>(); _faucet = Substitute.For <INdmFaucet>(); _nodeId = TestItem.PublicKeyA; _providerAddress = TestItem.AddressA; _consumerAddress = TestItem.AddressB; _verifySignature = false; _factory = new NdmSubprotocolFactory(_messageSerializationService, _nodeStatsManager, _logManager, _accountService, _consumerService, _ndmConsumerChannelManager, _ecdsa, _wallet, _faucet, _nodeId, _providerAddress, _consumerAddress, _verifySignature); }
public NdmSubprotocolFactory(IMessageSerializationService messageSerializationService, INodeStatsManager nodeStatsManager, ILogManager logManager, IConsumerService consumerService, INdmConsumerChannelManager ndmConsumerChannelManager, IEcdsa ecdsa, IWallet wallet, INdmFaucet faucet, PublicKey nodeId, Address providerAddress, Address consumerAddress, bool verifySignature = true) { MessageSerializationService = messageSerializationService; NodeStatsManager = nodeStatsManager ?? throw new ArgumentNullException(nameof(nodeStatsManager)); LogManager = logManager; ConsumerService = consumerService; NdmConsumerChannelManager = ndmConsumerChannelManager; Ecdsa = ecdsa; Wallet = wallet; Faucet = faucet; NodeId = nodeId; ProviderAddress = providerAddress; ConsumerAddress = consumerAddress; VerifySignature = verifySignature; ConsumerService.AddressChanged += (_, e) => ConsumerAddress = e.NewAddress; }
public VerifySignaturesCommandHandler(IShareRepository shareRepository, IEcdsa ecdsa) { _shareRepository = shareRepository; _ecdsa = ecdsa; }
public NodeRecordSigner(IEcdsa?ethereumEcdsa, PrivateKey?privateKey) { _ecdsa = ethereumEcdsa ?? throw new ArgumentNullException(nameof(ethereumEcdsa)); _privateKey = privateKey ?? throw new ArgumentNullException(nameof(privateKey)); }
public PersonalModule(IEcdsa ecdsa, IWallet wallet, ILogManager logManager) { _ecdsa = ecdsa ?? throw new ArgumentNullException(nameof(ecdsa)); _wallet = wallet ?? throw new ArgumentNullException(nameof(wallet)); }
public NodeIdResolver(IEcdsa ecdsa) { _ecdsa = ecdsa; }
public FindNodeMsgSerializer(IEcdsa ecdsa, IPrivateKeyGenerator nodeKey, INodeIdResolver nodeIdResolver) : base(ecdsa, nodeKey, nodeIdResolver) { }
public PersonalModule(IEcdsa ecdsa, IWallet wallet, IKeyStore keyStore) { _ecdsa = ecdsa ?? throw new ArgumentNullException(nameof(ecdsa)); _wallet = wallet ?? throw new ArgumentNullException(nameof(wallet)); _keyStore = keyStore; }
public NdmProviderSubprotocolFactory(IMessageSerializationService messageSerializationService, INodeStatsManager nodeStatsManager, ILogManager logManager, IAccountService accountService, IConsumerService consumerService, IProviderService providerService, INdmConsumerChannelManager ndmConsumerChannelManager, IEcdsa ecdsa, IWallet wallet, INdmFaucet faucet, PublicKey nodeId, Address providerAddress, Address consumerAddress, bool verifySignature = true) : base( messageSerializationService, nodeStatsManager, logManager, accountService, consumerService, ndmConsumerChannelManager, ecdsa, wallet, faucet, nodeId, providerAddress, consumerAddress, verifySignature) { _providerService = providerService; _providerService.AddressChanged += (_, e) => ProviderAddress = e.NewAddress; }
public ParityModule(IEcdsa ecdsa, ITxPool txPool, ILogManager logManager) { _ecdsa = ecdsa; _txPool = txPool; }
public EnrResponseMsgSerializer(IEcdsa ecdsa, IPrivateKeyGenerator nodeKey, INodeIdResolver nodeIdResolver) : base(ecdsa, nodeKey, nodeIdResolver) { _nodeRecordSigner = new NodeRecordSigner(ecdsa, nodeKey.Generate()); }
public async Task OneTimeSetUp() { InitDecoders(); SetUpSubstitutes(); logManager = NoErrorLimboLogs.Instance; timestamper = new Timestamper(); config = new NdmConfig(); configId = config.Id; var configDb = new MemDb(NdmDbNames.Configs); var configRepository = new ConfigRocksRepository(configDb, new NdmConfigDecoder()); await configRepository.AddAsync(config); configManager = new ConfigManager(config, configRepository); config.ProviderAddress = "c7f8522f15c189e00d2f895b4528b4f84516cd7b"; config.ProviderColdWalletAddress = "c7f8522f15c189e00d2f895b4528b4f84516cd7b"; config.ConsumerAddress = "a238812fb5c199ea051f89200028b4f08513cd6a"; providerAddress = new Address(config.ProviderAddress); coldWalletAddress = new Address(config.ProviderColdWalletAddress); var sessionDb = new MemDb(ProviderDbNames.ProviderSessions); sessionRepository = new ProviderSessionRocksRepository(sessionDb, new ProviderSessionDecoder()); sessionManager = new SessionManager(sessionRepository, timestamper, logManager); var consumersDb = new MemDb(ProviderDbNames.Consumers); consumerRepository = new ConsumerRocksRepository(consumersDb, new ConsumerDecoder()); paymentClaimDb = new MemDb(ProviderDbNames.PaymentClaims); paymentClaimRepository = new PaymentClaimRocksRepository(paymentClaimDb, new PaymentClaimDecoder()); var dataAssetDb = new MemDb(ProviderDbNames.DataAssets); dataAssetRepository = new DataAssetRocksRepository(dataAssetDb, new DataAssetDecoder()); ecdsa = new Ecdsa(); abiEncoder = new AbiEncoder(); ndmDataPublisher = new NdmDataPublisher(); dataAvaliabilityValidator = new DataAvailabilityValidator(); nodeId = new PublicKey(new CryptoRandom().GenerateRandomBytes(64)); providerName = "test"; filesPath = config.FilesPath; fileMaxSize = config.FileMaxSize; requiredBlockConfirmations = config.BlockConfirmations; paymentGasLimit = 70000; skipDepositVerification = true; backgroundServicesDisabled = false; DataAsset dataAsset = new DataAsset(new Keccak(Keccak.OfAnEmptyString.ToString()), "TestDataAsset", "Testing", 1, DataAssetUnitType.Unit, 1, 10, new DataAssetRules(new DataAssetRule(10)), new DataAssetProvider(providerAddress, "provider"), null, QueryType.Query); await dataAssetRepository.AddAsync(dataAsset); paymentClaimProcessor.SendTransactionAsync(Arg.Any <PaymentClaim>(), Arg.Any <UInt256>()).Returns(new Keccak("0x77a0e79f851c097f81210d88eb59ed8f933336f65e88b0bde6506f2c6556c2b6")); gasPriceService.GetCurrentPaymentClaimGasPriceAsync().Returns(Task.FromResult(new UInt256(10))); providerService = new ProviderService(configManager, configId, consumerRepository, dataAssetRepository, providerDepositApprovalRepository, paymentClaimRepository, paymentClaimProcessor, sessionRepository, timestamper, ecdsa, abiEncoder, ndmDataPublisher, gasPriceService, dataAvaliabilityValidator, sessionManager, transactionVerifier, depositManager, refundPolicy, depositService, wallet, blockchainBridge, providerAddress, coldWalletAddress, nodeId, providerName, filesPath, fileMaxSize, requiredBlockConfirmations, paymentGasLimit, logManager, skipDepositVerification, backgroundServicesDisabled); }
public NdmProviderSubprotocol(ISession p2PSession, INodeStatsManager nodeStatsManager, IMessageSerializationService serializer, ILogManager logManager, IConsumerService consumerService, IProviderService providerService, INdmConsumerChannelManager ndmConsumerChannelManager, IEcdsa ecdsa, IWallet wallet, INdmFaucet faucet, PublicKey nodeId, Address configuredProviderAddress, Address configuredConsumerAddress, bool verifySignature = true) : base(p2PSession, nodeStatsManager, serializer, logManager, consumerService, ndmConsumerChannelManager, ecdsa, wallet, faucet, nodeId, configuredProviderAddress, configuredConsumerAddress, verifySignature) { _providerService = providerService; MessageHandlers[NdmMessageCode.GetDataAssets] = message => Handle(Deserialize <GetDataAssetsMessage>(message.Data)); MessageHandlers[NdmMessageCode.GetDepositApprovals] = message => Handle(Deserialize <GetDepositApprovalsMessage>(message.Data)); MessageHandlers[NdmMessageCode.RequestDepositApproval] = message => Handle(Deserialize <RequestDepositApprovalMessage>(message.Data)); MessageHandlers[NdmMessageCode.DataDeliveryReceipt] = message => Handle(Deserialize <DataDeliveryReceiptMessage>(message.Data)); MessageHandlers[NdmMessageCode.DisableDataStream] = message => Handle(Deserialize <DisableDataStreamMessage>(message.Data)); MessageHandlers[NdmMessageCode.EnableDataStream] = message => Handle(Deserialize <EnableDataStreamMessage>(message.Data)); MessageHandlers[NdmMessageCode.FinishSession] = message => Handle(Deserialize <FinishSessionMessage>(message.Data)); MessageHandlers[NdmMessageCode.DataRequest] = message => Handle(Deserialize <DataRequestMessage>(message.Data)); MessageHandlers[NdmMessageCode.ConsumerAddressChanged] = message => Handle(Deserialize <ConsumerAddressChangedMessage>(message.Data)); MessageHandlers[NdmMessageCode.RequestEth] = message => Handle(Deserialize <RequestEthMessage>(message.Data)); }