public override void doInitAction(DoInitAction tag) { if (header_field.version > 6 && tag.sprite != null) { String __Packages = idRef(tag.sprite); className = (__Packages != null && __Packages.StartsWith("__Packages"))?__Packages.Substring(11):null; // length("__Packages.") = 11 if (isRegisterClass(tag.actionList)) { DebugModule dm = new DebugModule(); // C: We actually want the class name here, not the linkage ID. dm.name = "<" + __Packages + ".2>"; // C: We want the class name as the second input argument. Fortunately, we don't // really do anything with the source, so it's okay. dm.Text = "Object.registerClass(" + __Packages + ", " + __Packages + ");"; dm.bitmap = 1; LineRecord lr = new LineRecord(1, dm); int startOffset = tag.actionList.getOffset(0); dm.addOffset(lr, startOffset); tag.actionList.insert(startOffset, lr); modules.put((int)(SupportClass.Random.NextDouble() * System.Int32.MaxValue), dm); } } String[] temp = pool; collectActions(tag.actionList); pool = temp; className = null; }
public void Update_head_block() { debugBridge.UpdateHeadBlock(Arg.Any <Keccak>()); IDebugModule module = new DebugModule(LimboLogs.Instance, debugBridge, jsonRpcConfig); RpcTest.TestSerializedRequest(module, "debug_resetHead", TestItem.KeccakA.ToString()); debugBridge.Received().UpdateHeadBlock(TestItem.KeccakA); }
public void Migrate_receipts() { debugBridge.MigrateReceipts(Arg.Any <long>()).Returns(true); IDebugModule module = new DebugModule(LimboLogs.Instance, debugBridge, jsonRpcConfig); string response = RpcTest.TestSerializedRequest(module, "debug_migrateReceipts", "100"); Assert.NotNull(response); }
public void Get_block_rlp_when_missing() { debugBridge.GetBlockRlp(1).Returns((byte[])null); DebugModule module = new DebugModule(LimboLogs.Instance, debugBridge, jsonRpcConfig); JsonRpcErrorResponse response = RpcTest.TestRequest <IDebugModule>(module, "debug_getBlockRlp", "1") as JsonRpcErrorResponse; Assert.AreEqual(-32001, response?.Error.Code); }
public void Get_from_db_null_value() { byte[] key = new byte[] { 1, 2, 3 }; debugBridge.GetDbValue(Arg.Any <string>(), Arg.Any <byte[]>()).Returns((byte[])null); IConfigProvider configProvider = Substitute.For <IConfigProvider>(); DebugModule module = new DebugModule(LimboLogs.Instance, debugBridge, jsonRpcConfig); JsonRpcSuccessResponse response = RpcTest.TestRequest <IDebugModule>(module, "debug_getFromDb", "STATE", key.ToHexString(true)) as JsonRpcSuccessResponse; Assert.NotNull(response); }
public void Get_block_rlp_when_missing() { IDebugBridge debugBridge = Substitute.For <IDebugBridge>(); debugBridge.GetBlockRlp(1).Returns((byte[])null); DebugModule module = new DebugModule(NullLogManager.Instance, debugBridge); JsonRpcErrorResponse response = RpcTest.TestRequest <IDebugModule>(module, "debug_getBlockRlp", "1") as JsonRpcErrorResponse; Assert.AreEqual(-32601, response.Error.Code); }
public void Get_block_rlp_by_hash_when_missing() { BlockDecoder decoder = new BlockDecoder(); Rlp rlp = decoder.Encode(Build.A.Block.WithNumber(1).TestObject); debugBridge.GetBlockRlp(Keccak.Zero).Returns((byte[])null); DebugModule module = new DebugModule(LimboLogs.Instance, debugBridge, jsonRpcConfig); JsonRpcErrorResponse response = RpcTest.TestRequest <IDebugModule>(module, "debug_getBlockRlpByHash", $"{Keccak.Zero.Bytes.ToHexString()}") as JsonRpcErrorResponse; Assert.AreEqual(-32001, response.Error.Code); }
public void Get_block_rlp_by_hash() { BlockDecoder decoder = new BlockDecoder(); Rlp rlp = decoder.Encode(Build.A.Block.WithNumber(1).TestObject); debugBridge.GetBlockRlp(Keccak.Zero).Returns(rlp.Bytes); DebugModule module = new DebugModule(LimboLogs.Instance, debugBridge, jsonRpcConfig); JsonRpcSuccessResponse response = RpcTest.TestRequest <IDebugModule>(module, "debug_getBlockRlpByHash", $"{Keccak.Zero.Bytes.ToHexString()}") as JsonRpcSuccessResponse; Assert.AreEqual(rlp.Bytes, (byte[])response?.Result); }
public static void Main() { using (var container = new UnityContainer()) using (var host = new UnityServiceHost(container, typeof(DebugService), new Uri(SharedConfiguration.WCFDebugServiceLocation))) { DebugModule.ConfigureContainer(container); OpenHost(host); Console.WriteLine("WCF host is listening {0}", host.BaseAddresses.First()); Console.WriteLine("Press enter to exit..."); Console.ReadLine(); } }
public void Get_block_rlp() { BlockDecoder decoder = new BlockDecoder(); IDebugBridge debugBridge = Substitute.For <IDebugBridge>(); Rlp rlp = decoder.Encode(Build.A.Block.WithNumber(1).TestObject); debugBridge.GetBlockRlp(1).Returns(rlp.Bytes); DebugModule module = new DebugModule(LimboLogs.Instance, debugBridge); JsonRpcSuccessResponse response = RpcTest.TestRequest <IDebugModule>(module, "debug_getBlockRlp", "1") as JsonRpcSuccessResponse; Assert.AreEqual(rlp.Bytes, (byte[])response?.Result); }
public DebugModule getDebugModule(int offset) { DebugModule d = (DebugModule)modules.get_Renamed(offset); if (d == null) { return(null); } else { return(d); } }
public void Get_block_rlp_by_hash_when_missing() { BlockDecoder decoder = new BlockDecoder(); IDebugBridge debugBridge = Substitute.For <IDebugBridge>(); Rlp rlp = decoder.Encode(Build.A.Block.WithNumber(1).TestObject); debugBridge.GetBlockRlp(Keccak.Zero).Returns((byte[])null); DebugModule module = new DebugModule(NullLogManager.Instance, debugBridge); JsonRpcResponse response = RpcTest.TestRequest <IDebugModule>(module, "debug_getBlockRlpByHash", $"{Keccak.Zero.Bytes.ToHexString()}"); Assert.AreEqual(-32601, response.Error.Code); }
private void P2C_DebugSpeed(string[] param) { Singleton <GoldView> .Instance.SetPvpSpeed(float.Parse(param[1])); if (Singleton <HUDModuleManager> .Instance.gameObject) { DebugModule module = Singleton <HUDModuleManager> .Instance.GetModule <DebugModule>(EHUDModule.Debug); if (module != null) { module.SetPvpSpeed(float.Parse(param[1])); } } }
public void Get_from_db() { IDebugBridge debugBridge = Substitute.For <IDebugBridge>(); byte[] key = new byte[] { 1, 2, 3 }; byte[] value = new byte[] { 4, 5, 6 }; debugBridge.GetDbValue(Arg.Any <string>(), Arg.Any <byte[]>()).Returns(value); IConfigProvider configProvider = Substitute.For <IConfigProvider>(); DebugModule module = new DebugModule(LimboLogs.Instance, debugBridge); JsonRpcSuccessResponse response = RpcTest.TestRequest <IDebugModule>(module, "debug_getFromDb", "STATE", key.ToHexString(true)) as JsonRpcSuccessResponse; byte[] result = response.Result as byte[]; }
public void Get_from_db_null_value() { IDebugBridge debugBridge = Substitute.For <IDebugBridge>(); byte[] key = new byte[] { 1, 2, 3 }; debugBridge.GetDbValue(Arg.Any <string>(), Arg.Any <byte[]>()).Returns((byte[])null); IConfigProvider configProvider = Substitute.For <IConfigProvider>(); DebugModule module = new DebugModule(NullLogManager.Instance, debugBridge); JsonRpcResponse response = RpcTest.TestRequest <IDebugModule>(module, "debug_getFromDb", "STATE", key.ToHexString(true)); Assert.IsNull(response.Error, response.Error?.Message); Assert.IsNull(response.Result, "result"); }
public void Get_block_rlp() { BlockDecoder decoder = new BlockDecoder(); IDebugBridge debugBridge = Substitute.For <IDebugBridge>(); Rlp rlp = decoder.Encode(Build.A.Block.WithNumber(1).TestObject); debugBridge.GetBlockRlp(1).Returns(rlp.Bytes); DebugModule module = new DebugModule(NullLogManager.Instance, debugBridge); JsonRpcResponse response = RpcTest.TestRequest <IDebugModule>(module, "debug_getBlockRlp", "1"); Assert.IsNotInstanceOf <JsonRpcErrorResponse>(response); Assert.AreEqual(rlp.Bytes, (byte[])response.Result); }
public void Get_from_db() { IDebugBridge debugBridge = Substitute.For <IDebugBridge>(); byte[] key = new byte[] { 1, 2, 3 }; byte[] value = new byte[] { 4, 5, 6 }; debugBridge.GetDbValue(Arg.Any <string>(), Arg.Any <byte[]>()).Returns(value); IConfigProvider configProvider = Substitute.For <IConfigProvider>(); DebugModule module = new DebugModule(configProvider, NullLogManager.Instance, debugBridge, new UnforgivingJsonSerializer()); JsonRpcResponse response = RpcTest.TestRequest <IDebugModule>(module, "debug_getFromDb", "STATE", key.ToHexString(true)); byte[] result = response.Result as byte[]; Assert.AreEqual(value, result, response.Error?.Message); }
internal virtual void add(DebugModule m) { int count = 0; if (cache.Contains(m)) { count = (int)cache[m]; } cache[m] = ++count; if (count > topCount) { topCount = count; topModule = m; } }
public void Get_chain_level(string parameter) { debugBridge.GetLevelInfo(1).Returns( new ChainLevelInfo( true, new[] { new BlockInfo(TestItem.KeccakA, 1000), new BlockInfo(TestItem.KeccakB, 1001), })); DebugModule module = new DebugModule(LimboLogs.Instance, debugBridge, jsonRpcConfig); JsonRpcSuccessResponse response = RpcTest.TestRequest <IDebugModule>(module, "debug_getChainLevel", parameter) as JsonRpcSuccessResponse; ChainLevelForRpc chainLevel = response?.Result as ChainLevelForRpc; Assert.NotNull(chainLevel); Assert.AreEqual(true, chainLevel.HasBlockOnMainChain); Assert.AreEqual(2, chainLevel.BlockInfos.Length); }
public void Get_trace() { GethTxTraceEntry entry = new GethTxTraceEntry(); entry.Storage = new Dictionary <string, string> { { "1".PadLeft(64, '0'), "2".PadLeft(64, '0') }, { "3".PadLeft(64, '0'), "4".PadLeft(64, '0') }, }; entry.Memory = new List <string> { "5".PadLeft(64, '0'), "6".PadLeft(64, '0') }; entry.Stack = new List <string> { "7".PadLeft(64, '0'), "8".PadLeft(64, '0') }; entry.Operation = "STOP"; entry.Gas = 22000; entry.GasCost = 1; entry.Depth = 1; var trace = new GethLikeTxTrace(); trace.ReturnValue = Bytes.FromHexString("a2"); trace.Entries.Add(entry); IDebugBridge debugBridge = Substitute.For <IDebugBridge>(); debugBridge.GetTransactionTrace(Arg.Any <Keccak>()).Returns(trace); IConfigProvider configProvider = Substitute.For <IConfigProvider>(); DebugModule module = new DebugModule(configProvider, NullLogManager.Instance, debugBridge, new UnforgivingJsonSerializer()); string response = RpcTest.TestSerializedRequest <IDebugModule>(module, "debug_traceTransaction", TestObject.KeccakA.ToString(true)); Assert.AreEqual("{\"id\":67,\"jsonrpc\":\"2.0\",\"result\":{\"gas\":\"0x0\",\"failed\":false,\"returnValue\":\"0xa2\",\"structLogs\":[{\"pc\":0,\"op\":\"STOP\",\"gas\":22000,\"gasCost\":1,\"depth\":1,\"error\":null,\"stack\":[\"0000000000000000000000000000000000000000000000000000000000000007\",\"0000000000000000000000000000000000000000000000000000000000000008\"],\"memory\":[\"0000000000000000000000000000000000000000000000000000000000000005\",\"0000000000000000000000000000000000000000000000000000000000000006\"],\"storage\":{\"0000000000000000000000000000000000000000000000000000000000000001\":\"0000000000000000000000000000000000000000000000000000000000000002\",\"0000000000000000000000000000000000000000000000000000000000000003\":\"0000000000000000000000000000000000000000000000000000000000000004\"}}]}}", response); }
public void Get_trace_with_options() { GethTxTraceEntry entry = new GethTxTraceEntry(); entry.Storage = new Dictionary <string, string> { { "1".PadLeft(64, '0'), "2".PadLeft(64, '0') }, { "3".PadLeft(64, '0'), "4".PadLeft(64, '0') }, }; entry.Memory = new List <string> { "5".PadLeft(64, '0'), "6".PadLeft(64, '0') }; entry.Stack = new List <string> { }; entry.Operation = "STOP"; entry.Gas = 22000; entry.GasCost = 1; entry.Depth = 1; var trace = new GethLikeTxTrace(); trace.ReturnValue = Bytes.FromHexString("a2"); trace.Entries.Add(entry); IDebugBridge debugBridge = Substitute.For <IDebugBridge>(); debugBridge.GetTransactionTrace(Arg.Any <Keccak>(), Arg.Any <GethTraceOptions>()).Returns(trace); DebugModule module = new DebugModule(LimboLogs.Instance, debugBridge); string response = RpcTest.TestSerializedRequest <IDebugModule>(DebugModuleFactory.Converters, module, "debug_traceTransaction", TestItem.KeccakA.ToString(true), "{disableStack : true}"); Assert.AreEqual("{\"jsonrpc\":\"2.0\",\"result\":{\"gas\":\"0x0\",\"failed\":false,\"returnValue\":\"0xa2\",\"structLogs\":[{\"pc\":0,\"op\":\"STOP\",\"gas\":22000,\"gasCost\":1,\"depth\":1,\"error\":null,\"stack\":[],\"memory\":[\"0000000000000000000000000000000000000000000000000000000000000005\",\"0000000000000000000000000000000000000000000000000000000000000006\"],\"storage\":{\"0000000000000000000000000000000000000000000000000000000000000001\":\"0000000000000000000000000000000000000000000000000000000000000002\",\"0000000000000000000000000000000000000000000000000000000000000003\":\"0000000000000000000000000000000000000000000000000000000000000004\"}}]},\"id\":67}", response); }
public static async Task Main(string[] args) { var container = new UnityContainer(); DebugModule.ConfigureContainer(container); var server = new Server { Ports = { new ServerPort("localhost", SharedConfiguration.NativegRPCDebugServicePort, ServerCredentials.Insecure) } }; server.Services.AddServiceModelTransient( container.Resolve <Func <DebugService> >(), options => { // register server error handler options.ErrorHandler = container.Resolve <IServerErrorHandler>(); }); try { server.Start(); Console.WriteLine("gRPC host is listening http:/localhost:{0}", server.Ports.First().Port); Console.WriteLine("Press enter to exit..."); Console.ReadLine(); } finally { await server.ShutdownAsync(); } Console.WriteLine("Press enter for exit..."); Console.ReadLine(); }
/// <summary> process any dangling line records that belong to the given module</summary> /// <param name="lineRecords"> /// </param> /// <param name="moduleId"> /// </param> /// <param name="handler"> /// </param> /// <returns> /// </returns> private System.Collections.ArrayList purgeLineRecords(System.Collections.ArrayList lineRecords, int moduleId, DebugHandler handler) { System.Collections.ArrayList newLineRecords = new System.Collections.ArrayList(); DebugModule module = (DebugModule)modules.get_Renamed(moduleId); int i = 0, size = lineRecords.Count; while (i < size) { System.Int32 id = (System.Int32)lineRecords[i]; LineRecord lr = (LineRecord)lineRecords[i + 1]; System.Int32 offset = (System.Int32)lineRecords[i + 2]; if (id == moduleId) { lr.module = module; if (lr.module != null) { lr.module.addOffset(lr, offset); handler.offset(offset, lr); } else { handler.error("Could not find kDebugScript with module ID = " + id); } } else { newLineRecords.Add(id); newLineRecords.Add(lr); newLineRecords.Add(offset); } i += 3; } return(newLineRecords); }
private DebugModule findDebugModule(ActionList c) { MFUCache modules = new MFUCache(); for (int i = 0; i < c.size(); i++) { Action a = c.getAction(i); DebugModule temp = null; switch (a.code) { case ActionConstants.sactionDefineFunction: case ActionConstants.sactionDefineFunction2: temp = findDebugModule(((DefineFunction)a).actionList); break; case ActionList.sactionLineRecord: if (((LineRecord)a).module != null) { temp = ((LineRecord)a).module; } break; } if (temp != null) { modules.add(temp); } } // ActionList may have actions pointing to more than one debug module because of #include, etc. // The majority wins. return(modules.topModule); }
public virtual void printLines(LineRecord lr, StreamWriter out_Renamed) { DebugModule script = lr.module; if (script != null) { int lineno = lr.lineno; if (lineno > 0) { while (lineno - 1 > 0 && script.offsets[lineno - 1] == 0) { lineno--; } if (lineno == 1) { indent(); out_Renamed.WriteLine(script.name); } int off = script.index[lineno - 1]; int len = script.index[lr.lineno] - off; out_Renamed.Write(script.text.ToCharArray(), off, len); } } }
public void CopyFrom(DebugPacket _packet) { module_count = _packet.module_count; for (int i = 0; i < module_count; i++) { DebugModule cur_module = null; int cur_module_serial = _packet.modules[i].serial; foreach (DebugModule module in modules) { if (module.serial == cur_module_serial) { cur_module = module; break; } } if (cur_module == null) { cur_module = new DebugModule { serial = cur_module_serial }; modules.Add(cur_module); } cur_module.sensors_active = _packet.modules[i].sensors_active; for (int s = 0; s < 6; s++) { DebugSensor cur_sensor = null; int cur_sensor_id = _packet.modules[i].sensors[s].id; foreach (var sensor in cur_module.sensors) { if (sensor.id == cur_sensor_id) { cur_sensor = sensor; break; } } if (cur_sensor == null) { cur_sensor = new DebugSensor { id = cur_sensor_id }; cur_module.sensors.Add(cur_sensor); } cur_sensor.active = _packet.modules[i].sensors[s].active; if (cur_sensor.active) { cur_sensor.acc_x = _packet.modules[i].sensors[s].acc_x; cur_sensor.acc_y = _packet.modules[i].sensors[s].acc_y; cur_sensor.acc_z = _packet.modules[i].sensors[s].acc_z; cur_sensor.gyro_x = _packet.modules[i].sensors[s].gyro_x; cur_sensor.gyro_y = _packet.modules[i].sensors[s].gyro_y; cur_sensor.gyro_z = _packet.modules[i].sensors[s].gyro_z; cur_sensor.mag_x = _packet.modules[i].sensors[s].mag_x; cur_sensor.mag_y = _packet.modules[i].sensors[s].mag_y; cur_sensor.mag_z = _packet.modules[i].sensors[s].mag_z; cur_sensor.mag_terra_x = _packet.modules[i].sensors[s].mag_terra_x; cur_sensor.mag_terra_y = _packet.modules[i].sensors[s].mag_terra_y; cur_sensor.mag_terra_z = _packet.modules[i].sensors[s].mag_terra_z; cur_sensor.mag_coil_x = _packet.modules[i].sensors[s].mag_coil_x; cur_sensor.mag_coil_y = _packet.modules[i].sensors[s].mag_coil_y; cur_sensor.mag_coil_z = _packet.modules[i].sensors[s].mag_coil_z; } } } initialized = true; }
public void ParseUpdate(BinaryReader br) { module_count = br.ReadByte(); for (int i = 0; i < module_count; i++) { DebugModule cur_module = null; int cur_module_serial = br.ReadUInt16(); foreach (DebugModule module in modules) { if (module.serial == cur_module_serial) { cur_module = module; break; } } if (cur_module == null) { cur_module = new DebugModule { serial = cur_module_serial }; modules.Add(cur_module); } cur_module.sensors_active = br.ReadByte(); foreach (var sensor in cur_module.sensors) { sensor.active = false; } for (int s = 0; s < 6; s++) { DebugSensor cur_sensor = null; int cur_sensor_id = cur_module.serial * 16 + s; foreach (var sensor in cur_module.sensors) { if (sensor.id == cur_sensor_id) { cur_sensor = sensor; break; } } if (cur_sensor == null) { cur_sensor = new DebugSensor { id = cur_sensor_id }; cur_module.sensors.Add(cur_sensor); } cur_sensor.active = (cur_module.sensors_active & (1 << s)) > 0; if (cur_sensor.active) { cur_sensor.acc_x = br.ReadSingle(); cur_sensor.acc_y = br.ReadSingle(); cur_sensor.acc_z = br.ReadSingle(); cur_sensor.gyro_x = br.ReadSingle(); cur_sensor.gyro_y = br.ReadSingle(); cur_sensor.gyro_z = br.ReadSingle(); cur_sensor.mag_x = br.ReadSingle(); cur_sensor.mag_y = br.ReadSingle(); cur_sensor.mag_z = br.ReadSingle(); cur_sensor.mag_terra_x = br.ReadSingle(); cur_sensor.mag_terra_y = br.ReadSingle(); cur_sensor.mag_terra_z = br.ReadSingle(); cur_sensor.mag_coil_x = br.ReadSingle(); cur_sensor.mag_coil_y = br.ReadSingle(); cur_sensor.mag_coil_z = br.ReadSingle(); } } } initialized = true; }
private void RegisterJsonRpcModules() { if (!_initConfig.JsonRpcEnabled) { return; } if (_logger.IsDebug) { _logger.Debug($"Resolving CLI ({nameof(Cli.CliModuleLoader)})"); } IReadOnlyDbProvider rpcDbProvider = new ReadOnlyDbProvider(_dbProvider, false); AlternativeChain rpcChain = new AlternativeChain(_blockTree, _blockValidator, _rewardCalculator, _specProvider, rpcDbProvider, _recoveryStep, _logManager, _transactionPool, _receiptStorage); ITracer tracer = new Tracer(rpcChain.Processor, _receiptStorage, _blockTree, _dbProvider.TraceDb); IFilterStore filterStore = new FilterStore(); IFilterManager filterManager = new FilterManager(filterStore, _blockProcessor, _transactionPool, _logManager); RpcState rpcState = new RpcState(_blockTree, _specProvider, rpcDbProvider, _logManager); //creating blockchain bridge var blockchainBridge = new BlockchainBridge( rpcState.StateReader, rpcState.StateProvider, rpcState.StorageProvider, rpcState.BlockTree, _transactionPool, _transactionPoolInfoProvider, _receiptStorage, filterStore, filterManager, _wallet, rpcState.TransactionProcessor); TransactionPool debugTransactionPool = new TransactionPool(new PersistentTransactionStorage(_dbProvider.PendingTxsDb, _specProvider), new PendingTransactionThresholdValidator(_initConfig.ObsoletePendingTransactionInterval, _initConfig.RemovePendingTransactionInterval), _timestamp, _ethereumEcdsa, _specProvider, _logManager, _initConfig.RemovePendingTransactionInterval, _initConfig.PeerNotificationThreshold); var debugReceiptStorage = new PersistentReceiptStorage(_dbProvider.ReceiptsDb, _specProvider); AlternativeChain debugChain = new AlternativeChain(_blockTree, _blockValidator, _rewardCalculator, _specProvider, rpcDbProvider, _recoveryStep, _logManager, debugTransactionPool, debugReceiptStorage); IReadOnlyDbProvider debugDbProvider = new ReadOnlyDbProvider(_dbProvider, false); var debugBridge = new DebugBridge(_configProvider, debugDbProvider, tracer, debugChain.Processor); EthModule module = new EthModule(_jsonSerializer, _configProvider, _logManager, blockchainBridge); _rpcModuleProvider.Register <IEthModule>(module); DebugModule debugModule = new DebugModule(_configProvider, _logManager, debugBridge, _jsonSerializer); _rpcModuleProvider.Register <IDebugModule>(debugModule); if (_sealer is CliqueSealer) { CliqueModule cliqueModule = new CliqueModule(_configProvider, _logManager, _jsonSerializer, new CliqueBridge(_blockProducer as ICliqueBlockProducer, _snapshotManager, _blockTree)); _rpcModuleProvider.Register <ICliqueModule>(cliqueModule); } if (_initConfig.EnableUnsecuredDevWallet) { PersonalBridge personalBridge = new PersonalBridge(_wallet); PersonalModule personalModule = new PersonalModule(personalBridge, _configProvider, _logManager, _jsonSerializer); _rpcModuleProvider.Register <IPersonalModule>(personalModule); } AdminModule adminModule = new AdminModule(_configProvider, _logManager, _jsonSerializer); _rpcModuleProvider.Register <IAdminModule>(adminModule); TxPoolModule txPoolModule = new TxPoolModule(_configProvider, _logManager, _jsonSerializer, blockchainBridge); _rpcModuleProvider.Register <ITxPoolModule>(txPoolModule); if (_initConfig.NetworkEnabled && _initConfig.SynchronizationEnabled) { NetModule netModule = new NetModule(_configProvider, _logManager, _jsonSerializer, new NetBridge(_enode, _syncManager, _peerManager)); _rpcModuleProvider.Register <INetModule>(netModule); } TraceModule traceModule = new TraceModule(_configProvider, _logManager, _jsonSerializer, tracer); _rpcModuleProvider.Register <ITraceModule>(traceModule); }
private void RegisterJsonRpcModules() { if (!_initConfig.JsonRpcEnabled) { return; } if (_logger.IsDebug) { _logger.Debug($"Resolving CLI ({nameof(Cli.CliModuleLoader)})"); } IReadOnlyDbProvider rpcDbProvider = new ReadOnlyDbProvider(_dbProvider, false); AlternativeChain rpcChain = new AlternativeChain(_blockTree, _blockValidator, _rewardCalculator, _specProvider, rpcDbProvider, _recoveryStep, _logManager, _txPool, _receiptStorage); ITracer tracer = new Tracer(rpcChain.Processor, _receiptStorage, new ReadOnlyBlockTree(_blockTree), _dbProvider.TraceDb); IFilterStore filterStore = new FilterStore(); IFilterManager filterManager = new FilterManager(filterStore, _blockProcessor, _txPool, _logManager); RpcState rpcState = new RpcState(_blockTree, _specProvider, rpcDbProvider, _logManager); //creating blockchain bridge var blockchainBridge = new BlockchainBridge( rpcState.StateReader, rpcState.StateProvider, rpcState.StorageProvider, rpcState.BlockTree, _txPool, _transactionPoolInfoProvider, _receiptStorage, filterStore, filterManager, _wallet, rpcState.TransactionProcessor, _ethereumEcdsa); AlternativeChain debugChain = new AlternativeChain(_blockTree, _blockValidator, _rewardCalculator, _specProvider, rpcDbProvider, _recoveryStep, _logManager, NullTxPool.Instance, NullReceiptStorage.Instance); IReadOnlyDbProvider debugDbProvider = new ReadOnlyDbProvider(_dbProvider, false); var debugBridge = new DebugBridge(_configProvider, debugDbProvider, tracer, debugChain.Processor); EthModule module = new EthModule(_logManager, blockchainBridge); _rpcModuleProvider.Register <IEthModule>(module); DebugModule debugModule = new DebugModule(_logManager, debugBridge); _rpcModuleProvider.Register <IDebugModule>(debugModule); if (_sealValidator is CliqueSealValidator) { CliqueModule cliqueModule = new CliqueModule(_logManager, new CliqueBridge(_blockProducer as ICliqueBlockProducer, _snapshotManager, _blockTree)); _rpcModuleProvider.Register <ICliqueModule>(cliqueModule); } if (_initConfig.EnableUnsecuredDevWallet) { PersonalBridge personalBridge = new PersonalBridge(_ethereumEcdsa, _wallet); PersonalModule personalModule = new PersonalModule(personalBridge, _logManager); _rpcModuleProvider.Register <IPersonalModule>(personalModule); } AdminModule adminModule = new AdminModule(_logManager, _peerManager, _staticNodesManager); _rpcModuleProvider.Register <IAdminModule>(adminModule); TxPoolModule txPoolModule = new TxPoolModule(_logManager, blockchainBridge); _rpcModuleProvider.Register <ITxPoolModule>(txPoolModule); NetModule netModule = new NetModule(_logManager, new NetBridge(_enode, _syncServer, _peerManager)); _rpcModuleProvider.Register <INetModule>(netModule); TraceModule traceModule = new TraceModule(blockchainBridge, _logManager, tracer); _rpcModuleProvider.Register <ITraceModule>(traceModule); }
public override void module(DebugModule dm) { Console.Out.WriteLine("DebugScript #" + dm.id + " " + dm.bitmap + " " + dm.name + " (nlines = " + (dm.offsets.Length - 1) + ")"); }