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

Provenance 479 ibc go v2.0.2 and remove address truncation #1

Merged
merged 8 commits into from
Jan 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
16 changes: 8 additions & 8 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ import (
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
transfer "github.com/cosmos/ibc-go/modules/apps/transfer"
ibctransferkeeper "github.com/cosmos/ibc-go/modules/apps/transfer/keeper"
ibctransfertypes "github.com/cosmos/ibc-go/modules/apps/transfer/types"
ibc "github.com/cosmos/ibc-go/modules/core"
ibcclient "github.com/cosmos/ibc-go/modules/core/02-client"
porttypes "github.com/cosmos/ibc-go/modules/core/05-port/types"
ibchost "github.com/cosmos/ibc-go/modules/core/24-host"
ibckeeper "github.com/cosmos/ibc-go/modules/core/keeper"
transfer "github.com/cosmos/ibc-go/v2/modules/apps/transfer"
ibctransferkeeper "github.com/cosmos/ibc-go/v2/modules/apps/transfer/keeper"
ibctransfertypes "github.com/cosmos/ibc-go/v2/modules/apps/transfer/types"
ibc "github.com/cosmos/ibc-go/v2/modules/core"
ibcclient "github.com/cosmos/ibc-go/v2/modules/core/02-client"
porttypes "github.com/cosmos/ibc-go/v2/modules/core/05-port/types"
ibchost "github.com/cosmos/ibc-go/v2/modules/core/24-host"
ibckeeper "github.com/cosmos/ibc-go/v2/modules/core/keeper"

// unnamed import of statik for swagger UI support
_ "github.com/cosmos/cosmos-sdk/client/docs/statik"
Expand Down
11 changes: 6 additions & 5 deletions app/sim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ package app
import (
"encoding/json"
"fmt"
"os"
"path/filepath"
"testing"

"github.com/CosmWasm/wasmd/x/wasm"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/simapp"
Expand All @@ -20,15 +24,12 @@ import (
"github.com/cosmos/cosmos-sdk/x/simulation"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
ibctransfertypes "github.com/cosmos/ibc-go/modules/apps/transfer/types"
ibchost "github.com/cosmos/ibc-go/modules/core/24-host"
ibctransfertypes "github.com/cosmos/ibc-go/v2/modules/apps/transfer/types"
ibchost "github.com/cosmos/ibc-go/v2/modules/core/24-host"
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/libs/log"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
dbm "github.com/tendermint/tm-db"
"os"
"path/filepath"
"testing"
)

// Get flags every time the simulator is run
Expand Down
4 changes: 2 additions & 2 deletions app/test_access.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
ibctransferkeeper "github.com/cosmos/ibc-go/modules/apps/transfer/keeper"
ibckeeper "github.com/cosmos/ibc-go/modules/core/keeper"
ibctransferkeeper "github.com/cosmos/ibc-go/v2/modules/apps/transfer/keeper"
ibckeeper "github.com/cosmos/ibc-go/v2/modules/core/keeper"
)

type TestSupport struct {
Expand Down
11 changes: 6 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ go 1.16

require (
github.com/CosmWasm/wasmvm v0.16.0
github.com/cosmos/cosmos-sdk v0.44.0
github.com/containerd/continuity v0.1.0 // indirect
github.com/cosmos/cosmos-sdk v0.44.5
github.com/cosmos/iavl v0.17.1
github.com/cosmos/ibc-go v1.0.0
github.com/cosmos/ibc-go/v2 v2.0.2
github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b
github.com/gogo/protobuf v1.3.3
github.com/golang/protobuf v1.5.2
Expand All @@ -19,16 +20,16 @@ require (
github.com/regen-network/cosmos-proto v0.3.1
github.com/rs/zerolog v1.23.0
github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa
github.com/spf13/cast v1.4.0
github.com/spf13/cast v1.4.1
github.com/spf13/cobra v1.2.1
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.8.1
github.com/stretchr/testify v1.7.0
github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca
github.com/tendermint/tendermint v0.34.14
github.com/tendermint/tm-db v0.6.4
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c
google.golang.org/grpc v1.40.0
google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71
google.golang.org/grpc v1.42.0
gopkg.in/yaml.v2 v2.4.0
)

Expand Down
97 changes: 21 additions & 76 deletions go.sum

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions x/wasm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ was sent:
},
{
"key": "_contract_address",
"value": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhuc53mp6"
"value": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr"
}
]
}
Expand All @@ -70,7 +70,7 @@ provide a initial balance in the same `MsgInstantiateContract`. We see the follo
"Attr": [
{
"key": "recipient",
"value": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhuc53mp6"
"value": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr"
},
{
"key": "sender",
Expand All @@ -97,7 +97,7 @@ Here is an example from the escrow contract successfully releasing funds to the
"Attr": [
{
"key": "_contract_address",
"value": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhuc53mp6"
"value": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr"
},
{
"key": "action",
Expand Down Expand Up @@ -131,7 +131,7 @@ was executed (which always appears, while 2 is optional and has information as r
"Attr": [
{
"key": "recipient",
"value": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhuc53mp6"
"value": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr"
},
{
"key": "sender",
Expand All @@ -148,7 +148,7 @@ was executed (which always appears, while 2 is optional and has information as r
"Attr": [
{
"key": "_contract_address",
"value": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhuc53mp6"
"value": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr"
},
{
"key": "action",
Expand All @@ -169,7 +169,7 @@ was executed (which always appears, while 2 is optional and has information as r
},
{
"key": "sender",
"value": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhuc53mp6"
"value": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr"
},
{
"key": "amount",
Expand All @@ -194,7 +194,7 @@ was executed (which always appears, while 2 is optional and has information as r
},
{
"key": "_contract_address",
"value": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhuc53mp6"
"value": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr"
}
]
}
Expand Down
4 changes: 2 additions & 2 deletions x/wasm/client/cli/genesis_msg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ func TestInstantiateContractCmd(t *testing.T) {
}

func TestExecuteContractCmd(t *testing.T) {
const firstContractAddress = "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhuc53mp6"
const firstContractAddress = "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr"
minimalWasmGenesis := types.GenesisState{
Params: types.DefaultParams(),
}
Expand Down Expand Up @@ -384,7 +384,7 @@ func TestExecuteContractCmd(t *testing.T) {
},
mutator: func(cmd *cobra.Command) {
// See TestBuildContractAddress in keeper_test.go
cmd.SetArgs([]string{"cosmos1mujpjkwhut9yjw4xueyugc02evfv46y04aervg", `{}`})
cmd.SetArgs([]string{"cosmos1mujpjkwhut9yjw4xueyugc02evfv46y0dtmnz4lh8xxkkdapym9stu5qm8", `{}`})
flagSet := cmd.Flags()
flagSet.Set("run-as", myWellFundedAccount)
},
Expand Down
2 changes: 1 addition & 1 deletion x/wasm/client/cli/gov_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

func ProposalStoreCodeCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "wasm-store [wasm file] --source [source] --builder [builder] --title [text] --description [text] --run-as [address]",
Use: "wasm-store [wasm file] --title [text] --description [text] --run-as [address]",
Short: "Submit a wasm binary proposal",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
6 changes: 3 additions & 3 deletions x/wasm/client/proposal_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func TestGovRestHandlers(t *testing.T) {
"title": "Test Proposal",
"description": "My proposal",
"type": "migrate",
"contract": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhuc53mp6",
"contract": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr",
"code_id": "1",
"msg": dict{"foo": "bar"},
"run_as": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz",
Expand All @@ -188,7 +188,7 @@ func TestGovRestHandlers(t *testing.T) {
"title": "Test Proposal",
"description": "My proposal",
"type": "migrate",
"contract": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhuc53mp6",
"contract": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr",
"new_admin": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz",
"deposit": []dict{{"denom": "ustake", "amount": "10"}},
"proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
Expand All @@ -202,7 +202,7 @@ func TestGovRestHandlers(t *testing.T) {
"title": "Test Proposal",
"description": "My proposal",
"type": "migrate",
"contract": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhuc53mp6",
"contract": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr",
"deposit": []dict{{"denom": "ustake", "amount": "10"}},
"proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
"base_req": aBaseReq,
Expand Down
39 changes: 23 additions & 16 deletions x/wasm/ibc.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
channeltypes "github.com/cosmos/ibc-go/modules/core/04-channel/types"
porttypes "github.com/cosmos/ibc-go/modules/core/05-port/types"
host "github.com/cosmos/ibc-go/modules/core/24-host"
"github.com/cosmos/ibc-go/modules/core/exported"
channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types"
porttypes "github.com/cosmos/ibc-go/v2/modules/core/05-port/types"
host "github.com/cosmos/ibc-go/v2/modules/core/24-host"
"github.com/cosmos/ibc-go/v2/modules/core/exported"
)

var _ porttypes.IBCModule = IBCHandler{}
Expand Down Expand Up @@ -249,43 +249,39 @@ func (i IBCHandler) OnRecvPacket(
// OnAcknowledgementPacket implements the IBCModule interface
func (i IBCHandler) OnAcknowledgementPacket(
ctx sdk.Context, packet channeltypes.Packet, acknowledgement []byte, relayer sdk.AccAddress,
) (*sdk.Result, error) {
) error {
contractAddr, err := ContractFromPortID(packet.SourcePort)
if err != nil {
return nil, sdkerrors.Wrapf(err, "contract port id")
return sdkerrors.Wrapf(err, "contract port id")
}

err = i.keeper.OnAckPacket(ctx, contractAddr, wasmvmtypes.IBCPacketAckMsg{
Acknowledgement: wasmvmtypes.IBCAcknowledgement{Data: acknowledgement},
OriginalPacket: newIBCPacket(packet),
})
if err != nil {
return nil, err
return err
}

return &sdk.Result{
Events: ctx.EventManager().Events().ToABCIEvents(),
}, nil
return nil

}

// OnTimeoutPacket implements the IBCModule interface
func (i IBCHandler) OnTimeoutPacket(
ctx sdk.Context, packet channeltypes.Packet, relayer sdk.AccAddress,
) (*sdk.Result, error) {
) error {
contractAddr, err := ContractFromPortID(packet.SourcePort)
if err != nil {
return nil, sdkerrors.Wrapf(err, "contract port id")
return sdkerrors.Wrapf(err, "contract port id")
}
msg := wasmvmtypes.IBCPacketTimeoutMsg{Packet: newIBCPacket(packet)}
err = i.keeper.OnTimeoutPacket(ctx, contractAddr, msg)
if err != nil {
return nil, err
return err
}

return &sdk.Result{
Events: ctx.EventManager().Events().ToABCIEvents(),
}, nil
return nil

}

Expand Down Expand Up @@ -321,3 +317,14 @@ func ValidateChannelParams(channelID string) error {
}
return nil
}

func (i IBCHandler) NegotiateAppVersion(
ctx sdk.Context,
order channeltypes.Order,
connectionID string,
portID string,
counterparty channeltypes.Counterparty,
proposedVersion string,
) (version string, err error) {
return proposedVersion, nil
}
7 changes: 4 additions & 3 deletions x/wasm/ibc_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package wasm

import (
"testing"

wasmvmtypes "github.com/CosmWasm/wasmvm/types"
clienttypes "github.com/cosmos/ibc-go/modules/core/02-client/types"
channeltypes "github.com/cosmos/ibc-go/modules/core/04-channel/types"
clienttypes "github.com/cosmos/ibc-go/v2/modules/core/02-client/types"
channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types"
"github.com/stretchr/testify/assert"
"testing"
)

func TestMapToWasmVMIBCPacket(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion x/wasm/ibctesting/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ import (
"github.com/tendermint/tendermint/libs/log"
dbm "github.com/tendermint/tm-db"

"github.com/cosmos/ibc-go/modules/apps/transfer/simapp"
"github.com/cosmos/ibc-go/v2/modules/apps/transfer/simapp"
"github.com/CosmWasm/wasmd/x/wasm/ibctesting"
)

Expand Down
2 changes: 1 addition & 1 deletion x/wasm/ibctesting/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/cosmos/ibc-go/modules/core/keeper"
"github.com/cosmos/ibc-go/v2/modules/core/keeper"
"github.com/stretchr/testify/require"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/log"
Expand Down
14 changes: 7 additions & 7 deletions x/wasm/ibctesting/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ import (
tmtypes "github.com/tendermint/tendermint/types"
tmversion "github.com/tendermint/tendermint/version"

clienttypes "github.com/cosmos/ibc-go/modules/core/02-client/types"
channeltypes "github.com/cosmos/ibc-go/modules/core/04-channel/types"
commitmenttypes "github.com/cosmos/ibc-go/modules/core/23-commitment/types"
host "github.com/cosmos/ibc-go/modules/core/24-host"
"github.com/cosmos/ibc-go/modules/core/exported"
"github.com/cosmos/ibc-go/modules/core/types"
ibctmtypes "github.com/cosmos/ibc-go/modules/light-clients/07-tendermint/types"
clienttypes "github.com/cosmos/ibc-go/v2/modules/core/02-client/types"
channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types"
commitmenttypes "github.com/cosmos/ibc-go/v2/modules/core/23-commitment/types"
host "github.com/cosmos/ibc-go/v2/modules/core/24-host"
"github.com/cosmos/ibc-go/v2/modules/core/exported"
"github.com/cosmos/ibc-go/v2/modules/core/types"
ibctmtypes "github.com/cosmos/ibc-go/v2/modules/light-clients/07-tendermint/types"

"github.com/CosmWasm/wasmd/x/wasm/ibctesting/mock"
"github.com/CosmWasm/wasmd/x/wasm/ibctesting/simapp"
Expand Down
8 changes: 4 additions & 4 deletions x/wasm/ibctesting/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package ibctesting
import (
"time"

connectiontypes "github.com/cosmos/ibc-go/modules/core/03-connection/types"
channeltypes "github.com/cosmos/ibc-go/modules/core/04-channel/types"
"github.com/cosmos/ibc-go/modules/core/exported"
ibctmtypes "github.com/cosmos/ibc-go/modules/light-clients/07-tendermint/types"
connectiontypes "github.com/cosmos/ibc-go/v2/modules/core/03-connection/types"
channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types"
"github.com/cosmos/ibc-go/v2/modules/core/exported"
ibctmtypes "github.com/cosmos/ibc-go/v2/modules/light-clients/07-tendermint/types"

"github.com/CosmWasm/wasmd/x/wasm/ibctesting/mock"
)
Expand Down
4 changes: 2 additions & 2 deletions x/wasm/ibctesting/coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"testing"
"time"

channeltypes "github.com/cosmos/ibc-go/modules/core/04-channel/types"
host "github.com/cosmos/ibc-go/modules/core/24-host"
channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types"
host "github.com/cosmos/ibc-go/v2/modules/core/24-host"
"github.com/stretchr/testify/require"
abci "github.com/tendermint/tendermint/abci/types"

Expand Down
14 changes: 7 additions & 7 deletions x/wasm/ibctesting/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import (
// sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/stretchr/testify/require"

clienttypes "github.com/cosmos/ibc-go/modules/core/02-client/types"
connectiontypes "github.com/cosmos/ibc-go/modules/core/03-connection/types"
channeltypes "github.com/cosmos/ibc-go/modules/core/04-channel/types"
commitmenttypes "github.com/cosmos/ibc-go/modules/core/23-commitment/types"
host "github.com/cosmos/ibc-go/modules/core/24-host"
"github.com/cosmos/ibc-go/modules/core/exported"
ibctmtypes "github.com/cosmos/ibc-go/modules/light-clients/07-tendermint/types"
clienttypes "github.com/cosmos/ibc-go/v2/modules/core/02-client/types"
connectiontypes "github.com/cosmos/ibc-go/v2/modules/core/03-connection/types"
channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types"
commitmenttypes "github.com/cosmos/ibc-go/v2/modules/core/23-commitment/types"
host "github.com/cosmos/ibc-go/v2/modules/core/24-host"
"github.com/cosmos/ibc-go/v2/modules/core/exported"
ibctmtypes "github.com/cosmos/ibc-go/v2/modules/light-clients/07-tendermint/types"
)

// Endpoint is a which represents a channel endpoint and its associated
Expand Down
Loading