@agoric/cosmos 0.34.2-dev-4ea2a82.0.4ea2a82 → 0.34.2-dev-2858da6.0.2858da6
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 +0 -1
- package/ante/ante.go +2 -2
- package/app/app.go +96 -73
- package/app/sim_test.go +2 -0
- package/app/upgrade.go +6 -6
- package/daemon/cmd/root_test.go +0 -1
- package/git-revision.txt +1 -1
- package/go.mod +116 -83
- package/go.sum +130 -162
- package/package.json +2 -2
- package/proto/agoric/swingset/msgs.proto +0 -1
- package/proto/agoric/vbank/msgs.proto +1 -5
- package/proto/agoric/vibc/msgs.proto +2 -45
- package/scripts/protocgen.sh +1 -10
- package/tests/integrations/types/aminojson_test.go +2 -18
- package/third_party/proto/cosmos/base/query/v1beta1/pagination.proto +3 -2
- package/third_party/proto/cosmos/upgrade/v1beta1/upgrade.proto +3 -2
- package/third_party/proto/ibc/core/channel/v1/channel.proto +22 -6
- package/third_party/proto/ibc/core/client/v1/client.proto +53 -6
- package/types/address_hooks.go +2 -2
- package/types/address_hooks_test.go +3 -3
- package/types/ibc_packet.go +3 -3
- package/types/ibc_packet_test.go +3 -3
- package/x/swingset/types/msgs.pb.go +89 -90
- package/x/vbank/types/msgs.pb.go +8 -10
- package/x/vibc/alias.go +1 -0
- package/x/vibc/keeper/keeper.go +81 -40
- package/x/vibc/keeper/migrations.go +1 -1
- package/x/vibc/keeper/triggers.go +4 -8
- package/x/vibc/types/expected_keepers.go +20 -7
- package/x/vibc/types/ibc_module.go +20 -13
- package/x/vibc/types/msgs.go +3 -60
- package/x/vibc/types/msgs.pb.go +31 -683
- package/x/vibc/types/receiver.go +2 -2
- package/x/vlocalchain/vlocalchain_test.go +1 -1
- package/x/vtransfer/ibc_middleware.go +17 -15
- package/x/vtransfer/ibc_middleware_test.go +53 -30
- package/x/vtransfer/keeper/keeper.go +28 -19
- package/x/vtransfer/types/expected_keepers.go +8 -15
- package/x/vtransfer/utils_test.go +9 -4
- package/go.work +0 -39
- package/go.work.sum +0 -2636
- package/proto/Dockerfile +0 -14
- package/x/vibc/keeper/dynamic_router.go +0 -176
- package/x/vibc/keeper/dynamic_router_test.go +0 -240
- package/x/vibc/keeper/scope.go +0 -114
package/x/vibc/types/receiver.go
CHANGED
|
@@ -7,9 +7,9 @@ import (
|
|
|
7
7
|
|
|
8
8
|
"github.com/Agoric/agoric-sdk/golang/cosmos/types"
|
|
9
9
|
"github.com/Agoric/agoric-sdk/golang/cosmos/vm"
|
|
10
|
-
channeltypes "github.com/cosmos/ibc-go/
|
|
10
|
+
channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
|
|
11
11
|
|
|
12
|
-
"github.com/cosmos/ibc-go/
|
|
12
|
+
"github.com/cosmos/ibc-go/v8/modules/core/exported"
|
|
13
13
|
|
|
14
14
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
15
15
|
)
|
|
@@ -24,7 +24,7 @@ import (
|
|
|
24
24
|
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
|
25
25
|
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
|
|
26
26
|
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
|
|
27
|
-
transfertypes "github.com/cosmos/ibc-go/
|
|
27
|
+
transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
|
|
28
28
|
|
|
29
29
|
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
|
|
30
30
|
"github.com/cosmos/gogoproto/jsonpb"
|
|
@@ -3,10 +3,11 @@ package vtransfer
|
|
|
3
3
|
import (
|
|
4
4
|
"github.com/Agoric/agoric-sdk/golang/cosmos/x/vtransfer/keeper"
|
|
5
5
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"github.com/cosmos/ibc-go/
|
|
6
|
+
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
|
|
7
|
+
clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
|
|
8
|
+
channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
|
|
9
|
+
porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types"
|
|
10
|
+
"github.com/cosmos/ibc-go/v8/modules/core/exported"
|
|
10
11
|
)
|
|
11
12
|
|
|
12
13
|
// IBCMiddleware (https://ibc.cosmos.network/main/ibc/apps/ibcmodule) forwards
|
|
@@ -56,10 +57,11 @@ func (im IBCMiddleware) OnChanOpenInit(
|
|
|
56
57
|
connectionHops []string,
|
|
57
58
|
portID string,
|
|
58
59
|
channelID string,
|
|
60
|
+
chanCap *capabilitytypes.Capability,
|
|
59
61
|
counterparty channeltypes.Counterparty,
|
|
60
62
|
version string,
|
|
61
63
|
) (string, error) {
|
|
62
|
-
return im.ibcModule.OnChanOpenInit(ctx, order, connectionHops, portID, channelID, counterparty, version)
|
|
64
|
+
return im.ibcModule.OnChanOpenInit(ctx, order, connectionHops, portID, channelID, chanCap, counterparty, version)
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
// OnChanOpenTry implements the IBCModule interface.
|
|
@@ -69,10 +71,11 @@ func (im IBCMiddleware) OnChanOpenTry(
|
|
|
69
71
|
connectionHops []string,
|
|
70
72
|
portID,
|
|
71
73
|
channelID string,
|
|
74
|
+
chanCap *capabilitytypes.Capability,
|
|
72
75
|
counterparty channeltypes.Counterparty,
|
|
73
76
|
counterpartyVersion string,
|
|
74
77
|
) (string, error) {
|
|
75
|
-
return im.ibcModule.OnChanOpenTry(ctx, order, connectionHops, portID, channelID, counterparty, counterpartyVersion)
|
|
78
|
+
return im.ibcModule.OnChanOpenTry(ctx, order, connectionHops, portID, channelID, chanCap, counterparty, counterpartyVersion)
|
|
76
79
|
}
|
|
77
80
|
|
|
78
81
|
// OnChanOpenAck implements the IBCModule interface.
|
|
@@ -122,32 +125,29 @@ func (im IBCMiddleware) OnChanCloseConfirm(
|
|
|
122
125
|
// OnRecvPacket implements the IBCModule interface.
|
|
123
126
|
func (im IBCMiddleware) OnRecvPacket(
|
|
124
127
|
ctx sdk.Context,
|
|
125
|
-
channelVersion string,
|
|
126
128
|
packet channeltypes.Packet,
|
|
127
129
|
relayer sdk.AccAddress,
|
|
128
130
|
) exported.Acknowledgement {
|
|
129
|
-
return im.vtransferKeeper.InterceptOnRecvPacket(ctx, im.ibcModule,
|
|
131
|
+
return im.vtransferKeeper.InterceptOnRecvPacket(ctx, im.ibcModule, packet, relayer)
|
|
130
132
|
}
|
|
131
133
|
|
|
132
134
|
// OnAcknowledgementPacket implements the IBCModule interface.
|
|
133
135
|
func (im IBCMiddleware) OnAcknowledgementPacket(
|
|
134
136
|
ctx sdk.Context,
|
|
135
|
-
channelVersion string,
|
|
136
137
|
packet channeltypes.Packet,
|
|
137
138
|
acknowledgement []byte,
|
|
138
139
|
relayer sdk.AccAddress,
|
|
139
140
|
) error {
|
|
140
|
-
return im.vtransferKeeper.InterceptOnAcknowledgementPacket(ctx, im.ibcModule,
|
|
141
|
+
return im.vtransferKeeper.InterceptOnAcknowledgementPacket(ctx, im.ibcModule, packet, acknowledgement, relayer)
|
|
141
142
|
}
|
|
142
143
|
|
|
143
144
|
// OnTimeoutPacket implements the IBCModule interface.
|
|
144
145
|
func (im IBCMiddleware) OnTimeoutPacket(
|
|
145
146
|
ctx sdk.Context,
|
|
146
|
-
channelVersion string,
|
|
147
147
|
packet channeltypes.Packet,
|
|
148
148
|
relayer sdk.AccAddress,
|
|
149
149
|
) error {
|
|
150
|
-
return im.vtransferKeeper.InterceptOnTimeoutPacket(ctx, im.ibcModule,
|
|
150
|
+
return im.vtransferKeeper.InterceptOnTimeoutPacket(ctx, im.ibcModule, packet, relayer)
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
// WriteAcknowledgement implements the ICS4 Wrapper interface.
|
|
@@ -156,12 +156,13 @@ func (im IBCMiddleware) OnTimeoutPacket(
|
|
|
156
156
|
// because they support packet initiation.
|
|
157
157
|
func (im IBCMiddleware) WriteAcknowledgement(
|
|
158
158
|
ctx sdk.Context,
|
|
159
|
+
chanCap *capabilitytypes.Capability,
|
|
159
160
|
packet exported.PacketI,
|
|
160
161
|
ack exported.Acknowledgement,
|
|
161
162
|
) error {
|
|
162
|
-
syncAck, origPacket := im.vtransferKeeper.InterceptWriteAcknowledgement(ctx, packet, ack)
|
|
163
|
+
syncAck, origPacket := im.vtransferKeeper.InterceptWriteAcknowledgement(ctx, chanCap, packet, ack)
|
|
163
164
|
if syncAck != nil {
|
|
164
|
-
return im.vtransferKeeper.WriteAcknowledgement(ctx, origPacket, syncAck)
|
|
165
|
+
return im.vtransferKeeper.WriteAcknowledgement(ctx, chanCap, origPacket, syncAck)
|
|
165
166
|
}
|
|
166
167
|
return nil
|
|
167
168
|
}
|
|
@@ -173,13 +174,14 @@ func (im IBCMiddleware) WriteAcknowledgement(
|
|
|
173
174
|
// SendPacket implements the ICS4 Wrapper interface.
|
|
174
175
|
func (im IBCMiddleware) SendPacket(
|
|
175
176
|
ctx sdk.Context,
|
|
177
|
+
chanCap *capabilitytypes.Capability,
|
|
176
178
|
sourcePort string,
|
|
177
179
|
sourceChannel string,
|
|
178
180
|
timeoutHeight clienttypes.Height,
|
|
179
181
|
timeoutTimestamp uint64,
|
|
180
182
|
data []byte,
|
|
181
183
|
) (uint64, error) {
|
|
182
|
-
return im.vtransferKeeper.SendPacket(ctx, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, data)
|
|
184
|
+
return im.vtransferKeeper.SendPacket(ctx, chanCap, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, data)
|
|
183
185
|
}
|
|
184
186
|
|
|
185
187
|
// GetAppVersion implements the ICS4 Wrapper interface.
|
|
@@ -28,15 +28,16 @@ import (
|
|
|
28
28
|
|
|
29
29
|
sdkmath "cosmossdk.io/math"
|
|
30
30
|
abci "github.com/cometbft/cometbft/abci/types"
|
|
31
|
+
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
|
|
31
32
|
"github.com/cosmos/cosmos-sdk/baseapp"
|
|
32
33
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
33
34
|
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
|
34
35
|
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
|
|
35
|
-
packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/
|
|
36
|
-
ibctransfertypes "github.com/cosmos/ibc-go/
|
|
37
|
-
channeltypes "github.com/cosmos/ibc-go/
|
|
38
|
-
ibcexported "github.com/cosmos/ibc-go/
|
|
39
|
-
ibctesting "github.com/cosmos/ibc-go/
|
|
36
|
+
packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward/types"
|
|
37
|
+
ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
|
|
38
|
+
channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
|
|
39
|
+
ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
|
|
40
|
+
ibctesting "github.com/cosmos/ibc-go/v8/testing"
|
|
40
41
|
)
|
|
41
42
|
|
|
42
43
|
const (
|
|
@@ -84,7 +85,6 @@ func (s *IntegrationTestSuite) cacheEndpoint(a, b int, endpoint *ibctesting.Endp
|
|
|
84
85
|
amap := s.endpoints[a]
|
|
85
86
|
if amap == nil {
|
|
86
87
|
amap = make(map[int]*ibctesting.Endpoint)
|
|
87
|
-
s.endpoints[a] = amap
|
|
88
88
|
}
|
|
89
89
|
amap[b] = endpoint
|
|
90
90
|
}
|
|
@@ -108,7 +108,7 @@ func (s *IntegrationTestSuite) nextChannelOffset(instance int) int {
|
|
|
108
108
|
return offset
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
func SetupAgoricTestingApp(t *testing.T, instance int)
|
|
111
|
+
func SetupAgoricTestingApp(t *testing.T, instance int) TestingAppMaker {
|
|
112
112
|
return func() (ibctesting.TestingApp, map[string]json.RawMessage) {
|
|
113
113
|
db := dbm.NewMemDB()
|
|
114
114
|
mockController := func(ctx context.Context, needReply bool, jsonRequest string) (jsonReply string, err error) {
|
|
@@ -157,6 +157,15 @@ func SetupAgoricTestingApp(t *testing.T, instance int) ibctesting.AppCreator {
|
|
|
157
157
|
"channels": [],
|
|
158
158
|
"commitments": [],
|
|
159
159
|
"next_channel_sequence": "{{.nextChannelSequence}}",
|
|
160
|
+
"params": {
|
|
161
|
+
"upgrade_timeout": {
|
|
162
|
+
"height": {
|
|
163
|
+
"revision_number": "0",
|
|
164
|
+
"revision_height": "0"
|
|
165
|
+
},
|
|
166
|
+
"timestamp": "600000000000"
|
|
167
|
+
}
|
|
168
|
+
},
|
|
160
169
|
"receipts": [],
|
|
161
170
|
"recv_sequences": [],
|
|
162
171
|
"send_sequences": []
|
|
@@ -209,10 +218,14 @@ func (s *IntegrationTestSuite) SetupTest() {
|
|
|
209
218
|
)
|
|
210
219
|
|
|
211
220
|
chain.App = app
|
|
221
|
+
chain.QueryServer = app.GetIBCKeeper()
|
|
212
222
|
chain.TxConfig = app.GetTxConfig()
|
|
213
223
|
chain.Codec = app.AppCodec()
|
|
214
|
-
chain.
|
|
215
|
-
|
|
224
|
+
chain.CurrentHeader = tmproto.Header{
|
|
225
|
+
ChainID: chainID,
|
|
226
|
+
Height: 1,
|
|
227
|
+
Time: s.coordinator.CurrentTime.UTC(),
|
|
228
|
+
}
|
|
216
229
|
|
|
217
230
|
s.coordinator.CommitBlock(chain)
|
|
218
231
|
|
|
@@ -248,7 +261,13 @@ func (s *IntegrationTestSuite) NewTransferPath(endpointAChainIdx, endpointBChain
|
|
|
248
261
|
endpointAChain := s.coordinator.GetChain(ibctesting.GetChainID(endpointAChainIdx))
|
|
249
262
|
endpointBChain := s.coordinator.GetChain(ibctesting.GetChainID(endpointBChainIdx))
|
|
250
263
|
|
|
264
|
+
chAOffset := s.nextChannelOffset(endpointAChainIdx)
|
|
265
|
+
chBOffset := s.nextChannelOffset(endpointBChainIdx)
|
|
251
266
|
path := ibctesting.NewPath(endpointAChain, endpointBChain)
|
|
267
|
+
_, _, channelASeq := computeSequences(endpointAChainIdx)
|
|
268
|
+
_, _, channelBSeq := computeSequences(endpointBChainIdx)
|
|
269
|
+
path.EndpointA.ChannelID = fmt.Sprintf("channel-%d", channelASeq+chAOffset)
|
|
270
|
+
path.EndpointB.ChannelID = fmt.Sprintf("channel-%d", channelBSeq+chBOffset)
|
|
252
271
|
path.EndpointA.ChannelConfig.PortID = ibctesting.TransferPort
|
|
253
272
|
path.EndpointB.ChannelConfig.PortID = ibctesting.TransferPort
|
|
254
273
|
path.EndpointA.ChannelConfig.Version = "ics20-1"
|
|
@@ -259,17 +278,14 @@ func (s *IntegrationTestSuite) NewTransferPath(endpointAChainIdx, endpointBChain
|
|
|
259
278
|
s.coordinator.SetupConnections(path)
|
|
260
279
|
s.cacheEndpoint(endpointAChainIdx, endpointBChainIdx, path.EndpointA)
|
|
261
280
|
s.cacheEndpoint(endpointBChainIdx, endpointAChainIdx, path.EndpointB)
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
281
|
+
} else {
|
|
282
|
+
path.EndpointA.ClientID = endpoint.ClientID
|
|
283
|
+
path.EndpointA.ConnectionID = endpoint.ConnectionID
|
|
265
284
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
path.EndpointB.ClientID = endpoint.Counterparty.ClientID
|
|
271
|
-
path.EndpointB.ConnectionID = endpoint.Counterparty.ConnectionID
|
|
272
|
-
path.EndpointB.ChannelID = endpoint.Counterparty.ChannelID
|
|
285
|
+
path.EndpointB.ClientID = endpoint.Counterparty.ClientID
|
|
286
|
+
path.EndpointB.ConnectionID = endpoint.Counterparty.ConnectionID
|
|
287
|
+
}
|
|
288
|
+
s.coordinator.CreateChannels(path)
|
|
273
289
|
|
|
274
290
|
s.coordinator.CommitBlock(endpointAChain, endpointBChain)
|
|
275
291
|
|
|
@@ -398,11 +414,15 @@ func (s *IntegrationTestSuite) overrideSendPacketData(cdc codec.Codec, data []by
|
|
|
398
414
|
return nil, err
|
|
399
415
|
}
|
|
400
416
|
|
|
401
|
-
if !bytes.Equal(
|
|
402
|
-
|
|
417
|
+
if !bytes.Equal(data, bz) {
|
|
418
|
+
newBz, err := cdc.MarshalJSON(&newFtpd)
|
|
419
|
+
if err != nil {
|
|
420
|
+
return nil, err
|
|
421
|
+
}
|
|
422
|
+
return newBz, nil
|
|
403
423
|
}
|
|
404
424
|
|
|
405
|
-
return
|
|
425
|
+
return nil, fmt.Errorf("failed to find a way to permute packet data: %s", string(data))
|
|
406
426
|
}
|
|
407
427
|
|
|
408
428
|
func (s *IntegrationTestSuite) mintToAddress(chain *ibctesting.TestChain, addr sdk.AccAddress, denom, amount string) {
|
|
@@ -453,6 +473,7 @@ func (s *IntegrationTestSuite) TestHops() {
|
|
|
453
473
|
|
|
454
474
|
for hops := 1; hops <= 2; hops += 1 {
|
|
455
475
|
for _, tc := range testCases {
|
|
476
|
+
tc := tc
|
|
456
477
|
name := fmt.Sprintf("%s_%dHop", tc.name, hops)
|
|
457
478
|
s.Run(name, func() {
|
|
458
479
|
_, _, baseSenderAddr := testdata.KeyTestPubAddr()
|
|
@@ -581,8 +602,8 @@ func (s *IntegrationTestSuite) TestHops() {
|
|
|
581
602
|
s.Require().NoError(err)
|
|
582
603
|
s.coordinator.CommitBlock(nextPath.EndpointB.Chain)
|
|
583
604
|
|
|
584
|
-
writeAcknowledgementHeight = nextPath.EndpointB.Chain.
|
|
585
|
-
writeAcknowledgementTime = nextPath.EndpointB.Chain.
|
|
605
|
+
writeAcknowledgementHeight = nextPath.EndpointB.Chain.CurrentHeader.Height
|
|
606
|
+
writeAcknowledgementTime = nextPath.EndpointB.Chain.CurrentHeader.Time.Unix()
|
|
586
607
|
|
|
587
608
|
packetRes, err = nextPath.EndpointB.RecvPacketWithResult(sendPacket)
|
|
588
609
|
s.Require().NoError(err)
|
|
@@ -690,8 +711,8 @@ func (s *IntegrationTestSuite) TestHops() {
|
|
|
690
711
|
err = paths[0].EndpointA.UpdateClient()
|
|
691
712
|
s.Require().NoError(err)
|
|
692
713
|
|
|
693
|
-
acknowledgementHeight := s.chainA.
|
|
694
|
-
acknowledgementTime := s.chainA.
|
|
714
|
+
acknowledgementHeight := s.chainA.CurrentHeader.Height
|
|
715
|
+
acknowledgementTime := s.chainA.CurrentHeader.Time.Unix()
|
|
695
716
|
|
|
696
717
|
// Prove the initial packet's acknowledgement.
|
|
697
718
|
ackRes, err := acknowledgePacketWithResult(paths[0].EndpointA, ackedPacket, ack.Acknowledgement())
|
|
@@ -718,8 +739,11 @@ func (s *IntegrationTestSuite) TestHops() {
|
|
|
718
739
|
gotAttrs := 0
|
|
719
740
|
for _, attr := range event.Attributes {
|
|
720
741
|
switch string(attr.Key) {
|
|
721
|
-
case
|
|
722
|
-
s.Require().Equal(
|
|
742
|
+
case "module":
|
|
743
|
+
s.Require().Equal(ibctransfertypes.ModuleName, string(attr.Value))
|
|
744
|
+
gotAttrs += 1
|
|
745
|
+
case ibctransfertypes.AttributeKeyAckSuccess:
|
|
746
|
+
s.Require().Equal("\x01", string(attr.Value))
|
|
723
747
|
gotAttrs += 1
|
|
724
748
|
case ibctransfertypes.AttributeKeyMemo:
|
|
725
749
|
s.Require().Equal(transferData.Memo, string(attr.Value))
|
|
@@ -727,7 +751,7 @@ func (s *IntegrationTestSuite) TestHops() {
|
|
|
727
751
|
case ibctransfertypes.AttributeKeyReceiver:
|
|
728
752
|
s.Require().Equal(transferData.Receiver, string(attr.Value))
|
|
729
753
|
gotAttrs += 1
|
|
730
|
-
case ibctransfertypes.AttributeKeySender:
|
|
754
|
+
case "sender": // ibctransfertypes.AttributeKeySender:
|
|
731
755
|
s.Require().Equal(transferData.Sender, string(attr.Value))
|
|
732
756
|
gotAttrs += 1
|
|
733
757
|
case ibctransfertypes.AttributeKeyDenom:
|
|
@@ -760,7 +784,6 @@ func (s *IntegrationTestSuite) TestHops() {
|
|
|
760
784
|
BlockTime: acknowledgementTime,
|
|
761
785
|
},
|
|
762
786
|
Event: "acknowledgementPacket",
|
|
763
|
-
ChannelVersion: paths[0].EndpointA.ChannelConfig.Version,
|
|
764
787
|
Target: baseSender,
|
|
765
788
|
Packet: types.CopyToIBCPacket(expectedPacket),
|
|
766
789
|
Acknowledgement: ack.Acknowledgement(),
|
|
@@ -15,17 +15,19 @@ import (
|
|
|
15
15
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
16
16
|
sdktypeserrors "github.com/cosmos/cosmos-sdk/types/errors"
|
|
17
17
|
|
|
18
|
+
capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper"
|
|
19
|
+
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
|
|
20
|
+
|
|
18
21
|
agtypes "github.com/Agoric/agoric-sdk/golang/cosmos/types"
|
|
19
22
|
"github.com/Agoric/agoric-sdk/golang/cosmos/vm"
|
|
20
23
|
"github.com/Agoric/agoric-sdk/golang/cosmos/x/vibc"
|
|
21
|
-
vibckeeper "github.com/Agoric/agoric-sdk/golang/cosmos/x/vibc/keeper"
|
|
22
24
|
vibctypes "github.com/Agoric/agoric-sdk/golang/cosmos/x/vibc/types"
|
|
23
25
|
|
|
24
|
-
clienttypes "github.com/cosmos/ibc-go/
|
|
25
|
-
channeltypes "github.com/cosmos/ibc-go/
|
|
26
|
-
porttypes "github.com/cosmos/ibc-go/
|
|
27
|
-
host "github.com/cosmos/ibc-go/
|
|
28
|
-
ibcexported "github.com/cosmos/ibc-go/
|
|
26
|
+
clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
|
|
27
|
+
channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
|
|
28
|
+
porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types"
|
|
29
|
+
host "github.com/cosmos/ibc-go/v8/modules/core/24-host"
|
|
30
|
+
ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
|
|
29
31
|
)
|
|
30
32
|
|
|
31
33
|
var _ porttypes.ICS4Wrapper = (*Keeper)(nil)
|
|
@@ -77,6 +79,7 @@ type ics4Wrapper struct {
|
|
|
77
79
|
|
|
78
80
|
func (i4 *ics4Wrapper) SendPacket(
|
|
79
81
|
ctx sdk.Context,
|
|
82
|
+
chanCap *capabilitytypes.Capability,
|
|
80
83
|
sourcePort string,
|
|
81
84
|
sourceChannel string,
|
|
82
85
|
timeoutHeight clienttypes.Height,
|
|
@@ -98,7 +101,7 @@ func (i4 *ics4Wrapper) SendPacket(
|
|
|
98
101
|
}
|
|
99
102
|
|
|
100
103
|
// Send the stripped data to the next wrapper.
|
|
101
|
-
sequence, err = i4.ICS4Wrapper.SendPacket(ctx, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, strippedData)
|
|
104
|
+
sequence, err = i4.ICS4Wrapper.SendPacket(ctx, chanCap, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, strippedData)
|
|
102
105
|
if err != nil {
|
|
103
106
|
return sequence, err
|
|
104
107
|
}
|
|
@@ -114,6 +117,7 @@ func (i4 *ics4Wrapper) SendPacket(
|
|
|
114
117
|
|
|
115
118
|
func (i4 *ics4Wrapper) WriteAcknowledgement(
|
|
116
119
|
ctx sdk.Context,
|
|
120
|
+
chanCap *capabilitytypes.Capability,
|
|
117
121
|
packet ibcexported.PacketI,
|
|
118
122
|
ack ibcexported.Acknowledgement,
|
|
119
123
|
) error {
|
|
@@ -123,7 +127,7 @@ func (i4 *ics4Wrapper) WriteAcknowledgement(
|
|
|
123
127
|
origPacket.Data = packetStore.Get(packetKey)
|
|
124
128
|
packetStore.Delete(packetKey)
|
|
125
129
|
}
|
|
126
|
-
return i4.ICS4Wrapper.WriteAcknowledgement(ctx, origPacket, ack)
|
|
130
|
+
return i4.ICS4Wrapper.WriteAcknowledgement(ctx, chanCap, origPacket, ack)
|
|
127
131
|
}
|
|
128
132
|
|
|
129
133
|
// NewICS4Wrapper creates a new ICS4Wrapper instance
|
|
@@ -136,13 +140,14 @@ func NewKeeper(
|
|
|
136
140
|
cdc codec.Codec,
|
|
137
141
|
storeService corestore.KVStoreService,
|
|
138
142
|
prototypeVibcKeeper vibc.Keeper,
|
|
143
|
+
scopedTransferKeeper capabilitykeeper.ScopedKeeper,
|
|
139
144
|
pushAction vm.ActionPusher,
|
|
140
145
|
) Keeper {
|
|
141
146
|
wrappedPushAction := wrapActionPusher(pushAction)
|
|
142
147
|
|
|
143
148
|
// This vibcKeeper is used to send notifications from the vtransfer middleware
|
|
144
149
|
// to the VM.
|
|
145
|
-
vibcKeeper := prototypeVibcKeeper.WithScope(
|
|
150
|
+
vibcKeeper := prototypeVibcKeeper.WithScope(nil, scopedTransferKeeper, wrappedPushAction)
|
|
146
151
|
k := Keeper{
|
|
147
152
|
ReceiverImpl: vibcKeeper,
|
|
148
153
|
|
|
@@ -230,7 +235,7 @@ func (k Keeper) PacketStoreFromOrigin(ctx sdk.Context, ourOrigin agtypes.PacketO
|
|
|
230
235
|
// Many error acknowledgments are sent synchronously, but most cases instead return nil
|
|
231
236
|
// to tell the IBC system that acknowledgment is async (i.e., that WriteAcknowledgement
|
|
232
237
|
// will be called later, after the VM has dealt with the packet).
|
|
233
|
-
func (k Keeper) InterceptOnRecvPacket(ctx sdk.Context, ibcModule porttypes.IBCModule,
|
|
238
|
+
func (k Keeper) InterceptOnRecvPacket(ctx sdk.Context, ibcModule porttypes.IBCModule, packet ibcexported.PacketI, relayer sdk.AccAddress) ibcexported.Acknowledgement {
|
|
234
239
|
// Pass every (stripped-receiver) inbound packet to the wrapped IBC module.
|
|
235
240
|
var strippedPacket agtypes.IBCPacket
|
|
236
241
|
_, err := agtypes.ExtractBaseAddressFromPacket(k.cdc, packet, agtypes.RoleReceiver, &strippedPacket)
|
|
@@ -240,20 +245,26 @@ func (k Keeper) InterceptOnRecvPacket(ctx sdk.Context, ibcModule porttypes.IBCMo
|
|
|
240
245
|
|
|
241
246
|
portID := packet.GetDestPort()
|
|
242
247
|
channelID := packet.GetDestChannel()
|
|
248
|
+
capName := host.ChannelCapabilityPath(portID, channelID)
|
|
249
|
+
chanCap, ok := k.vibcKeeper.GetCapability(ctx, capName)
|
|
250
|
+
if !ok {
|
|
251
|
+
err := sdkioerrors.Wrapf(channeltypes.ErrChannelCapabilityNotFound, "could not retrieve channel capability at: %s", capName)
|
|
252
|
+
return channeltypes.NewErrorAcknowledgement(err)
|
|
253
|
+
}
|
|
243
254
|
|
|
244
255
|
if !k.debug.DoNotStore && !bytes.Equal(strippedPacket.GetData(), packet.GetData()) {
|
|
245
256
|
packetStore, packetKey := k.PacketStore(ctx, agtypes.PacketDst, portID, channelID, packet.GetSequence())
|
|
246
257
|
packetStore.Set(packetKey, packet.GetData())
|
|
247
258
|
}
|
|
248
259
|
|
|
249
|
-
ack := ibcModule.OnRecvPacket(ctx,
|
|
260
|
+
ack := ibcModule.OnRecvPacket(ctx, agtypes.CopyToChannelPacket(strippedPacket), relayer)
|
|
250
261
|
if ack == nil {
|
|
251
262
|
// Already declared to be an async ack. Will be cleaned up by ics4Wrapper.WriteAcknowledgement.
|
|
252
263
|
return nil
|
|
253
264
|
}
|
|
254
265
|
|
|
255
266
|
// Give the VM a chance to write (or override) the ack.
|
|
256
|
-
syncAck, _ := k.InterceptWriteAcknowledgement(ctx, packet, ack)
|
|
267
|
+
syncAck, _ := k.InterceptWriteAcknowledgement(ctx, chanCap, packet, ack)
|
|
257
268
|
return syncAck
|
|
258
269
|
}
|
|
259
270
|
|
|
@@ -262,7 +273,6 @@ func (k Keeper) InterceptOnRecvPacket(ctx sdk.Context, ibcModule porttypes.IBCMo
|
|
|
262
273
|
func (k Keeper) InterceptOnAcknowledgementPacket(
|
|
263
274
|
ctx sdk.Context,
|
|
264
275
|
ibcModule porttypes.IBCModule,
|
|
265
|
-
channelVersion string,
|
|
266
276
|
packet ibcexported.PacketI,
|
|
267
277
|
acknowledgement []byte,
|
|
268
278
|
relayer sdk.AccAddress,
|
|
@@ -279,7 +289,7 @@ func (k Keeper) InterceptOnAcknowledgementPacket(
|
|
|
279
289
|
packetStore.Delete(packetKey)
|
|
280
290
|
}
|
|
281
291
|
|
|
282
|
-
modErr := ibcModule.OnAcknowledgementPacket(ctx,
|
|
292
|
+
modErr := ibcModule.OnAcknowledgementPacket(ctx, agtypes.CopyToChannelPacket(packet), acknowledgement, relayer)
|
|
283
293
|
|
|
284
294
|
// If the sender is not a watched account, we're done.
|
|
285
295
|
if !k.targetIsWatched(ctx, baseSender) {
|
|
@@ -287,7 +297,7 @@ func (k Keeper) InterceptOnAcknowledgementPacket(
|
|
|
287
297
|
}
|
|
288
298
|
|
|
289
299
|
// Trigger VM with the original packet, regardless of errors in the ibcModule.
|
|
290
|
-
vmErr := k.vibcKeeper.TriggerOnAcknowledgementPacket(ctx, baseSender,
|
|
300
|
+
vmErr := k.vibcKeeper.TriggerOnAcknowledgementPacket(ctx, baseSender, origPacket, acknowledgement, relayer)
|
|
291
301
|
|
|
292
302
|
// Any error from the VM is trumped by one from the wrapped IBC module.
|
|
293
303
|
if modErr != nil {
|
|
@@ -301,7 +311,6 @@ func (k Keeper) InterceptOnAcknowledgementPacket(
|
|
|
301
311
|
func (k Keeper) InterceptOnTimeoutPacket(
|
|
302
312
|
ctx sdk.Context,
|
|
303
313
|
ibcModule porttypes.IBCModule,
|
|
304
|
-
channelVersion string,
|
|
305
314
|
packet ibcexported.PacketI,
|
|
306
315
|
relayer sdk.AccAddress,
|
|
307
316
|
) error {
|
|
@@ -318,7 +327,7 @@ func (k Keeper) InterceptOnTimeoutPacket(
|
|
|
318
327
|
}
|
|
319
328
|
|
|
320
329
|
// Pass every stripped-sender timeout to the wrapped IBC module.
|
|
321
|
-
modErr := ibcModule.OnTimeoutPacket(ctx,
|
|
330
|
+
modErr := ibcModule.OnTimeoutPacket(ctx, agtypes.CopyToChannelPacket(packet), relayer)
|
|
322
331
|
|
|
323
332
|
// If the sender is not a watched account, we're done.
|
|
324
333
|
if !k.targetIsWatched(ctx, baseSender) {
|
|
@@ -326,7 +335,7 @@ func (k Keeper) InterceptOnTimeoutPacket(
|
|
|
326
335
|
}
|
|
327
336
|
|
|
328
337
|
// Trigger VM with the original packet, regardless of errors in the app.
|
|
329
|
-
vmErr := k.vibcKeeper.TriggerOnTimeoutPacket(ctx, baseSender,
|
|
338
|
+
vmErr := k.vibcKeeper.TriggerOnTimeoutPacket(ctx, baseSender, origPacket, relayer)
|
|
330
339
|
|
|
331
340
|
// Any error from the VM is trumped by one from the wrapped IBC module.
|
|
332
341
|
if modErr != nil {
|
|
@@ -337,7 +346,7 @@ func (k Keeper) InterceptOnTimeoutPacket(
|
|
|
337
346
|
|
|
338
347
|
// InterceptWriteAcknowledgement checks to see if the packet's receiver is a
|
|
339
348
|
// targeted account, and if so, delegates to the VM.
|
|
340
|
-
func (k Keeper) InterceptWriteAcknowledgement(ctx sdk.Context, packet ibcexported.PacketI, ack ibcexported.Acknowledgement) (ibcexported.Acknowledgement, ibcexported.PacketI) {
|
|
349
|
+
func (k Keeper) InterceptWriteAcknowledgement(ctx sdk.Context, chanCap *capabilitytypes.Capability, packet ibcexported.PacketI, ack ibcexported.Acknowledgement) (ibcexported.Acknowledgement, ibcexported.PacketI) {
|
|
341
350
|
// Get the base receiver from the packet, without computing a stripped packet.
|
|
342
351
|
baseReceiver, err := agtypes.ExtractBaseAddressFromPacket(k.cdc, packet, agtypes.RoleReceiver, nil)
|
|
343
352
|
|
|
@@ -2,28 +2,21 @@ package types
|
|
|
2
2
|
|
|
3
3
|
import (
|
|
4
4
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
5
|
-
|
|
6
|
-
channel "github.com/cosmos/ibc-go/
|
|
7
|
-
ibcexported "github.com/cosmos/ibc-go/
|
|
5
|
+
capability "github.com/cosmos/ibc-go/modules/capability/types"
|
|
6
|
+
channel "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
|
|
7
|
+
ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
|
|
8
8
|
)
|
|
9
9
|
|
|
10
10
|
// ChannelKeeper defines the expected IBC channel keeper
|
|
11
11
|
type ChannelKeeper interface {
|
|
12
12
|
GetChannel(ctx sdk.Context, srcPort, srcChan string) (channel channel.Channel, found bool)
|
|
13
13
|
GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool)
|
|
14
|
-
SendPacket(
|
|
15
|
-
|
|
16
|
-
sourcePort string,
|
|
17
|
-
sourceChannel string,
|
|
18
|
-
timeoutHeight clienttypes.Height,
|
|
19
|
-
timeoutTimestamp uint64,
|
|
20
|
-
data []byte,
|
|
21
|
-
) (uint64, error)
|
|
22
|
-
WriteAcknowledgement(ctx sdk.Context, packet ibcexported.PacketI, acknowledgement ibcexported.Acknowledgement) error
|
|
14
|
+
SendPacket(ctx sdk.Context, channelCap *capability.Capability, packet ibcexported.PacketI) error
|
|
15
|
+
WriteAcknowledgement(ctx sdk.Context, channelCap *capability.Capability, packet ibcexported.PacketI, acknowledgement ibcexported.Acknowledgement) error
|
|
23
16
|
ChanOpenInit(ctx sdk.Context, order channel.Order, connectionHops []string, portID string,
|
|
24
|
-
counterparty channel.Counterparty, version string) (string, error)
|
|
17
|
+
portCap *capability.Capability, counterparty channel.Counterparty, version string) (string, *capability.Capability, error)
|
|
25
18
|
WriteOpenInitChannel(ctx sdk.Context, portID, channelID string, order channel.Order,
|
|
26
19
|
connectionHops []string, counterparty channel.Counterparty, version string)
|
|
27
|
-
ChanCloseInit(ctx sdk.Context, portID, channelID string) error
|
|
28
|
-
TimeoutExecuted(ctx sdk.Context, packet
|
|
20
|
+
ChanCloseInit(ctx sdk.Context, portID, channelID string, chanCap *capability.Capability) error
|
|
21
|
+
TimeoutExecuted(ctx sdk.Context, channelCap *capability.Capability, packet ibcexported.PacketI) error
|
|
29
22
|
}
|
|
@@ -6,10 +6,10 @@ import (
|
|
|
6
6
|
"strconv"
|
|
7
7
|
|
|
8
8
|
abci "github.com/cometbft/cometbft/abci/types"
|
|
9
|
-
clienttypes "github.com/cosmos/ibc-go/
|
|
10
|
-
channeltypes "github.com/cosmos/ibc-go/
|
|
11
|
-
host "github.com/cosmos/ibc-go/
|
|
12
|
-
ibctesting "github.com/cosmos/ibc-go/
|
|
9
|
+
clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
|
|
10
|
+
channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
|
|
11
|
+
host "github.com/cosmos/ibc-go/v8/modules/core/24-host"
|
|
12
|
+
ibctesting "github.com/cosmos/ibc-go/v8/testing"
|
|
13
13
|
)
|
|
14
14
|
|
|
15
15
|
// acknowledgePacketWithResult sends a MsgAcknowledgement to the channel associated with the endpoint.
|
|
@@ -44,6 +44,8 @@ func ParseAckFromFilteredEvents(events []abci.Event, filteredType string) ([]byt
|
|
|
44
44
|
return nil, fmt.Errorf("failed to parse hex ack: %w", err)
|
|
45
45
|
}
|
|
46
46
|
return hexAck, nil
|
|
47
|
+
case channeltypes.AttributeKeyAck: //nolint:staticcheck // DEPRECATED
|
|
48
|
+
return []byte(attr.Value), nil
|
|
47
49
|
}
|
|
48
50
|
}
|
|
49
51
|
}
|
|
@@ -73,6 +75,9 @@ func ParsePacketFromFilteredEvents(events []abci.Event, filteredType string) (ch
|
|
|
73
75
|
}
|
|
74
76
|
packet.Data = hexData
|
|
75
77
|
|
|
78
|
+
case channeltypes.AttributeKeyData: //nolint:staticcheck // DEPRECATED
|
|
79
|
+
packet.Data = []byte(attr.Value)
|
|
80
|
+
|
|
76
81
|
case channeltypes.AttributeKeySequence:
|
|
77
82
|
seq, err := strconv.ParseUint(attr.Value, 10, 64)
|
|
78
83
|
if err != nil {
|
package/go.work
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
go 1.24.1
|
|
2
|
-
|
|
3
|
-
use .
|
|
4
|
-
|
|
5
|
-
// Agoric-forked Interchain Stack replacements:
|
|
6
|
-
replace (
|
|
7
|
-
cosmossdk.io/api => github.com/agoric-labs/cosmos-sdk/api v0.53.6-alpha.agoric.1
|
|
8
|
-
cosmossdk.io/client/v2 => github.com/agoric-labs/cosmos-sdk/client/v2 v2.0.0-beta.11-v0.53.6-alpha.agoric.1
|
|
9
|
-
cosmossdk.io/collections => github.com/agoric-labs/cosmos-sdk/collections v0.53.6-alpha.agoric.1
|
|
10
|
-
cosmossdk.io/core => github.com/agoric-labs/cosmos-sdk/core v0.53.6-alpha.agoric.1
|
|
11
|
-
cosmossdk.io/depinject => github.com/agoric-labs/cosmos-sdk/depinject v0.53.6-alpha.agoric.1
|
|
12
|
-
cosmossdk.io/errors => github.com/agoric-labs/cosmos-sdk/errors v0.53.6-alpha.agoric.1
|
|
13
|
-
cosmossdk.io/log => github.com/agoric-labs/cosmos-sdk/log v0.53.6-alpha.agoric.1
|
|
14
|
-
cosmossdk.io/math => github.com/agoric-labs/cosmos-sdk/math v0.53.6-alpha.agoric.1
|
|
15
|
-
cosmossdk.io/simapp => github.com/agoric-labs/cosmos-sdk/simapp v0.53.6-alpha.agoric.1
|
|
16
|
-
cosmossdk.io/store => github.com/agoric-labs/cosmos-sdk/store v0.53.6-alpha.agoric.1
|
|
17
|
-
cosmossdk.io/systemtests => github.com/agoric-labs/cosmos-sdk/systemtests v0.53.6-alpha.agoric.1
|
|
18
|
-
cosmossdk.io/tests => github.com/agoric-labs/cosmos-sdk/tests v0.53.6-alpha.agoric.1
|
|
19
|
-
cosmossdk.io/tests/systemtests => github.com/agoric-labs/cosmos-sdk/tests/systemtests v0.53.6-alpha.agoric.1
|
|
20
|
-
cosmossdk.io/tools/benchmark => github.com/agoric-labs/cosmos-sdk/tools/benchmark v0.53.6-alpha.agoric.1
|
|
21
|
-
cosmossdk.io/tools/confix => github.com/agoric-labs/cosmos-sdk/tools/confix v0.53.6-alpha.agoric.1
|
|
22
|
-
cosmossdk.io/tools/cosmovisor => github.com/agoric-labs/cosmos-sdk/tools/cosmovisor v0.53.6-alpha.agoric.1
|
|
23
|
-
cosmossdk.io/x/circuit => github.com/agoric-labs/cosmos-sdk/x/circuit v0.53.6-alpha.agoric.1
|
|
24
|
-
cosmossdk.io/x/evidence => github.com/agoric-labs/cosmos-sdk/x/evidence v0.53.6-alpha.agoric.1
|
|
25
|
-
cosmossdk.io/x/feegrant => github.com/agoric-labs/cosmos-sdk/x/feegrant v0.53.6-alpha.agoric.1
|
|
26
|
-
cosmossdk.io/x/nft => github.com/agoric-labs/cosmos-sdk/x/nft v0.53.6-alpha.agoric.1
|
|
27
|
-
cosmossdk.io/x/tx => github.com/agoric-labs/cosmos-sdk/x/tx v0.53.6-alpha.agoric.1
|
|
28
|
-
cosmossdk.io/x/upgrade => github.com/agoric-labs/cosmos-sdk/x/upgrade v0.53.6-alpha.agoric.1
|
|
29
|
-
|
|
30
|
-
github.com/cometbft/cometbft => github.com/agoric-labs/cometbft v0.38.21-alpha.agoric.1
|
|
31
|
-
github.com/cosmos/cosmos-sdk => github.com/agoric-labs/cosmos-sdk v0.53.6-alpha.agoric.1
|
|
32
|
-
github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v10 => github.com/agoric-labs/ibc-apps/middleware/packet-forward-middleware/v10 v10.1.1-alpha.agoric.0
|
|
33
|
-
github.com/cosmos/ibc-go/e2e => github.com/agoric-labs/ibc-go/e2e v10.5.0-alpha.agoric.4
|
|
34
|
-
github.com/cosmos/ibc-go/modules/light-clients/08-wasm/v10 => github.com/agoric-labs/ibc-go/modules/light-clients/08-wasm/v10 v10.5.0-alpha.agoric.4
|
|
35
|
-
github.com/cosmos/ibc-go/simapp => github.com/agoric-labs/ibc-go/simapp v10.5.0-alpha.agoric.4
|
|
36
|
-
github.com/cosmos/ibc-go/v10 => github.com/agoric-labs/ibc-go/v10 v10.5.0-alpha.agoric.4
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
|