Skip to content
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

chore: linting fixes #19855

Merged
merged 3 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading