-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RpcServer, RpcClient: strip HF_ prefix from getversion
response
#838
Conversation
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 <[email protected]>
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), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the #838 (comment) and updated version.
src/RpcClient/Models/RpcVersion.cs
Outdated
@@ -63,7 +64,7 @@ public static RpcProtocol FromJson(JObject json) | |||
MaxTransactionsPerBlock = (uint)json["maxtransactionsperblock"].AsNumber(), | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are adding it again. why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test fails with System.ArgumentException: Requested value 'HF_HF_Aspidochelone' was not found.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I accidentally forgot to commit the test file changes, fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to use a method to check if the string startWith, instead of replace always the first 3 chars.
Strip `HF_` prefix from the hardforks response. Fix @cschuchardt88's review: neo-project#838 (comment). Signed-off-by: Anna Shaleva <[email protected]>
Fix @shargon's review: neo-project#838 (review). Signed-off-by: Anna Shaleva <[email protected]>
Fix @shargon's review: neo-project#838 (review). Signed-off-by: Anna Shaleva <[email protected]>
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.