You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently I've been trying to integrate MsgEditSideChainValidator via Javascript SDK and Amino codec and I found interesting case with optional fields. E.g when I want to update Side Chain Validator:
typeMsgEditSideChainValidatorstruct {
DescriptionDescription`json:"description"`ValidatorAddr sdk.ValAddress`json:"address"`// We pass a reference to the new commission rate as it's not mandatory to// update. If not updated, the deserialized rate will be zero with no way to// distinguish if an update was intended.//// REF: #2373CommissionRate*sdk.Dec`json:"commission_rate"`SideChainIdstring`json:"side_chain_id"`// for SideFeeAddr, we do not update the values if they are not provided.SideFeeAddr []byte`json:"side_fee_addr"`SideConsAddr []byte`json:"side_cons_addr,omitempty"`
}
with only e.g. updated website, sending such amino-encoded payload:
In this payload fields that I do not want to update were filled with nulls, yet they were skipped in JSON repr. Such payload also is used for signing purposes.
However, decoding this message on bnc-cosmos-sdk side and getting sign bytes yields completely different shape:
Unified behaviour between js and cosmos SDKs.
I think that Golang SDK should drop nullable fields, since it is more flexible to add new fields without breaking compatibility with previous JS SDKs.
I submitted PR as part of this issue.
For Admin Use
Not duplicate issue
Appropriate labels applied
Appropriate contributors tagged
Contributor assigned/self-assigned
The text was updated successfully, but these errors were encountered:
Summary of Bug
Recently I've been trying to integrate
MsgEditSideChainValidator
via Javascript SDK and Amino codec and I found interesting case with optional fields. E.g when I want to update Side Chain Validator:with only e.g. updated website, sending such amino-encoded payload:
In this payload fields that I do not want to update were filled with nulls, yet they were skipped in JSON repr. Such payload also is used for signing purposes.
However, decoding this message on
bnc-cosmos-sdk
side and getting sign bytes yields completely different shape:yielding in completely different sign data bytes.
Steps to Reproduce
As above.
Expected behaviour
Unified behaviour between js and cosmos SDKs.
I think that Golang SDK should drop nullable fields, since it is more flexible to add new fields without breaking compatibility with previous JS SDKs.
I submitted PR as part of this issue.
For Admin Use
The text was updated successfully, but these errors were encountered: