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

Change smtypes and solomachinetypes alias to solomachine #2743

Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions modules/core/02-client/keeper/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
clienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types"
commitmenttypes "github.com/cosmos/ibc-go/v6/modules/core/23-commitment/types"
"github.com/cosmos/ibc-go/v6/modules/core/exported"
solomachinetypes "github.com/cosmos/ibc-go/v6/modules/light-clients/06-solomachine"
solomachine "github.com/cosmos/ibc-go/v6/modules/light-clients/06-solomachine"
ibctm "github.com/cosmos/ibc-go/v6/modules/light-clients/07-tendermint"
ibctesting "github.com/cosmos/ibc-go/v6/testing"
)
Expand All @@ -23,7 +23,7 @@ func (suite *KeeperTestSuite) TestCreateClient() {
expPass bool
}{
{"success", ibctm.NewClientState(testChainID, ibctm.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath), true},
{"client type not supported", solomachinetypes.NewClientState(0, &solomachinetypes.ConsensusState{suite.solomachine.ConsensusState().PublicKey, suite.solomachine.Diversifier, suite.solomachine.Time}), false},
{"client type not supported", solomachine.NewClientState(0, &solomachine.ConsensusState{suite.solomachine.ConsensusState().PublicKey, suite.solomachine.Diversifier, suite.solomachine.Time}), false},
}

for i, tc := range cases {
Expand Down
4 changes: 2 additions & 2 deletions modules/core/02-client/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"github.com/cosmos/ibc-go/v6/modules/core/02-client/types"
commitmenttypes "github.com/cosmos/ibc-go/v6/modules/core/23-commitment/types"
"github.com/cosmos/ibc-go/v6/modules/core/exported"
solomachinetypes "github.com/cosmos/ibc-go/v6/modules/light-clients/06-solomachine"
solomachine "github.com/cosmos/ibc-go/v6/modules/light-clients/06-solomachine"
ibctm "github.com/cosmos/ibc-go/v6/modules/light-clients/07-tendermint"
ibctesting "github.com/cosmos/ibc-go/v6/testing"
ibctestingmock "github.com/cosmos/ibc-go/v6/testing/mock"
Expand Down Expand Up @@ -190,7 +190,7 @@ func (suite *KeeperTestSuite) TestValidateSelfClient() {
},
{
"invalid client type",
solomachinetypes.NewClientState(0, &solomachinetypes.ConsensusState{suite.solomachine.ConsensusState().PublicKey, suite.solomachine.Diversifier, suite.solomachine.Time}),
solomachine.NewClientState(0, &solomachine.ConsensusState{suite.solomachine.ConsensusState().PublicKey, suite.solomachine.Diversifier, suite.solomachine.Time}),
false,
},
{
Expand Down
8 changes: 4 additions & 4 deletions modules/core/02-client/legacy/v100/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
clienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types"
host "github.com/cosmos/ibc-go/v6/modules/core/24-host"
"github.com/cosmos/ibc-go/v6/modules/core/exported"
smtypes "github.com/cosmos/ibc-go/v6/modules/light-clients/06-solomachine"
solomachine "github.com/cosmos/ibc-go/v6/modules/light-clients/06-solomachine"
ibctm "github.com/cosmos/ibc-go/v6/modules/light-clients/07-tendermint"
)

Expand Down Expand Up @@ -106,15 +106,15 @@ func MigrateStore(ctx sdk.Context, storeKey storetypes.StoreKey, cdc codec.Binar
}

// migrateSolomachine migrates the solomachine from v1 to v2 solo machine protobuf definition.
func migrateSolomachine(clientState *ClientState) *smtypes.ClientState {
func migrateSolomachine(clientState *ClientState) *solomachine.ClientState {
isFrozen := clientState.FrozenSequence != 0
consensusState := &smtypes.ConsensusState{
consensusState := &solomachine.ConsensusState{
PublicKey: clientState.ConsensusState.PublicKey,
Diversifier: clientState.ConsensusState.Diversifier,
Timestamp: clientState.ConsensusState.Timestamp,
}

return &smtypes.ClientState{
return &solomachine.ClientState{
Sequence: clientState.Sequence,
IsFrozen: isFrozen,
ConsensusState: consensusState,
Expand Down
4 changes: 2 additions & 2 deletions modules/core/02-client/types/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/cosmos/ibc-go/v6/modules/core/02-client/types"
commitmenttypes "github.com/cosmos/ibc-go/v6/modules/core/23-commitment/types"
"github.com/cosmos/ibc-go/v6/modules/core/exported"
solomachinetypes "github.com/cosmos/ibc-go/v6/modules/light-clients/06-solomachine"
solomachine "github.com/cosmos/ibc-go/v6/modules/light-clients/06-solomachine"
ibctm "github.com/cosmos/ibc-go/v6/modules/light-clients/07-tendermint"
ibctesting "github.com/cosmos/ibc-go/v6/testing"
ibctestingmock "github.com/cosmos/ibc-go/v6/testing/mock"
Expand Down Expand Up @@ -114,7 +114,7 @@ func (suite *TypesTestSuite) TestValidateGenesis() {
types.NewIdentifiedClientState(
soloMachineClientID, ibctm.NewClientState(suite.chainA.ChainID, ibctm.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath),
),
types.NewIdentifiedClientState(tmClientID0, solomachinetypes.NewClientState(0, &solomachinetypes.ConsensusState{suite.solomachine.ConsensusState().PublicKey, suite.solomachine.Diversifier, suite.solomachine.Time})),
types.NewIdentifiedClientState(tmClientID0, solomachine.NewClientState(0, &solomachine.ConsensusState{suite.solomachine.ConsensusState().PublicKey, suite.solomachine.Diversifier, suite.solomachine.Time})),
},
nil,
nil,
Expand Down
10 changes: 5 additions & 5 deletions modules/core/02-client/types/msgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/cosmos/ibc-go/v6/modules/core/02-client/types"
commitmenttypes "github.com/cosmos/ibc-go/v6/modules/core/23-commitment/types"
solomachinetypes "github.com/cosmos/ibc-go/v6/modules/light-clients/06-solomachine"
solomachine "github.com/cosmos/ibc-go/v6/modules/light-clients/06-solomachine"
ibctm "github.com/cosmos/ibc-go/v6/modules/light-clients/07-tendermint"
ibctesting "github.com/cosmos/ibc-go/v6/testing"
)
Expand Down Expand Up @@ -152,7 +152,7 @@ func (suite *TypesTestSuite) TestMsgCreateClient_ValidateBasic() {
"invalid solomachine client",
func() {
soloMachine := ibctesting.NewSolomachine(suite.T(), suite.chainA.Codec, "solomachine", "", 2)
msg, err = types.NewMsgCreateClient(&solomachinetypes.ClientState{}, soloMachine.ConsensusState(), suite.chainA.SenderAccount.GetAddress().String())
msg, err = types.NewMsgCreateClient(&solomachine.ClientState{}, soloMachine.ConsensusState(), suite.chainA.SenderAccount.GetAddress().String())
suite.Require().NoError(err)
},
false,
Expand All @@ -161,7 +161,7 @@ func (suite *TypesTestSuite) TestMsgCreateClient_ValidateBasic() {
"invalid solomachine consensus state",
func() {
soloMachine := ibctesting.NewSolomachine(suite.T(), suite.chainA.Codec, "solomachine", "", 2)
msg, err = types.NewMsgCreateClient(soloMachine.ClientState(), &solomachinetypes.ConsensusState{}, suite.chainA.SenderAccount.GetAddress().String())
msg, err = types.NewMsgCreateClient(soloMachine.ClientState(), &solomachine.ConsensusState{}, suite.chainA.SenderAccount.GetAddress().String())
suite.Require().NoError(err)
},
false,
Expand Down Expand Up @@ -301,7 +301,7 @@ func (suite *TypesTestSuite) TestMsgUpdateClient_ValidateBasic() {
{
"invalid solomachine header",
func() {
msg, err = types.NewMsgUpdateClient("solomachine", &solomachinetypes.Header{}, suite.chainA.SenderAccount.GetAddress().String())
msg, err = types.NewMsgUpdateClient("solomachine", &solomachine.Header{}, suite.chainA.SenderAccount.GetAddress().String())
suite.Require().NoError(err)
},
false,
Expand Down Expand Up @@ -583,7 +583,7 @@ func (suite *TypesTestSuite) TestMsgSubmitMisbehaviour_ValidateBasic() {
{
"invalid solomachine misbehaviour",
func() {
msg, err = types.NewMsgSubmitMisbehaviour("solomachine", &solomachinetypes.Misbehaviour{}, suite.chainA.SenderAccount.GetAddress().String())
msg, err = types.NewMsgSubmitMisbehaviour("solomachine", &solomachine.Misbehaviour{}, suite.chainA.SenderAccount.GetAddress().String())
suite.Require().NoError(err)
},
false,
Expand Down
4 changes: 2 additions & 2 deletions modules/core/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
connectiontypes "github.com/cosmos/ibc-go/v6/modules/core/03-connection/types"
channeltypes "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types"
commitmenttypes "github.com/cosmos/ibc-go/v6/modules/core/23-commitment/types"
solomachinetypes "github.com/cosmos/ibc-go/v6/modules/light-clients/06-solomachine"
solomachine "github.com/cosmos/ibc-go/v6/modules/light-clients/06-solomachine"
ibctm "github.com/cosmos/ibc-go/v6/modules/light-clients/07-tendermint"
)

Expand All @@ -16,7 +16,7 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
clienttypes.RegisterInterfaces(registry)
connectiontypes.RegisterInterfaces(registry)
channeltypes.RegisterInterfaces(registry)
solomachinetypes.RegisterInterfaces(registry)
solomachine.RegisterInterfaces(registry)
ibctm.RegisterInterfaces(registry)
commitmenttypes.RegisterInterfaces(registry)
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

clienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types"
"github.com/cosmos/ibc-go/v6/modules/core/exported"
smtypes "github.com/cosmos/ibc-go/v6/modules/light-clients/06-solomachine"
solomachine "github.com/cosmos/ibc-go/v6/modules/light-clients/06-solomachine"
ibctm "github.com/cosmos/ibc-go/v6/modules/light-clients/07-tendermint"
ibctesting "github.com/cosmos/ibc-go/v6/testing"
ibctestingmock "github.com/cosmos/ibc-go/v6/testing/mock"
Expand Down Expand Up @@ -284,7 +284,7 @@ func (suite *TendermintTestSuite) TestVerifyMisbehaviour() {
},
{
"invalid tendermint misbehaviour", func() {
misbehaviour = &smtypes.Misbehaviour{}
misbehaviour = &solomachine.Misbehaviour{}
}, false,
},
{
Expand Down Expand Up @@ -603,7 +603,7 @@ func (suite *TendermintTestSuite) TestVerifyMisbehaviourNonRevisionChainID() {
},
{
"invalid tendermint misbehaviour", func() {
misbehaviour = &smtypes.Misbehaviour{}
misbehaviour = &solomachine.Misbehaviour{}
}, false,
},
{
Expand Down
30 changes: 15 additions & 15 deletions testing/solomachine.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
commitmenttypes "github.com/cosmos/ibc-go/v6/modules/core/23-commitment/types"
host "github.com/cosmos/ibc-go/v6/modules/core/24-host"
"github.com/cosmos/ibc-go/v6/modules/core/exported"
solomachinetypes "github.com/cosmos/ibc-go/v6/modules/light-clients/06-solomachine"
solomachine "github.com/cosmos/ibc-go/v6/modules/light-clients/06-solomachine"
)

// Solomachine is a testing helper used to simulate a counterparty
Expand Down Expand Up @@ -83,16 +83,16 @@ func GenerateKeys(t *testing.T, n uint64) ([]cryptotypes.PrivKey, []cryptotypes.
}

// ClientState returns a new solo machine ClientState instance.
func (solo *Solomachine) ClientState() *solomachinetypes.ClientState {
return solomachinetypes.NewClientState(solo.Sequence, solo.ConsensusState())
func (solo *Solomachine) ClientState() *solomachine.ClientState {
return solomachine.NewClientState(solo.Sequence, solo.ConsensusState())
}

// ConsensusState returns a new solo machine ConsensusState instance
func (solo *Solomachine) ConsensusState() *solomachinetypes.ConsensusState {
func (solo *Solomachine) ConsensusState() *solomachine.ConsensusState {
publicKey, err := codectypes.NewAnyWithValue(solo.PublicKey)
require.NoError(solo.t, err)

return &solomachinetypes.ConsensusState{
return &solomachine.ConsensusState{
PublicKey: publicKey,
Diversifier: solo.Diversifier,
Timestamp: solo.Time,
Expand All @@ -107,22 +107,22 @@ func (solo *Solomachine) GetHeight() exported.Height {
// CreateHeader generates a new private/public key pair and creates the
// necessary signature to construct a valid solo machine header.
// A new diversifier will be used as well
func (solo *Solomachine) CreateHeader(newDiversifier string) *solomachinetypes.Header {
func (solo *Solomachine) CreateHeader(newDiversifier string) *solomachine.Header {
// generate new private keys and signature for header
newPrivKeys, newPubKeys, newPubKey := GenerateKeys(solo.t, uint64(len(solo.PrivateKeys)))

publicKey, err := codectypes.NewAnyWithValue(newPubKey)
require.NoError(solo.t, err)

data := &solomachinetypes.HeaderData{
data := &solomachine.HeaderData{
NewPubKey: publicKey,
NewDiversifier: newDiversifier,
}

dataBz, err := solo.cdc.Marshal(data)
require.NoError(solo.t, err)

signBytes := &solomachinetypes.SignBytes{
signBytes := &solomachine.SignBytes{
Sequence: solo.Sequence,
Timestamp: solo.Time,
Diversifier: solo.Diversifier,
Expand All @@ -135,7 +135,7 @@ func (solo *Solomachine) CreateHeader(newDiversifier string) *solomachinetypes.H

sig := solo.GenerateSignature(bz)

header := &solomachinetypes.Header{
header := &solomachine.Header{
Sequence: solo.Sequence,
Timestamp: solo.Time,
Signature: sig,
Expand All @@ -155,15 +155,15 @@ func (solo *Solomachine) CreateHeader(newDiversifier string) *solomachinetypes.H

// CreateMisbehaviour constructs testing misbehaviour for the solo machine client
// by signing over two different data bytes at the same sequence.
func (solo *Solomachine) CreateMisbehaviour() *solomachinetypes.Misbehaviour {
func (solo *Solomachine) CreateMisbehaviour() *solomachine.Misbehaviour {
merklePath := solo.GetClientStatePath("counterparty")
path, err := solo.cdc.Marshal(&merklePath)
require.NoError(solo.t, err)

data, err := solo.cdc.Marshal(solo.ClientState())
require.NoError(solo.t, err)

signBytes := &solomachinetypes.SignBytes{
signBytes := &solomachine.SignBytes{
Sequence: solo.Sequence,
Timestamp: solo.Time,
Diversifier: solo.Diversifier,
Expand All @@ -175,7 +175,7 @@ func (solo *Solomachine) CreateMisbehaviour() *solomachinetypes.Misbehaviour {
require.NoError(solo.t, err)

sig := solo.GenerateSignature(bz)
signatureOne := solomachinetypes.SignatureAndData{
signatureOne := solomachine.SignatureAndData{
Signature: sig,
Path: path,
Data: data,
Expand All @@ -192,7 +192,7 @@ func (solo *Solomachine) CreateMisbehaviour() *solomachinetypes.Misbehaviour {
data, err = solo.cdc.Marshal(solo.ConsensusState())
require.NoError(solo.t, err)

signBytes = &solomachinetypes.SignBytes{
signBytes = &solomachine.SignBytes{
Sequence: solo.Sequence,
Timestamp: solo.Time,
Diversifier: solo.Diversifier,
Expand All @@ -204,14 +204,14 @@ func (solo *Solomachine) CreateMisbehaviour() *solomachinetypes.Misbehaviour {
require.NoError(solo.t, err)

sig = solo.GenerateSignature(bz)
signatureTwo := solomachinetypes.SignatureAndData{
signatureTwo := solomachine.SignatureAndData{
Signature: sig,
Path: path,
Data: data,
Timestamp: solo.Time,
}

return &solomachinetypes.Misbehaviour{
return &solomachine.Misbehaviour{
ClientId: solo.ClientID,
Sequence: solo.Sequence,
SignatureOne: &signatureOne,
Expand Down