@agoric/cosmos 0.35.0-upgrade-14-dev-c8f9e7b.0 → 0.35.0-upgrade-16a-dev-fb592e4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +121 -77
- package/MAINTAINERS.md +3 -0
- package/Makefile +36 -26
- package/ante/ante.go +7 -9
- package/ante/inbound_test.go +3 -2
- package/ante/vm_admission.go +2 -1
- package/app/app.go +212 -140
- package/app/upgrade.go +76 -0
- package/cmd/agd/agvm.go +42 -0
- package/cmd/agd/main.go +130 -11
- package/cmd/libdaemon/main.go +64 -53
- package/cmd/libdaemon/main_test.go +2 -1
- package/daemon/cmd/root.go +171 -74
- package/daemon/cmd/root_test.go +189 -1
- package/daemon/main.go +4 -2
- package/e2e_test/Makefile +29 -0
- package/e2e_test/README.md +100 -0
- package/e2e_test/go.mod +217 -0
- package/e2e_test/go.sum +1323 -0
- package/e2e_test/ibc_conformance_test.go +56 -0
- package/e2e_test/pfm_test.go +613 -0
- package/e2e_test/util.go +271 -0
- package/git-revision.txt +1 -1
- package/go.mod +22 -11
- package/go.sum +17 -13
- package/package.json +9 -5
- package/proto/agoric/swingset/genesis.proto +4 -0
- package/proto/agoric/swingset/swingset.proto +1 -1
- package/proto/agoric/vlocalchain/.clang-format +7 -0
- package/proto/agoric/vlocalchain/vlocalchain.proto +31 -0
- package/proto/agoric/vtransfer/genesis.proto +18 -0
- package/scripts/protocgen.sh +7 -8
- package/types/kv_entry_helpers.go +42 -0
- package/upgradegaia.sh +8 -8
- package/vm/action.go +5 -4
- package/vm/action_test.go +31 -11
- package/vm/client.go +113 -0
- package/vm/client_test.go +182 -0
- package/vm/controller.go +17 -40
- package/vm/core_proposals.go +22 -2
- package/vm/jsonrpcconn/jsonrpcconn.go +160 -0
- package/vm/jsonrpcconn/jsonrpcconn_test.go +126 -0
- package/vm/proto_json.go +38 -0
- package/vm/proto_json_test.go +103 -0
- package/vm/server.go +124 -0
- package/x/swingset/abci.go +10 -10
- package/x/swingset/alias.go +2 -0
- package/x/swingset/client/cli/tx.go +4 -0
- package/x/swingset/genesis.go +84 -24
- package/x/swingset/handler.go +2 -1
- package/x/swingset/keeper/extension_snapshotter.go +2 -2
- package/x/swingset/keeper/keeper.go +13 -25
- package/x/swingset/keeper/msg_server.go +18 -18
- package/x/swingset/keeper/proposal.go +3 -3
- package/x/swingset/keeper/querier.go +12 -11
- package/x/swingset/keeper/swing_store_exports_handler.go +21 -6
- package/x/swingset/keeper/test_utils.go +16 -0
- package/x/swingset/module.go +7 -7
- package/x/swingset/proposal_handler.go +2 -1
- package/x/swingset/testing/queue.go +17 -0
- package/x/swingset/types/default-params.go +1 -1
- package/x/swingset/types/expected_keepers.go +3 -2
- package/x/swingset/types/genesis.pb.go +78 -25
- package/x/swingset/types/msgs.go +44 -24
- package/x/swingset/types/params.go +2 -1
- package/x/swingset/types/proposal.go +5 -4
- package/x/swingset/types/swingset.pb.go +1 -1
- package/x/vbank/genesis.go +0 -2
- package/x/vbank/handler.go +2 -1
- package/x/vbank/keeper/querier.go +4 -3
- package/x/vbank/module.go +0 -5
- package/x/vbank/types/msgs.go +0 -12
- package/x/vbank/vbank.go +9 -9
- package/x/vbank/vbank_test.go +2 -2
- package/x/vibc/alias.go +3 -0
- package/x/vibc/handler.go +16 -9
- package/x/vibc/keeper/keeper.go +102 -65
- package/x/vibc/keeper/triggers.go +101 -0
- package/x/vibc/module.go +5 -8
- package/x/vibc/types/expected_keepers.go +13 -0
- package/x/vibc/types/ibc_module.go +336 -0
- package/x/vibc/types/receiver.go +170 -0
- package/x/vlocalchain/alias.go +19 -0
- package/x/vlocalchain/handler.go +21 -0
- package/x/vlocalchain/keeper/keeper.go +279 -0
- package/x/vlocalchain/keeper/keeper_test.go +97 -0
- package/x/vlocalchain/types/codec.go +34 -0
- package/x/vlocalchain/types/key.go +27 -0
- package/x/vlocalchain/types/msgs.go +16 -0
- package/x/vlocalchain/types/vlocalchain.pb.go +1072 -0
- package/x/vlocalchain/vlocalchain.go +114 -0
- package/x/vlocalchain/vlocalchain_test.go +434 -0
- package/x/vstorage/handler.go +2 -1
- package/x/vstorage/keeper/grpc_query.go +0 -1
- package/x/vstorage/keeper/keeper.go +13 -20
- package/x/vstorage/keeper/querier.go +6 -5
- package/x/vstorage/keeper/querier_test.go +4 -3
- package/x/vstorage/module.go +0 -5
- package/x/vstorage/testing/queue.go +27 -0
- package/x/vtransfer/alias.go +13 -0
- package/x/vtransfer/genesis.go +39 -0
- package/x/vtransfer/genesis_test.go +12 -0
- package/x/vtransfer/handler.go +20 -0
- package/x/vtransfer/ibc_middleware.go +186 -0
- package/x/vtransfer/ibc_middleware_test.go +448 -0
- package/x/vtransfer/keeper/keeper.go +281 -0
- package/x/vtransfer/module.go +124 -0
- package/x/vtransfer/types/expected_keepers.go +38 -0
- package/x/vtransfer/types/genesis.pb.go +327 -0
- package/x/vtransfer/types/key.go +9 -0
- package/x/vtransfer/types/msgs.go +9 -0
- package/ante/fee.go +0 -96
- package/proto/agoric/lien/genesis.proto +0 -25
- package/proto/agoric/lien/lien.proto +0 -25
- package/x/lien/alias.go +0 -17
- package/x/lien/genesis.go +0 -58
- package/x/lien/genesis_test.go +0 -101
- package/x/lien/keeper/account.go +0 -290
- package/x/lien/keeper/keeper.go +0 -255
- package/x/lien/keeper/keeper_test.go +0 -623
- package/x/lien/lien.go +0 -205
- package/x/lien/lien_test.go +0 -533
- package/x/lien/module.go +0 -115
- package/x/lien/spec/01_concepts.md +0 -146
- package/x/lien/spec/02_messages.md +0 -96
- package/x/lien/types/accountkeeper.go +0 -81
- package/x/lien/types/accountstate.go +0 -27
- package/x/lien/types/expected_keepers.go +0 -18
- package/x/lien/types/genesis.pb.go +0 -567
- package/x/lien/types/key.go +0 -25
- package/x/lien/types/lien.pb.go +0 -403
- package/x/vibc/ibc.go +0 -394
- /package/{src/index.cjs → index.cjs} +0 -0
|
@@ -3,6 +3,7 @@ package keeper
|
|
|
3
3
|
import (
|
|
4
4
|
abci "github.com/tendermint/tendermint/abci/types"
|
|
5
5
|
|
|
6
|
+
sdkioerrors "cosmossdk.io/errors"
|
|
6
7
|
"github.com/cosmos/cosmos-sdk/codec"
|
|
7
8
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
8
9
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
|
@@ -20,7 +21,7 @@ const (
|
|
|
20
21
|
// entry path with no extra data, and returns the path of that vstorage entry.
|
|
21
22
|
func getVstorageEntryPath(urlPathSegments []string) (string, error) {
|
|
22
23
|
if len(urlPathSegments) != 1 || types.ValidatePath(urlPathSegments[0]) != nil {
|
|
23
|
-
return "",
|
|
24
|
+
return "", sdkioerrors.Wrap(sdkerrors.ErrInvalidRequest, "invalid vstorage entry path")
|
|
24
25
|
}
|
|
25
26
|
return urlPathSegments[0], nil
|
|
26
27
|
}
|
|
@@ -51,7 +52,7 @@ func NewQuerier(keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier
|
|
|
51
52
|
}
|
|
52
53
|
return queryChildren(ctx, entryPath, req, keeper, legacyQuerierCdc)
|
|
53
54
|
default:
|
|
54
|
-
return nil,
|
|
55
|
+
return nil, sdkioerrors.Wrap(sdkerrors.ErrUnknownRequest, "unknown vstorage query path")
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
}
|
|
@@ -60,12 +61,12 @@ func NewQuerier(keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier
|
|
|
60
61
|
func queryData(ctx sdk.Context, path string, req abci.RequestQuery, keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) (res []byte, err error) {
|
|
61
62
|
entry := keeper.GetEntry(ctx, path)
|
|
62
63
|
if !entry.HasValue() {
|
|
63
|
-
return nil,
|
|
64
|
+
return nil, sdkioerrors.Wrap(sdkerrors.ErrNotFound, "no data for vstorage path")
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
bz, marshalErr := codec.MarshalJSONIndent(legacyQuerierCdc, types.Data{Value: entry.StringValue()})
|
|
67
68
|
if marshalErr != nil {
|
|
68
|
-
return nil,
|
|
69
|
+
return nil, sdkioerrors.Wrap(sdkerrors.ErrJSONMarshal, marshalErr.Error())
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
return bz, nil
|
|
@@ -82,7 +83,7 @@ func queryChildren(ctx sdk.Context, path string, req abci.RequestQuery, keeper K
|
|
|
82
83
|
|
|
83
84
|
bz, err2 := codec.MarshalJSONIndent(legacyQuerierCdc, types.Children{Children: klist})
|
|
84
85
|
if err2 != nil {
|
|
85
|
-
return nil,
|
|
86
|
+
return nil, sdkioerrors.Wrap(sdkerrors.ErrJSONMarshal, err2.Error())
|
|
86
87
|
}
|
|
87
88
|
|
|
88
89
|
return bz, nil
|
|
@@ -8,6 +8,7 @@ import (
|
|
|
8
8
|
|
|
9
9
|
abci "github.com/tendermint/tendermint/abci/types"
|
|
10
10
|
|
|
11
|
+
sdkioerrors "cosmossdk.io/errors"
|
|
11
12
|
"github.com/cosmos/cosmos-sdk/codec"
|
|
12
13
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
|
13
14
|
)
|
|
@@ -26,7 +27,7 @@ func TestQuerier(t *testing.T) {
|
|
|
26
27
|
label string
|
|
27
28
|
path []string
|
|
28
29
|
expected []byte
|
|
29
|
-
err *
|
|
30
|
+
err *sdkioerrors.Error
|
|
30
31
|
}
|
|
31
32
|
testCases := []testCase{}
|
|
32
33
|
|
|
@@ -77,7 +78,7 @@ func TestQuerier(t *testing.T) {
|
|
|
77
78
|
}...)
|
|
78
79
|
|
|
79
80
|
// Ensure stability of cosmos-sdk error codes
|
|
80
|
-
if codespace, code, _ :=
|
|
81
|
+
if codespace, code, _ := sdkioerrors.ABCIInfo(sdkerrors.ErrNotFound, true); codespace != "sdk" || code != 38 {
|
|
81
82
|
t.Errorf("cosmos-sdk ErrNotFound has codespace %s, code %d, expected sdk/38", codespace, code)
|
|
82
83
|
}
|
|
83
84
|
|
|
@@ -102,7 +103,7 @@ func TestQuerier(t *testing.T) {
|
|
|
102
103
|
if desc.err != nil {
|
|
103
104
|
if err == nil {
|
|
104
105
|
t.Errorf("%s: got no error, want error %q", desc.label, *desc.err)
|
|
105
|
-
} else if codespace, code, _ :=
|
|
106
|
+
} else if codespace, code, _ := sdkioerrors.ABCIInfo(err, true); codespace != desc.err.Codespace() || code != desc.err.ABCICode() {
|
|
106
107
|
t.Errorf("%s: got error %v, want error %q", desc.label, err, *desc.err)
|
|
107
108
|
}
|
|
108
109
|
} else if !bytes.Equal(res, desc.expected) {
|
package/x/vstorage/module.go
CHANGED
|
@@ -4,7 +4,6 @@ import (
|
|
|
4
4
|
"context"
|
|
5
5
|
"encoding/json"
|
|
6
6
|
|
|
7
|
-
"github.com/gorilla/mux"
|
|
8
7
|
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
|
9
8
|
"github.com/spf13/cobra"
|
|
10
9
|
|
|
@@ -57,10 +56,6 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod
|
|
|
57
56
|
return ValidateGenesis(&data)
|
|
58
57
|
}
|
|
59
58
|
|
|
60
|
-
// Register rest routes
|
|
61
|
-
func (AppModuleBasic) RegisterRESTRoutes(ctx client.Context, rtr *mux.Router) {
|
|
62
|
-
}
|
|
63
|
-
|
|
64
59
|
func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {
|
|
65
60
|
_ = types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx))
|
|
66
61
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
package testing
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"fmt"
|
|
5
|
+
|
|
6
|
+
keeper "github.com/Agoric/agoric-sdk/golang/cosmos/x/vstorage/keeper"
|
|
7
|
+
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
func GetQueueItems(ctx sdk.Context, vstorageKeeper keeper.Keeper, queuePath string) ([]string, error) {
|
|
11
|
+
head, err := vstorageKeeper.GetIntValue(ctx, queuePath+".head")
|
|
12
|
+
if err != nil {
|
|
13
|
+
return nil, err
|
|
14
|
+
}
|
|
15
|
+
tail, err := vstorageKeeper.GetIntValue(ctx, queuePath+".tail")
|
|
16
|
+
if err != nil {
|
|
17
|
+
return nil, err
|
|
18
|
+
}
|
|
19
|
+
length := tail.Sub(head).Int64()
|
|
20
|
+
values := make([]string, length)
|
|
21
|
+
var i int64
|
|
22
|
+
for i = 0; i < length; i++ {
|
|
23
|
+
path := fmt.Sprintf("%s.%s", queuePath, head.Add(sdk.NewInt(i)).String())
|
|
24
|
+
values[i] = vstorageKeeper.GetEntry(ctx, path).StringValue()
|
|
25
|
+
}
|
|
26
|
+
return values, nil
|
|
27
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
package vtransfer
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"github.com/Agoric/agoric-sdk/golang/cosmos/x/vtransfer/keeper"
|
|
5
|
+
"github.com/Agoric/agoric-sdk/golang/cosmos/x/vtransfer/types"
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
const (
|
|
9
|
+
ModuleName = types.ModuleName
|
|
10
|
+
StoreKey = types.StoreKey
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
type Keeper = keeper.Keeper
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
package vtransfer
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"fmt"
|
|
5
|
+
|
|
6
|
+
"github.com/Agoric/agoric-sdk/golang/cosmos/x/vtransfer/types"
|
|
7
|
+
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
8
|
+
abci "github.com/tendermint/tendermint/abci/types"
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
func NewGenesisState() *types.GenesisState {
|
|
12
|
+
return &types.GenesisState{}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
func ValidateGenesis(data *types.GenesisState) error {
|
|
16
|
+
if data == nil {
|
|
17
|
+
return fmt.Errorf("vtransfer genesis data cannot be nil")
|
|
18
|
+
}
|
|
19
|
+
return nil
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
func DefaultGenesisState() *types.GenesisState {
|
|
23
|
+
return &types.GenesisState{}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
func InitGenesis(ctx sdk.Context, keeper Keeper, data *types.GenesisState) []abci.ValidatorUpdate {
|
|
27
|
+
keeper.SetWatchedAddresses(ctx, data.GetWatchedAddresses())
|
|
28
|
+
return []abci.ValidatorUpdate{}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
func ExportGenesis(ctx sdk.Context, k Keeper) *types.GenesisState {
|
|
32
|
+
var gs types.GenesisState
|
|
33
|
+
addresses, err := k.GetWatchedAddresses(ctx)
|
|
34
|
+
if err != nil {
|
|
35
|
+
panic(err)
|
|
36
|
+
}
|
|
37
|
+
gs.WatchedAddresses = addresses
|
|
38
|
+
return &gs
|
|
39
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
package vtransfer
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"testing"
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
func TestDefaultGenesis(t *testing.T) {
|
|
8
|
+
defaultGenesisState := DefaultGenesisState()
|
|
9
|
+
if err := ValidateGenesis(defaultGenesisState); err != nil {
|
|
10
|
+
t.Errorf("DefaultGenesisState did not validate %v: %e", defaultGenesisState, err)
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
package vtransfer
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"fmt"
|
|
5
|
+
|
|
6
|
+
"github.com/Agoric/agoric-sdk/golang/cosmos/x/vtransfer/keeper"
|
|
7
|
+
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
8
|
+
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
// NewHandler returns a handler for "vtransfer" type messages.
|
|
12
|
+
func NewHandler(keeper keeper.Keeper) sdk.Handler {
|
|
13
|
+
return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) {
|
|
14
|
+
switch msg := msg.(type) {
|
|
15
|
+
default:
|
|
16
|
+
errMsg := fmt.Sprintf("Unrecognized vtransfer Msg type: %T", msg)
|
|
17
|
+
return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg)
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
package vtransfer
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"github.com/Agoric/agoric-sdk/golang/cosmos/x/vtransfer/keeper"
|
|
5
|
+
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
6
|
+
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
|
7
|
+
clienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types"
|
|
8
|
+
channeltypes "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types"
|
|
9
|
+
porttypes "github.com/cosmos/ibc-go/v6/modules/core/05-port/types"
|
|
10
|
+
"github.com/cosmos/ibc-go/v6/modules/core/exported"
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
// IBCMiddleware (https://ibc.cosmos.network/main/ibc/apps/ibcmodule) forwards
|
|
14
|
+
// most of its methods to the next layer in the stack (which may be the ibc-go
|
|
15
|
+
// transfer application or another middleware), but hooks the packet-related
|
|
16
|
+
// methods and sends them to vtransferKeeper for async interception by the
|
|
17
|
+
// associated VM:
|
|
18
|
+
//
|
|
19
|
+
// 1. IBCModule channel handshake callbacks (OnChanOpenInit, OnChanOpenTry,
|
|
20
|
+
// OnChanOpenAck, and OnChanOpenConfirm)—handled by the wrapped IBCModule.
|
|
21
|
+
//
|
|
22
|
+
// 2. IBCModule channel closing callbacks (OnChanCloseInit and
|
|
23
|
+
// OnChanCloseConfirm)—handled by the wrapped IBCModule.
|
|
24
|
+
//
|
|
25
|
+
// 3. IBCModule packet callbacks (OnRecvPacket, OnAcknowledgementPacket, and
|
|
26
|
+
// OnTimeoutPacket)—intercepted by vtransfer.
|
|
27
|
+
//
|
|
28
|
+
// 4. ICS4Wrapper packet initiation methods (SendPacket, WriteAcknowledgement
|
|
29
|
+
// and GetAppVersion)—delegated by vtransfer to vibc.
|
|
30
|
+
|
|
31
|
+
var _ porttypes.Middleware = (*IBCMiddleware)(nil)
|
|
32
|
+
|
|
33
|
+
// IBCMiddleware implements the ICS26 callbacks for the middleware given the
|
|
34
|
+
// underlying IBCModule and the keeper.
|
|
35
|
+
type IBCMiddleware struct {
|
|
36
|
+
ibcModule porttypes.IBCModule
|
|
37
|
+
vtransferKeeper keeper.Keeper
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// NewIBCMiddleware creates a new IBCMiddleware given the underlying IBCModule and keeper.
|
|
41
|
+
func NewIBCMiddleware(ibcModule porttypes.IBCModule, vtransferKeeper keeper.Keeper) IBCMiddleware {
|
|
42
|
+
return IBCMiddleware{
|
|
43
|
+
ibcModule: ibcModule,
|
|
44
|
+
vtransferKeeper: vtransferKeeper,
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
///////////////////////////////////
|
|
49
|
+
// The following channel handshake events are all directly forwarded to the
|
|
50
|
+
// wrapped IBCModule. They are not performed in the context of a packet, and so
|
|
51
|
+
// do not need to be intercepted.
|
|
52
|
+
|
|
53
|
+
// OnChanCloseInit implements the IBCModule interface.
|
|
54
|
+
func (im IBCMiddleware) OnChanOpenInit(
|
|
55
|
+
ctx sdk.Context,
|
|
56
|
+
order channeltypes.Order,
|
|
57
|
+
connectionHops []string,
|
|
58
|
+
portID string,
|
|
59
|
+
channelID string,
|
|
60
|
+
chanCap *capabilitytypes.Capability,
|
|
61
|
+
counterparty channeltypes.Counterparty,
|
|
62
|
+
version string,
|
|
63
|
+
) (string, error) {
|
|
64
|
+
return im.ibcModule.OnChanOpenInit(ctx, order, connectionHops, portID, channelID, chanCap, counterparty, version)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// OnChanOpenTry implements the IBCModule interface.
|
|
68
|
+
func (im IBCMiddleware) OnChanOpenTry(
|
|
69
|
+
ctx sdk.Context,
|
|
70
|
+
order channeltypes.Order,
|
|
71
|
+
connectionHops []string,
|
|
72
|
+
portID,
|
|
73
|
+
channelID string,
|
|
74
|
+
chanCap *capabilitytypes.Capability,
|
|
75
|
+
counterparty channeltypes.Counterparty,
|
|
76
|
+
counterpartyVersion string,
|
|
77
|
+
) (string, error) {
|
|
78
|
+
return im.ibcModule.OnChanOpenTry(ctx, order, connectionHops, portID, channelID, chanCap, counterparty, counterpartyVersion)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// OnChanOpenAck implements the IBCModule interface.
|
|
82
|
+
func (im IBCMiddleware) OnChanOpenAck(
|
|
83
|
+
ctx sdk.Context,
|
|
84
|
+
portID,
|
|
85
|
+
channelID string,
|
|
86
|
+
counterpartyChannelID string,
|
|
87
|
+
counterpartyVersion string,
|
|
88
|
+
) error {
|
|
89
|
+
return im.ibcModule.OnChanOpenAck(ctx, portID, channelID, counterpartyChannelID, counterpartyVersion)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// OnChanOpenConfirm implements the IBCModule interface.
|
|
93
|
+
func (im IBCMiddleware) OnChanOpenConfirm(
|
|
94
|
+
ctx sdk.Context,
|
|
95
|
+
portID,
|
|
96
|
+
channelID string,
|
|
97
|
+
) error {
|
|
98
|
+
return im.ibcModule.OnChanOpenConfirm(ctx, portID, channelID)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// OnChanCloseInit implements the IBCModule interface.
|
|
102
|
+
func (im IBCMiddleware) OnChanCloseInit(
|
|
103
|
+
ctx sdk.Context,
|
|
104
|
+
portID,
|
|
105
|
+
channelID string,
|
|
106
|
+
) error {
|
|
107
|
+
return im.ibcModule.OnChanCloseInit(ctx, portID, channelID)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// OnChanCloseConfirm implements the IBCModule interface.
|
|
111
|
+
func (im IBCMiddleware) OnChanCloseConfirm(
|
|
112
|
+
ctx sdk.Context,
|
|
113
|
+
portID,
|
|
114
|
+
channelID string,
|
|
115
|
+
) error {
|
|
116
|
+
return im.ibcModule.OnChanCloseConfirm(ctx, portID, channelID)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
///////////////////////////////////
|
|
120
|
+
// The following packet methods are all implemented by
|
|
121
|
+
// im.vtransferKeeper.Intercept*, so named because those methods are "tee"s
|
|
122
|
+
// combining the middleware stack with an interception of the packet event
|
|
123
|
+
// (On*Packet) or packet method (WriteAcknowledgment) by the async VM.
|
|
124
|
+
|
|
125
|
+
// OnRecvPacket implements the IBCModule interface.
|
|
126
|
+
func (im IBCMiddleware) OnRecvPacket(
|
|
127
|
+
ctx sdk.Context,
|
|
128
|
+
packet channeltypes.Packet,
|
|
129
|
+
relayer sdk.AccAddress,
|
|
130
|
+
) exported.Acknowledgement {
|
|
131
|
+
return im.vtransferKeeper.InterceptOnRecvPacket(ctx, im.ibcModule, packet, relayer)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// OnAcknowledgementPacket implements the IBCModule interface.
|
|
135
|
+
func (im IBCMiddleware) OnAcknowledgementPacket(
|
|
136
|
+
ctx sdk.Context,
|
|
137
|
+
packet channeltypes.Packet,
|
|
138
|
+
acknowledgement []byte,
|
|
139
|
+
relayer sdk.AccAddress,
|
|
140
|
+
) error {
|
|
141
|
+
return im.vtransferKeeper.InterceptOnAcknowledgementPacket(ctx, im.ibcModule, packet, acknowledgement, relayer)
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// OnTimeoutPacket implements the IBCModule interface.
|
|
145
|
+
func (im IBCMiddleware) OnTimeoutPacket(
|
|
146
|
+
ctx sdk.Context,
|
|
147
|
+
packet channeltypes.Packet,
|
|
148
|
+
relayer sdk.AccAddress,
|
|
149
|
+
) error {
|
|
150
|
+
return im.vtransferKeeper.InterceptOnTimeoutPacket(ctx, im.ibcModule, packet, relayer)
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// WriteAcknowledgement implements the ICS4 Wrapper interface.
|
|
154
|
+
// Unlike implementations of IBCModule interface methods, implementations of
|
|
155
|
+
// ICS4 Wrapper interface methods do not pass along the wrapped IBC module
|
|
156
|
+
// because they support packet initiation.
|
|
157
|
+
func (im IBCMiddleware) WriteAcknowledgement(
|
|
158
|
+
ctx sdk.Context,
|
|
159
|
+
chanCap *capabilitytypes.Capability,
|
|
160
|
+
packet exported.PacketI,
|
|
161
|
+
ack exported.Acknowledgement,
|
|
162
|
+
) error {
|
|
163
|
+
return im.vtransferKeeper.InterceptWriteAcknowledgement(ctx, chanCap, packet, ack)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
///////////////////////////////////
|
|
167
|
+
// The following methods are directly implemented by the ICS4Wrapper outside of
|
|
168
|
+
// us, whether the ibc-go stack or another middleware.
|
|
169
|
+
|
|
170
|
+
// SendPacket implements the ICS4 Wrapper interface.
|
|
171
|
+
func (im IBCMiddleware) SendPacket(
|
|
172
|
+
ctx sdk.Context,
|
|
173
|
+
chanCap *capabilitytypes.Capability,
|
|
174
|
+
sourcePort string,
|
|
175
|
+
sourceChannel string,
|
|
176
|
+
timeoutHeight clienttypes.Height,
|
|
177
|
+
timeoutTimestamp uint64,
|
|
178
|
+
data []byte,
|
|
179
|
+
) (uint64, error) {
|
|
180
|
+
return im.vtransferKeeper.SendPacket(ctx, chanCap, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, data)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// GetAppVersion implements the ICS4 Wrapper interface.
|
|
184
|
+
func (im IBCMiddleware) GetAppVersion(ctx sdk.Context, portID, channelID string) (string, bool) {
|
|
185
|
+
return im.vtransferKeeper.GetAppVersion(ctx, portID, channelID)
|
|
186
|
+
}
|