RpcServer, RpcClient: strip HF_ prefix from getversion response#838
RpcServer, RpcClient: strip HF_ prefix from getversion response#838Jim8y merged 3 commits intoneo-project:masterfrom
getversion response#838Conversation
It's nice to have clear hardfork ame without hardfork prefix so that the resulting hardfork JSON-ized name can be applicable by both C# and NeoGo nodes. Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
5d82e63 to
ef9dff0
Compare
|
weird to make C# aligned to neogo, instead of neogo aligned to C#. If it is not a bug or improvement proposal, i dont have any motivation to stay @shargon Any thought on this? |
|
It's obviously an improvement for the RPC protocol. These prefixes are OK for some code-level constants in a big module, but they're not really interesting for RPC reply that has Note also, that their introduction into the protocol was accidental, not intentional (as well as inclusion into 3.6.1). |
|
you have to remove neo-modules/tests/Neo.Network.RPC.Tests/RpcTestCases.json Lines 2495 to 2500 in 6ead780 for the tests to work again. Or Change to reflect your changes.
Prefix should be removed. and should be like this Its in section hardfork already. so no need for prefix of May need to fix #825 as well... |
|
Changes to the interface should be very careful, we dont know if someone is already using it or not, and it is not a good experience to change the inteface from time to time. Yes, without HF prefix is much reasonable, but since it has I wont stand my opinion if @shargon agrees to update, but before that, i dont think it is necessary or should be done in another compatible way without breaking existing interface. |
src/RpcClient/Models/RpcVersion.cs
Outdated
| // Strip HF_ prefix. | ||
| ["name"] = s.Key.ToString().Substring(3), |
src/RpcClient/Models/RpcVersion.cs
Outdated
| MemoryPoolMaxTransactions = (int)json["memorypoolmaxtransactions"].AsNumber(), | ||
| InitialGasDistribution = (ulong)json["initialgasdistribution"].AsNumber(), | ||
| Hardforks = new Dictionary<Hardfork, uint>(((JArray)json["hardforks"]).Select(s => new KeyValuePair<Hardfork, uint>(Enum.Parse<Hardfork>(s["name"].AsString()), (uint)s["blockheight"].AsNumber()))), | ||
| Hardforks = new Dictionary<Hardfork, uint>(((JArray)json["hardforks"]).Select(s => new KeyValuePair<Hardfork, uint>(Enum.Parse<Hardfork>($"HF_{s["name"].AsString()}"), (uint)s["blockheight"].AsNumber()))), |
There was a problem hiding this comment.
you are adding it again. why?
There was a problem hiding this comment.
Test fails with System.ArgumentException: Requested value 'HF_HF_Aspidochelone' was not found.
There was a problem hiding this comment.
I accidentally forgot to commit the test file changes, fixed.
Strip `HF_` prefix from the hardforks response. Fix @cschuchardt88's review: neo-project#838 (comment). Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
Fix @shargon's review: neo-project#838 (review). Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
Fix @shargon's review: neo-project#838 (review). Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
6468dc7 to
2015178
Compare
|
As Roman said in #838 (comment), the initial idea for hardforks naming was to use "Aspidochelone", "Basilisk" and etc. for user-facing outputs (see the neo-project/neo#2749 (comment)), and |
Fixed, see the updated version, please. |
It's nice to have clear hardfork ame without hardfork prefix so that the resulting hardfork JSON-ized name can be applicable by both C# and NeoGo nodes.
Ref. #822.