Skip to content

Commit

Permalink
Temporary Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeniy-scherbina committed Sep 10, 2024
1 parent f511db4 commit f2b2809
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 4 deletions.
14 changes: 10 additions & 4 deletions kava/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ import (
"time"

"github.com/coinbase/rosetta-sdk-go/types"
abci "github.com/cometbft/cometbft/abci/types"
ctypes "github.com/cometbft/cometbft/rpc/core/types"
tmrpctypes "github.com/cometbft/cometbft/rpc/jsonrpc/types"
tmtypes "github.com/cometbft/cometbft/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
authante "github.com/cosmos/cosmos-sdk/x/auth/ante"
Expand All @@ -34,10 +38,6 @@ import (
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
kava "github.com/kava-labs/kava/app"
"github.com/kava-labs/kava/app/params"
abci "github.com/cometbft/cometbft/abci/types"
ctypes "github.com/cometbft/cometbft/rpc/core/types"
tmrpctypes "github.com/cometbft/cometbft/rpc/jsonrpc/types"
tmtypes "github.com/cometbft/cometbft/types"
)

var noBlockResultsForHeight = regexp.MustCompile(`could not find results for height #(\d+)`)
Expand All @@ -53,6 +53,12 @@ type Client struct {
func NewClient(rpc RPCClient, balanceServiceFactory BalanceServiceFactory) (*Client, error) {
encodingConfig := kava.MakeEncodingConfig()

encodingConfig.InterfaceRegistry.RegisterInterface(
"ibc.lightclients.solomachine.v2.ClientState",
(*ClientStateI)(nil),
&ClientState{},
)

return &Client{
rpc: rpc,
encodingConfig: encodingConfig,
Expand Down
44 changes: 44 additions & 0 deletions kava/custom_files.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package kava

import (
"github.com/cosmos/cosmos-sdk/codec/types"
"github.com/gogo/protobuf/proto"
)

type ClientStateI interface {

Check failure on line 8 in kava/custom_files.go

View workflow job for this annotation

GitHub Actions / build

exported type ClientStateI should have comment or be unexported
proto.Message
}

// ClientState defines a solo machine client that tracks the current consensus
// state and if the client is frozen.
type ClientState struct {
// latest sequence of the client state
Sequence uint64 `protobuf:"varint,1,opt,name=sequence,proto3" json:"sequence,omitempty"`
// frozen sequence of the solo machine
IsFrozen bool `protobuf:"varint,2,opt,name=is_frozen,json=isFrozen,proto3" json:"is_frozen,omitempty" yaml:"is_frozen"`
ConsensusState *ConsensusState `protobuf:"bytes,3,opt,name=consensus_state,json=consensusState,proto3" json:"consensus_state,omitempty" yaml:"consensus_state"`
// when set to true, will allow governance to update a solo machine client.
// The client will be unfrozen if it is frozen.
AllowUpdateAfterProposal bool `protobuf:"varint,4,opt,name=allow_update_after_proposal,json=allowUpdateAfterProposal,proto3" json:"allow_update_after_proposal,omitempty" yaml:"allow_update_after_proposal"`
}

func (m *ClientState) Reset() { *m = ClientState{} }

Check failure on line 25 in kava/custom_files.go

View workflow job for this annotation

GitHub Actions / build

exported method ClientState.Reset should have comment or be unexported
func (m *ClientState) String() string { return proto.CompactTextString(m) }
func (*ClientState) ProtoMessage() {}

Check failure on line 27 in kava/custom_files.go

View workflow job for this annotation

GitHub Actions / build

exported method ClientState.ProtoMessage should have comment or be unexported

// ConsensusState defines a solo machine consensus state. The sequence of a
// consensus state is contained in the "height" key used in storing the
// consensus state.
type ConsensusState struct {
// public key of the solo machine
PublicKey *types.Any `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty" yaml:"public_key"`
// diversifier allows the same public key to be re-used across different solo
// machine clients (potentially on different chains) without being considered
// misbehaviour.
Diversifier string `protobuf:"bytes,2,opt,name=diversifier,proto3" json:"diversifier,omitempty"`
Timestamp uint64 `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
}

func (m *ConsensusState) Reset() { *m = ConsensusState{} }

Check failure on line 42 in kava/custom_files.go

View workflow job for this annotation

GitHub Actions / build

exported method ConsensusState.Reset should have comment or be unexported
func (m *ConsensusState) String() string { return proto.CompactTextString(m) }
func (*ConsensusState) ProtoMessage() {}

Check failure on line 44 in kava/custom_files.go

View workflow job for this annotation

GitHub Actions / build

exported method ConsensusState.ProtoMessage should have comment or be unexported

0 comments on commit f2b2809

Please sign in to comment.