Skip to content

Commit

Permalink
cleaning up
Browse files Browse the repository at this point in the history
  • Loading branch information
insumity committed Feb 5, 2024
1 parent 4eac8bf commit 8f2269f
Show file tree
Hide file tree
Showing 7 changed files with 845 additions and 65 deletions.
5 changes: 3 additions & 2 deletions proto/interchain_security/ccv/provider/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ message MsgOptIn {
string chain_id = 1;
// the validator address on the provider
string provider_addr = 2 [ (gogoproto.moretags) = "yaml:\"address\"" ];
// the consensus public key to use on the consumer in json string format corresponding to proto-any,
// (optional) the consensus public key to use on the consumer in json string format corresponding to proto-any,
// for example `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is="}`
string consumerKey = 3;
// we can set `consumer_key = ""` if we do not consider the `consumer_key`
string consumer_key = 3;
}

message MsgOptInResponse {}
Expand Down
6 changes: 3 additions & 3 deletions x/ccv/provider/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,12 @@ func NewOptInCmd() *cobra.Command {

providerValAddr := clientCtx.GetFromAddress()

var consumerPubKey types.MsgOptIn_ConsumerKey
var consumerPubKey string
if len(args) == 2 {
// consumer public key was provided
consumerPubKey = types.MsgOptIn_ConsumerKey{ConsumerKey: args[1]}
consumerPubKey = args[1]
} else {
consumerPubKey = types.MsgOptIn_ConsumerKey{}
consumerPubKey = ""
}
msg, err := types.NewMsgOptIn(args[0], sdk.ValAddress(providerValAddr), consumerPubKey)

Expand Down
2 changes: 1 addition & 1 deletion x/ccv/provider/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

// RegisterLegacyAminoCodec registers the necessary x/ibc transfer interfaces and concrete types
// on the provided `LegacyAmino codec. These types are used for Amino JSON serialization.
// on the provided LegacyAmino codec. These types are used for Amino JSON serialization.
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
}

Expand Down
6 changes: 3 additions & 3 deletions x/ccv/provider/types/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,15 @@ const (
TopNBytePrefix

// OptedInBytePrefix is the byte prefix used when storing for each consumer chain all the opted in validators
OptedInBytePrefix = 31
OptedInBytePrefix

// ToBeOptedInBytePrefix is the byte prefix used when storing for each consumer chain the validators that
// are about to be opted in
ToBeOptedInBytePrefix = 32
ToBeOptedInBytePrefix

// ToBeOptedOutBytePrefix is the byte prefix used when storing for each consumer chain the validators that
// are about to be opted out
ToBeOptedOutBytePrefix = 33
ToBeOptedOutBytePrefix

// NOTE: DO NOT ADD NEW BYTE PREFIXES HERE WITHOUT ADDING THEM TO getAllKeyPrefixes() IN keys_test.go
)
Expand Down
8 changes: 4 additions & 4 deletions x/ccv/provider/types/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,11 @@ func (msg MsgSubmitConsumerDoubleVoting) GetSigners() []sdk.AccAddress {
}

// NewMsgOptIn creates a new NewMsgOptIn instance.
func NewMsgOptIn(chainID string, providerValidatorAddress sdk.ValAddress, consumerConsensusPubKey MsgOptIn_ConsumerKey) (*MsgOptIn, error) {
func NewMsgOptIn(chainID string, providerValidatorAddress sdk.ValAddress, consumerConsensusPubKey string) (*MsgOptIn, error) {
return &MsgOptIn{
ChainId: chainID,
ProviderAddr: providerValidatorAddress.String(),
XConsumerKey: &consumerConsensusPubKey,
ConsumerKey: consumerConsensusPubKey,
}, nil
}

Expand Down Expand Up @@ -253,8 +253,8 @@ func (msg MsgOptIn) ValidateBasic() error {
return ErrInvalidProviderAddress
}

if _, ok := msg.XConsumerKey.(*MsgOptIn_ConsumerKey); ok {
if _, _, err := ParseConsumerKeyFromJson(msg.GetConsumerKey()); err != nil {
if msg.ConsumerKey != "" {
if _, _, err := ParseConsumerKeyFromJson(msg.ConsumerKey); err != nil {
return ErrInvalidConsumerConsensusPubKey
}
}
Expand Down
8 changes: 4 additions & 4 deletions x/ccv/provider/types/provider.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8f2269f

Please sign in to comment.