From 53f3e3b08cfa7074d4abed44bba2b921c64d5d18 Mon Sep 17 00:00:00 2001 From: bettybao1209 Date: Fri, 27 Mar 2020 11:53:48 +0800 Subject: [PATCH 01/26] add relayresult --- src/RpcServer/RpcServer.Node.cs | 8 ++++---- tests/Neo.Network.RPC.Tests/RpcTestCases.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/RpcServer/RpcServer.Node.cs b/src/RpcServer/RpcServer.Node.cs index cdec3f405..458130cf7 100644 --- a/src/RpcServer/RpcServer.Node.cs +++ b/src/RpcServer/RpcServer.Node.cs @@ -41,9 +41,9 @@ private JObject GetPeers(JArray _params) return json; } - private static JObject GetRelayResult(RelayResultReason reason, UInt256 hash) + private static JObject GetRelayResult(VerifyResult reason, UInt256 hash) { - if (reason == RelayResultReason.Succeed) + if (reason == VerifyResult.Succeed) { var ret = new JObject(); ret["hash"] = hash.ToString(); @@ -70,7 +70,7 @@ private JObject GetVersion(JArray _params) private JObject SendRawTransaction(JArray _params) { Transaction tx = _params[0].AsString().HexToBytes().AsSerializable(); - RelayResultReason reason = System.Blockchain.Ask(tx).Result; + VerifyResult reason = System.Blockchain.Ask(tx).Result; return GetRelayResult(reason, tx.Hash); } @@ -78,7 +78,7 @@ private JObject SendRawTransaction(JArray _params) private JObject SubmitBlock(JArray _params) { Block block = _params[0].AsString().HexToBytes().AsSerializable(); - RelayResultReason reason = System.Blockchain.Ask(block).Result; + VerifyResult reason = System.Blockchain.Ask(block).Result; return GetRelayResult(reason, block.Hash); } } diff --git a/tests/Neo.Network.RPC.Tests/RpcTestCases.json b/tests/Neo.Network.RPC.Tests/RpcTestCases.json index 95c7b1409..706fd0227 100644 --- a/tests/Neo.Network.RPC.Tests/RpcTestCases.json +++ b/tests/Neo.Network.RPC.Tests/RpcTestCases.json @@ -13,7 +13,7 @@ "error": { "code": -500, "message": "InsufficientFunds", - "data": " at Neo.Plugins.RpcServer.GetRelayResult(RelayResultReason reason, UInt256 hash)\r\n at Neo.Network.RPC.Models.RpcServer.SendRawTransaction(JArray _params)\r\n at Neo.Network.RPC.Models.RpcServer.ProcessRequest(HttpContext context, JObject request)" + "data": " at Neo.Plugins.RpcServer.GetRelayResult(VerifyResult reason, UInt256 hash)\r\n at Neo.Network.RPC.Models.RpcServer.SendRawTransaction(JArray _params)\r\n at Neo.Network.RPC.Models.RpcServer.ProcessRequest(HttpContext context, JObject request)" } } }, From 053f21af14652a6ea440230b2e0e295d08ffa936 Mon Sep 17 00:00:00 2001 From: bettybao1209 Date: Fri, 27 Mar 2020 22:28:46 +0800 Subject: [PATCH 02/26] subscribe event stream --- src/RpcServer/RpcServer.Node.cs | 46 ++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/src/RpcServer/RpcServer.Node.cs b/src/RpcServer/RpcServer.Node.cs index 458130cf7..4f46d2f4b 100644 --- a/src/RpcServer/RpcServer.Node.cs +++ b/src/RpcServer/RpcServer.Node.cs @@ -2,12 +2,16 @@ #pragma warning disable IDE0060 using Akka.Actor; +using Akka.Event; using Neo.IO; using Neo.IO.Json; using Neo.Ledger; using Neo.Network.P2P; using Neo.Network.P2P.Payloads; +using System; using System.Linq; +using System.Threading.Tasks; +using static Neo.Ledger.Blockchain; namespace Neo.Plugins { @@ -70,16 +74,50 @@ private JObject GetVersion(JArray _params) private JObject SendRawTransaction(JArray _params) { Transaction tx = _params[0].AsString().HexToBytes().AsSerializable(); - VerifyResult reason = System.Blockchain.Ask(tx).Result; - return GetRelayResult(reason, tx.Hash); + return Send(tx); } [RpcMethod] private JObject SubmitBlock(JArray _params) { Block block = _params[0].AsString().HexToBytes().AsSerializable(); - VerifyResult reason = System.Blockchain.Ask(block).Result; - return GetRelayResult(reason, block.Hash); + return Send(block); + } + + private JObject Send(IInventory inventory) + { + var a = System.ActorSystem.ActorOf(RpcActor.Props()); + System.ActorSystem.EventStream.Subscribe(a, typeof(RelayResult)); + System.Blockchain.Tell(inventory); + + int timeOut = 1000; + DateTime current = DateTime.Now; + while (a.Ask(0).Result == null && DateTime.Now.Subtract(current).Milliseconds < timeOut) { Task.Delay(50); } + var result = a.Ask(0).Result; + return GetRelayResult(result.Result, inventory.Hash); + } + + private class RpcActor : UntypedActor + { + public static Props Props() + { + return Akka.Actor.Props.Create(() => new RpcActor()); + } + + private RelayResult result; + + protected override void OnReceive(object message) + { + switch (message) + { + case RelayResult reason: + result = reason; + break; + case 0: + Sender.Tell(result); + break; + } + } } } } From 2653c3b613ed6bed26300d3bed1f7f572be22de2 Mon Sep 17 00:00:00 2001 From: bettybao1209 Date: Mon, 30 Mar 2020 10:59:44 +0800 Subject: [PATCH 03/26] define as static var --- src/RpcServer/RpcServer.Node.cs | 29 ++--------------------------- src/RpcServer/RpcServer.cs | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 27 deletions(-) diff --git a/src/RpcServer/RpcServer.Node.cs b/src/RpcServer/RpcServer.Node.cs index 4f46d2f4b..f4222981a 100644 --- a/src/RpcServer/RpcServer.Node.cs +++ b/src/RpcServer/RpcServer.Node.cs @@ -86,38 +86,13 @@ private JObject SubmitBlock(JArray _params) private JObject Send(IInventory inventory) { - var a = System.ActorSystem.ActorOf(RpcActor.Props()); - System.ActorSystem.EventStream.Subscribe(a, typeof(RelayResult)); System.Blockchain.Tell(inventory); int timeOut = 1000; DateTime current = DateTime.Now; - while (a.Ask(0).Result == null && DateTime.Now.Subtract(current).Milliseconds < timeOut) { Task.Delay(50); } - var result = a.Ask(0).Result; + while (rpcActor.Ask(0).Result == null && DateTime.Now.Subtract(current).Milliseconds < timeOut) { Task.Delay(50); } + var result = rpcActor.Ask(0).Result; return GetRelayResult(result.Result, inventory.Hash); } - - private class RpcActor : UntypedActor - { - public static Props Props() - { - return Akka.Actor.Props.Create(() => new RpcActor()); - } - - private RelayResult result; - - protected override void OnReceive(object message) - { - switch (message) - { - case RelayResult reason: - result = reason; - break; - case 0: - Sender.Tell(result); - break; - } - } - } } } diff --git a/src/RpcServer/RpcServer.cs b/src/RpcServer/RpcServer.cs index ee027543e..2a679531e 100644 --- a/src/RpcServer/RpcServer.cs +++ b/src/RpcServer/RpcServer.cs @@ -1,3 +1,4 @@ +using Akka.Actor; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; @@ -16,6 +17,7 @@ using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading.Tasks; +using static Neo.Ledger.Blockchain; namespace Neo.Plugins { @@ -23,10 +25,35 @@ public sealed partial class RpcServer : Plugin { private static readonly Dictionary> methods = new Dictionary>(); private IWebHost host; + private static readonly IActorRef rpcActor = System.ActorSystem.ActorOf(RpcActor.Props()); public RpcServer() { RegisterMethods(this); + System.ActorSystem.EventStream.Subscribe(rpcActor, typeof(RelayResult)); + } + + private class RpcActor : UntypedActor + { + public static Props Props() + { + return Akka.Actor.Props.Create(() => new RpcActor()); + } + + private RelayResult result; + + protected override void OnReceive(object message) + { + switch (message) + { + case RelayResult reason: + result = reason; + break; + case 0: + Sender.Tell(result); + break; + } + } } private bool CheckAuth(HttpContext context) @@ -246,5 +273,7 @@ public static void RegisterMethods(object handler) methods[name] = (Func)method.CreateDelegate(typeof(Func), handler); } } + + } } From 871688c6162fbf4784a61165a3dca89d799ae025 Mon Sep 17 00:00:00 2001 From: bettybao1209 Date: Mon, 30 Mar 2020 15:29:00 +0800 Subject: [PATCH 04/26] extract class --- src/RpcServer/RpcActor.cs | 28 ++++++++++++++++++++++++++++ src/RpcServer/RpcServer.Node.cs | 1 - src/RpcServer/RpcServer.cs | 23 ----------------------- 3 files changed, 28 insertions(+), 24 deletions(-) create mode 100644 src/RpcServer/RpcActor.cs diff --git a/src/RpcServer/RpcActor.cs b/src/RpcServer/RpcActor.cs new file mode 100644 index 000000000..d7edaa50f --- /dev/null +++ b/src/RpcServer/RpcActor.cs @@ -0,0 +1,28 @@ +using Akka.Actor; +using static Neo.Ledger.Blockchain; + +namespace Neo.Plugins +{ + public class RpcActor : UntypedActor + { + public static Props Props() + { + return Akka.Actor.Props.Create(() => new RpcActor()); + } + + private RelayResult result; + + protected override void OnReceive(object message) + { + switch (message) + { + case RelayResult reason: + result = reason; + break; + case 0: + Sender.Tell(result); + break; + } + } + } +} diff --git a/src/RpcServer/RpcServer.Node.cs b/src/RpcServer/RpcServer.Node.cs index f4222981a..94ee1199b 100644 --- a/src/RpcServer/RpcServer.Node.cs +++ b/src/RpcServer/RpcServer.Node.cs @@ -2,7 +2,6 @@ #pragma warning disable IDE0060 using Akka.Actor; -using Akka.Event; using Neo.IO; using Neo.IO.Json; using Neo.Ledger; diff --git a/src/RpcServer/RpcServer.cs b/src/RpcServer/RpcServer.cs index 2a679531e..3fd1549cc 100644 --- a/src/RpcServer/RpcServer.cs +++ b/src/RpcServer/RpcServer.cs @@ -33,29 +33,6 @@ public RpcServer() System.ActorSystem.EventStream.Subscribe(rpcActor, typeof(RelayResult)); } - private class RpcActor : UntypedActor - { - public static Props Props() - { - return Akka.Actor.Props.Create(() => new RpcActor()); - } - - private RelayResult result; - - protected override void OnReceive(object message) - { - switch (message) - { - case RelayResult reason: - result = reason; - break; - case 0: - Sender.Tell(result); - break; - } - } - } - private bool CheckAuth(HttpContext context) { if (string.IsNullOrEmpty(Settings.Default.RpcUser)) return true; From 86bc55ad3e5672981103858ca1c327b185e808a9 Mon Sep 17 00:00:00 2001 From: erikzhang Date: Mon, 30 Mar 2020 15:59:40 +0800 Subject: [PATCH 05/26] Update dependency --- src/RpcServer/RpcServer.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/RpcServer/RpcServer.csproj b/src/RpcServer/RpcServer.csproj index de60f6a7d..1eb46869d 100644 --- a/src/RpcServer/RpcServer.csproj +++ b/src/RpcServer/RpcServer.csproj @@ -15,7 +15,7 @@ - + From 4897fdd6da736e5c625968f06a2867913b50eb82 Mon Sep 17 00:00:00 2001 From: erikzhang Date: Mon, 30 Mar 2020 16:04:08 +0800 Subject: [PATCH 06/26] Reorganize files. --- src/RpcServer/RpcActor.cs | 13 +++++++++---- src/RpcServer/RpcServer.Node.cs | 2 ++ src/RpcServer/RpcServer.cs | 6 ------ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/RpcServer/RpcActor.cs b/src/RpcServer/RpcActor.cs index d7edaa50f..c64a2bc2f 100644 --- a/src/RpcServer/RpcActor.cs +++ b/src/RpcServer/RpcActor.cs @@ -5,13 +5,13 @@ namespace Neo.Plugins { public class RpcActor : UntypedActor { - public static Props Props() + private RelayResult result; + + public RpcActor() { - return Akka.Actor.Props.Create(() => new RpcActor()); + Context.System.EventStream.Subscribe(Self, typeof(RelayResult)); } - private RelayResult result; - protected override void OnReceive(object message) { switch (message) @@ -24,5 +24,10 @@ protected override void OnReceive(object message) break; } } + + public static Props Props() + { + return Akka.Actor.Props.Create(() => new RpcActor()); + } } } diff --git a/src/RpcServer/RpcServer.Node.cs b/src/RpcServer/RpcServer.Node.cs index 94ee1199b..388b5ff06 100644 --- a/src/RpcServer/RpcServer.Node.cs +++ b/src/RpcServer/RpcServer.Node.cs @@ -16,6 +16,8 @@ namespace Neo.Plugins { partial class RpcServer { + private static readonly IActorRef rpcActor = System.ActorSystem.ActorOf(RpcActor.Props()); + [RpcMethod] private JObject GetConnectionCount(JArray _params) { diff --git a/src/RpcServer/RpcServer.cs b/src/RpcServer/RpcServer.cs index 3fd1549cc..ee027543e 100644 --- a/src/RpcServer/RpcServer.cs +++ b/src/RpcServer/RpcServer.cs @@ -1,4 +1,3 @@ -using Akka.Actor; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; @@ -17,7 +16,6 @@ using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading.Tasks; -using static Neo.Ledger.Blockchain; namespace Neo.Plugins { @@ -25,12 +23,10 @@ public sealed partial class RpcServer : Plugin { private static readonly Dictionary> methods = new Dictionary>(); private IWebHost host; - private static readonly IActorRef rpcActor = System.ActorSystem.ActorOf(RpcActor.Props()); public RpcServer() { RegisterMethods(this); - System.ActorSystem.EventStream.Subscribe(rpcActor, typeof(RelayResult)); } private bool CheckAuth(HttpContext context) @@ -250,7 +246,5 @@ public static void RegisterMethods(object handler) methods[name] = (Func)method.CreateDelegate(typeof(Func), handler); } } - - } } From ce0c17e40c3515af16e79d1684fc8740558c9f8b Mon Sep 17 00:00:00 2001 From: erikzhang Date: Mon, 30 Mar 2020 16:07:53 +0800 Subject: [PATCH 07/26] Rename --- src/RpcServer/{RpcActor.cs => RelayActor.cs} | 6 +++--- src/RpcServer/RpcServer.Node.cs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) rename src/RpcServer/{RpcActor.cs => RelayActor.cs} (81%) diff --git a/src/RpcServer/RpcActor.cs b/src/RpcServer/RelayActor.cs similarity index 81% rename from src/RpcServer/RpcActor.cs rename to src/RpcServer/RelayActor.cs index c64a2bc2f..d4f0bd895 100644 --- a/src/RpcServer/RpcActor.cs +++ b/src/RpcServer/RelayActor.cs @@ -3,11 +3,11 @@ namespace Neo.Plugins { - public class RpcActor : UntypedActor + public class RelayActor : UntypedActor { private RelayResult result; - public RpcActor() + public RelayActor() { Context.System.EventStream.Subscribe(Self, typeof(RelayResult)); } @@ -27,7 +27,7 @@ protected override void OnReceive(object message) public static Props Props() { - return Akka.Actor.Props.Create(() => new RpcActor()); + return Akka.Actor.Props.Create(() => new RelayActor()); } } } diff --git a/src/RpcServer/RpcServer.Node.cs b/src/RpcServer/RpcServer.Node.cs index 388b5ff06..ea3fb962d 100644 --- a/src/RpcServer/RpcServer.Node.cs +++ b/src/RpcServer/RpcServer.Node.cs @@ -16,7 +16,7 @@ namespace Neo.Plugins { partial class RpcServer { - private static readonly IActorRef rpcActor = System.ActorSystem.ActorOf(RpcActor.Props()); + private static readonly IActorRef relayActor = System.ActorSystem.ActorOf(RelayActor.Props()); [RpcMethod] private JObject GetConnectionCount(JArray _params) @@ -91,8 +91,8 @@ private JObject Send(IInventory inventory) int timeOut = 1000; DateTime current = DateTime.Now; - while (rpcActor.Ask(0).Result == null && DateTime.Now.Subtract(current).Milliseconds < timeOut) { Task.Delay(50); } - var result = rpcActor.Ask(0).Result; + while (relayActor.Ask(0).Result == null && DateTime.Now.Subtract(current).Milliseconds < timeOut) { Task.Delay(50); } + var result = relayActor.Ask(0).Result; return GetRelayResult(result.Result, inventory.Hash); } } From 06b526c160cc0ee111eaf7a5bf1836f720beb618 Mon Sep 17 00:00:00 2001 From: erikzhang Date: Mon, 30 Mar 2020 16:23:34 +0800 Subject: [PATCH 08/26] Fix --- src/RpcServer/RelayActor.cs | 23 +++++++++++++++-------- src/RpcServer/RpcServer.Node.cs | 27 +++++++++------------------ 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/src/RpcServer/RelayActor.cs b/src/RpcServer/RelayActor.cs index d4f0bd895..e5419f94b 100644 --- a/src/RpcServer/RelayActor.cs +++ b/src/RpcServer/RelayActor.cs @@ -1,14 +1,18 @@ using Akka.Actor; +using Neo.Network.P2P.Payloads; using static Neo.Ledger.Blockchain; namespace Neo.Plugins { public class RelayActor : UntypedActor { - private RelayResult result; + private readonly IActorRef blockchain; + private IInventory inventory; + private IActorRef sender; - public RelayActor() + public RelayActor(IActorRef blockchain) { + this.blockchain = blockchain; Context.System.EventStream.Subscribe(Self, typeof(RelayResult)); } @@ -16,18 +20,21 @@ protected override void OnReceive(object message) { switch (message) { - case RelayResult reason: - result = reason; + case IInventory inventory: + this.inventory = inventory; + this.sender = Sender; + blockchain.Tell(inventory); break; - case 0: - Sender.Tell(result); + case RelayResult reason: + if (reason.Inventory.Hash.Equals(inventory.Hash)) + sender.Tell(reason); break; } } - public static Props Props() + public static Props Props(IActorRef blockchain) { - return Akka.Actor.Props.Create(() => new RelayActor()); + return Akka.Actor.Props.Create(() => new RelayActor(blockchain)); } } } diff --git a/src/RpcServer/RpcServer.Node.cs b/src/RpcServer/RpcServer.Node.cs index ea3fb962d..b0c1a2a71 100644 --- a/src/RpcServer/RpcServer.Node.cs +++ b/src/RpcServer/RpcServer.Node.cs @@ -16,7 +16,7 @@ namespace Neo.Plugins { partial class RpcServer { - private static readonly IActorRef relayActor = System.ActorSystem.ActorOf(RelayActor.Props()); + private static readonly IActorRef relayActor = System.ActorSystem.ActorOf(RelayActor.Props(System.Blockchain)); [RpcMethod] private JObject GetConnectionCount(JArray _params) @@ -46,17 +46,19 @@ private JObject GetPeers(JArray _params) return json; } - private static JObject GetRelayResult(VerifyResult reason, UInt256 hash) + private JObject GetRelayResult(IInventory inventory) { - if (reason == VerifyResult.Succeed) + const int timeOut = 1000; + var result = relayActor.Ask(inventory, TimeSpan.FromMilliseconds(timeOut)).Result; + if (result.Result == VerifyResult.Succeed) { var ret = new JObject(); - ret["hash"] = hash.ToString(); + ret["hash"] = inventory.Hash.ToString(); return ret; } else { - throw new RpcException(-500, reason.ToString()); + throw new RpcException(-500, result.Result.ToString()); } } @@ -75,25 +77,14 @@ private JObject GetVersion(JArray _params) private JObject SendRawTransaction(JArray _params) { Transaction tx = _params[0].AsString().HexToBytes().AsSerializable(); - return Send(tx); + return GetRelayResult(tx); } [RpcMethod] private JObject SubmitBlock(JArray _params) { Block block = _params[0].AsString().HexToBytes().AsSerializable(); - return Send(block); - } - - private JObject Send(IInventory inventory) - { - System.Blockchain.Tell(inventory); - - int timeOut = 1000; - DateTime current = DateTime.Now; - while (relayActor.Ask(0).Result == null && DateTime.Now.Subtract(current).Milliseconds < timeOut) { Task.Delay(50); } - var result = relayActor.Ask(0).Result; - return GetRelayResult(result.Result, inventory.Hash); + return GetRelayResult(block); } } } From d77f76e9fc9d93a1abfdfa50725d46258e561805 Mon Sep 17 00:00:00 2001 From: erikzhang Date: Mon, 30 Mar 2020 16:24:47 +0800 Subject: [PATCH 09/26] Update RpcServer.Node.cs --- src/RpcServer/RpcServer.Node.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/RpcServer/RpcServer.Node.cs b/src/RpcServer/RpcServer.Node.cs index b0c1a2a71..f2ea4079d 100644 --- a/src/RpcServer/RpcServer.Node.cs +++ b/src/RpcServer/RpcServer.Node.cs @@ -9,7 +9,6 @@ using Neo.Network.P2P.Payloads; using System; using System.Linq; -using System.Threading.Tasks; using static Neo.Ledger.Blockchain; namespace Neo.Plugins From 1bb7479d150b468d0bc2e3d7235fe8924e2c105f Mon Sep 17 00:00:00 2001 From: erikzhang Date: Mon, 30 Mar 2020 16:25:40 +0800 Subject: [PATCH 10/26] static --- src/RpcServer/RpcServer.Node.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/RpcServer/RpcServer.Node.cs b/src/RpcServer/RpcServer.Node.cs index f2ea4079d..d6d50397c 100644 --- a/src/RpcServer/RpcServer.Node.cs +++ b/src/RpcServer/RpcServer.Node.cs @@ -45,7 +45,7 @@ private JObject GetPeers(JArray _params) return json; } - private JObject GetRelayResult(IInventory inventory) + private static JObject GetRelayResult(IInventory inventory) { const int timeOut = 1000; var result = relayActor.Ask(inventory, TimeSpan.FromMilliseconds(timeOut)).Result; From 007ff3e811a7ac9ef55274a2e78760cc72149e81 Mon Sep 17 00:00:00 2001 From: bettybao1209 Date: Mon, 30 Mar 2020 18:23:56 +0800 Subject: [PATCH 11/26] add dictionary --- src/RpcServer/RelayActor.cs | 27 +++++++++++++++------------ src/RpcServer/RpcServer.Node.cs | 2 +- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/RpcServer/RelayActor.cs b/src/RpcServer/RelayActor.cs index e5419f94b..65397672b 100644 --- a/src/RpcServer/RelayActor.cs +++ b/src/RpcServer/RelayActor.cs @@ -1,18 +1,18 @@ using Akka.Actor; using Neo.Network.P2P.Payloads; +using System.Collections.Generic; using static Neo.Ledger.Blockchain; namespace Neo.Plugins { public class RelayActor : UntypedActor { - private readonly IActorRef blockchain; - private IInventory inventory; - private IActorRef sender; + private readonly NeoSystem neoSystem; + private readonly Dictionary senders = new Dictionary(); - public RelayActor(IActorRef blockchain) + public RelayActor(NeoSystem neoSystem) { - this.blockchain = blockchain; + this.neoSystem = neoSystem; Context.System.EventStream.Subscribe(Self, typeof(RelayResult)); } @@ -21,20 +21,23 @@ protected override void OnReceive(object message) switch (message) { case IInventory inventory: - this.inventory = inventory; - this.sender = Sender; - blockchain.Tell(inventory); + this.senders.Add(inventory.Hash, Sender); + neoSystem.Blockchain.Tell(inventory); break; case RelayResult reason: - if (reason.Inventory.Hash.Equals(inventory.Hash)) - sender.Tell(reason); + UInt256 hash = reason.Inventory.Hash; + if (senders.ContainsKey(reason.Inventory.Hash)) + { + senders[hash].Tell(reason); + senders.Remove(hash); + } break; } } - public static Props Props(IActorRef blockchain) + public static Props Props(NeoSystem neoSystem) { - return Akka.Actor.Props.Create(() => new RelayActor(blockchain)); + return Akka.Actor.Props.Create(() => new RelayActor(neoSystem)); } } } diff --git a/src/RpcServer/RpcServer.Node.cs b/src/RpcServer/RpcServer.Node.cs index d6d50397c..442666a58 100644 --- a/src/RpcServer/RpcServer.Node.cs +++ b/src/RpcServer/RpcServer.Node.cs @@ -15,7 +15,7 @@ namespace Neo.Plugins { partial class RpcServer { - private static readonly IActorRef relayActor = System.ActorSystem.ActorOf(RelayActor.Props(System.Blockchain)); + private static readonly IActorRef relayActor = System.ActorSystem.ActorOf(RelayActor.Props(System)); [RpcMethod] private JObject GetConnectionCount(JArray _params) From def1ebfab44140568c6b10be74d0e9bd3eaaf2b8 Mon Sep 17 00:00:00 2001 From: Shargon Date: Mon, 30 Mar 2020 20:10:13 +0200 Subject: [PATCH 12/26] Optimize dictionary access --- src/RpcServer/RelayActor.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/RpcServer/RelayActor.cs b/src/RpcServer/RelayActor.cs index 65397672b..ef8231c20 100644 --- a/src/RpcServer/RelayActor.cs +++ b/src/RpcServer/RelayActor.cs @@ -21,17 +21,19 @@ protected override void OnReceive(object message) switch (message) { case IInventory inventory: - this.senders.Add(inventory.Hash, Sender); - neoSystem.Blockchain.Tell(inventory); - break; + { + senders.Add(inventory.Hash, Sender); + neoSystem.Blockchain.Tell(inventory); + break; + } case RelayResult reason: - UInt256 hash = reason.Inventory.Hash; - if (senders.ContainsKey(reason.Inventory.Hash)) { - senders[hash].Tell(reason); - senders.Remove(hash); + if (senders.Remove(reason.Inventory.Hash, out var actor)) + { + actor.Tell(reason); + } + break; } - break; } } From ca3eadcaa41517a7376e5422e0c484b50b3328a9 Mon Sep 17 00:00:00 2001 From: Krain Chen Date: Wed, 1 Apr 2020 19:10:56 +0800 Subject: [PATCH 13/26] add expire milliseconds for dictionary --- src/RpcServer/RelayActor.cs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/RpcServer/RelayActor.cs b/src/RpcServer/RelayActor.cs index ef8231c20..995119667 100644 --- a/src/RpcServer/RelayActor.cs +++ b/src/RpcServer/RelayActor.cs @@ -1,6 +1,7 @@ using Akka.Actor; using Neo.Network.P2P.Payloads; using System.Collections.Generic; +using System.Threading.Tasks; using static Neo.Ledger.Blockchain; namespace Neo.Plugins @@ -9,10 +10,12 @@ public class RelayActor : UntypedActor { private readonly NeoSystem neoSystem; private readonly Dictionary senders = new Dictionary(); + private readonly int expireMs; - public RelayActor(NeoSystem neoSystem) + public RelayActor(NeoSystem neoSystem, int expireMs) { this.neoSystem = neoSystem; + this.expireMs = expireMs; Context.System.EventStream.Subscribe(Self, typeof(RelayResult)); } @@ -22,8 +25,15 @@ protected override void OnReceive(object message) { case IInventory inventory: { - senders.Add(inventory.Hash, Sender); + UInt256 hash = inventory.Hash; + senders.Add(hash, Sender); neoSystem.Blockchain.Tell(inventory); + // the sender will clean the record after expireMs + Task.Run(async () => + { + await Task.Delay(expireMs); + senders.Remove(hash); + }); break; } case RelayResult reason: @@ -37,9 +47,9 @@ protected override void OnReceive(object message) } } - public static Props Props(NeoSystem neoSystem) + public static Props Props(NeoSystem neoSystem, int expire = 10000) { - return Akka.Actor.Props.Create(() => new RelayActor(neoSystem)); + return Akka.Actor.Props.Create(() => new RelayActor(neoSystem, expire)); } } } From 91b2135fed35e9bae6a0673dae41766d35d0c8e3 Mon Sep 17 00:00:00 2001 From: bettybao1209 Date: Tue, 7 Apr 2020 14:08:53 +0800 Subject: [PATCH 14/26] clean code --- src/RpcServer/RpcServer.Blockchain.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/RpcServer/RpcServer.Blockchain.cs b/src/RpcServer/RpcServer.Blockchain.cs index ef52b4a1b..a821de917 100644 --- a/src/RpcServer/RpcServer.Blockchain.cs +++ b/src/RpcServer/RpcServer.Blockchain.cs @@ -6,9 +6,7 @@ using Neo.Ledger; using Neo.Network.P2P.Payloads; using Neo.Persistence; -using Neo.SmartContract; using Neo.SmartContract.Native; -using Neo.VM; using System; using System.Collections.Generic; using System.Linq; From 6ad0bacf5f8a53037022860b05f6615a7a17df5a Mon Sep 17 00:00:00 2001 From: bettybao1209 Date: Tue, 7 Apr 2020 19:18:22 +0800 Subject: [PATCH 15/26] add dictionary with max size --- src/RpcServer/FixedDictionary.cs | 45 ++++++++++++++++++++++++++++++++ src/RpcServer/RelayActor.cs | 25 +++++++----------- 2 files changed, 54 insertions(+), 16 deletions(-) create mode 100644 src/RpcServer/FixedDictionary.cs diff --git a/src/RpcServer/FixedDictionary.cs b/src/RpcServer/FixedDictionary.cs new file mode 100644 index 000000000..aef91b225 --- /dev/null +++ b/src/RpcServer/FixedDictionary.cs @@ -0,0 +1,45 @@ +using System.Collections.Generic; + +namespace Neo.Plugins +{ + public class FixedDictionary + { + private readonly Dictionary dictionary = new Dictionary(); + private readonly List keys = new List(); + private readonly int capacity; + + public FixedDictionary(int capacity) + { + this.capacity = capacity; + } + + public void Add(TKey key, TValue value) + { + if (dictionary.Count == capacity) + { + var oldestKey = keys[0]; + dictionary.Remove(oldestKey); + keys.RemoveAt(0); + } + + dictionary.Add(key, value); + keys.Add(key); + } + + public void Remove(TKey key) + { + dictionary.Remove(key); + keys.Remove(key); + } + + public bool ContainsKey(TKey key) + { + return keys.Contains(key); + } + + public TValue this[TKey key] + { + get { return dictionary[key]; } + } + } +} diff --git a/src/RpcServer/RelayActor.cs b/src/RpcServer/RelayActor.cs index 995119667..cef43d944 100644 --- a/src/RpcServer/RelayActor.cs +++ b/src/RpcServer/RelayActor.cs @@ -1,7 +1,5 @@ using Akka.Actor; using Neo.Network.P2P.Payloads; -using System.Collections.Generic; -using System.Threading.Tasks; using static Neo.Ledger.Blockchain; namespace Neo.Plugins @@ -9,13 +7,12 @@ namespace Neo.Plugins public class RelayActor : UntypedActor { private readonly NeoSystem neoSystem; - private readonly Dictionary senders = new Dictionary(); - private readonly int expireMs; + private readonly FixedDictionary senders; - public RelayActor(NeoSystem neoSystem, int expireMs) + public RelayActor(NeoSystem neoSystem, int capacity) { this.neoSystem = neoSystem; - this.expireMs = expireMs; + senders = new FixedDictionary(capacity); Context.System.EventStream.Subscribe(Self, typeof(RelayResult)); } @@ -28,28 +25,24 @@ protected override void OnReceive(object message) UInt256 hash = inventory.Hash; senders.Add(hash, Sender); neoSystem.Blockchain.Tell(inventory); - // the sender will clean the record after expireMs - Task.Run(async () => - { - await Task.Delay(expireMs); - senders.Remove(hash); - }); break; } case RelayResult reason: { - if (senders.Remove(reason.Inventory.Hash, out var actor)) + UInt256 hash = reason.Inventory.Hash; + if (senders.ContainsKey(hash)) { - actor.Tell(reason); + senders[hash].Tell(reason); + senders.Remove(hash); } break; } } } - public static Props Props(NeoSystem neoSystem, int expire = 10000) + public static Props Props(NeoSystem neoSystem, int capacity = 1000) { - return Akka.Actor.Props.Create(() => new RelayActor(neoSystem, expire)); + return Akka.Actor.Props.Create(() => new RelayActor(neoSystem, capacity)); } } } From 43bcfa11549ee7a61aea4639bbb8fb1a01bca614 Mon Sep 17 00:00:00 2001 From: Shargon Date: Tue, 7 Apr 2020 21:58:28 +0200 Subject: [PATCH 16/26] Optimize --- src/RpcServer/FixedDictionary.cs | 28 +++++++++++++++++----------- src/RpcServer/RelayActor.cs | 5 ++--- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/RpcServer/FixedDictionary.cs b/src/RpcServer/FixedDictionary.cs index aef91b225..f2cd228d4 100644 --- a/src/RpcServer/FixedDictionary.cs +++ b/src/RpcServer/FixedDictionary.cs @@ -15,26 +15,32 @@ public FixedDictionary(int capacity) public void Add(TKey key, TValue value) { - if (dictionary.Count == capacity) + if (dictionary.TryAdd(key, value)) { - var oldestKey = keys[0]; - dictionary.Remove(oldestKey); - keys.RemoveAt(0); - } + keys.Add(key); - dictionary.Add(key, value); - keys.Add(key); + if (dictionary.Count >= capacity) + { + var oldestKey = keys[0]; + dictionary.Remove(oldestKey); + keys.RemoveAt(0); + } + } } - public void Remove(TKey key) + public bool Remove(TKey key, out TValue value) { - dictionary.Remove(key); - keys.Remove(key); + if (dictionary.Remove(key, out value)) + { + keys.Remove(key); + return true; + } + return false; } public bool ContainsKey(TKey key) { - return keys.Contains(key); + return dictionary.ContainsKey(key); } public TValue this[TKey key] diff --git a/src/RpcServer/RelayActor.cs b/src/RpcServer/RelayActor.cs index cef43d944..984466521 100644 --- a/src/RpcServer/RelayActor.cs +++ b/src/RpcServer/RelayActor.cs @@ -30,10 +30,9 @@ protected override void OnReceive(object message) case RelayResult reason: { UInt256 hash = reason.Inventory.Hash; - if (senders.ContainsKey(hash)) + if (senders.Remove(hash, out var entry)) { - senders[hash].Tell(reason); - senders.Remove(hash); + entry.Tell(reason); } break; } From 0cb3d3e71ad525d4e6ca81a08ba39a54ce46a7c5 Mon Sep 17 00:00:00 2001 From: bettybao1209 Date: Wed, 8 Apr 2020 13:55:07 +0800 Subject: [PATCH 17/26] update dependency --- src/RpcServer/RpcServer.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/RpcServer/RpcServer.csproj b/src/RpcServer/RpcServer.csproj index 1eb46869d..365b9250b 100644 --- a/src/RpcServer/RpcServer.csproj +++ b/src/RpcServer/RpcServer.csproj @@ -1,7 +1,7 @@ - 3.0.0-CI00863 + 3.0.0-CI00878 netstandard2.1 Neo.Plugins @@ -15,7 +15,7 @@ - + From beedd79527ce92c313db18de1d58cbbe32cc148d Mon Sep 17 00:00:00 2001 From: bettybao1209 Date: Wed, 8 Apr 2020 21:24:30 +0800 Subject: [PATCH 18/26] optimize FixedDictionary --- src/RpcServer/FixedDictionary.cs | 44 +++++++------------ src/RpcServer/RelayActor.cs | 11 ++--- .../FixedDictionaryTests.cs | 22 ++++++++++ .../Neo.Network.RPC.Tests.csproj | 1 + 4 files changed, 44 insertions(+), 34 deletions(-) create mode 100644 tests/Neo.Network.RPC.Tests/FixedDictionaryTests.cs diff --git a/src/RpcServer/FixedDictionary.cs b/src/RpcServer/FixedDictionary.cs index f2cd228d4..7f5137aaa 100644 --- a/src/RpcServer/FixedDictionary.cs +++ b/src/RpcServer/FixedDictionary.cs @@ -1,11 +1,10 @@ -using System.Collections.Generic; +using Akka.Actor; +using System.Collections.ObjectModel; namespace Neo.Plugins { - public class FixedDictionary + public class FixedDictionary : KeyedCollection { - private readonly Dictionary dictionary = new Dictionary(); - private readonly List keys = new List(); private readonly int capacity; public FixedDictionary(int capacity) @@ -13,39 +12,26 @@ public FixedDictionary(int capacity) this.capacity = capacity; } - public void Add(TKey key, TValue value) + protected override UInt256 GetKeyForItem(ActorItem item) { - if (dictionary.TryAdd(key, value)) - { - keys.Add(key); - - if (dictionary.Count >= capacity) - { - var oldestKey = keys[0]; - dictionary.Remove(oldestKey); - keys.RemoveAt(0); - } - } + return item.Hash; } - public bool Remove(TKey key, out TValue value) + protected override void InsertItem(int index, ActorItem newItem) { - if (dictionary.Remove(key, out value)) + base.InsertItem(index, newItem); + + if (Count > capacity) { - keys.Remove(key); - return true; + RemoveAt(0); } - return false; } + } - public bool ContainsKey(TKey key) - { - return dictionary.ContainsKey(key); - } + public class ActorItem + { + public UInt256 Hash { get; set; } - public TValue this[TKey key] - { - get { return dictionary[key]; } - } + public IActorRef Actor { get; set; } } } diff --git a/src/RpcServer/RelayActor.cs b/src/RpcServer/RelayActor.cs index 984466521..9efdd04bd 100644 --- a/src/RpcServer/RelayActor.cs +++ b/src/RpcServer/RelayActor.cs @@ -7,12 +7,12 @@ namespace Neo.Plugins public class RelayActor : UntypedActor { private readonly NeoSystem neoSystem; - private readonly FixedDictionary senders; + private readonly FixedDictionary senders; public RelayActor(NeoSystem neoSystem, int capacity) { this.neoSystem = neoSystem; - senders = new FixedDictionary(capacity); + senders = new FixedDictionary(capacity); Context.System.EventStream.Subscribe(Self, typeof(RelayResult)); } @@ -23,16 +23,17 @@ protected override void OnReceive(object message) case IInventory inventory: { UInt256 hash = inventory.Hash; - senders.Add(hash, Sender); + senders.Add(new ActorItem { Hash = hash, Actor = Sender }); neoSystem.Blockchain.Tell(inventory); break; } case RelayResult reason: { UInt256 hash = reason.Inventory.Hash; - if (senders.Remove(hash, out var entry)) + if (senders.TryGetValue(hash, out var entry)) { - entry.Tell(reason); + entry.Actor.Tell(reason); + senders.Remove(entry.Hash); } break; } diff --git a/tests/Neo.Network.RPC.Tests/FixedDictionaryTests.cs b/tests/Neo.Network.RPC.Tests/FixedDictionaryTests.cs new file mode 100644 index 000000000..0313bed1d --- /dev/null +++ b/tests/Neo.Network.RPC.Tests/FixedDictionaryTests.cs @@ -0,0 +1,22 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Neo.Plugins; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Neo.Plugins.Tests +{ + [TestClass()] + public class FixedDictionaryTests + { + [TestMethod()] + public void FixedDictionaryTest() + { + FixedDictionary dictionary = new FixedDictionary(2); + dictionary.Add(new ActorItem() { Hash = UInt256.Zero, Actor = null }); + dictionary.Add(new ActorItem() { Hash = UInt256.Parse("0x530de76326a8662d1b730ba4fbdf011051eabd142015587e846da42376adf35f"), Actor = null }); + dictionary.Add(new ActorItem() { Hash = UInt256.Parse("0x530de76326a8662d1b730ba4fbdf011051eabd142015587e846da42376adf350"), Actor = null }); + Assert.AreEqual(2, dictionary.Count); + } + } +} diff --git a/tests/Neo.Network.RPC.Tests/Neo.Network.RPC.Tests.csproj b/tests/Neo.Network.RPC.Tests/Neo.Network.RPC.Tests.csproj index af5c7c416..69ba71573 100644 --- a/tests/Neo.Network.RPC.Tests/Neo.Network.RPC.Tests.csproj +++ b/tests/Neo.Network.RPC.Tests/Neo.Network.RPC.Tests.csproj @@ -17,6 +17,7 @@ + From bf1d0cb9389f6e6e5d9fdf6e9f63ba847ee39670 Mon Sep 17 00:00:00 2001 From: bettybao1209 Date: Wed, 8 Apr 2020 21:28:12 +0800 Subject: [PATCH 19/26] format --- src/RpcServer/FixedDictionary.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/RpcServer/FixedDictionary.cs b/src/RpcServer/FixedDictionary.cs index 7f5137aaa..e856ce8c1 100644 --- a/src/RpcServer/FixedDictionary.cs +++ b/src/RpcServer/FixedDictionary.cs @@ -1,4 +1,4 @@ -using Akka.Actor; +using Akka.Actor; using System.Collections.ObjectModel; namespace Neo.Plugins From eba944cd16b0236100cbee5e8eb8cc315433decd Mon Sep 17 00:00:00 2001 From: erikzhang Date: Thu, 9 Apr 2020 17:22:35 +0800 Subject: [PATCH 20/26] Rename --- src/RpcServer/Properties/AssemblyInfo.cs | 3 +++ src/RpcServer/RelayActor.cs | 4 ++-- src/RpcServer/{FixedDictionary.cs => SendersCollection.cs} | 4 ++-- .../{FixedDictionaryTests.cs => SendersCollectionTests.cs} | 4 ++-- 4 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 src/RpcServer/Properties/AssemblyInfo.cs rename src/RpcServer/{FixedDictionary.cs => SendersCollection.cs} (84%) rename tests/Neo.Network.RPC.Tests/{FixedDictionaryTests.cs => SendersCollectionTests.cs} (86%) diff --git a/src/RpcServer/Properties/AssemblyInfo.cs b/src/RpcServer/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..46ff5b88b --- /dev/null +++ b/src/RpcServer/Properties/AssemblyInfo.cs @@ -0,0 +1,3 @@ +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Neo.Network.RPC.Tests")] diff --git a/src/RpcServer/RelayActor.cs b/src/RpcServer/RelayActor.cs index 9efdd04bd..71de529ae 100644 --- a/src/RpcServer/RelayActor.cs +++ b/src/RpcServer/RelayActor.cs @@ -7,12 +7,12 @@ namespace Neo.Plugins public class RelayActor : UntypedActor { private readonly NeoSystem neoSystem; - private readonly FixedDictionary senders; + private readonly SendersCollection senders; public RelayActor(NeoSystem neoSystem, int capacity) { this.neoSystem = neoSystem; - senders = new FixedDictionary(capacity); + senders = new SendersCollection(capacity); Context.System.EventStream.Subscribe(Self, typeof(RelayResult)); } diff --git a/src/RpcServer/FixedDictionary.cs b/src/RpcServer/SendersCollection.cs similarity index 84% rename from src/RpcServer/FixedDictionary.cs rename to src/RpcServer/SendersCollection.cs index e856ce8c1..7982be0c8 100644 --- a/src/RpcServer/FixedDictionary.cs +++ b/src/RpcServer/SendersCollection.cs @@ -3,11 +3,11 @@ namespace Neo.Plugins { - public class FixedDictionary : KeyedCollection + internal class SendersCollection : KeyedCollection { private readonly int capacity; - public FixedDictionary(int capacity) + public SendersCollection(int capacity) { this.capacity = capacity; } diff --git a/tests/Neo.Network.RPC.Tests/FixedDictionaryTests.cs b/tests/Neo.Network.RPC.Tests/SendersCollectionTests.cs similarity index 86% rename from tests/Neo.Network.RPC.Tests/FixedDictionaryTests.cs rename to tests/Neo.Network.RPC.Tests/SendersCollectionTests.cs index 0313bed1d..d8f76dd99 100644 --- a/tests/Neo.Network.RPC.Tests/FixedDictionaryTests.cs +++ b/tests/Neo.Network.RPC.Tests/SendersCollectionTests.cs @@ -7,12 +7,12 @@ namespace Neo.Plugins.Tests { [TestClass()] - public class FixedDictionaryTests + public class SendersCollectionTests { [TestMethod()] public void FixedDictionaryTest() { - FixedDictionary dictionary = new FixedDictionary(2); + SendersCollection dictionary = new SendersCollection(2); dictionary.Add(new ActorItem() { Hash = UInt256.Zero, Actor = null }); dictionary.Add(new ActorItem() { Hash = UInt256.Parse("0x530de76326a8662d1b730ba4fbdf011051eabd142015587e846da42376adf35f"), Actor = null }); dictionary.Add(new ActorItem() { Hash = UInt256.Parse("0x530de76326a8662d1b730ba4fbdf011051eabd142015587e846da42376adf350"), Actor = null }); From 5bf6d4d244e39b4d5c7dbd6b5fc0c1cd75b53e15 Mon Sep 17 00:00:00 2001 From: erikzhang Date: Thu, 9 Apr 2020 17:23:47 +0800 Subject: [PATCH 21/26] internal --- src/RpcServer/SendersCollection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/RpcServer/SendersCollection.cs b/src/RpcServer/SendersCollection.cs index 7982be0c8..ec0a46fa3 100644 --- a/src/RpcServer/SendersCollection.cs +++ b/src/RpcServer/SendersCollection.cs @@ -28,7 +28,7 @@ protected override void InsertItem(int index, ActorItem newItem) } } - public class ActorItem + internal class ActorItem { public UInt256 Hash { get; set; } From 2988b8ddfe3e211e287d9301a9105c65d898bd03 Mon Sep 17 00:00:00 2001 From: bettybao1209 Date: Thu, 9 Apr 2020 18:10:50 +0800 Subject: [PATCH 22/26] create UT project for RpcServer --- src/RpcServer/Properties/AssemblyInfo.cs | 2 +- .../Neo.Network.RPC.Tests.csproj | 1 - .../Neo.Plugin.RpcServer.Tests.csproj | 20 +++++++++++++++++++ .../SendersCollectionTests.cs | 5 +---- 4 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 tests/Neo.Plugin.RpcServer.Tests/Neo.Plugin.RpcServer.Tests.csproj rename tests/{Neo.Network.RPC.Tests => Neo.Plugin.RpcServer.Tests}/SendersCollectionTests.cs (88%) diff --git a/src/RpcServer/Properties/AssemblyInfo.cs b/src/RpcServer/Properties/AssemblyInfo.cs index 46ff5b88b..133c598a8 100644 --- a/src/RpcServer/Properties/AssemblyInfo.cs +++ b/src/RpcServer/Properties/AssemblyInfo.cs @@ -1,3 +1,3 @@ using System.Runtime.CompilerServices; -[assembly: InternalsVisibleTo("Neo.Network.RPC.Tests")] +[assembly: InternalsVisibleTo("Neo.Plugin.RpcServer.Tests")] diff --git a/tests/Neo.Network.RPC.Tests/Neo.Network.RPC.Tests.csproj b/tests/Neo.Network.RPC.Tests/Neo.Network.RPC.Tests.csproj index 69ba71573..af5c7c416 100644 --- a/tests/Neo.Network.RPC.Tests/Neo.Network.RPC.Tests.csproj +++ b/tests/Neo.Network.RPC.Tests/Neo.Network.RPC.Tests.csproj @@ -17,7 +17,6 @@ - diff --git a/tests/Neo.Plugin.RpcServer.Tests/Neo.Plugin.RpcServer.Tests.csproj b/tests/Neo.Plugin.RpcServer.Tests/Neo.Plugin.RpcServer.Tests.csproj new file mode 100644 index 000000000..bb585feef --- /dev/null +++ b/tests/Neo.Plugin.RpcServer.Tests/Neo.Plugin.RpcServer.Tests.csproj @@ -0,0 +1,20 @@ + + + + netcoreapp3.1 + + false + + + + + + + + + + + + + + diff --git a/tests/Neo.Network.RPC.Tests/SendersCollectionTests.cs b/tests/Neo.Plugin.RpcServer.Tests/SendersCollectionTests.cs similarity index 88% rename from tests/Neo.Network.RPC.Tests/SendersCollectionTests.cs rename to tests/Neo.Plugin.RpcServer.Tests/SendersCollectionTests.cs index d8f76dd99..690453c41 100644 --- a/tests/Neo.Network.RPC.Tests/SendersCollectionTests.cs +++ b/tests/Neo.Plugin.RpcServer.Tests/SendersCollectionTests.cs @@ -1,10 +1,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Neo.Plugins; -using System; -using System.Collections.Generic; -using System.Text; -namespace Neo.Plugins.Tests +namespace Neo.Plugin.RpcServer.Tests { [TestClass()] public class SendersCollectionTests From b7e9f0a5f4e72d23b23b3f49a42d9f9181136dd9 Mon Sep 17 00:00:00 2001 From: bettybao1209 Date: Thu, 9 Apr 2020 18:24:53 +0800 Subject: [PATCH 23/26] fix --- .../Neo.Plugin.RpcServer.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Neo.Plugin.RpcServer.Tests/Neo.Plugin.RpcServer.Tests.csproj b/tests/Neo.Plugin.RpcServer.Tests/Neo.Plugin.RpcServer.Tests.csproj index bb585feef..4737b49a5 100644 --- a/tests/Neo.Plugin.RpcServer.Tests/Neo.Plugin.RpcServer.Tests.csproj +++ b/tests/Neo.Plugin.RpcServer.Tests/Neo.Plugin.RpcServer.Tests.csproj @@ -14,7 +14,7 @@ - + From 93063aa5ba966c9e7e3ae1a34d557e96e1ef1ea9 Mon Sep 17 00:00:00 2001 From: bettybao1209 Date: Thu, 9 Apr 2020 20:33:32 +0800 Subject: [PATCH 24/26] rename to Neo.Plugins.RpcServer.Tests --- neo-modules.sln | 195 +++++++++--------- src/RpcServer/Properties/AssemblyInfo.cs | 2 +- .../Neo.Plugins.RpcServer.Tests.csproj} | 40 ++-- .../SendersCollectionTests.cs | 37 ++-- 4 files changed, 140 insertions(+), 134 deletions(-) rename tests/{Neo.Plugin.RpcServer.Tests/Neo.Plugin.RpcServer.Tests.csproj => Neo.Plugins.RpcServer.Tests/Neo.Plugins.RpcServer.Tests/Neo.Plugins.RpcServer.Tests.csproj} (84%) rename tests/{Neo.Plugin.RpcServer.Tests => Neo.Plugins.RpcServer.Tests/Neo.Plugins.RpcServer.Tests}/SendersCollectionTests.cs (87%) diff --git a/neo-modules.sln b/neo-modules.sln index 1f5f32fbc..de52a72f7 100644 --- a/neo-modules.sln +++ b/neo-modules.sln @@ -1,94 +1,101 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.28729.10 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{97E81C78-1637-481F-9485-DA1225E94C23}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{59D802AB-C552-422A-B9C3-64D329FBCDCC}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationLogs", "src\ApplicationLogs\ApplicationLogs.csproj", "{84DA8EA6-EF60-4FCD-B1C6-65C1A8323B3F}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StatesDumper", "src\StatesDumper\StatesDumper.csproj", "{86531DB1-A231-46C4-823F-BE60972F7523}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RpcNep5Tracker", "src\RpcNep5Tracker\RpcNep5Tracker.csproj", "{BBE8AC15-12DF-4AF0-ABC1-F1557EB5DC8E}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SystemLog", "src\SystemLog\SystemLog.csproj", "{14DB62D5-0EA1-4A98-8656-1AA2D0345206}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LevelDBStore", "src\LevelDBStore\LevelDBStore.csproj", "{C66214CD-0B97-4EA5-B7A2-164F54346F19}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RocksDBStore", "src\RocksDBStore\RocksDBStore.csproj", "{0E2AAF05-C55A-4B36-8750-F55743FBE4B3}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RpcClient", "src\RpcClient\RpcClient.csproj", "{8DC57A45-A192-4953-81B1-6907FB7C28D2}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RpcServer", "src\RpcServer\RpcServer.csproj", "{1403FFE9-4265-4269-8E3D-5A79EFD108CA}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Neo.Network.RPC.Tests", "tests\Neo.Network.RPC.Tests\Neo.Network.RPC.Tests.csproj", "{D52460B3-AB5C-4D07-B400-9E7ADCB01FF5}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Neo.Plugins.Storage.Tests", "tests\Neo.Plugins.Storage.Tests\Neo.Plugins.Storage.Tests.csproj", "{9E7EA895-302A-4C0C-BA9B-54F9A67AD75C}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {84DA8EA6-EF60-4FCD-B1C6-65C1A8323B3F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {84DA8EA6-EF60-4FCD-B1C6-65C1A8323B3F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {84DA8EA6-EF60-4FCD-B1C6-65C1A8323B3F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {84DA8EA6-EF60-4FCD-B1C6-65C1A8323B3F}.Release|Any CPU.Build.0 = Release|Any CPU - {86531DB1-A231-46C4-823F-BE60972F7523}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {86531DB1-A231-46C4-823F-BE60972F7523}.Debug|Any CPU.Build.0 = Debug|Any CPU - {86531DB1-A231-46C4-823F-BE60972F7523}.Release|Any CPU.ActiveCfg = Release|Any CPU - {86531DB1-A231-46C4-823F-BE60972F7523}.Release|Any CPU.Build.0 = Release|Any CPU - {BBE8AC15-12DF-4AF0-ABC1-F1557EB5DC8E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BBE8AC15-12DF-4AF0-ABC1-F1557EB5DC8E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BBE8AC15-12DF-4AF0-ABC1-F1557EB5DC8E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BBE8AC15-12DF-4AF0-ABC1-F1557EB5DC8E}.Release|Any CPU.Build.0 = Release|Any CPU - {14DB62D5-0EA1-4A98-8656-1AA2D0345206}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {14DB62D5-0EA1-4A98-8656-1AA2D0345206}.Debug|Any CPU.Build.0 = Debug|Any CPU - {14DB62D5-0EA1-4A98-8656-1AA2D0345206}.Release|Any CPU.ActiveCfg = Release|Any CPU - {14DB62D5-0EA1-4A98-8656-1AA2D0345206}.Release|Any CPU.Build.0 = Release|Any CPU - {C66214CD-0B97-4EA5-B7A2-164F54346F19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C66214CD-0B97-4EA5-B7A2-164F54346F19}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C66214CD-0B97-4EA5-B7A2-164F54346F19}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C66214CD-0B97-4EA5-B7A2-164F54346F19}.Release|Any CPU.Build.0 = Release|Any CPU - {0E2AAF05-C55A-4B36-8750-F55743FBE4B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0E2AAF05-C55A-4B36-8750-F55743FBE4B3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0E2AAF05-C55A-4B36-8750-F55743FBE4B3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0E2AAF05-C55A-4B36-8750-F55743FBE4B3}.Release|Any CPU.Build.0 = Release|Any CPU - {8DC57A45-A192-4953-81B1-6907FB7C28D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8DC57A45-A192-4953-81B1-6907FB7C28D2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8DC57A45-A192-4953-81B1-6907FB7C28D2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8DC57A45-A192-4953-81B1-6907FB7C28D2}.Release|Any CPU.Build.0 = Release|Any CPU - {1403FFE9-4265-4269-8E3D-5A79EFD108CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1403FFE9-4265-4269-8E3D-5A79EFD108CA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1403FFE9-4265-4269-8E3D-5A79EFD108CA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1403FFE9-4265-4269-8E3D-5A79EFD108CA}.Release|Any CPU.Build.0 = Release|Any CPU - {D52460B3-AB5C-4D07-B400-9E7ADCB01FF5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D52460B3-AB5C-4D07-B400-9E7ADCB01FF5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D52460B3-AB5C-4D07-B400-9E7ADCB01FF5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D52460B3-AB5C-4D07-B400-9E7ADCB01FF5}.Release|Any CPU.Build.0 = Release|Any CPU - {9E7EA895-302A-4C0C-BA9B-54F9A67AD75C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9E7EA895-302A-4C0C-BA9B-54F9A67AD75C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9E7EA895-302A-4C0C-BA9B-54F9A67AD75C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9E7EA895-302A-4C0C-BA9B-54F9A67AD75C}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {84DA8EA6-EF60-4FCD-B1C6-65C1A8323B3F} = {97E81C78-1637-481F-9485-DA1225E94C23} - {86531DB1-A231-46C4-823F-BE60972F7523} = {97E81C78-1637-481F-9485-DA1225E94C23} - {BBE8AC15-12DF-4AF0-ABC1-F1557EB5DC8E} = {97E81C78-1637-481F-9485-DA1225E94C23} - {14DB62D5-0EA1-4A98-8656-1AA2D0345206} = {97E81C78-1637-481F-9485-DA1225E94C23} - {C66214CD-0B97-4EA5-B7A2-164F54346F19} = {97E81C78-1637-481F-9485-DA1225E94C23} - {0E2AAF05-C55A-4B36-8750-F55743FBE4B3} = {97E81C78-1637-481F-9485-DA1225E94C23} - {8DC57A45-A192-4953-81B1-6907FB7C28D2} = {97E81C78-1637-481F-9485-DA1225E94C23} - {1403FFE9-4265-4269-8E3D-5A79EFD108CA} = {97E81C78-1637-481F-9485-DA1225E94C23} - {D52460B3-AB5C-4D07-B400-9E7ADCB01FF5} = {59D802AB-C552-422A-B9C3-64D329FBCDCC} - {9E7EA895-302A-4C0C-BA9B-54F9A67AD75C} = {59D802AB-C552-422A-B9C3-64D329FBCDCC} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {61D3ADE6-BBFC-402D-AB42-1C71C9F9EDE3} - EndGlobalSection -EndGlobal +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.28729.10 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{97E81C78-1637-481F-9485-DA1225E94C23}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{59D802AB-C552-422A-B9C3-64D329FBCDCC}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationLogs", "src\ApplicationLogs\ApplicationLogs.csproj", "{84DA8EA6-EF60-4FCD-B1C6-65C1A8323B3F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StatesDumper", "src\StatesDumper\StatesDumper.csproj", "{86531DB1-A231-46C4-823F-BE60972F7523}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RpcNep5Tracker", "src\RpcNep5Tracker\RpcNep5Tracker.csproj", "{BBE8AC15-12DF-4AF0-ABC1-F1557EB5DC8E}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SystemLog", "src\SystemLog\SystemLog.csproj", "{14DB62D5-0EA1-4A98-8656-1AA2D0345206}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LevelDBStore", "src\LevelDBStore\LevelDBStore.csproj", "{C66214CD-0B97-4EA5-B7A2-164F54346F19}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RocksDBStore", "src\RocksDBStore\RocksDBStore.csproj", "{0E2AAF05-C55A-4B36-8750-F55743FBE4B3}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RpcClient", "src\RpcClient\RpcClient.csproj", "{8DC57A45-A192-4953-81B1-6907FB7C28D2}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RpcServer", "src\RpcServer\RpcServer.csproj", "{1403FFE9-4265-4269-8E3D-5A79EFD108CA}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Neo.Network.RPC.Tests", "tests\Neo.Network.RPC.Tests\Neo.Network.RPC.Tests.csproj", "{D52460B3-AB5C-4D07-B400-9E7ADCB01FF5}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Neo.Plugins.Storage.Tests", "tests\Neo.Plugins.Storage.Tests\Neo.Plugins.Storage.Tests.csproj", "{9E7EA895-302A-4C0C-BA9B-54F9A67AD75C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Neo.Plugins.RpcServer.Tests", "tests\Neo.Plugins.RpcServer.Tests\Neo.Plugins.RpcServer.Tests\Neo.Plugins.RpcServer.Tests.csproj", "{A7E38B4E-D95D-440A-A976-CF107BA93BE2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {84DA8EA6-EF60-4FCD-B1C6-65C1A8323B3F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {84DA8EA6-EF60-4FCD-B1C6-65C1A8323B3F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {84DA8EA6-EF60-4FCD-B1C6-65C1A8323B3F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {84DA8EA6-EF60-4FCD-B1C6-65C1A8323B3F}.Release|Any CPU.Build.0 = Release|Any CPU + {86531DB1-A231-46C4-823F-BE60972F7523}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {86531DB1-A231-46C4-823F-BE60972F7523}.Debug|Any CPU.Build.0 = Debug|Any CPU + {86531DB1-A231-46C4-823F-BE60972F7523}.Release|Any CPU.ActiveCfg = Release|Any CPU + {86531DB1-A231-46C4-823F-BE60972F7523}.Release|Any CPU.Build.0 = Release|Any CPU + {BBE8AC15-12DF-4AF0-ABC1-F1557EB5DC8E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BBE8AC15-12DF-4AF0-ABC1-F1557EB5DC8E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BBE8AC15-12DF-4AF0-ABC1-F1557EB5DC8E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BBE8AC15-12DF-4AF0-ABC1-F1557EB5DC8E}.Release|Any CPU.Build.0 = Release|Any CPU + {14DB62D5-0EA1-4A98-8656-1AA2D0345206}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {14DB62D5-0EA1-4A98-8656-1AA2D0345206}.Debug|Any CPU.Build.0 = Debug|Any CPU + {14DB62D5-0EA1-4A98-8656-1AA2D0345206}.Release|Any CPU.ActiveCfg = Release|Any CPU + {14DB62D5-0EA1-4A98-8656-1AA2D0345206}.Release|Any CPU.Build.0 = Release|Any CPU + {C66214CD-0B97-4EA5-B7A2-164F54346F19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C66214CD-0B97-4EA5-B7A2-164F54346F19}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C66214CD-0B97-4EA5-B7A2-164F54346F19}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C66214CD-0B97-4EA5-B7A2-164F54346F19}.Release|Any CPU.Build.0 = Release|Any CPU + {0E2AAF05-C55A-4B36-8750-F55743FBE4B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0E2AAF05-C55A-4B36-8750-F55743FBE4B3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0E2AAF05-C55A-4B36-8750-F55743FBE4B3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0E2AAF05-C55A-4B36-8750-F55743FBE4B3}.Release|Any CPU.Build.0 = Release|Any CPU + {8DC57A45-A192-4953-81B1-6907FB7C28D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8DC57A45-A192-4953-81B1-6907FB7C28D2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8DC57A45-A192-4953-81B1-6907FB7C28D2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8DC57A45-A192-4953-81B1-6907FB7C28D2}.Release|Any CPU.Build.0 = Release|Any CPU + {1403FFE9-4265-4269-8E3D-5A79EFD108CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1403FFE9-4265-4269-8E3D-5A79EFD108CA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1403FFE9-4265-4269-8E3D-5A79EFD108CA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1403FFE9-4265-4269-8E3D-5A79EFD108CA}.Release|Any CPU.Build.0 = Release|Any CPU + {D52460B3-AB5C-4D07-B400-9E7ADCB01FF5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D52460B3-AB5C-4D07-B400-9E7ADCB01FF5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D52460B3-AB5C-4D07-B400-9E7ADCB01FF5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D52460B3-AB5C-4D07-B400-9E7ADCB01FF5}.Release|Any CPU.Build.0 = Release|Any CPU + {9E7EA895-302A-4C0C-BA9B-54F9A67AD75C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9E7EA895-302A-4C0C-BA9B-54F9A67AD75C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9E7EA895-302A-4C0C-BA9B-54F9A67AD75C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9E7EA895-302A-4C0C-BA9B-54F9A67AD75C}.Release|Any CPU.Build.0 = Release|Any CPU + {A7E38B4E-D95D-440A-A976-CF107BA93BE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A7E38B4E-D95D-440A-A976-CF107BA93BE2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A7E38B4E-D95D-440A-A976-CF107BA93BE2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A7E38B4E-D95D-440A-A976-CF107BA93BE2}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {84DA8EA6-EF60-4FCD-B1C6-65C1A8323B3F} = {97E81C78-1637-481F-9485-DA1225E94C23} + {86531DB1-A231-46C4-823F-BE60972F7523} = {97E81C78-1637-481F-9485-DA1225E94C23} + {BBE8AC15-12DF-4AF0-ABC1-F1557EB5DC8E} = {97E81C78-1637-481F-9485-DA1225E94C23} + {14DB62D5-0EA1-4A98-8656-1AA2D0345206} = {97E81C78-1637-481F-9485-DA1225E94C23} + {C66214CD-0B97-4EA5-B7A2-164F54346F19} = {97E81C78-1637-481F-9485-DA1225E94C23} + {0E2AAF05-C55A-4B36-8750-F55743FBE4B3} = {97E81C78-1637-481F-9485-DA1225E94C23} + {8DC57A45-A192-4953-81B1-6907FB7C28D2} = {97E81C78-1637-481F-9485-DA1225E94C23} + {1403FFE9-4265-4269-8E3D-5A79EFD108CA} = {97E81C78-1637-481F-9485-DA1225E94C23} + {D52460B3-AB5C-4D07-B400-9E7ADCB01FF5} = {59D802AB-C552-422A-B9C3-64D329FBCDCC} + {9E7EA895-302A-4C0C-BA9B-54F9A67AD75C} = {59D802AB-C552-422A-B9C3-64D329FBCDCC} + {A7E38B4E-D95D-440A-A976-CF107BA93BE2} = {59D802AB-C552-422A-B9C3-64D329FBCDCC} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {61D3ADE6-BBFC-402D-AB42-1C71C9F9EDE3} + EndGlobalSection +EndGlobal diff --git a/src/RpcServer/Properties/AssemblyInfo.cs b/src/RpcServer/Properties/AssemblyInfo.cs index 133c598a8..fcd04a70e 100644 --- a/src/RpcServer/Properties/AssemblyInfo.cs +++ b/src/RpcServer/Properties/AssemblyInfo.cs @@ -1,3 +1,3 @@ using System.Runtime.CompilerServices; -[assembly: InternalsVisibleTo("Neo.Plugin.RpcServer.Tests")] +[assembly: InternalsVisibleTo("Neo.Plugins.RpcServer.Tests")] diff --git a/tests/Neo.Plugin.RpcServer.Tests/Neo.Plugin.RpcServer.Tests.csproj b/tests/Neo.Plugins.RpcServer.Tests/Neo.Plugins.RpcServer.Tests/Neo.Plugins.RpcServer.Tests.csproj similarity index 84% rename from tests/Neo.Plugin.RpcServer.Tests/Neo.Plugin.RpcServer.Tests.csproj rename to tests/Neo.Plugins.RpcServer.Tests/Neo.Plugins.RpcServer.Tests/Neo.Plugins.RpcServer.Tests.csproj index 4737b49a5..581f5211c 100644 --- a/tests/Neo.Plugin.RpcServer.Tests/Neo.Plugin.RpcServer.Tests.csproj +++ b/tests/Neo.Plugins.RpcServer.Tests/Neo.Plugins.RpcServer.Tests/Neo.Plugins.RpcServer.Tests.csproj @@ -1,20 +1,20 @@ - - - - netcoreapp3.1 - - false - - - - - - - - - - - - - - + + + + netcoreapp3.1 + + false + + + + + + + + + + + + + + diff --git a/tests/Neo.Plugin.RpcServer.Tests/SendersCollectionTests.cs b/tests/Neo.Plugins.RpcServer.Tests/Neo.Plugins.RpcServer.Tests/SendersCollectionTests.cs similarity index 87% rename from tests/Neo.Plugin.RpcServer.Tests/SendersCollectionTests.cs rename to tests/Neo.Plugins.RpcServer.Tests/Neo.Plugins.RpcServer.Tests/SendersCollectionTests.cs index 690453c41..8c4831f9e 100644 --- a/tests/Neo.Plugin.RpcServer.Tests/SendersCollectionTests.cs +++ b/tests/Neo.Plugins.RpcServer.Tests/Neo.Plugins.RpcServer.Tests/SendersCollectionTests.cs @@ -1,19 +1,18 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Neo.Plugins; - -namespace Neo.Plugin.RpcServer.Tests -{ - [TestClass()] - public class SendersCollectionTests - { - [TestMethod()] - public void FixedDictionaryTest() - { - SendersCollection dictionary = new SendersCollection(2); - dictionary.Add(new ActorItem() { Hash = UInt256.Zero, Actor = null }); - dictionary.Add(new ActorItem() { Hash = UInt256.Parse("0x530de76326a8662d1b730ba4fbdf011051eabd142015587e846da42376adf35f"), Actor = null }); - dictionary.Add(new ActorItem() { Hash = UInt256.Parse("0x530de76326a8662d1b730ba4fbdf011051eabd142015587e846da42376adf350"), Actor = null }); - Assert.AreEqual(2, dictionary.Count); - } - } -} +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Neo.Plugins.RpcServer.Tests +{ + [TestClass()] + public class SendersCollectionTests + { + [TestMethod()] + public void SendersCollectionTest() + { + SendersCollection dictionary = new SendersCollection(2); + dictionary.Add(new ActorItem() { Hash = UInt256.Zero, Actor = null }); + dictionary.Add(new ActorItem() { Hash = UInt256.Parse("0x530de76326a8662d1b730ba4fbdf011051eabd142015587e846da42376adf35f"), Actor = null }); + dictionary.Add(new ActorItem() { Hash = UInt256.Parse("0x530de76326a8662d1b730ba4fbdf011051eabd142015587e846da42376adf350"), Actor = null }); + Assert.AreEqual(2, dictionary.Count); + } + } +} From 2d63346582f1f37e91f5947591be4e053c7a4119 Mon Sep 17 00:00:00 2001 From: bettybao1209 Date: Thu, 9 Apr 2020 20:37:23 +0800 Subject: [PATCH 25/26] format --- .../SendersCollectionTests.cs | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/tests/Neo.Plugins.RpcServer.Tests/Neo.Plugins.RpcServer.Tests/SendersCollectionTests.cs b/tests/Neo.Plugins.RpcServer.Tests/Neo.Plugins.RpcServer.Tests/SendersCollectionTests.cs index 8c4831f9e..8ba261a9f 100644 --- a/tests/Neo.Plugins.RpcServer.Tests/Neo.Plugins.RpcServer.Tests/SendersCollectionTests.cs +++ b/tests/Neo.Plugins.RpcServer.Tests/Neo.Plugins.RpcServer.Tests/SendersCollectionTests.cs @@ -1,18 +1,18 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace Neo.Plugins.RpcServer.Tests -{ - [TestClass()] - public class SendersCollectionTests - { - [TestMethod()] - public void SendersCollectionTest() - { - SendersCollection dictionary = new SendersCollection(2); - dictionary.Add(new ActorItem() { Hash = UInt256.Zero, Actor = null }); - dictionary.Add(new ActorItem() { Hash = UInt256.Parse("0x530de76326a8662d1b730ba4fbdf011051eabd142015587e846da42376adf35f"), Actor = null }); - dictionary.Add(new ActorItem() { Hash = UInt256.Parse("0x530de76326a8662d1b730ba4fbdf011051eabd142015587e846da42376adf350"), Actor = null }); - Assert.AreEqual(2, dictionary.Count); - } - } -} +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Neo.Plugins.RpcServer.Tests +{ + [TestClass()] + public class SendersCollectionTests + { + [TestMethod()] + public void SendersCollectionTest() + { + SendersCollection dictionary = new SendersCollection(2); + dictionary.Add(new ActorItem() { Hash = UInt256.Zero, Actor = null }); + dictionary.Add(new ActorItem() { Hash = UInt256.Parse("0x530de76326a8662d1b730ba4fbdf011051eabd142015587e846da42376adf35f"), Actor = null }); + dictionary.Add(new ActorItem() { Hash = UInt256.Parse("0x530de76326a8662d1b730ba4fbdf011051eabd142015587e846da42376adf350"), Actor = null }); + Assert.AreEqual(2, dictionary.Count); + } + } +} From 07764a0cda058d879b0cace790e5ba1512af258a Mon Sep 17 00:00:00 2001 From: bettybao1209 Date: Thu, 9 Apr 2020 21:07:04 +0800 Subject: [PATCH 26/26] reorganize files --- neo-modules.sln | 12 ++++++------ .../Neo.Plugins.RpcServer.Tests.csproj | 2 +- .../SendersCollectionTests.cs | 0 3 files changed, 7 insertions(+), 7 deletions(-) rename tests/Neo.Plugins.RpcServer.Tests/{Neo.Plugins.RpcServer.Tests => }/Neo.Plugins.RpcServer.Tests.csproj (84%) rename tests/Neo.Plugins.RpcServer.Tests/{Neo.Plugins.RpcServer.Tests => }/SendersCollectionTests.cs (100%) diff --git a/neo-modules.sln b/neo-modules.sln index de52a72f7..082ba5e99 100644 --- a/neo-modules.sln +++ b/neo-modules.sln @@ -26,7 +26,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Neo.Network.RPC.Tests", "te EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Neo.Plugins.Storage.Tests", "tests\Neo.Plugins.Storage.Tests\Neo.Plugins.Storage.Tests.csproj", "{9E7EA895-302A-4C0C-BA9B-54F9A67AD75C}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Neo.Plugins.RpcServer.Tests", "tests\Neo.Plugins.RpcServer.Tests\Neo.Plugins.RpcServer.Tests\Neo.Plugins.RpcServer.Tests.csproj", "{A7E38B4E-D95D-440A-A976-CF107BA93BE2}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Neo.Plugins.RpcServer.Tests", "tests\Neo.Plugins.RpcServer.Tests\Neo.Plugins.RpcServer.Tests.csproj", "{0AD4EAE3-C9A4-485D-85B1-42C9871ECC20}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -74,10 +74,10 @@ Global {9E7EA895-302A-4C0C-BA9B-54F9A67AD75C}.Debug|Any CPU.Build.0 = Debug|Any CPU {9E7EA895-302A-4C0C-BA9B-54F9A67AD75C}.Release|Any CPU.ActiveCfg = Release|Any CPU {9E7EA895-302A-4C0C-BA9B-54F9A67AD75C}.Release|Any CPU.Build.0 = Release|Any CPU - {A7E38B4E-D95D-440A-A976-CF107BA93BE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A7E38B4E-D95D-440A-A976-CF107BA93BE2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A7E38B4E-D95D-440A-A976-CF107BA93BE2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A7E38B4E-D95D-440A-A976-CF107BA93BE2}.Release|Any CPU.Build.0 = Release|Any CPU + {0AD4EAE3-C9A4-485D-85B1-42C9871ECC20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0AD4EAE3-C9A4-485D-85B1-42C9871ECC20}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0AD4EAE3-C9A4-485D-85B1-42C9871ECC20}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0AD4EAE3-C9A4-485D-85B1-42C9871ECC20}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -93,7 +93,7 @@ Global {1403FFE9-4265-4269-8E3D-5A79EFD108CA} = {97E81C78-1637-481F-9485-DA1225E94C23} {D52460B3-AB5C-4D07-B400-9E7ADCB01FF5} = {59D802AB-C552-422A-B9C3-64D329FBCDCC} {9E7EA895-302A-4C0C-BA9B-54F9A67AD75C} = {59D802AB-C552-422A-B9C3-64D329FBCDCC} - {A7E38B4E-D95D-440A-A976-CF107BA93BE2} = {59D802AB-C552-422A-B9C3-64D329FBCDCC} + {0AD4EAE3-C9A4-485D-85B1-42C9871ECC20} = {59D802AB-C552-422A-B9C3-64D329FBCDCC} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {61D3ADE6-BBFC-402D-AB42-1C71C9F9EDE3} diff --git a/tests/Neo.Plugins.RpcServer.Tests/Neo.Plugins.RpcServer.Tests/Neo.Plugins.RpcServer.Tests.csproj b/tests/Neo.Plugins.RpcServer.Tests/Neo.Plugins.RpcServer.Tests.csproj similarity index 84% rename from tests/Neo.Plugins.RpcServer.Tests/Neo.Plugins.RpcServer.Tests/Neo.Plugins.RpcServer.Tests.csproj rename to tests/Neo.Plugins.RpcServer.Tests/Neo.Plugins.RpcServer.Tests.csproj index 581f5211c..0297ac8e5 100644 --- a/tests/Neo.Plugins.RpcServer.Tests/Neo.Plugins.RpcServer.Tests/Neo.Plugins.RpcServer.Tests.csproj +++ b/tests/Neo.Plugins.RpcServer.Tests/Neo.Plugins.RpcServer.Tests.csproj @@ -14,7 +14,7 @@ - + diff --git a/tests/Neo.Plugins.RpcServer.Tests/Neo.Plugins.RpcServer.Tests/SendersCollectionTests.cs b/tests/Neo.Plugins.RpcServer.Tests/SendersCollectionTests.cs similarity index 100% rename from tests/Neo.Plugins.RpcServer.Tests/Neo.Plugins.RpcServer.Tests/SendersCollectionTests.cs rename to tests/Neo.Plugins.RpcServer.Tests/SendersCollectionTests.cs