chore: linting fixes (#19855)
Co-authored-by: son trinh <trinhleson2000@gmail.com>
This commit is contained in:
parent
d1c3547d8e
commit
138db2bb2a
@ -6,7 +6,6 @@ package db
|
||||
import (
|
||||
corestore "cosmossdk.io/core/store"
|
||||
"cosmossdk.io/store/v2"
|
||||
"github.com/linxGnu/grocksdb"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -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")
|
||||
|
||||
}
|
||||
@ -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")
|
||||
}
|
||||
@ -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")
|
||||
}
|
||||
|
||||
@ -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
|
||||
}
|
||||
@ -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
|
||||
}
|
||||
@ -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
|
||||
@ -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 {
|
||||
|
||||
@ -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},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user