-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Favor bare binary-marshalling over length prefixed-marshalling #5799
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5799 +/- ##
=======================================
Coverage 36.03% 36.03%
=======================================
Files 342 342
Lines 34782 34782
=======================================
Hits 12534 12534
Misses 20998 20998
Partials 1250 1250 |
…om:cosmos/cosmos-sdk into jonathan/5748-marshal-unmashal-binare-bare
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. Thanks @jgimeno ☕️
Might be worth it to have another quick sign off from @cwgoes or @ValarDragon :)
Co-Authored-By: Alexander Bezobchuk <[email protected]>
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
@@ -148,6 +148,7 @@ Buffers for state serialization instead of Amino. | |||
to define their own concrete `MsgSubmitProposal` types. | |||
* The module now accepts a `Codec` interface which extends the `codec.Marshaler` interface by | |||
requiring a concrete codec to know how to serialize `Proposal` types. | |||
* (codec) [\#5799](https://github.com/cosmos/cosmos-sdk/pull/5799) Now we favor the use of MarshalBinaryBare instead of LengthPrefixed in all cases that is not needed. |
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.
* (codec) [\#5799](https://github.com/cosmos/cosmos-sdk/pull/5799) Now we favor the use of MarshalBinaryBare instead of LengthPrefixed in all cases that is not needed. | |
* (codec) [\#5799](https://github.com/cosmos/cosmos-sdk/pull/5799) Now we favor the use of `(Un)MarshalBinaryBare` instead of `(Un)MarshalBinaryLengthPrefixed` in all cases that are not needed. |
This brings a potentially massive ABI breaking change for clients, and as such it should be mentioned in the CHANGELOG. @jgimeno gaia's build is broken due to this PR, feel free to poke me when you spare some time, I'm happy to provide assistance and try to fix it together |
How so? I think the proper message was added to changelog. For any client dealing with raw amino binary encoding, the given entry should be clear enough. That being said, @jgimeno can you update Gaia to the SDK's latest |
Whether a change introduces ABI/client breakages can be determined with a simple test: do gaia Don't get me wrong, the CHANGELOG line per se` looks good to me, I'm arguing that this change should be mentioned among the breaking ones as well so that clients will be informed. |
Not necessarily. CLI/REST work in JSON, not binary. The test suite could easily fail if we're doing manual binary encoding/decoding, which I 100% bet is the case. |
Yeah, there were only 2 cases that checked manually the encoding of a transaction. The other failure were due to the changes we did for the proposal json encoding for amounts. |
Whether an interface is part of a program's ABI or API does not depend on encoding. It has nothing to do with encoding. Any interface between two binary programs is an ABI, e.g. HTTP server and client such as |
Right, I get that. I'm still not following you on what broke here WRT to ABI. We went from length-prefixing to non-length-prefixing. Clients in this model are only the servers (apps) which will understand how to talk to each other. Older clients won't and that is precisely what was stated in the changelog. |
@@ -124,7 +124,7 @@ func (kb baseKeybase) DecodeSignature(info Info, msg []byte) (sig []byte, pub tm | |||
return nil, nil, err | |||
} | |||
|
|||
if err := CryptoCdc.UnmarshalBinaryLengthPrefixed([]byte(signed), sig); err != nil { |
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.
Sorry @jgimeno, I skimmed through and didn't realize you also updated the Keybase. The Keybase should not be updated because than that will break existing local wallets. Let's undo these.
@@ -337,12 +337,12 @@ func (i multiInfo) GetPath() (*hd.BIP44Params, error) { | |||
|
|||
// encoding info | |||
func marshalInfo(i Info) []byte { | |||
return CryptoCdc.MustMarshalBinaryLengthPrefixed(i) |
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.
} | ||
|
||
// decoding info | ||
func unmarshalInfo(bz []byte) (info Info, err error) { | ||
err = CryptoCdc.UnmarshalBinaryLengthPrefixed(bz, &info) |
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.
* change abci file to use BinaryBare * change all calls to EncodeLengthPrefixed to BinaryBare in distribution keeper store. * change all calls to EncodeLengthPrefixed to BinaryBare in mint keeper store. * change all calls to EncodeLengthPrefixed to BinaryBare in auth keeper store. * change all calls to EncodeLengthPrefixed to BinaryBare in distribution keeper store. * change all calls to EncodeLengthPrefixed to BinaryBare in staking keeper store. * change all calls to EncodeLengthPrefixed to BinaryBare in staking keeper store. * change all calls to EncodeLengthPrefixed to BinaryBare in gov keeper store. * change all calls to EncodeLengthPrefixed to BinaryBare in slashing keeper store. * update decoder test * migrate decoder * migrate gov simulation decoder * migrate baseapp_test * refactor QuerySubspace * refactor coedc std codec * migrate keybase * migrate iavl store * migrate root multi * migrate ante basic * migrate tx type to bare * migrate auth client * update auth types * update decoder * migrate supply decoder * migrate stake encoding * migrate staking simulation * migrate genutil * migrate simapp test helpers * migrate docs * upgrade changelog * Update CHANGELOG.md Co-Authored-By: Alexander Bezobchuk <[email protected]> Co-authored-by: Alexander Bezobchuk <[email protected]>
Closes: #5748
Description
For contributor use:
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerFor admin use:
WIP
,R4R
,docs
, etc)