-
Notifications
You must be signed in to change notification settings - Fork 227
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
rpc: Add support for consensus_state endpoint #719
Conversation
Signed-off-by: Thane Thomson <connect@thanethomson.com>
Signed-off-by: Thane Thomson <connect@thanethomson.com>
Signed-off-by: Thane Thomson <connect@thanethomson.com>
Codecov Report
@@ Coverage Diff @@
## master #719 +/- ##
========================================
+ Coverage 40.0% 41.5% +1.5%
========================================
Files 202 205 +3
Lines 12805 13628 +823
Branches 3204 3307 +103
========================================
+ Hits 5130 5667 +537
- Misses 7348 7599 +251
- Partials 327 362 +35
Continue to review full report at Codecov.
|
Signed-off-by: Thane Thomson <connect@thanethomson.com>
Signed-off-by: Thane Thomson <connect@thanethomson.com>
Signed-off-by: Thane Thomson <connect@thanethomson.com>
Signed-off-by: Thane Thomson <connect@thanethomson.com>
Signed-off-by: Thane Thomson <connect@thanethomson.com>
pub step: i8, | ||
} | ||
|
||
impl Serialize for HeightRoundStep { |
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 know we deprioritized separating JSON serialization in the code, but would it make sense to add one-off JSON structs when we implement new domain types?
This seems like a prime example where we can create a HeightRoundStep JSON type that has i64/i64/i8 fields and then add a #[serde(try_from="json-type", into="json-type")]
to the top of this struct.
I'm asking because tracking custom serialization implementations can become tricky and this implementation has public fields (described as a Type 0 struct in issue #661 ) but domain knowledge restrictions in the serialization (which I consider no-no and should be either in a TryFrom trait or a constructor as described by Type 1 and Type 2 structs in the same issue). I would guess that this doesn't cause issues in regular cases, because most of the fields are well guarded (Height and Round are domain types), but I can for example create a HeightRoundStep with step == -2 which I think is invalid.
So, even if we keep the custom serialization, it seems that a constructor might be warranted.
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.
We could separate the JSON struct from the domain type for HeightRoundStep
, but where would we put it?
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.
Chatted to @greg-szabo about this, and we'll follow up here in a separate issue (#749).
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.
👍
Signed-off-by: Thane Thomson <connect@thanethomson.com>
Closes #674