Skip to content

Commit

Permalink
chore: review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
aleem1314 committed Dec 11, 2023
1 parent f0e823d commit f58b180
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion x/consensus/keeper/concensus_keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (k Keeper) getConsensusQueue(ctx context.Context, queueTypeName string) (co
}

if opts.Cdc == nil {
opts.Cdc = k.Cdc
opts.Cdc = k.cdc
}

if opts.Batched {
Expand Down
11 changes: 10 additions & 1 deletion x/consensus/keeper/consensus/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import (

"cosmossdk.io/store/prefix"
storetypes "cosmossdk.io/store/types"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/gogoproto/proto"
keeperutil "github.com/palomachain/paloma/util/keeper"
"github.com/palomachain/paloma/x/consensus/types"
)
Expand All @@ -17,6 +19,13 @@ var _ Queuer = Queue{}

type ConsensusMsg = types.ConsensusMsg

type codecMarshaler interface {
types.AnyUnpacker
MarshalInterface(i proto.Message) ([]byte, error)
UnmarshalInterface(bz []byte, ptr interface{}) error
Unmarshal(bz []byte, ptr codec.ProtoMarshaler) error
}

// Queue is a database storing messages that need to be signed.
type Queue struct {
qo QueueOptions
Expand All @@ -27,7 +36,7 @@ type QueueOptions struct {
QueueTypeName string
Sg keeperutil.StoreGetter
Ider keeperutil.IDGenerator
Cdc types.CodecMarshaler
Cdc codecMarshaler
TypeCheck types.TypeChecker
BytesToSignCalculator types.BytesToSignFunc
VerifySignature types.VerifySignatureFunc
Expand Down
2 changes: 1 addition & 1 deletion x/consensus/keeper/consensus/consensus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func TestConsensusQueueAllMethods(t *testing.T) {
QueueTypeName: "simple-message",
Sg: sg,
Ider: keeperutil.NewIDGenerator(sg, nil),
Cdc: nil,
Cdc: types.ModuleCdc,
TypeCheck: types.StaticTypeChecker(msgType),
Attestator: mck,
BytesToSignCalculator: msgType.ConsensusSignBytes(),
Expand Down
6 changes: 1 addition & 5 deletions x/consensus/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (

"cosmossdk.io/core/store"
"cosmossdk.io/log"
"cosmossdk.io/store/prefix"
storetypes "cosmossdk.io/store/types"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/runtime"
Expand All @@ -19,7 +18,6 @@ import (
type (
Keeper struct {
cdc codec.BinaryCodec
Cdc types.CodecMarshaler
storeKey store.KVStoreService
paramstore paramtypes.Subspace

Expand Down Expand Up @@ -58,7 +56,5 @@ func (k Keeper) Logger(ctx context.Context) log.Logger {
}

func (k Keeper) Store(ctx context.Context) storetypes.KVStore {
s := runtime.KVStoreAdapter(k.storeKey.OpenKVStore(ctx))

return prefix.NewStore(s, []byte("store"))
return runtime.KVStoreAdapter(k.storeKey.OpenKVStore(ctx))
}
8 changes: 0 additions & 8 deletions x/consensus/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package types
import (
"encoding/binary"

"github.com/cosmos/cosmos-sdk/codec"
proto "github.com/cosmos/gogoproto/proto"
)

Expand All @@ -13,13 +12,6 @@ func Uint64ToByte(n uint64) []byte {
return b
}

type CodecMarshaler interface {
AnyUnpacker
MarshalInterface(i proto.Message) ([]byte, error)
UnmarshalInterface(bz []byte, ptr interface{}) error
Unmarshal(bz []byte, ptr codec.ProtoMarshaler) error
}

type ConsensusMsg interface {
proto.Message
}

0 comments on commit f58b180

Please sign in to comment.