@agoric/cosmos 0.34.2-dev-d2ea4b4.0 → 0.34.2-dev-7ffae88.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/Makefile +21 -6
- package/ante/ante.go +7 -5
- package/app/app.go +55 -43
- package/daemon/cmd/genaccounts.go +8 -4
- package/daemon/cmd/root.go +17 -6
- package/daemon/cmd/root_test.go +1 -1
- package/daemon/cmd/testnet.go +1 -1
- package/daemon/main.go +1 -1
- package/git-revision.txt +1 -1
- package/go.mod +95 -64
- package/go.sum +590 -241
- package/package.json +2 -2
- package/scripts/protocgen.sh +1 -1
- package/third_party/proto/buf.yaml +1 -0
- package/third_party/proto/cosmos/base/query/v1beta1/pagination.proto +2 -1
- package/third_party/proto/cosmos/base/v1beta1/coin.proto +7 -4
- package/third_party/proto/cosmos/upgrade/v1beta1/upgrade.proto +14 -6
- package/third_party/proto/cosmos_proto/cosmos.proto +84 -3
- package/third_party/proto/google/api/annotations.proto +1 -1
- package/third_party/proto/google/api/http.proto +181 -120
- package/third_party/proto/google/api/httpbody.proto +9 -6
- package/third_party/proto/google/protobuf/any.proto +1 -7
- package/third_party/proto/ibc/core/channel/v1/channel.proto +1 -1
- package/third_party/proto/ibc/core/client/v1/client.proto +1 -1
- package/upgradegaia.sh +13 -4
- package/x/lien/keeper/account.go +3 -3
- package/x/lien/keeper/keeper.go +5 -4
- package/x/lien/keeper/keeper_test.go +8 -8
- package/x/lien/lien_test.go +1 -1
- package/x/swingset/client/cli/tx.go +2 -2
- package/x/swingset/client/proposal_handler.go +2 -17
- package/x/swingset/keeper/keeper.go +7 -4
- package/x/swingset/keeper/keeper_test.go +1 -1
- package/x/swingset/proposal_handler.go +3 -3
- package/x/swingset/types/codec.go +2 -2
- package/x/swingset/types/proposal.go +5 -5
- package/x/vbank/keeper/keeper.go +3 -2
- package/x/vbank/keeper/rewards.go +1 -1
- package/x/vbank/vbank_test.go +3 -3
- package/x/vibc/ibc.go +18 -19
- package/x/vibc/keeper/keeper.go +19 -18
- package/x/vibc/types/expected_keepers.go +13 -5
- package/x/vibc/types/msgs.go +1 -1
- package/x/vibc/types/msgs.pb.go +1 -1
- package/x/vstorage/keeper/keeper.go +3 -2
- package/x/vstorage/keeper/keeper_test.go +1 -1
- package/x/vstorage/vstorage_test.go +1 -1
|
@@ -99,7 +99,7 @@ func makeTestKit() testKit {
|
|
|
99
99
|
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
|
|
100
100
|
authtypes.Minter: {authtypes.Minter},
|
|
101
101
|
}
|
|
102
|
-
innerAk := authkeeper.NewAccountKeeper(cdc, authStoreKey, authSpace, authtypes.ProtoBaseAccount, maccPerms)
|
|
102
|
+
innerAk := authkeeper.NewAccountKeeper(cdc, authStoreKey, authSpace, authtypes.ProtoBaseAccount, maccPerms, "agoric")
|
|
103
103
|
wak := types.NewWrappedAccountKeeper(innerAk)
|
|
104
104
|
|
|
105
105
|
// bank keeper
|
|
@@ -120,12 +120,12 @@ func makeTestKit() testKit {
|
|
|
120
120
|
|
|
121
121
|
db := dbm.NewMemDB()
|
|
122
122
|
ms := store.NewCommitMultiStore(db)
|
|
123
|
-
ms.MountStoreWithDB(paramsTKey,
|
|
124
|
-
ms.MountStoreWithDB(paramsStoreKey,
|
|
125
|
-
ms.MountStoreWithDB(authStoreKey,
|
|
126
|
-
ms.MountStoreWithDB(bankStoreKey,
|
|
127
|
-
ms.MountStoreWithDB(stakingStoreKey,
|
|
128
|
-
ms.MountStoreWithDB(lienStoreKey,
|
|
123
|
+
ms.MountStoreWithDB(paramsTKey, storetypes.StoreTypeTransient, nil)
|
|
124
|
+
ms.MountStoreWithDB(paramsStoreKey, storetypes.StoreTypeIAVL, db)
|
|
125
|
+
ms.MountStoreWithDB(authStoreKey, storetypes.StoreTypeIAVL, db)
|
|
126
|
+
ms.MountStoreWithDB(bankStoreKey, storetypes.StoreTypeIAVL, db)
|
|
127
|
+
ms.MountStoreWithDB(stakingStoreKey, storetypes.StoreTypeIAVL, db)
|
|
128
|
+
ms.MountStoreWithDB(lienStoreKey, storetypes.StoreTypeIAVL, db)
|
|
129
129
|
err := ms.LoadLatestVersion()
|
|
130
130
|
if err != nil {
|
|
131
131
|
panic(err)
|
|
@@ -165,7 +165,7 @@ func (tk testKit) initAccount(t *testing.T, funder, addr sdk.AccAddress, state t
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
// Total
|
|
168
|
-
toMint := state.Total.Sub(state.Locked)
|
|
168
|
+
toMint := state.Total.Sub(state.Locked...)
|
|
169
169
|
if !toMint.IsZero() {
|
|
170
170
|
err := tk.bankKeeper.MintCoins(tk.ctx, authtypes.Minter, toMint)
|
|
171
171
|
if err != nil {
|
package/x/lien/lien_test.go
CHANGED
|
@@ -97,7 +97,7 @@ func (m *mockLienKeeper) BondDenom(ctx sdk.Context) string {
|
|
|
97
97
|
func (m *mockLienKeeper) GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins {
|
|
98
98
|
state := m.GetAccountState(ctx, addr)
|
|
99
99
|
delegated := state.Bonded.Add(state.Unbonding...)
|
|
100
|
-
bank := state.Total.Sub(state.Total.Min(delegated))
|
|
100
|
+
bank := state.Total.Sub(state.Total.Min(delegated)...)
|
|
101
101
|
return bank
|
|
102
102
|
}
|
|
103
103
|
|
|
@@ -13,7 +13,7 @@ import (
|
|
|
13
13
|
"github.com/cosmos/cosmos-sdk/client/flags"
|
|
14
14
|
"github.com/cosmos/cosmos-sdk/client/tx"
|
|
15
15
|
govcli "github.com/cosmos/cosmos-sdk/x/gov/client/cli"
|
|
16
|
-
|
|
16
|
+
govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
|
|
17
17
|
|
|
18
18
|
"github.com/Agoric/agoric-sdk/golang/cosmos/x/swingset/types"
|
|
19
19
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
@@ -302,7 +302,7 @@ Specify at least one pair of permit.json and code.js files`,
|
|
|
302
302
|
return err
|
|
303
303
|
}
|
|
304
304
|
|
|
305
|
-
msg, err :=
|
|
305
|
+
msg, err := govv1beta1.NewMsgSubmitProposal(content, deposit, from)
|
|
306
306
|
if err != nil {
|
|
307
307
|
return err
|
|
308
308
|
}
|
|
@@ -1,25 +1,10 @@
|
|
|
1
1
|
package client
|
|
2
2
|
|
|
3
3
|
import (
|
|
4
|
-
"net/http"
|
|
5
|
-
|
|
6
|
-
"github.com/cosmos/cosmos-sdk/client"
|
|
7
|
-
"github.com/cosmos/cosmos-sdk/types/rest"
|
|
8
|
-
govclient "github.com/cosmos/cosmos-sdk/x/gov/client"
|
|
9
|
-
govrest "github.com/cosmos/cosmos-sdk/x/gov/client/rest"
|
|
10
|
-
|
|
11
4
|
"github.com/Agoric/agoric-sdk/golang/cosmos/x/swingset/client/cli"
|
|
5
|
+
govclient "github.com/cosmos/cosmos-sdk/x/gov/client"
|
|
12
6
|
)
|
|
13
7
|
|
|
14
8
|
var (
|
|
15
|
-
CoreEvalProposalHandler = govclient.NewProposalHandler(cli.NewCmdSubmitCoreEvalProposal
|
|
9
|
+
CoreEvalProposalHandler = govclient.NewProposalHandler(cli.NewCmdSubmitCoreEvalProposal)
|
|
16
10
|
)
|
|
17
|
-
|
|
18
|
-
func emptyRestHandler(client.Context) govrest.ProposalRESTHandler {
|
|
19
|
-
return govrest.ProposalRESTHandler{
|
|
20
|
-
SubRoute: "unsupported-swingset",
|
|
21
|
-
Handler: func(w http.ResponseWriter, r *http.Request) {
|
|
22
|
-
rest.WriteErrorResponse(w, http.StatusBadRequest, "Legacy REST Routes are not supported for SwingSet proposals")
|
|
23
|
-
},
|
|
24
|
-
}
|
|
25
|
-
}
|
|
@@ -7,11 +7,14 @@ import (
|
|
|
7
7
|
stdlog "log"
|
|
8
8
|
"math"
|
|
9
9
|
|
|
10
|
+
sdkmath "cosmossdk.io/math"
|
|
11
|
+
|
|
10
12
|
"github.com/tendermint/tendermint/libs/log"
|
|
11
13
|
|
|
12
14
|
"github.com/cosmos/cosmos-sdk/baseapp"
|
|
13
15
|
"github.com/cosmos/cosmos-sdk/codec"
|
|
14
16
|
"github.com/cosmos/cosmos-sdk/store/prefix"
|
|
17
|
+
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
|
15
18
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
16
19
|
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
|
|
17
20
|
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
|
|
@@ -69,7 +72,7 @@ type inboundQueueRecord struct {
|
|
|
69
72
|
|
|
70
73
|
// Keeper maintains the link to data vstorage and exposes getter/setter methods for the various parts of the state machine
|
|
71
74
|
type Keeper struct {
|
|
72
|
-
storeKey
|
|
75
|
+
storeKey storetypes.StoreKey
|
|
73
76
|
cdc codec.Codec
|
|
74
77
|
paramSpace paramtypes.Subspace
|
|
75
78
|
|
|
@@ -87,7 +90,7 @@ var _ ante.SwingsetKeeper = &Keeper{}
|
|
|
87
90
|
|
|
88
91
|
// NewKeeper creates a new IBC transfer Keeper instance
|
|
89
92
|
func NewKeeper(
|
|
90
|
-
cdc codec.Codec, key
|
|
93
|
+
cdc codec.Codec, key storetypes.StoreKey, paramSpace paramtypes.Subspace,
|
|
91
94
|
accountKeeper types.AccountKeeper, bankKeeper bankkeeper.Keeper,
|
|
92
95
|
vstorageKeeper vstoragekeeper.Keeper, feeCollectorName string,
|
|
93
96
|
callToController func(ctx sdk.Context, str string) (string, error),
|
|
@@ -304,9 +307,9 @@ func (k Keeper) GetBeansOwing(ctx sdk.Context, addr sdk.AccAddress) sdk.Uint {
|
|
|
304
307
|
path := getBeansOwingPathForAddress(addr)
|
|
305
308
|
entry := k.vstorageKeeper.GetEntry(ctx, path)
|
|
306
309
|
if !entry.HasValue() {
|
|
307
|
-
return
|
|
310
|
+
return sdkmath.ZeroUint()
|
|
308
311
|
}
|
|
309
|
-
return
|
|
312
|
+
return sdkmath.NewUintFromString(entry.StringValue())
|
|
310
313
|
}
|
|
311
314
|
|
|
312
315
|
// SetBeansOwing sets the number of beans that the given address owes to the
|
|
@@ -196,7 +196,7 @@ var (
|
|
|
196
196
|
func makeTestStore() sdk.KVStore {
|
|
197
197
|
db := dbm.NewMemDB()
|
|
198
198
|
ms := store.NewCommitMultiStore(db)
|
|
199
|
-
ms.MountStoreWithDB(swingsetStoreKey,
|
|
199
|
+
ms.MountStoreWithDB(swingsetStoreKey, storetypes.StoreTypeIAVL, db)
|
|
200
200
|
err := ms.LoadLatestVersion()
|
|
201
201
|
if err != nil {
|
|
202
202
|
panic(err)
|
|
@@ -3,15 +3,15 @@ package swingset
|
|
|
3
3
|
import (
|
|
4
4
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
5
5
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
|
6
|
-
|
|
6
|
+
govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
|
|
7
7
|
|
|
8
8
|
"github.com/Agoric/agoric-sdk/golang/cosmos/x/swingset/keeper"
|
|
9
9
|
"github.com/Agoric/agoric-sdk/golang/cosmos/x/swingset/types"
|
|
10
10
|
)
|
|
11
11
|
|
|
12
12
|
// NewSwingSetProposalHandler defines the SwingSet proposal handler
|
|
13
|
-
func NewSwingSetProposalHandler(k keeper.Keeper)
|
|
14
|
-
return func(ctx sdk.Context, content
|
|
13
|
+
func NewSwingSetProposalHandler(k keeper.Keeper) govv1beta1.Handler {
|
|
14
|
+
return func(ctx sdk.Context, content govv1beta1.Content) error {
|
|
15
15
|
switch c := content.(type) {
|
|
16
16
|
case *types.CoreEvalProposal:
|
|
17
17
|
return k.CoreEvalProposal(ctx, c)
|
|
@@ -6,7 +6,7 @@ import (
|
|
|
6
6
|
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
|
|
7
7
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
8
8
|
"github.com/cosmos/cosmos-sdk/types/msgservice"
|
|
9
|
-
|
|
9
|
+
govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
|
|
10
10
|
)
|
|
11
11
|
|
|
12
12
|
var (
|
|
@@ -44,7 +44,7 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
|
|
|
44
44
|
&MsgWalletSpendAction{},
|
|
45
45
|
)
|
|
46
46
|
registry.RegisterImplementations(
|
|
47
|
-
(*
|
|
47
|
+
(*govv1beta1.Content)(nil),
|
|
48
48
|
&CoreEvalProposal{},
|
|
49
49
|
)
|
|
50
50
|
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
|
|
@@ -5,7 +5,7 @@ import (
|
|
|
5
5
|
"strings"
|
|
6
6
|
|
|
7
7
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
|
8
|
-
|
|
8
|
+
govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
|
|
9
9
|
)
|
|
10
10
|
|
|
11
11
|
const (
|
|
@@ -14,15 +14,15 @@ const (
|
|
|
14
14
|
)
|
|
15
15
|
|
|
16
16
|
var (
|
|
17
|
-
_
|
|
17
|
+
_ govv1beta1.Content = &CoreEvalProposal{}
|
|
18
18
|
)
|
|
19
19
|
|
|
20
20
|
func init() {
|
|
21
|
-
|
|
21
|
+
govv1beta1.RegisterProposalType(ProposalTypeCoreEval)
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
// NewCoreEvalProposal creates a new core eval proposal.
|
|
25
|
-
func NewCoreEvalProposal(title, description string, evals []CoreEval)
|
|
25
|
+
func NewCoreEvalProposal(title, description string, evals []CoreEval) govv1beta1.Content {
|
|
26
26
|
return &CoreEvalProposal{
|
|
27
27
|
Title: title,
|
|
28
28
|
Description: description,
|
|
@@ -44,7 +44,7 @@ func (cep *CoreEvalProposal) ProposalType() string { return ProposalTypeCoreEval
|
|
|
44
44
|
|
|
45
45
|
// ValidateBasic runs basic stateless validity checks
|
|
46
46
|
func (cep *CoreEvalProposal) ValidateBasic() error {
|
|
47
|
-
err :=
|
|
47
|
+
err := govv1beta1.ValidateAbstract(cep)
|
|
48
48
|
if err != nil {
|
|
49
49
|
return err
|
|
50
50
|
}
|
package/x/vbank/keeper/keeper.go
CHANGED
|
@@ -2,6 +2,7 @@ package keeper
|
|
|
2
2
|
|
|
3
3
|
import (
|
|
4
4
|
"github.com/cosmos/cosmos-sdk/codec"
|
|
5
|
+
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
|
5
6
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
6
7
|
|
|
7
8
|
"github.com/Agoric/agoric-sdk/golang/cosmos/x/vbank/types"
|
|
@@ -15,7 +16,7 @@ const stateKey string = "state"
|
|
|
15
16
|
|
|
16
17
|
// Keeper maintains the link to data storage and exposes getter/setter methods for the various parts of the state machine
|
|
17
18
|
type Keeper struct {
|
|
18
|
-
storeKey
|
|
19
|
+
storeKey storetypes.StoreKey
|
|
19
20
|
cdc codec.Codec
|
|
20
21
|
paramSpace paramtypes.Subspace
|
|
21
22
|
|
|
@@ -27,7 +28,7 @@ type Keeper struct {
|
|
|
27
28
|
|
|
28
29
|
// NewKeeper creates a new vbank Keeper instance
|
|
29
30
|
func NewKeeper(
|
|
30
|
-
cdc codec.Codec, key
|
|
31
|
+
cdc codec.Codec, key storetypes.StoreKey, paramSpace paramtypes.Subspace,
|
|
31
32
|
accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper,
|
|
32
33
|
rewardDistributorName string,
|
|
33
34
|
pushAction vm.ActionPusher,
|
package/x/vbank/vbank_test.go
CHANGED
|
@@ -263,9 +263,9 @@ func makeTestKit(account types.AccountKeeper, bank types.BankKeeper) (Keeper, sd
|
|
|
263
263
|
|
|
264
264
|
db := dbm.NewMemDB()
|
|
265
265
|
ms := store.NewCommitMultiStore(db)
|
|
266
|
-
ms.MountStoreWithDB(vbankStoreKey,
|
|
267
|
-
ms.MountStoreWithDB(paramsStoreKey,
|
|
268
|
-
ms.MountStoreWithDB(paramsTStoreKey,
|
|
266
|
+
ms.MountStoreWithDB(vbankStoreKey, storetypes.StoreTypeIAVL, db)
|
|
267
|
+
ms.MountStoreWithDB(paramsStoreKey, storetypes.StoreTypeIAVL, db)
|
|
268
|
+
ms.MountStoreWithDB(paramsTStoreKey, storetypes.StoreTypeTransient, db)
|
|
269
269
|
err := ms.LoadLatestVersion()
|
|
270
270
|
if err != nil {
|
|
271
271
|
panic(err)
|
package/x/vibc/ibc.go
CHANGED
|
@@ -8,11 +8,11 @@ import (
|
|
|
8
8
|
"github.com/Agoric/agoric-sdk/golang/cosmos/vm"
|
|
9
9
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
|
10
10
|
capability "github.com/cosmos/cosmos-sdk/x/capability/types"
|
|
11
|
-
channeltypes "github.com/cosmos/ibc-go/
|
|
12
|
-
porttypes "github.com/cosmos/ibc-go/
|
|
13
|
-
host "github.com/cosmos/ibc-go/
|
|
11
|
+
channeltypes "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types"
|
|
12
|
+
porttypes "github.com/cosmos/ibc-go/v6/modules/core/05-port/types"
|
|
13
|
+
host "github.com/cosmos/ibc-go/v6/modules/core/24-host"
|
|
14
14
|
|
|
15
|
-
"github.com/cosmos/ibc-go/
|
|
15
|
+
"github.com/cosmos/ibc-go/v6/modules/core/exported"
|
|
16
16
|
|
|
17
17
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
18
18
|
)
|
|
@@ -81,29 +81,28 @@ func (ch IBCModule) Receive(cctx context.Context, str string) (ret string, err e
|
|
|
81
81
|
|
|
82
82
|
switch msg.Method {
|
|
83
83
|
case "sendPacket":
|
|
84
|
-
seq, ok := keeper.GetNextSequenceSend(
|
|
85
|
-
ctx,
|
|
86
|
-
msg.Packet.SourcePort,
|
|
87
|
-
msg.Packet.SourceChannel,
|
|
88
|
-
)
|
|
89
|
-
if !ok {
|
|
90
|
-
return "", fmt.Errorf("unknown sequence number")
|
|
91
|
-
}
|
|
92
|
-
|
|
93
84
|
timeoutTimestamp := msg.Packet.TimeoutTimestamp
|
|
94
85
|
if msg.Packet.TimeoutHeight.IsZero() && msg.Packet.TimeoutTimestamp == 0 {
|
|
95
86
|
// Use the relative timeout if no absolute timeout is specifiied.
|
|
96
87
|
timeoutTimestamp = uint64(ctx.BlockTime().UnixNano()) + msg.RelativeTimeoutNs
|
|
97
88
|
}
|
|
98
89
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
msg.Packet.SourcePort,
|
|
102
|
-
msg.Packet.
|
|
103
|
-
msg.Packet.TimeoutHeight,
|
|
90
|
+
seq, err := keeper.SendPacket(
|
|
91
|
+
ctx,
|
|
92
|
+
msg.Packet.SourcePort,
|
|
93
|
+
msg.Packet.SourceChannel,
|
|
94
|
+
msg.Packet.TimeoutHeight,
|
|
95
|
+
timeoutTimestamp,
|
|
96
|
+
msg.Packet.Data,
|
|
104
97
|
)
|
|
105
|
-
err = keeper.SendPacket(ctx, packet)
|
|
106
98
|
if err == nil {
|
|
99
|
+
// synthesize the sent packet
|
|
100
|
+
packet := channeltypes.NewPacket(
|
|
101
|
+
msg.Packet.Data, seq,
|
|
102
|
+
msg.Packet.SourcePort, msg.Packet.SourceChannel,
|
|
103
|
+
msg.Packet.DestinationPort, msg.Packet.DestinationChannel,
|
|
104
|
+
msg.Packet.TimeoutHeight, timeoutTimestamp,
|
|
105
|
+
)
|
|
107
106
|
bytes, err := json.Marshal(&packet)
|
|
108
107
|
if err == nil {
|
|
109
108
|
ret = string(bytes)
|
package/x/vibc/keeper/keeper.go
CHANGED
|
@@ -4,15 +4,17 @@ import (
|
|
|
4
4
|
"fmt"
|
|
5
5
|
|
|
6
6
|
"github.com/cosmos/cosmos-sdk/codec"
|
|
7
|
+
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
|
7
8
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
8
9
|
|
|
9
10
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
|
10
11
|
capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
|
|
11
12
|
capability "github.com/cosmos/cosmos-sdk/x/capability/types"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
clienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types"
|
|
14
|
+
channeltypes "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types"
|
|
15
|
+
porttypes "github.com/cosmos/ibc-go/v6/modules/core/05-port/types"
|
|
16
|
+
host "github.com/cosmos/ibc-go/v6/modules/core/24-host"
|
|
17
|
+
ibcexported "github.com/cosmos/ibc-go/v6/modules/core/exported"
|
|
16
18
|
|
|
17
19
|
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
|
|
18
20
|
|
|
@@ -22,7 +24,7 @@ import (
|
|
|
22
24
|
|
|
23
25
|
// Keeper maintains the link to data storage and exposes getter/setter methods for the various parts of the state machine
|
|
24
26
|
type Keeper struct {
|
|
25
|
-
storeKey
|
|
27
|
+
storeKey storetypes.StoreKey
|
|
26
28
|
cdc codec.Codec
|
|
27
29
|
|
|
28
30
|
channelKeeper types.ChannelKeeper
|
|
@@ -35,7 +37,7 @@ type Keeper struct {
|
|
|
35
37
|
|
|
36
38
|
// NewKeeper creates a new dIBC Keeper instance
|
|
37
39
|
func NewKeeper(
|
|
38
|
-
cdc codec.Codec, key
|
|
40
|
+
cdc codec.Codec, key storetypes.StoreKey,
|
|
39
41
|
channelKeeper types.ChannelKeeper, portKeeper types.PortKeeper,
|
|
40
42
|
bankKeeper bankkeeper.Keeper,
|
|
41
43
|
scopedKeeper capabilitykeeper.ScopedKeeper,
|
|
@@ -57,12 +59,6 @@ func (k Keeper) GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) s
|
|
|
57
59
|
return k.bankKeeper.GetBalance(ctx, addr, denom)
|
|
58
60
|
}
|
|
59
61
|
|
|
60
|
-
// GetNextSequenceSend defines a wrapper function for the channel Keeper's function
|
|
61
|
-
// in order to expose it to the vibc IBC handler.
|
|
62
|
-
func (k Keeper) GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool) {
|
|
63
|
-
return k.channelKeeper.GetNextSequenceSend(ctx, portID, channelID)
|
|
64
|
-
}
|
|
65
|
-
|
|
66
62
|
// GetChannel defines a wrapper function for the channel Keeper's function
|
|
67
63
|
// in order to expose it to the vibc IBC handler.
|
|
68
64
|
func (k Keeper) GetChannel(ctx sdk.Context, portID, channelID string) (channeltypes.Channel, bool) {
|
|
@@ -98,15 +94,20 @@ func (k Keeper) ChanOpenInit(ctx sdk.Context, order channeltypes.Order, connecti
|
|
|
98
94
|
|
|
99
95
|
// SendPacket defines a wrapper function for the channel Keeper's function
|
|
100
96
|
// in order to expose it to the vibc IBC handler.
|
|
101
|
-
func (k Keeper) SendPacket(
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
97
|
+
func (k Keeper) SendPacket(
|
|
98
|
+
ctx sdk.Context,
|
|
99
|
+
sourcePort string,
|
|
100
|
+
sourceChannel string,
|
|
101
|
+
timeoutHeight clienttypes.Height,
|
|
102
|
+
timeoutTimestamp uint64,
|
|
103
|
+
data []byte,
|
|
104
|
+
) (uint64, error) {
|
|
105
|
+
capName := host.ChannelCapabilityPath(sourcePort, sourceChannel)
|
|
105
106
|
chanCap, ok := k.GetCapability(ctx, capName)
|
|
106
107
|
if !ok {
|
|
107
|
-
return sdkerrors.Wrapf(channeltypes.ErrChannelCapabilityNotFound, "could not retrieve channel capability at: %s", capName)
|
|
108
|
+
return 0, sdkerrors.Wrapf(channeltypes.ErrChannelCapabilityNotFound, "could not retrieve channel capability at: %s", capName)
|
|
108
109
|
}
|
|
109
|
-
return k.channelKeeper.SendPacket(ctx, chanCap,
|
|
110
|
+
return k.channelKeeper.SendPacket(ctx, chanCap, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, data)
|
|
110
111
|
}
|
|
111
112
|
|
|
112
113
|
var _ ibcexported.Acknowledgement = (*rawAcknowledgement)(nil)
|
|
@@ -3,16 +3,24 @@ package types
|
|
|
3
3
|
import (
|
|
4
4
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
5
5
|
capability "github.com/cosmos/cosmos-sdk/x/capability/types"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
clienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types"
|
|
7
|
+
connection "github.com/cosmos/ibc-go/v6/modules/core/03-connection/types"
|
|
8
|
+
channel "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types"
|
|
9
|
+
ibcexported "github.com/cosmos/ibc-go/v6/modules/core/exported"
|
|
9
10
|
)
|
|
10
11
|
|
|
11
12
|
// ChannelKeeper defines the expected IBC channel keeper
|
|
12
13
|
type ChannelKeeper interface {
|
|
13
14
|
GetChannel(ctx sdk.Context, srcPort, srcChan string) (channel channel.Channel, found bool)
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
SendPacket(
|
|
16
|
+
ctx sdk.Context,
|
|
17
|
+
channelCap *capability.Capability,
|
|
18
|
+
sourcePort string,
|
|
19
|
+
sourceChannel string,
|
|
20
|
+
timeoutHeight clienttypes.Height,
|
|
21
|
+
timeoutTimestamp uint64,
|
|
22
|
+
data []byte,
|
|
23
|
+
) (uint64, error)
|
|
16
24
|
WriteAcknowledgement(ctx sdk.Context, channelCap *capability.Capability, packet ibcexported.PacketI, acknowledgement ibcexported.Acknowledgement) error
|
|
17
25
|
ChanOpenInit(ctx sdk.Context, order channel.Order, connectionHops []string, portID string,
|
|
18
26
|
portCap *capability.Capability, counterparty channel.Counterparty, version string) (string, *capability.Capability, error)
|
package/x/vibc/types/msgs.go
CHANGED
|
@@ -4,7 +4,7 @@ import (
|
|
|
4
4
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
5
5
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
|
6
6
|
|
|
7
|
-
chanTypes "github.com/cosmos/ibc-go/
|
|
7
|
+
chanTypes "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types"
|
|
8
8
|
)
|
|
9
9
|
|
|
10
10
|
const RouterKey = ModuleName // this was defined in your key.go file
|
package/x/vibc/types/msgs.pb.go
CHANGED
|
@@ -7,7 +7,7 @@ import (
|
|
|
7
7
|
context "context"
|
|
8
8
|
fmt "fmt"
|
|
9
9
|
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
|
|
10
|
-
types "github.com/cosmos/ibc-go/
|
|
10
|
+
types "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types"
|
|
11
11
|
_ "github.com/gogo/protobuf/gogoproto"
|
|
12
12
|
grpc1 "github.com/gogo/protobuf/grpc"
|
|
13
13
|
proto "github.com/gogo/protobuf/proto"
|
|
@@ -10,6 +10,7 @@ import (
|
|
|
10
10
|
"strconv"
|
|
11
11
|
"strings"
|
|
12
12
|
|
|
13
|
+
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
|
13
14
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
14
15
|
db "github.com/tendermint/tm-db"
|
|
15
16
|
|
|
@@ -62,7 +63,7 @@ func cutPrefix(s, prefix []byte) (after []byte, found bool) {
|
|
|
62
63
|
// for the various parts of the state machine
|
|
63
64
|
type Keeper struct {
|
|
64
65
|
changeManager ChangeManager
|
|
65
|
-
storeKey
|
|
66
|
+
storeKey storetypes.StoreKey
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
func (bcm *BatchingChangeManager) Track(ctx sdk.Context, k Keeper, entry agoric.KVEntry, isLegacy bool) {
|
|
@@ -116,7 +117,7 @@ func NewBatchingChangeManager() *BatchingChangeManager {
|
|
|
116
117
|
return &bcm
|
|
117
118
|
}
|
|
118
119
|
|
|
119
|
-
func NewKeeper(storeKey
|
|
120
|
+
func NewKeeper(storeKey storetypes.StoreKey) Keeper {
|
|
120
121
|
return Keeper{
|
|
121
122
|
storeKey: storeKey,
|
|
122
123
|
changeManager: NewBatchingChangeManager(),
|
|
@@ -31,7 +31,7 @@ func makeTestKit() testKit {
|
|
|
31
31
|
|
|
32
32
|
db := dbm.NewMemDB()
|
|
33
33
|
ms := store.NewCommitMultiStore(db)
|
|
34
|
-
ms.MountStoreWithDB(vstorageStoreKey,
|
|
34
|
+
ms.MountStoreWithDB(vstorageStoreKey, storetypes.StoreTypeIAVL, db)
|
|
35
35
|
err := ms.LoadLatestVersion()
|
|
36
36
|
if err != nil {
|
|
37
37
|
panic(err)
|
|
@@ -39,7 +39,7 @@ func makeTestKit() testKit {
|
|
|
39
39
|
keeper := NewKeeper(storeKey)
|
|
40
40
|
db := dbm.NewMemDB()
|
|
41
41
|
ms := store.NewCommitMultiStore(db)
|
|
42
|
-
ms.MountStoreWithDB(storeKey,
|
|
42
|
+
ms.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db)
|
|
43
43
|
err := ms.LoadLatestVersion()
|
|
44
44
|
if err != nil {
|
|
45
45
|
panic(err)
|