Skip to content

Commit

Permalink
Remove unused wasm hooks and channel keeper
Browse files Browse the repository at this point in the history
  • Loading branch information
antstalepresh committed Jun 26, 2024
1 parent 9d31ece commit 3bd5507
Show file tree
Hide file tree
Showing 19 changed files with 60 additions and 2,104 deletions.
27 changes: 1 addition & 26 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,6 @@ type App struct {
ParamsKeeper paramskeeper.Keeper
IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
OnionKeeper *onionkeeper.Keeper
Ics20WasmHooks *onion.WasmHooks
HooksICS4Wrapper onion.ICS4Middleware
IBCFeeKeeper ibcfeekeeper.Keeper
ICAControllerKeeper icacontrollerkeeper.Keeper
ICAHostKeeper icahostkeeper.Keeper
Expand Down Expand Up @@ -558,15 +556,12 @@ func New(
app.OnionKeeper = onionkeeper.NewKeeper(
keys[oniontypes.StoreKey],
app.GetSubspace(oniontypes.ModuleName),
app.IBCKeeper.ChannelKeeper,
nil,
app.MsgServiceRouter(),
app.AccountKeeper,
txConfig.SignModeHandler(),
)

app.WireICS20PreWasmKeeper(appCodec, bApp, app.OnionKeeper)

// IBC Fee Module keeper

app.IBCFeeKeeper = ibcfeekeeper.NewKeeper(
Expand Down Expand Up @@ -725,10 +720,6 @@ func New(
wasmOpts...,
)

// Pass the contract keeper to all the structs (generally ICS4Wrappers for ibc middlewares) that need it
app.Ics20WasmHooks.ContractKeeper = &app.WasmKeeper
app.OnionKeeper.ContractKeeper = wasmkeeper.NewDefaultPermissionKeeper(app.WasmKeeper)

// Register the proposal types
// Deprecated: Avoid adding new handlers, instead use the new proposal flow
// by granting the governance module the right to execute the message.
Expand Down Expand Up @@ -783,7 +774,7 @@ func New(
var transferStack ibcporttypes.IBCModule
transferStack = transfer.NewIBCModule(app.TransferKeeper)
transferStack = ibcfee.NewIBCMiddleware(transferStack, app.IBCFeeKeeper)
transferStack = onion.NewIBCMiddleware(transferStack, &app.HooksICS4Wrapper, app.OnionKeeper, encodingConfig.TxConfig)
transferStack = onion.NewIBCModule(transferStack, app.OnionKeeper, encodingConfig.TxConfig)

// Create Interchain Accounts Stack
// SendPacket, since it is originating from the application to core IBC:
Expand Down Expand Up @@ -1207,22 +1198,6 @@ func New(
return app
}

// WireICS20PreWasmKeeper Create the IBC Transfer Stack from bottom to top:
func (app *App) WireICS20PreWasmKeeper(
appCodec codec.Codec,
bApp *baseapp.BaseApp,
hooksKeeper *onionkeeper.Keeper,
) {
// Setup the ICS4Wrapper used by the hooks middleware
addrPrefix := sdk.GetConfig().GetBech32AccountAddrPrefix()
wasmHooks := onion.NewWasmHooks(hooksKeeper, nil, addrPrefix) // The contract keeper needs to be set later
app.Ics20WasmHooks = &wasmHooks
app.HooksICS4Wrapper = onion.NewICS4Middleware(
app.IBCKeeper.ChannelKeeper,
app.Ics20WasmHooks,
)
}

func (app *App) setPostHandler() {
postHandler, err := posthandler.NewPostHandler(
posthandler.HandlerOptions{},
Expand Down
2 changes: 0 additions & 2 deletions proto/kujira/onion/params.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,4 @@ import "google/protobuf/duration.proto";
option go_package = "github.com/Team-Kujira/core/x/onion/types";

message Params {
repeated string allowed_async_ack_contracts = 1
[ (gogoproto.moretags) = "yaml:\"allowed_async_ack_contracts\"" ];
}
15 changes: 0 additions & 15 deletions proto/kujira/onion/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,4 @@ option go_package = "github.com/Team-Kujira/core/x/onion/types";

// Msg defines the Msg service.
service Msg {
// EmitIBCAck checks the sender can emit the ack and writes the IBC
// acknowledgement
rpc EmitIBCAck(MsgEmitIBCAck) returns (MsgEmitIBCAckResponse);
}

message MsgEmitIBCAck {
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
uint64 packet_sequence = 2
[ (gogoproto.moretags) = "yaml:\"packet_sequence\"" ];
string channel = 3 [ (gogoproto.moretags) = "yaml:\"channel\"" ];
}
message MsgEmitIBCAckResponse {
string contract_result = 1
[ (gogoproto.moretags) = "yaml:\"contract_result\"" ];
string ibc_ack = 2 [ (gogoproto.moretags) = "yaml:\"ibc_ack\"" ];
}
39 changes: 0 additions & 39 deletions x/onion/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,11 @@ package cli
import (
"context"
"fmt"
"strings"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/version"
"github.com/spf13/cobra"

"github.com/Team-Kujira/core/x/onion/keeper"

"github.com/Team-Kujira/core/x/onion/types"
)

Expand Down Expand Up @@ -40,45 +35,11 @@ func GetQueryCmd() *cobra.Command {
}

cmd.AddCommand(
GetCmdWasmSender(),
GetCmdQuerySequence(),
)
return cmd
}

// GetCmdPoolParams return pool params.
func GetCmdWasmSender() *cobra.Command {
cmd := &cobra.Command{
Use: "wasm-sender <channelID> <originalSender>",
Short: "Generate the local address for a wasm hooks sender",
Long: strings.TrimSpace(
fmt.Sprintf(`Generate the local address for a wasm hooks sender.
Example:
$ %s query ibc-hooks wasm-hooks-sender channel-42 juno12smx2wdlyttvyzvzg54y2vnqwq2qjatezqwqxu
`,
version.AppName,
),
),
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
channelID := args[0]
originalSender := args[1]
// ToDo: Make this flexible as an arg
prefix := sdk.GetConfig().GetBech32AccountAddrPrefix()
senderBech32, err := keeper.DeriveIntermediateSender(channelID, originalSender, prefix)
if err != nil {
return err
}
fmt.Println(senderBech32)
return nil
},
}

flags.AddQueryFlagsToCmd(cmd)

return cmd
}

// GetCmdQuerySequence implements the query sequence command.
func GetCmdQuerySequence() *cobra.Command {
cmd := &cobra.Command{
Expand Down
145 changes: 0 additions & 145 deletions x/onion/hooks.go

This file was deleted.

Loading

0 comments on commit 3bd5507

Please sign in to comment.