Skip to content

Commit

Permalink
Resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
alpe committed Apr 24, 2023
1 parent 451950a commit 60f3f81
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 41 deletions.
6 changes: 1 addition & 5 deletions x/wasm/ibc.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,12 +264,8 @@ func (i IBCHandler) OnRecvPacket(
) ibcexported.Acknowledgement {
contractAddr, err := ContractFromPortID(packet.DestinationPort)
if err != nil {
<<<<<<< HEAD
return channeltypes.NewErrorAcknowledgement(sdkerrors.Wrapf(err, "contract port id"))
=======
// this must not happen as ports were registered before
panic(errorsmod.Wrapf(err, "contract port id"))
>>>>>>> 7cd5893e (Redesign IBC on packet recv error/ result.Err handling)
panic(sdkerrors.Wrapf(err, "contract port id"))
}

em := sdk.NewEventManager()
Expand Down
41 changes: 18 additions & 23 deletions x/wasm/ibc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,15 @@ import (
"testing"

wasmvmtypes "github.com/CosmWasm/wasmvm/types"
<<<<<<< HEAD
clienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types"
channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
=======
abci "github.com/cometbft/cometbft/abci/types"
"github.com/cometbft/cometbft/libs/rand"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/address"
clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported"
>>>>>>> 7cd5893e (Redesign IBC on packet recv error/ result.Err handling)
clienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types"
channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
ibcexported "github.com/cosmos/ibc-go/v4/modules/core/exported"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/rand"

"github.com/CosmWasm/wasmd/x/wasm/keeper"
"github.com/CosmWasm/wasmd/x/wasm/types"
Expand Down Expand Up @@ -46,9 +41,9 @@ func TestOnRecvPacket(t *testing.T) {
{
Type: "ibc_packet_received",
Attributes: []abci.EventAttribute{
{Key: "module", Value: "wasm"},
{Key: "_contract_address", Value: "cosmos1w09vr7rpe2agu0kg2zlpkdckce865l3zps8mxjurxthfh3m7035qe5hh7f"},
{Key: "success", Value: "true"},
{Key: []byte("module"), Value: []byte("wasm")},
{Key: []byte("_contract_address"), Value: []byte("cosmos1w09vr7rpe2agu0kg2zlpkdckce865l3zps8mxjurxthfh3m7035qe5hh7f")},
{Key: []byte("success"), Value: []byte("true")},
},
},
},
Expand All @@ -61,9 +56,9 @@ func TestOnRecvPacket(t *testing.T) {
{
Type: "ibc_packet_received",
Attributes: []abci.EventAttribute{
{Key: "module", Value: "wasm"},
{Key: "_contract_address", Value: "cosmos1w09vr7rpe2agu0kg2zlpkdckce865l3zps8mxjurxthfh3m7035qe5hh7f"},
{Key: "success", Value: "false"},
{Key: []byte("module"), Value: []byte("wasm")},
{Key: []byte("_contract_address"), Value: []byte("cosmos1w09vr7rpe2agu0kg2zlpkdckce865l3zps8mxjurxthfh3m7035qe5hh7f")},
{Key: []byte("success"), Value: []byte("false")},
},
},
},
Expand All @@ -75,9 +70,9 @@ func TestOnRecvPacket(t *testing.T) {
{
Type: "ibc_packet_received",
Attributes: []abci.EventAttribute{
{Key: "module", Value: "wasm"},
{Key: "_contract_address", Value: "cosmos1w09vr7rpe2agu0kg2zlpkdckce865l3zps8mxjurxthfh3m7035qe5hh7f"},
{Key: "success", Value: "true"},
{Key: []byte("module"), Value: []byte("wasm")},
{Key: []byte("_contract_address"), Value: []byte("cosmos1w09vr7rpe2agu0kg2zlpkdckce865l3zps8mxjurxthfh3m7035qe5hh7f")},
{Key: []byte("success"), Value: []byte("true")},
},
},
},
Expand All @@ -95,10 +90,10 @@ func TestOnRecvPacket(t *testing.T) {
expEvents: sdk.Events{{
Type: "ibc_packet_received",
Attributes: []abci.EventAttribute{
{Key: "module", Value: "wasm"},
{Key: "_contract_address", Value: "cosmos1w09vr7rpe2agu0kg2zlpkdckce865l3zps8mxjurxthfh3m7035qe5hh7f"},
{Key: "success", Value: "false"},
{Key: "error", Value: "testing: invalid"}, // not redacted
{Key: []byte("module"), Value: []byte("wasm")},
{Key: []byte("_contract_address"), Value: []byte("cosmos1w09vr7rpe2agu0kg2zlpkdckce865l3zps8mxjurxthfh3m7035qe5hh7f")},
{Key: []byte("success"), Value: []byte("false")},
{Key: []byte("error"), Value: []byte("testing: invalid")}, // not redacted
},
}},
},
Expand Down
13 changes: 2 additions & 11 deletions x/wasm/keeper/relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@ package keeper
import (
"time"

<<<<<<< HEAD
=======
channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported"
channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
ibcexported "github.com/cosmos/ibc-go/v4/modules/core/exported"

errorsmod "cosmossdk.io/errors"
>>>>>>> 7cd5893e (Redesign IBC on packet recv error/ result.Err handling)
wasmvmtypes "github.com/CosmWasm/wasmvm/types"
"github.com/cosmos/cosmos-sdk/telemetry"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -139,16 +135,11 @@ func (k Keeper) OnRecvPacket(
if execErr != nil {
panic(execErr) // let contract fully abort IBC receive in certain case
}
<<<<<<< HEAD
if res.Err != "" { // handle error case as before https://github.com/CosmWasm/wasmvm/commit/c300106fe5c9426a495f8e10821e00a9330c56c6
return nil, sdkerrors.Wrap(types.ErrExecuteFailed, res.Err)
=======
if res.Err != "" {
// return error ACK with non-redacted contract message, state will be reverted
return channeltypes.Acknowledgement{
Response: &channeltypes.Acknowledgement_Error{Error: res.Err},
}, nil
>>>>>>> 7cd5893e (Redesign IBC on packet recv error/ result.Err handling)
}
// note submessage reply results can overwrite the `Acknowledgement` data
data, err := k.handleContractResponse(ctx, contractAddr, contractInfo.IBCPortID, res.Ok.Messages, res.Ok.Attributes, res.Ok.Acknowledgement, res.Ok.Events)
Expand Down
2 changes: 1 addition & 1 deletion x/wasm/types/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/ibc-go/v7/modules/core/exported"
"github.com/cosmos/ibc-go/v4/modules/core/exported"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion x/wasm/types/exported_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
wasmvmtypes "github.com/CosmWasm/wasmvm/types"
sdk "github.com/cosmos/cosmos-sdk/types"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported"
ibcexported "github.com/cosmos/ibc-go/v4/modules/core/exported"
)

// ViewKeeper provides read only operations
Expand Down

0 comments on commit 60f3f81

Please sign in to comment.