Skip to content

Commit

Permalink
chore: linting fixes (cosmos#19855)
Browse files Browse the repository at this point in the history
Co-authored-by: son trinh <[email protected]>
  • Loading branch information
tac0turtle and sontrinh16 authored Mar 25, 2024
1 parent d1c3547 commit 138db2b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 27 deletions.
17 changes: 1 addition & 16 deletions store/db/rocksdb_noflag.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package db
import (
corestore "cosmossdk.io/core/store"
"cosmossdk.io/store/v2"
"github.com/linxGnu/grocksdb"
)

var (
Expand All @@ -19,7 +18,7 @@ var (
type RocksDB struct {
}

func NewRocksDB(dataDir string) (*RocksDB, error) {
func NewRocksDB(name, dataDir string) (*RocksDB, error) {
panic("rocksdb must be built with -tags rocksdb")

}
Expand Down Expand Up @@ -61,10 +60,6 @@ var _ corestore.Iterator = (*rocksDBIterator)(nil)
type rocksDBIterator struct {
}

func newRocksDBIterator(src *grocksdb.Iterator, start, end []byte, reverse bool) *rocksDBIterator {
panic("rocksdb must be built with -tags rocksdb")
}

func (itr *rocksDBIterator) Domain() (start, end []byte) {
panic("rocksdb must be built with -tags rocksdb")
}
Expand Down Expand Up @@ -123,13 +118,3 @@ func (b *rocksDBBatch) Close() error {
func (b *rocksDBBatch) GetByteSize() (int, error) {
panic("rocksdb must be built with -tags rocksdb")
}

func readOnlySlice(s *grocksdb.Slice) []byte {
panic("rocksdb must be built with -tags rocksdb")
}

// copyAndFreeSlice will copy a given RocksDB slice and free it. If the slice
// does not exist, <nil> will be returned.
func copyAndFreeSlice(s *grocksdb.Slice) []byte {
panic("rocksdb must be built with -tags rocksdb")
}
8 changes: 4 additions & 4 deletions store/proof/commit_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (ci *CommitInfo) GetStoreProof(storeKey []byte) ([]byte, *CommitmentOp, err
leaves := make([][]byte, len(ci.StoreInfos))
for i, si := range ci.StoreInfos {
var err error
leaves[i], err = LeafHash([]byte(si.Name), si.GetHash())
leaves[i], err = LeafHash(si.Name, si.GetHash())
if err != nil {
return nil, nil, err
}
Expand All @@ -85,7 +85,7 @@ func (ci *CommitInfo) GetStoreProof(storeKey []byte) ([]byte, *CommitmentOp, err
}

rootHash, inners := ProofFromByteSlices(leaves, index)
commitmentOp := ConvertCommitmentOp(inners, []byte(storeKey), ci.StoreInfos[index].GetHash())
commitmentOp := ConvertCommitmentOp(inners, storeKey, ci.StoreInfos[index].GetHash())

return rootHash, &commitmentOp, nil
}
Expand All @@ -96,7 +96,7 @@ func (ci *CommitInfo) encodedSize() int {
size += encoding.EncodeVarintSize(ci.Timestamp.UnixNano())
size += encoding.EncodeUvarintSize(uint64(len(ci.StoreInfos)))
for _, storeInfo := range ci.StoreInfos {
size += encoding.EncodeBytesSize([]byte(storeInfo.Name))
size += encoding.EncodeBytesSize(storeInfo.Name)
size += encoding.EncodeBytesSize(storeInfo.CommitID.Hash)
}
return size
Expand Down Expand Up @@ -124,7 +124,7 @@ func (ci *CommitInfo) Marshal() ([]byte, error) {
return nil, err
}
for _, si := range ci.StoreInfos {
if err := encoding.EncodeBytes(&buf, []byte(si.Name)); err != nil {
if err := encoding.EncodeBytes(&buf, si.Name); err != nil {
return nil, err
}
if err := encoding.EncodeBytes(&buf, si.CommitID.Hash); err != nil {
Expand Down
14 changes: 7 additions & 7 deletions x/params/types/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,18 @@ func validateMaxRedelegationEntries(i interface{}) error {

func (p *params) ParamSetPairs() types.ParamSetPairs {
return types.ParamSetPairs{
{keyUnbondingTime, &p.UnbondingTime, validateUnbondingTime},
{keyMaxValidators, &p.MaxValidators, validateMaxValidators},
{keyBondDenom, &p.BondDenom, validateBondDenom},
types.ParamSetPair{Key: keyUnbondingTime, Value: &p.UnbondingTime, ValidatorFn: validateUnbondingTime},
types.ParamSetPair{Key: keyMaxValidators, Value: &p.MaxValidators, ValidatorFn: validateMaxValidators},
types.ParamSetPair{Key: keyBondDenom, Value: &p.BondDenom, ValidatorFn: validateBondDenom},
}
}

func (p *paramsV2) ParamSetPairs() types.ParamSetPairs {
return types.ParamSetPairs{
{keyUnbondingTime, &p.UnbondingTime, validateUnbondingTime},
{keyMaxValidators, &p.MaxValidators, validateMaxValidators},
{keyBondDenom, &p.BondDenom, validateBondDenom},
{keyMaxRedelegationEntries, &p.MaxRedelegationEntries, validateMaxRedelegationEntries},
types.ParamSetPair{Key: keyUnbondingTime, Value: &p.UnbondingTime, ValidatorFn: validateUnbondingTime},
types.ParamSetPair{Key: keyMaxValidators, Value: &p.MaxValidators, ValidatorFn: validateMaxValidators},
types.ParamSetPair{Key: keyBondDenom, Value: &p.BondDenom, ValidatorFn: validateBondDenom},
types.ParamSetPair{Key: keyMaxRedelegationEntries, Value: &p.MaxRedelegationEntries, ValidatorFn: validateMaxRedelegationEntries},
}
}

Expand Down

0 comments on commit 138db2b

Please sign in to comment.