@agoric/cosmos 0.34.2-dev-c5dea1c.0.c5dea1c → 0.34.2-dev-4ea2a82.0.4ea2a82

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.
Files changed (46) hide show
  1. package/Makefile +1 -0
  2. package/ante/ante.go +2 -2
  3. package/app/app.go +73 -96
  4. package/app/sim_test.go +0 -2
  5. package/app/upgrade.go +6 -6
  6. package/daemon/cmd/root_test.go +1 -0
  7. package/git-revision.txt +1 -1
  8. package/go.mod +83 -116
  9. package/go.sum +162 -130
  10. package/go.work +39 -0
  11. package/go.work.sum +2636 -0
  12. package/package.json +2 -2
  13. package/proto/Dockerfile +14 -0
  14. package/proto/agoric/swingset/msgs.proto +1 -0
  15. package/proto/agoric/vbank/msgs.proto +5 -1
  16. package/proto/agoric/vibc/msgs.proto +45 -2
  17. package/scripts/protocgen.sh +10 -1
  18. package/tests/integrations/types/aminojson_test.go +18 -2
  19. package/third_party/proto/cosmos/base/query/v1beta1/pagination.proto +2 -3
  20. package/third_party/proto/cosmos/upgrade/v1beta1/upgrade.proto +2 -3
  21. package/third_party/proto/ibc/core/channel/v1/channel.proto +6 -22
  22. package/third_party/proto/ibc/core/client/v1/client.proto +6 -53
  23. package/types/address_hooks.go +2 -2
  24. package/types/address_hooks_test.go +3 -3
  25. package/types/ibc_packet.go +3 -3
  26. package/types/ibc_packet_test.go +3 -3
  27. package/x/swingset/types/msgs.pb.go +90 -89
  28. package/x/vbank/types/msgs.pb.go +10 -8
  29. package/x/vibc/alias.go +0 -1
  30. package/x/vibc/keeper/dynamic_router.go +176 -0
  31. package/x/vibc/keeper/dynamic_router_test.go +240 -0
  32. package/x/vibc/keeper/keeper.go +40 -81
  33. package/x/vibc/keeper/migrations.go +1 -1
  34. package/x/vibc/keeper/scope.go +114 -0
  35. package/x/vibc/keeper/triggers.go +8 -4
  36. package/x/vibc/types/expected_keepers.go +7 -20
  37. package/x/vibc/types/ibc_module.go +13 -20
  38. package/x/vibc/types/msgs.go +60 -3
  39. package/x/vibc/types/msgs.pb.go +683 -31
  40. package/x/vibc/types/receiver.go +2 -2
  41. package/x/vlocalchain/vlocalchain_test.go +1 -1
  42. package/x/vtransfer/ibc_middleware.go +15 -17
  43. package/x/vtransfer/ibc_middleware_test.go +30 -53
  44. package/x/vtransfer/keeper/keeper.go +19 -28
  45. package/x/vtransfer/types/expected_keepers.go +15 -8
  46. package/x/vtransfer/utils_test.go +4 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/cosmos",
3
- "version": "0.34.2-dev-c5dea1c.0.c5dea1c",
3
+ "version": "0.34.2-dev-4ea2a82.0.4ea2a82",
4
4
  "description": "Connect JS to the Cosmos blockchain SDK",
5
5
  "parsers": {
6
6
  "js": "mjs"
@@ -41,5 +41,5 @@
41
41
  "typeCoverage": {
42
42
  "atLeast": 0
43
43
  },
44
- "gitHead": "c5dea1c874d9ab8a0da0d559d66be9c7d611741f"
44
+ "gitHead": "4ea2a829ab7a251c14fa872a0c7ac3e85b178eeb"
45
45
  }
@@ -0,0 +1,14 @@
1
+ ARG SOURCE_IMAGE
2
+ FROM ${SOURCE_IMAGE}
3
+
4
+ ARG NEW_UID
5
+ RUN id -u > old_uid
6
+ USER root
7
+
8
+ # Change file ownership from old UID to NEW_UID
9
+ RUN find / -path /proc -prune -o -user $(cat old_uid) -print0 | \
10
+ xargs -0 -n256 chown ${NEW_UID}
11
+
12
+ # Modify /etc/passwd to set the user ID to NEW_UID
13
+ RUN sed -i -e "s/\\(^[^:]*:[^:]*:\\)$(cat old_uid)/\\1${NEW_UID}/" /etc/passwd
14
+ USER ${NEW_UID}
@@ -11,6 +11,7 @@ option go_package = "github.com/Agoric/agoric-sdk/golang/cosmos/x/swingset/types
11
11
 
12
12
  // Transactions.
13
13
  service Msg {
14
+ option (cosmos.msg.v1.service) = true;
14
15
  // Install a JavaScript sources bundle on the chain's SwingSet controller.
15
16
  rpc InstallBundle(MsgInstallBundle) returns (MsgInstallBundleResponse);
16
17
  // Send a chunk of a bundle (or other artifact) to tolerate RPC message size limits.
@@ -1,7 +1,11 @@
1
1
  syntax = "proto3";
2
2
  package agoric.vbank;
3
3
 
4
+ import "cosmos/msg/v1/msg.proto";
5
+
4
6
  option go_package = "github.com/Agoric/agoric-sdk/golang/cosmos/x/vbank/types";
5
7
 
6
8
  // No transactions.
7
- service Msg {}
9
+ service Msg {
10
+ option (cosmos.msg.v1.service) = true;
11
+ }
@@ -3,12 +3,14 @@ package agoric.vibc;
3
3
 
4
4
  import "amino/amino.proto";
5
5
  import "gogoproto/gogo.proto";
6
- import "ibc/core/channel/v1/channel.proto";
6
+ import "cosmos/msg/v1/msg.proto";
7
7
 
8
8
  option go_package = "github.com/Agoric/agoric-sdk/golang/cosmos/x/vibc/types";
9
9
 
10
10
  // The module transactions.
11
11
  service Msg {
12
+ option (cosmos.msg.v1.service) = true;
13
+
12
14
  // Force sending an arbitrary packet on a channel.
13
15
  rpc SendPacket(MsgSendPacket) returns (MsgSendPacketResponse);
14
16
  }
@@ -18,7 +20,7 @@ message MsgSendPacket {
18
20
  option (gogoproto.equal) = false;
19
21
  option (amino.name) = "vibc/SendPacket";
20
22
 
21
- ibc.core.channel.v1.Packet packet = 1
23
+ Packet packet = 1
22
24
  [(gogoproto.nullable) = false, (gogoproto.jsontag) = "packet", (gogoproto.moretags) = "yaml:\"packet\""];
23
25
  bytes sender = 2 [
24
26
  (amino.encoding) = "legacy_address",
@@ -31,3 +33,44 @@ message MsgSendPacket {
31
33
 
32
34
  // Empty response for SendPacket.
33
35
  message MsgSendPacketResponse {}
36
+
37
+ // Packet defines a type that carries data across different chains through IBC.
38
+ // The fields in the Packet correspond to the fields in the IBC packet
39
+ // definition in ibc/core/channel/v1/channel.proto, but with amino and gogoproto
40
+ // options to ensure compatibility with the Cosmos SDK's Protobuf code
41
+ // generation and JSON encoding. See ibc/core/channel/v1/channel.proto for more
42
+ // details on the semantics of each field in the Packet.
43
+ message Packet {
44
+ option (gogoproto.goproto_getters) = false;
45
+
46
+ // number corresponds to the order of sends and receives, where a Packet
47
+ // with an earlier sequence number must be sent and received before a Packet
48
+ // with a later sequence number.
49
+ uint64 sequence = 1;
50
+ // identifies the port on the sending chain.
51
+ string source_port = 2;
52
+ // identifies the channel end on the sending chain.
53
+ string source_channel = 3;
54
+ // identifies the port on the receiving chain.
55
+ string destination_port = 4;
56
+ // identifies the channel end on the receiving chain.
57
+ string destination_channel = 5;
58
+ // actual opaque bytes transferred directly to the application module
59
+ bytes data = 6;
60
+ // block height after which the packet times out
61
+ Height timeout_height = 7 [(gogoproto.nullable) = false];
62
+ // block timestamp (in nanoseconds) after which the packet times out
63
+ uint64 timeout_timestamp = 8;
64
+ }
65
+
66
+ // Height is a local type that enforces amino and gogoproto compatibility for
67
+ // the Height type used in IBC. See ibc/core/client/v1/client.proto for more
68
+ // details on the Height type.
69
+ message Height {
70
+ option (gogoproto.goproto_getters) = false;
71
+
72
+ // the revision that the client is currently on
73
+ uint64 revision_number = 1 [(amino.dont_omitempty) = true, (gogoproto.jsontag) = "revision_number"];
74
+ // the height within the given revision
75
+ uint64 revision_height = 2 [(amino.dont_omitempty) = true, (gogoproto.jsontag) = "revision_height"];
76
+ }
@@ -5,11 +5,20 @@
5
5
  # docker run --rm -v $(pwd):/workspace --workdir /workspace cosmossdk-proto sh ./scripts/protocgen.sh
6
6
 
7
7
  set -eo pipefail
8
+ cd proto
9
+
10
+ if touch .permtest; then
11
+ rm -f .permtest
12
+ else
13
+ echo "ERROR: Cannot write to the current directory. Please check the permissions for this user."
14
+ id || true
15
+ ls -ald . || true
16
+ exit 1
17
+ fi
8
18
 
9
19
  buf_cmd="go tool buf"
10
20
 
11
21
  echo "Generating gogo proto code"
12
- cd proto
13
22
  proto_dirs=$(find . -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq)
14
23
  for dir in $proto_dirs; do
15
24
  for file in $(find "${dir}" -maxdepth 1 -name '*.proto'); do
@@ -33,8 +33,8 @@ import (
33
33
  "github.com/cosmos/cosmos-sdk/x/params/types/proposal"
34
34
  "github.com/cosmos/cosmos-sdk/x/slashing"
35
35
  "github.com/cosmos/cosmos-sdk/x/staking"
36
- clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
37
- channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
36
+ clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
37
+ channeltypes "github.com/cosmos/ibc-go/v10/modules/core/04-channel/types"
38
38
 
39
39
  "github.com/Agoric/agoric-sdk/golang/cosmos/app/txconfig"
40
40
  "github.com/Agoric/agoric-sdk/golang/cosmos/x/swingset"
@@ -98,11 +98,27 @@ func TestAminoJSON_LegacyParity(t *testing.T) {
98
98
  paramsChangeGovMsg, err := govv1beta1.NewMsgSubmitProposal(paramsChangeProposal, coins, addr1)
99
99
  require.NoError(t, err)
100
100
 
101
+
101
102
  ibcPacket := channeltypes.NewPacket(
102
103
  []byte("data"),
103
104
  987654321098765432,
104
105
  "port-src", "channel-13",
105
106
  "port-dst", "channel-42",
107
+ // clienttypes.Height{} does not always produce {"revision_number":0,"revision_height":0} when marshaled to JSON.
108
+ //
109
+ // Clue in cosmos/third_party/proto/ibc/core/client/v1/client.proto:
110
+ // // Please note that json tags for generated Go code are overridden to explicitly exclude the omitempty jsontag.
111
+ // // This enforces the Go json marshaller to always emit zero values for both revision_number and revision_height.
112
+ // message Height {
113
+ // option (gogoproto.goproto_getters) = false;
114
+ // option (gogoproto.goproto_stringer) = false;
115
+ //
116
+ // // the revision that the client is currently on
117
+ // uint64 revision_number = 1 [(gogoproto.jsontag) = "revision_number"];
118
+ // // the height within the given revision
119
+ // uint64 revision_height = 2 [(gogoproto.jsontag) = "revision_height"];
120
+ // }
121
+ // clienttypes.Height{RevisionNumber: 1, RevisionHeight: 2}, // workaround to get tests to pass
106
122
  clienttypes.Height{},
107
123
  123456789012345678,
108
124
  )
@@ -2,6 +2,7 @@ syntax = "proto3";
2
2
  package cosmos.base.query.v1beta1;
3
3
 
4
4
  option go_package = "github.com/cosmos/cosmos-sdk/types/query";
5
+ import "cosmos_proto/cosmos.proto";
5
6
 
6
7
  // PageRequest is to be embedded in gRPC request messages for efficient
7
8
  // pagination. Ex:
@@ -32,9 +33,7 @@ message PageRequest {
32
33
  bool count_total = 4;
33
34
 
34
35
  // reverse is set to true if results are to be returned in the descending order.
35
- //
36
- // Since: cosmos-sdk 0.43
37
- bool reverse = 5;
36
+ bool reverse = 5 [(cosmos_proto.field_added_in) = "cosmos-sdk 0.43"];
38
37
  }
39
38
 
40
39
  // PageResponse is to be embedded in gRPC response messages where the
@@ -81,10 +81,9 @@ message CancelSoftwareUpgradeProposal {
81
81
  }
82
82
 
83
83
  // ModuleVersion specifies a module and its consensus version.
84
- //
85
- // Since: cosmos-sdk 0.43
86
84
  message ModuleVersion {
87
- option (gogoproto.equal) = true;
85
+ option (cosmos_proto.message_added_in) = "cosmos-sdk 0.43";
86
+ option (gogoproto.equal) = true;
88
87
 
89
88
  // name of the app module
90
89
  string name = 1;
@@ -2,7 +2,7 @@ syntax = "proto3";
2
2
 
3
3
  package ibc.core.channel.v1;
4
4
 
5
- option go_package = "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types";
5
+ option go_package = "github.com/cosmos/ibc-go/v10/modules/core/04-channel/types";
6
6
 
7
7
  import "gogoproto/gogo.proto";
8
8
  import "ibc/core/client/v1/client.proto";
@@ -24,9 +24,6 @@ message Channel {
24
24
  repeated string connection_hops = 4;
25
25
  // opaque channel version, which is agreed upon during the handshake
26
26
  string version = 5;
27
- // upgrade sequence indicates the latest upgrade attempt performed by this channel
28
- // the value of 0 indicates the channel has never been upgraded
29
- uint64 upgrade_sequence = 6;
30
27
  }
31
28
 
32
29
  // IdentifiedChannel defines a channel with additional port and channel
@@ -49,13 +46,10 @@ message IdentifiedChannel {
49
46
  string port_id = 6;
50
47
  // channel identifier
51
48
  string channel_id = 7;
52
- // upgrade sequence indicates the latest upgrade attempt performed by this channel
53
- // the value of 0 indicates the channel has never been upgraded
54
- uint64 upgrade_sequence = 8;
55
49
  }
56
50
 
57
51
  // State defines if a channel is in one of the following states:
58
- // CLOSED, INIT, TRYOPEN, OPEN, FLUSHING, FLUSHCOMPLETE or UNINITIALIZED.
52
+ // CLOSED, INIT, TRYOPEN, OPEN, or UNINITIALIZED.
59
53
  enum State {
60
54
  option (gogoproto.goproto_enum_prefix) = false;
61
55
 
@@ -71,10 +65,6 @@ enum State {
71
65
  // A channel has been closed and can no longer be used to send or receive
72
66
  // packets.
73
67
  STATE_CLOSED = 4 [(gogoproto.enumvalue_customname) = "CLOSED"];
74
- // A channel has just accepted the upgrade handshake attempt and is flushing in-flight packets.
75
- STATE_FLUSHING = 5 [(gogoproto.enumvalue_customname) = "FLUSHING"];
76
- // A channel has just completed flushing any in-flight packets.
77
- STATE_FLUSHCOMPLETE = 6 [(gogoproto.enumvalue_customname) = "FLUSHCOMPLETE"];
78
68
  }
79
69
 
80
70
  // Order defines if a channel is ORDERED or UNORDERED
@@ -141,7 +131,7 @@ message PacketState {
141
131
  bytes data = 4;
142
132
  }
143
133
 
144
- // PacketId is an identifer for a unique Packet
134
+ // PacketId is an identifier for a unique Packet
145
135
  // Source chains refer to packets by source port/channel
146
136
  // Destination chains refer to packets by destination port/channel
147
137
  message PacketId {
@@ -171,17 +161,11 @@ message Acknowledgement {
171
161
  }
172
162
 
173
163
  // Timeout defines an execution deadline structure for 04-channel handlers.
174
- // This includes packet lifecycle handlers as well as the upgrade handshake handlers.
164
+ // This includes packet lifecycle handlers.
175
165
  // A valid Timeout contains either one or both of a timestamp and block height (sequence).
176
166
  message Timeout {
177
- // block height after which the packet or upgrade times out
167
+ // block height after which the packet times out
178
168
  ibc.core.client.v1.Height height = 1 [(gogoproto.nullable) = false];
179
- // block timestamp (in nanoseconds) after which the packet or upgrade times out
169
+ // block timestamp (in nanoseconds) after which the packet times out
180
170
  uint64 timestamp = 2;
181
171
  }
182
-
183
- // Params defines the set of IBC channel parameters.
184
- message Params {
185
- // the relative timeout after which channel upgrades will time out.
186
- Timeout upgrade_timeout = 1 [(gogoproto.nullable) = false];
187
- }
@@ -2,10 +2,8 @@ syntax = "proto3";
2
2
 
3
3
  package ibc.core.client.v1;
4
4
 
5
- option go_package = "github.com/cosmos/ibc-go/v8/modules/core/02-client/types";
5
+ option go_package = "github.com/cosmos/ibc-go/v10/modules/core/02-client/types";
6
6
 
7
- import "cosmos/upgrade/v1beta1/upgrade.proto";
8
- import "cosmos_proto/cosmos.proto";
9
7
  import "gogoproto/gogo.proto";
10
8
  import "google/protobuf/any.proto";
11
9
 
@@ -46,14 +44,17 @@ message ClientConsensusStates {
46
44
  // breaking changes In these cases, the RevisionNumber is incremented so that
47
45
  // height continues to be monitonically increasing even as the RevisionHeight
48
46
  // gets reset
47
+ //
48
+ // Please note that json tags for generated Go code are overridden to explicitly exclude the omitempty jsontag.
49
+ // This enforces the Go json marshaller to always emit zero values for both revision_number and revision_height.
49
50
  message Height {
50
51
  option (gogoproto.goproto_getters) = false;
51
52
  option (gogoproto.goproto_stringer) = false;
52
53
 
53
54
  // the revision that the client is currently on
54
- uint64 revision_number = 1;
55
+ uint64 revision_number = 1 [(gogoproto.jsontag) = "revision_number"];
55
56
  // the height within the given revision
56
- uint64 revision_height = 2;
57
+ uint64 revision_height = 2 [(gogoproto.jsontag) = "revision_height"];
57
58
  }
58
59
 
59
60
  // Params defines the set of IBC light client parameters.
@@ -63,51 +64,3 @@ message Params {
63
64
  // of this client will be disabled until it is added again to the list.
64
65
  repeated string allowed_clients = 1;
65
66
  }
66
-
67
- // ClientUpdateProposal is a legacy governance proposal. If it passes, the substitute
68
- // client's latest consensus state is copied over to the subject client. The proposal
69
- // handler may fail if the subject and the substitute do not match in client and
70
- // chain parameters (with exception to latest height, frozen height, and chain-id).
71
- //
72
- // Deprecated: Please use MsgRecoverClient in favour of this message type.
73
- message ClientUpdateProposal {
74
- option deprecated = true;
75
-
76
- option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";
77
- option (gogoproto.goproto_getters) = false;
78
-
79
- // the title of the update proposal
80
- string title = 1;
81
- // the description of the proposal
82
- string description = 2;
83
- // the client identifier for the client to be updated if the proposal passes
84
- string subject_client_id = 3 [(gogoproto.moretags) = "yaml:\"subject_client_id\""];
85
- // the substitute client identifier for the client standing in for the subject
86
- // client
87
- string substitute_client_id = 4 [(gogoproto.moretags) = "yaml:\"substitute_client_id\""];
88
- }
89
-
90
- // UpgradeProposal is a gov Content type for initiating an IBC breaking
91
- // upgrade.
92
- //
93
- // Deprecated: Please use MsgIBCSoftwareUpgrade in favour of this message type.
94
- message UpgradeProposal {
95
- option deprecated = true;
96
-
97
- option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";
98
- option (gogoproto.goproto_getters) = false;
99
- option (gogoproto.goproto_stringer) = false;
100
- option (gogoproto.equal) = true;
101
-
102
- string title = 1;
103
- string description = 2;
104
- cosmos.upgrade.v1beta1.Plan plan = 3 [(gogoproto.nullable) = false];
105
-
106
- // An UpgradedClientState must be provided to perform an IBC breaking upgrade.
107
- // This will make the chain commit to the correct upgraded (self) client state
108
- // before the upgrade occurs, so that connecting chains can verify that the
109
- // new upgraded client is valid by verifying a proof on the previous version
110
- // of the chain. This will allow IBC connections to persist smoothly across
111
- // planned chain upgrades
112
- google.protobuf.Any upgraded_client_state = 4 [(gogoproto.moretags) = "yaml:\"upgraded_client_state\""];
113
- }
@@ -7,8 +7,8 @@ import (
7
7
  "github.com/cosmos/cosmos-sdk/codec"
8
8
  "github.com/cosmos/cosmos-sdk/types/bech32"
9
9
 
10
- transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
11
- ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
10
+ transfertypes "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types"
11
+ ibcexported "github.com/cosmos/ibc-go/v10/modules/core/exported"
12
12
  )
13
13
 
14
14
  type AddressRole string
@@ -8,9 +8,9 @@ import (
8
8
  codec "github.com/cosmos/cosmos-sdk/codec"
9
9
  cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
10
10
 
11
- transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
12
- clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
13
- channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
11
+ transfertypes "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types"
12
+ clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
13
+ channeltypes "github.com/cosmos/ibc-go/v10/modules/core/04-channel/types"
14
14
 
15
15
  agtypes "github.com/Agoric/agoric-sdk/golang/cosmos/types"
16
16
  )
@@ -3,9 +3,9 @@ package types
3
3
  import (
4
4
  "encoding/json"
5
5
 
6
- clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
7
- channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
8
- "github.com/cosmos/ibc-go/v8/modules/core/exported"
6
+ clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
7
+ channeltypes "github.com/cosmos/ibc-go/v10/modules/core/04-channel/types"
8
+ "github.com/cosmos/ibc-go/v10/modules/core/exported"
9
9
  )
10
10
 
11
11
  var _ json.Marshaler = IBCPacket{}
@@ -11,9 +11,9 @@ import (
11
11
  "github.com/stretchr/testify/assert"
12
12
  "github.com/stretchr/testify/require"
13
13
 
14
- clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
15
- channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
16
- ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
14
+ clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
15
+ channeltypes "github.com/cosmos/ibc-go/v10/modules/core/04-channel/types"
16
+ ibcexported "github.com/cosmos/ibc-go/v10/modules/core/exported"
17
17
  )
18
18
 
19
19
  func CreateTestChannelPacket() channeltypes.Packet {