-
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
update Tendermint genesis #917
update Tendermint genesis #917
Conversation
Codecov Report
@@ Coverage Diff @@
## master #917 +/- ##
========================================
- Coverage 70.6% 70.6% -0.1%
========================================
Files 203 203
Lines 16217 16230 +13
========================================
- Hits 11465 11464 -1
- Misses 4752 4766 +14
Continue to review full report at Codecov.
|
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.
Just one question from my side. Otherwise looks good! 🙏
tendermint/src/genesis.rs
Outdated
@@ -24,25 +25,9 @@ pub struct Genesis<AppState = serde_json::Value> { | |||
pub validators: Vec<validator::Info>, | |||
|
|||
/// App hash | |||
#[serde(skip_serializing_if = "Vec::is_empty", with = "serde_bytes")] | |||
pub app_hash: Vec<u8>, | |||
pub app_hash: String, |
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.
What's your reasoning behind this change?
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.
In our app, we're updating the genesis.json generated from Tendermint Go. It sets "app_hash": ""
, which is parsed as an empty Vec
, but when we serialize it back to json, it omits the field completely. Then on subsequent run, the parser fails due to Error("missing field
app_hash", ...)
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.
And what if you changed it to:
pub app_hash: String, | |
#[serde(with = "serde_bytes")] | |
pub app_hash: Vec<u8>, |
In the Go version of Tendermint it's modeled as HexBytes
, which is an array of bytes, and I think it should be modeled similarly here.
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.
unfortunately, this writes back "app_hash": []
into JSON, which is not accepted :/
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.
perhaps this could use a custom serialize/deserialize with hex encoding/decoding
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.
#[serde(with="serializers::bytes::hexstring")]
does it, I'll fix it up
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.
LGTM! 👍
closes #916
.changelog/