Favor marshal unmashal binare bare (#5799)
* 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 <alexanderbez@users.noreply.github.com> Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
This commit is contained in:
co-authored by
Alexander Bezobchuk
parent
b87f5934f5
commit
2e42f9cb74
@@ -68,7 +68,7 @@ func MultiStoreProofOpDecoder(pop merkle.ProofOp) (merkle.ProofOperator, error)
|
||||
// XXX: a bit strange as we'll discard this, but it works
|
||||
var op MultiStoreProofOp
|
||||
|
||||
err := cdc.UnmarshalBinaryLengthPrefixed(pop.Data, &op)
|
||||
err := cdc.UnmarshalBinaryBare(pop.Data, &op)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("decoding ProofOp.Data into MultiStoreProofOp: %w", err)
|
||||
}
|
||||
@@ -79,7 +79,7 @@ func MultiStoreProofOpDecoder(pop merkle.ProofOp) (merkle.ProofOperator, error)
|
||||
// ProofOp return a merkle proof operation from a given multi-store proof
|
||||
// operation.
|
||||
func (op MultiStoreProofOp) ProofOp() merkle.ProofOp {
|
||||
bz := cdc.MustMarshalBinaryLengthPrefixed(op)
|
||||
bz := cdc.MustMarshalBinaryBare(op)
|
||||
return merkle.ProofOp{
|
||||
Type: ProofOpMultiStore,
|
||||
Key: op.key,
|
||||
|
||||
@@ -617,7 +617,7 @@ func getLatestVersion(db dbm.DB) int64 {
|
||||
return 0
|
||||
}
|
||||
|
||||
err = cdc.UnmarshalBinaryLengthPrefixed(latestBytes, &latest)
|
||||
err = cdc.UnmarshalBinaryBare(latestBytes, &latest)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -627,7 +627,7 @@ func getLatestVersion(db dbm.DB) int64 {
|
||||
|
||||
// Set the latest version.
|
||||
func setLatestVersion(batch dbm.Batch, version int64) {
|
||||
latestBytes, _ := cdc.MarshalBinaryLengthPrefixed(version)
|
||||
latestBytes, _ := cdc.MarshalBinaryBare(version)
|
||||
batch.Set([]byte(latestVersionKey), latestBytes)
|
||||
}
|
||||
|
||||
@@ -668,7 +668,7 @@ func getCommitInfo(db dbm.DB, ver int64) (commitInfo, error) {
|
||||
|
||||
var cInfo commitInfo
|
||||
|
||||
err = cdc.UnmarshalBinaryLengthPrefixed(cInfoBytes, &cInfo)
|
||||
err = cdc.UnmarshalBinaryBare(cInfoBytes, &cInfo)
|
||||
if err != nil {
|
||||
return commitInfo{}, errors.Wrap(err, "failed to get store")
|
||||
}
|
||||
@@ -678,7 +678,7 @@ func getCommitInfo(db dbm.DB, ver int64) (commitInfo, error) {
|
||||
|
||||
// Set a commitInfo for given version.
|
||||
func setCommitInfo(batch dbm.Batch, version int64, cInfo commitInfo) {
|
||||
cInfoBytes := cdc.MustMarshalBinaryLengthPrefixed(cInfo)
|
||||
cInfoBytes := cdc.MustMarshalBinaryBare(cInfo)
|
||||
cInfoKey := fmt.Sprintf(commitInfoKeyFmt, version)
|
||||
batch.Set([]byte(cInfoKey), cInfoBytes)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user