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

x/ibc: proto migration pt 1 #6097

Merged
merged 33 commits into from
May 6, 2020
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
31a4670
x/ibc: proto migration pt 1
fedekunze Apr 29, 2020
7524bf7
fix tests
fedekunze Apr 29, 2020
5596dd3
fixes and godoc
fedekunze Apr 29, 2020
b911032
yaml tags
fedekunze Apr 29, 2020
68cc932
rm changelog
fedekunze Apr 29, 2020
22bc941
fix conflicts
fedekunze May 4, 2020
ad022fa
address comments from review
fedekunze May 4, 2020
0ccb4e1
fix some tests
fedekunze May 4, 2020
7d5d0c6
fix tests
fedekunze May 4, 2020
b8b04c6
Merge branch 'master' into ibc-proto-1
fedekunze May 4, 2020
50eab5a
Merge branch 'master' of github.com:cosmos/cosmos-sdk into ibc-proto-1
fedekunze May 4, 2020
2fd640b
add _UNSPECIFIED suffix for default enums
fedekunze May 4, 2020
6650381
Merge branch 'ibc-proto-1' of github.com:cosmos/cosmos-sdk into ibc-p…
fedekunze May 4, 2020
87fdf2d
Merge branch 'master' into ibc-proto-1
fedekunze May 4, 2020
568a95b
Merge branch 'master' into ibc-proto-1
alexanderbez May 4, 2020
baf0601
Merge branch 'master' into ibc-proto-1
fedekunze May 5, 2020
4f584f7
Merge branch 'master' into ibc-proto-1
alexanderbez May 5, 2020
6a6a482
Update app
alexanderbez May 5, 2020
8c94311
protobuf Any fixes
fedekunze May 5, 2020
e8b8a6a
use gogoproto
fedekunze May 5, 2020
41e1d06
fix conflicts
fedekunze May 5, 2020
4b96586
fix tests
fedekunze May 5, 2020
3a43058
Merge branch 'master' into ibc-proto-1
alexanderbez May 5, 2020
1018479
Merge branch 'master' into ibc-proto-1
aaronc May 5, 2020
0416af2
Merge branch 'master' into ibc-proto-1
fedekunze May 5, 2020
79e6f0a
wrap all messages
fedekunze May 5, 2020
1ac2173
Merge branch 'ibc-proto-1' of github.com:cosmos/cosmos-sdk into ibc-p…
fedekunze May 5, 2020
8a62f8a
address @alexanderbez comments
fedekunze May 6, 2020
eb8f67a
update proto files
fedekunze May 6, 2020
0ae4ccf
Merge branch 'master' into ibc-proto-1
fedekunze May 6, 2020
2e6048b
Merge branch 'master' into ibc-proto-1
fedekunze May 6, 2020
660269b
Merge branch 'master' into ibc-proto-1
fedekunze May 6, 2020
8b3261e
Merge branch 'master' into ibc-proto-1
fedekunze May 6, 2020
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
6 changes: 4 additions & 2 deletions simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,15 @@ func NewSimApp(
)

// Create IBC Keeper
// TODO: remove amino codec dependency once Tendermint version is upgraded with
// protobuf changes
app.IBCKeeper = ibc.NewKeeper(
app.cdc, keys[ibc.StoreKey], app.StakingKeeper, scopedIBCKeeper,
app.cdc, appCodec, keys[ibc.StoreKey], app.StakingKeeper, scopedIBCKeeper,
)

// Create Transfer Keepers
app.TransferKeeper = transfer.NewKeeper(
app.cdc, keys[transfer.StoreKey],
appCodec, keys[transfer.StoreKey],
app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper,
app.AccountKeeper, app.BankKeeper, scopedTransferKeeper,
)
Expand Down
7 changes: 4 additions & 3 deletions std/codec.pb.go

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

7 changes: 4 additions & 3 deletions std/codec.proto
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ message MsgSubmitProposal {
Content content = 2;
}

// Proposal defines the application-level concrete proposal type used in governance
// proposals.
// Proposal defines the application-level concrete proposal type used in
// governance proposals.
message Proposal {
option (gogoproto.equal) = true;

Expand All @@ -67,7 +67,8 @@ message Content {
option (gogoproto.equal) = true;
option (cosmos_proto.interface_type) = "*github.com/cosmos/cosmos-sdk/x/gov/types.Content";

// sum defines a set of all acceptable concrete governance proposal Content types.
// sum defines a set of all acceptable concrete governance proposal Content
// types.
oneof sum {
cosmos_sdk.x.gov.v1.TextProposal text = 1;
cosmos_sdk.x.params.v1.ParameterChangeProposal parameter_change = 2;
Expand Down
4 changes: 2 additions & 2 deletions x/evidence/types/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package types
import (
"time"

"github.com/tendermint/tendermint/crypto"

sdk "github.com/cosmos/cosmos-sdk/types"
stakingexported "github.com/cosmos/cosmos-sdk/x/staking/exported"

"github.com/tendermint/tendermint/crypto"
)

type (
Expand Down
4 changes: 2 additions & 2 deletions x/ibc/02-client/exported/exported.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type ClientState interface {
consensusState ConsensusState,
) error
VerifyConnectionState(
cdc *codec.Codec,
cdc codec.Marshaler,
height uint64,
prefix commitmentexported.Prefix,
proof commitmentexported.Proof,
Expand All @@ -44,7 +44,7 @@ type ClientState interface {
consensusState ConsensusState,
) error
VerifyChannelState(
cdc *codec.Codec,
cdc codec.Marshaler,
height uint64,
prefix commitmentexported.Prefix,
proof commitmentexported.Proof,
Expand Down
1 change: 1 addition & 0 deletions x/ibc/03-connection/alias.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var (
QuerierConnections = keeper.QuerierConnections
QuerierClientConnections = keeper.QuerierClientConnections
RegisterCodec = types.RegisterCodec
RegisterInterfaces = types.RegisterInterfaces
NewConnectionEnd = types.NewConnectionEnd
NewCounterparty = types.NewCounterparty
ErrConnectionExists = types.ErrConnectionExists
Expand Down
54 changes: 27 additions & 27 deletions x/ibc/03-connection/client/rest/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/cosmos/cosmos-sdk/client/context"
"github.com/cosmos/cosmos-sdk/types/rest"
commitmentexported "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/exported"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
)

const (
Expand All @@ -21,42 +21,42 @@ func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router, queryRoute string)

// ConnectionOpenInitReq defines the properties of a connection open init request's body.
type ConnectionOpenInitReq struct {
BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
ConnectionID string `json:"connection_id" yaml:"connection_id"`
ClientID string `json:"client_id" yaml:"client_id"`
CounterpartyClientID string `json:"counterparty_client_id" yaml:"counterparty_client_id"`
CounterpartyConnectionID string `json:"counterparty_connection_id" yaml:"counterparty_connection_id"`
CounterpartyPrefix commitmentexported.Prefix `json:"counterparty_prefix" yaml:"counterparty_prefix"`
BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
ConnectionID string `json:"connection_id" yaml:"connection_id"`
ClientID string `json:"client_id" yaml:"client_id"`
CounterpartyClientID string `json:"counterparty_client_id" yaml:"counterparty_client_id"`
CounterpartyConnectionID string `json:"counterparty_connection_id" yaml:"counterparty_connection_id"`
CounterpartyPrefix commitmenttypes.MerklePrefix `json:"counterparty_prefix" yaml:"counterparty_prefix"`
}

// ConnectionOpenTryReq defines the properties of a connection open try request's body.
type ConnectionOpenTryReq struct {
BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
ConnectionID string `json:"connection_id" yaml:"connection_id"`
ClientID string `json:"client_id" yaml:"client_id"`
CounterpartyClientID string `json:"counterparty_client_id" yaml:"counterparty_client_id"`
CounterpartyConnectionID string `json:"counterparty_connection_id" yaml:"counterparty_connection_id"`
CounterpartyPrefix commitmentexported.Prefix `json:"counterparty_prefix" yaml:"counterparty_prefix"`
CounterpartyVersions []string `json:"counterparty_versions" yaml:"counterparty_versions"`
ProofInit commitmentexported.Proof `json:"proof_init" yaml:"proof_init"`
ProofConsensus commitmentexported.Proof `json:"proof_consensus" yaml:"proof_consensus"`
ProofHeight uint64 `json:"proof_height" yaml:"proof_height"`
ConsensusHeight uint64 `json:"consensus_height" yaml:"consensus_height"`
BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
ConnectionID string `json:"connection_id" yaml:"connection_id"`
ClientID string `json:"client_id" yaml:"client_id"`
CounterpartyClientID string `json:"counterparty_client_id" yaml:"counterparty_client_id"`
CounterpartyConnectionID string `json:"counterparty_connection_id" yaml:"counterparty_connection_id"`
CounterpartyPrefix commitmenttypes.MerklePrefix `json:"counterparty_prefix" yaml:"counterparty_prefix"`
CounterpartyVersions []string `json:"counterparty_versions" yaml:"counterparty_versions"`
ProofInit commitmenttypes.MerkleProof `json:"proof_init" yaml:"proof_init"`
ProofConsensus commitmenttypes.MerkleProof `json:"proof_consensus" yaml:"proof_consensus"`
ProofHeight uint64 `json:"proof_height" yaml:"proof_height"`
ConsensusHeight uint64 `json:"consensus_height" yaml:"consensus_height"`
}

// ConnectionOpenAckReq defines the properties of a connection open ack request's body.
type ConnectionOpenAckReq struct {
BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
ProofTry commitmentexported.Proof `json:"proof_try" yaml:"proof_try"`
ProofConsensus commitmentexported.Proof `json:"proof_consensus" yaml:"proof_consensus"`
ProofHeight uint64 `json:"proof_height" yaml:"proof_height"`
ConsensusHeight uint64 `json:"consensus_height" yaml:"consensus_height"`
Version string `json:"version" yaml:"version"`
BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
ProofTry commitmenttypes.MerkleProof `json:"proof_try" yaml:"proof_try"`
ProofConsensus commitmenttypes.MerkleProof `json:"proof_consensus" yaml:"proof_consensus"`
ProofHeight uint64 `json:"proof_height" yaml:"proof_height"`
ConsensusHeight uint64 `json:"consensus_height" yaml:"consensus_height"`
Version string `json:"version" yaml:"version"`
}

// ConnectionOpenConfirmReq defines the properties of a connection open confirm request's body.
type ConnectionOpenConfirmReq struct {
BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
ProofAck commitmentexported.Proof `json:"proof_ack" yaml:"proof_ack"`
ProofHeight uint64 `json:"proof_height" yaml:"proof_height"`
BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
ProofAck commitmenttypes.MerkleProof `json:"proof_ack" yaml:"proof_ack"`
ProofHeight uint64 `json:"proof_height" yaml:"proof_height"`
}
70 changes: 2 additions & 68 deletions x/ibc/03-connection/exported/exported.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package exported

import (
"encoding/json"

commitmentexported "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/exported"
ibctypes "github.com/cosmos/cosmos-sdk/x/ibc/types"
)

// ConnectionI describes the required methods for a connection.
type ConnectionI interface {
GetState() State
GetState() ibctypes.State
GetID() string
GetClientID() string
GetCounterparty() CounterpartyI
Expand All @@ -23,68 +22,3 @@ type CounterpartyI interface {
GetPrefix() commitmentexported.Prefix
ValidateBasic() error
}

// State defines the state of a connection between two disctinct
// chains
type State byte

// available connection states
const (
UNINITIALIZED State = iota // default State
INIT
TRYOPEN
OPEN
)

// string representation of the connection states
const (
StateUninitialized string = "UNINITIALIZED"
StateInit string = "INIT"
StateTryOpen string = "TRYOPEN"
StateOpen string = "OPEN"
)

// String implements the Stringer interface
func (s State) String() string {
switch s {
case INIT:
return StateInit
case TRYOPEN:
return StateTryOpen
case OPEN:
return StateOpen
default:
return StateUninitialized
}
}

// StateFromString parses a string into a connection state
func StateFromString(state string) State {
switch state {
case StateInit:
return INIT
case StateTryOpen:
return TRYOPEN
case StateOpen:
return OPEN
default:
return UNINITIALIZED
}
}

// MarshalJSON marshal to JSON using string.
func (s State) MarshalJSON() ([]byte, error) {
return json.Marshal(s.String())
}

// UnmarshalJSON decodes from JSON assuming Bech32 encoding.
func (s *State) UnmarshalJSON(data []byte) error {
var str string
err := json.Unmarshal(data, &str)
if err != nil {
return err
}

*s = StateFromString(str)
return nil
}
46 changes: 0 additions & 46 deletions x/ibc/03-connection/exported/exported_test.go

This file was deleted.

Loading