public void Proof_module_is_registered_if_configured() { JsonRpcConfig jsonRpcConfig = new JsonRpcConfig(); jsonRpcConfig.Enabled = true; IConfigProvider configProvider = Substitute.For <IConfigProvider>(); configProvider.GetConfig <IJsonRpcConfig>().Returns(jsonRpcConfig); IRpcModuleProvider rpcModuleProvider = Substitute.For <IRpcModuleProvider>(); NethermindApi context = Build.ContextWithMocks(); context.ConfigProvider = configProvider; context.RpcModuleProvider = rpcModuleProvider; var signer = new Signer(ChainId.Mainnet, TestItem.PrivateKeyA, LimboLogs.Instance); context.TxSender = new NullTxSender(); context.EngineSignerStore = signer; context.KeyStore = Substitute.For <IKeyStore>(); context.SyncModeSelector = Substitute.For <ISyncModeSelector>(); context.ChainLevelInfoRepository = Substitute.For <IChainLevelInfoRepository>(); RegisterRpcModules registerRpcModules = new RegisterRpcModules(context); registerRpcModules.Execute(CancellationToken.None); rpcModuleProvider.ReceivedWithAnyArgs().Register <IProofModule>(null); }
public void Proof_module_is_not_registered_when_json_rpc_not_enabled() { JsonRpcConfig jsonRpcConfig = new JsonRpcConfig(); jsonRpcConfig.Enabled = false; IConfigProvider configProvider = Substitute.For <IConfigProvider>(); configProvider.GetConfig <IJsonRpcConfig>().Returns(jsonRpcConfig); IRpcModuleProvider rpcModuleProvider = Substitute.For <IRpcModuleProvider>(); NethermindApi context = new NethermindApi(configProvider, LimboLogs.Instance) { ConfigProvider = configProvider, RpcModuleProvider = rpcModuleProvider, TxPool = Substitute.For <ITxPool>(), BlockTree = Substitute.For <IBlockTree>(), Wallet = Substitute.For <IWallet>(), SpecProvider = Substitute.For <ISpecProvider>(), TxSender = Substitute.For <ITxSender>() }; RegisterRpcModules registerRpcModules = new RegisterRpcModules(context); registerRpcModules.Execute(CancellationToken.None); rpcModuleProvider.DidNotReceiveWithAnyArgs().Register <IProofModule>(null); }
public void Proof_module_is_registered_if_configured() { JsonRpcConfig jsonRpcConfig = new JsonRpcConfig(); jsonRpcConfig.Enabled = true; IConfigProvider configProvider = Substitute.For <IConfigProvider>(); configProvider.GetConfig <IJsonRpcConfig>().Returns(jsonRpcConfig); IRpcModuleProvider rpcModuleProvider = Substitute.For <IRpcModuleProvider>(); EthereumRunnerContext context = Build.ContextWithMocks(); context.ConfigProvider = configProvider; context.RpcModuleProvider = rpcModuleProvider; context.Signer = new Signer(ChainId.Mainnet, TestItem.PrivateKeyA, LimboLogs.Instance); context.KeyStore = Substitute.For <IKeyStore>(); RegisterRpcModules registerRpcModules = new RegisterRpcModules(context); registerRpcModules.Execute(CancellationToken.None); rpcModuleProvider.ReceivedWithAnyArgs().Register <IProofModule>(null); }
public async Task Proof_module_is_registered_if_configured() { JsonRpcConfig jsonRpcConfig = new JsonRpcConfig { Enabled = true }; Runner.Ethereum.Api.NethermindApi context = Build.ContextWithMocks(); context.ConfigProvider.GetConfig <IJsonRpcConfig>().Returns(jsonRpcConfig); RegisterRpcModules registerRpcModules = new RegisterRpcModules(context); await registerRpcModules.Execute(CancellationToken.None); context.RpcModuleProvider.Check("proof_call", RpcEndpoint.Http).Should().Be(ModuleResolution.Enabled); }
public async Task Proof_module_is_not_registered_when_json_rpc_not_enabled() { JsonRpcConfig jsonRpcConfig = new JsonRpcConfig { Enabled = false }; Runner.Ethereum.Api.NethermindApi context = Build.ContextWithMocks(); context.ConfigProvider.GetConfig <IJsonRpcConfig>().Returns(jsonRpcConfig); context.RpcModuleProvider.Enabled.Returns(Array.Empty <ModuleType>()); RegisterRpcModules registerRpcModules = new RegisterRpcModules(context); await registerRpcModules.Execute(CancellationToken.None); context.RpcModuleProvider.DidNotReceiveWithAnyArgs().Register <IProofRpcModule>(null); }
public void Proof_module_is_registered_if_configured() { JsonRpcConfig jsonRpcConfig = new JsonRpcConfig(); jsonRpcConfig.Enabled = true; IConfigProvider configProvider = Substitute.For <IConfigProvider>(); configProvider.GetConfig <IJsonRpcConfig>().Returns(jsonRpcConfig); IRpcModuleProvider rpcModuleProvider = Substitute.For <IRpcModuleProvider>(); EthereumRunnerContext context = Build.ContextWithMocks(); context.ConfigProvider = configProvider; context.RpcModuleProvider = rpcModuleProvider; RegisterRpcModules registerRpcModules = new RegisterRpcModules(context); registerRpcModules.Execute(CancellationToken.None); rpcModuleProvider.ReceivedWithAnyArgs().Register <IProofModule>(null); }
public void Proof_module_is_not_registered_when_json_rpc_not_enabled() { JsonRpcConfig jsonRpcConfig = new JsonRpcConfig(); jsonRpcConfig.Enabled = false; IConfigProvider configProvider = Substitute.For <IConfigProvider>(); configProvider.GetConfig <IJsonRpcConfig>().Returns(jsonRpcConfig); IRpcModuleProvider rpcModuleProvider = Substitute.For <IRpcModuleProvider>(); EthereumRunnerContext context = new EthereumRunnerContext(configProvider, LimboLogs.Instance); context.ConfigProvider = configProvider; context.RpcModuleProvider = rpcModuleProvider; RegisterRpcModules registerRpcModules = new RegisterRpcModules(context); registerRpcModules.Execute(); rpcModuleProvider.DidNotReceiveWithAnyArgs().Register <IProofModule>(null); }