@agoric/cosmos 0.35.0-u19.2 → 0.35.0-u21.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/.clang-format +116 -0
- package/CHANGELOG.md +18 -18
- package/Makefile +38 -67
- package/ante/ante.go +2 -2
- package/ante/inbound_test.go +1 -1
- package/app/app.go +173 -142
- package/app/export.go +6 -6
- package/app/genesis.go +4 -0
- package/app/sim_test.go +299 -50
- package/app/upgrade.go +142 -96
- package/app/upgrade_test.go +63 -0
- package/cmd/agd/agvm.go +1 -1
- package/cmd/agd/main.go +1 -1
- package/cmd/libdaemon/main.go +34 -1
- package/daemon/cmd/root.go +26 -35
- package/daemon/cmd/root_test.go +5 -4
- package/daemon/cmd/testnet.go +221 -95
- package/daemon/main.go +1 -0
- package/git-revision.txt +1 -1
- package/go.mod +93 -58
- package/go.sum +148 -95
- package/package.json +6 -3
- package/proto/agoric/swingset/genesis.proto +7 -11
- package/proto/agoric/swingset/msgs.proto +56 -75
- package/proto/agoric/swingset/query.proto +7 -10
- package/proto/agoric/swingset/swingset.proto +79 -108
- package/proto/agoric/vbank/genesis.proto +5 -5
- package/proto/agoric/vbank/msgs.proto +1 -2
- package/proto/agoric/vbank/vbank.proto +42 -52
- package/proto/agoric/vibc/msgs.proto +8 -11
- package/proto/agoric/vstorage/genesis.proto +6 -9
- package/proto/agoric/vstorage/query.proto +19 -48
- package/proto/agoric/vstorage/vstorage.proto +4 -10
- package/proto/agoric/vtransfer/genesis.proto +7 -7
- package/proto/buf.gen.gogo.yaml +8 -0
- package/proto/buf.gen.pulsar.yaml +17 -0
- package/proto/buf.gen.swagger.yaml +5 -0
- package/proto/buf.yaml +10 -0
- package/scripts/protocgen.sh +14 -21
- package/third_party/proto/amino/amino.proto +79 -0
- package/third_party/proto/cosmos/base/v1beta1/coin.proto +7 -2
- package/third_party/proto/cosmos/ics23/v1/proofs.proto +243 -0
- package/third_party/proto/cosmos/msg/v1/msg.proto +30 -0
- package/third_party/proto/cosmos/upgrade/v1beta1/upgrade.proto +17 -5
- package/third_party/proto/cosmos_proto/cosmos.proto +16 -1
- package/third_party/proto/gogoproto/gogo.proto +2 -2
- package/third_party/proto/google/protobuf/any.proto +6 -3
- package/third_party/proto/ibc/core/channel/v1/channel.proto +1 -1
- package/third_party/proto/ibc/core/client/v1/client.proto +4 -2
- package/types/address_hooks.go +5 -12
- package/types/address_hooks_test.go +34 -34
- package/types/codec.go +23 -0
- package/types/ibc_packet.go +64 -0
- package/types/ibc_packet_test.go +117 -0
- package/vm/client.go +32 -7
- package/vm/proto_json.go +2 -2
- package/x/swingset/abci.go +1 -1
- package/x/swingset/alias.go +0 -1
- package/x/swingset/config.go +1 -1
- package/x/swingset/keeper/extension_snapshotter.go +1 -1
- package/x/swingset/keeper/extension_snapshotter_test.go +1 -1
- package/x/swingset/keeper/keeper.go +1 -1
- package/x/swingset/keeper/keeper_test.go +1 -1
- package/x/swingset/keeper/querier.go +1 -30
- package/x/swingset/keeper/swing_store_exports_handler.go +1 -1
- package/x/swingset/keeper/swing_store_exports_handler_test.go +1 -1
- package/x/swingset/module.go +1 -14
- package/x/swingset/types/default-params.go +24 -16
- package/x/swingset/types/genesis.pb.go +2 -2
- package/x/swingset/types/msgs.pb.go +4 -3
- package/x/swingset/types/msgs_test.go +1 -1
- package/x/swingset/types/query.pb.go +4 -3
- package/x/swingset/types/swingset.pb.go +2 -2
- package/x/vbank/genesis.go +1 -1
- package/x/vbank/keeper/querier.go +1 -21
- package/x/vbank/module.go +1 -16
- package/x/vbank/types/genesis.pb.go +2 -2
- package/x/vbank/types/msgs.pb.go +3 -2
- package/x/vbank/types/query.pb.go +4 -3
- package/x/vbank/types/vbank.pb.go +2 -2
- package/x/vbank/vbank_test.go +95 -16
- package/x/vibc/keeper/keeper.go +8 -5
- package/x/vibc/keeper/migrations.go +36 -0
- package/x/vibc/keeper/triggers.go +6 -32
- package/x/vibc/module.go +9 -17
- package/x/vibc/types/expected_keepers.go +6 -10
- package/x/vibc/types/ibc_module.go +30 -20
- package/x/vibc/types/msgs.go +1 -1
- package/x/vibc/types/msgs.pb.go +5 -4
- package/x/vibc/types/receiver.go +17 -17
- package/x/vlocalchain/keeper/keeper.go +3 -3
- package/x/vlocalchain/types/vlocalchain.pb.go +1 -1
- package/x/vlocalchain/vlocalchain_test.go +6 -6
- package/x/vstorage/README.md +0 -8
- package/x/vstorage/alias.go +0 -1
- package/x/vstorage/client/cli/query.go +1 -1
- package/x/vstorage/genesis.go +1 -1
- package/x/vstorage/keeper/keeper.go +40 -5
- package/x/vstorage/keeper/keeper_test.go +24 -24
- package/x/vstorage/keeper/querier.go +1 -32
- package/x/vstorage/keeper/querier_test.go +41 -6
- package/x/vstorage/module.go +1 -14
- package/x/vstorage/types/genesis.pb.go +2 -2
- package/x/vstorage/types/path_keys.go +7 -8
- package/x/vstorage/types/query.pb.go +8 -5
- package/x/vstorage/types/vstorage.pb.go +2 -2
- package/x/vstorage/vstorage_test.go +3 -3
- package/x/vtransfer/genesis.go +1 -1
- package/x/vtransfer/handler.go +4 -2
- package/x/vtransfer/ibc_middleware.go +4 -4
- package/x/vtransfer/ibc_middleware_test.go +14 -16
- package/x/vtransfer/keeper/keeper.go +38 -48
- package/x/vtransfer/module.go +1 -14
- package/x/vtransfer/types/expected_keepers.go +2 -18
- package/x/vtransfer/types/genesis.pb.go +2 -2
- package/x/vtransfer/utils_test.go +15 -15
- package/daemon/cmd/genaccounts.go +0 -195
- package/e2e_test/Makefile +0 -29
- package/e2e_test/README.md +0 -100
- package/e2e_test/go.mod +0 -239
- package/e2e_test/go.sum +0 -1323
- package/e2e_test/ibc_conformance_test.go +0 -56
- package/e2e_test/pfm_test.go +0 -613
- package/e2e_test/util.go +0 -271
package/x/vibc/types/msgs.pb.go
CHANGED
|
@@ -7,10 +7,10 @@ import (
|
|
|
7
7
|
context "context"
|
|
8
8
|
fmt "fmt"
|
|
9
9
|
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
_ "github.com/cosmos/gogoproto/gogoproto"
|
|
11
|
+
grpc1 "github.com/cosmos/gogoproto/grpc"
|
|
12
|
+
proto "github.com/cosmos/gogoproto/proto"
|
|
13
|
+
types "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
|
|
14
14
|
grpc "google.golang.org/grpc"
|
|
15
15
|
codes "google.golang.org/grpc/codes"
|
|
16
16
|
status "google.golang.org/grpc/status"
|
|
@@ -223,6 +223,7 @@ func _Msg_SendPacket_Handler(srv interface{}, ctx context.Context, dec func(inte
|
|
|
223
223
|
return interceptor(ctx, in, info, handler)
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
+
var Msg_serviceDesc = _Msg_serviceDesc
|
|
226
227
|
var _Msg_serviceDesc = grpc.ServiceDesc{
|
|
227
228
|
ServiceName: "agoric.vibc.Msg",
|
|
228
229
|
HandlerType: (*MsgServer)(nil),
|
package/x/vibc/types/receiver.go
CHANGED
|
@@ -5,10 +5,11 @@ import (
|
|
|
5
5
|
"encoding/json"
|
|
6
6
|
"fmt"
|
|
7
7
|
|
|
8
|
+
"github.com/Agoric/agoric-sdk/golang/cosmos/types"
|
|
8
9
|
"github.com/Agoric/agoric-sdk/golang/cosmos/vm"
|
|
9
|
-
channeltypes "github.com/cosmos/ibc-go/
|
|
10
|
+
channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
|
|
10
11
|
|
|
11
|
-
"github.com/cosmos/ibc-go/
|
|
12
|
+
"github.com/cosmos/ibc-go/v7/modules/core/exported"
|
|
12
13
|
|
|
13
14
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
14
15
|
)
|
|
@@ -39,14 +40,14 @@ func NewReceiver(impl ReceiverImpl) Receiver {
|
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
type portMessage struct { // comes from swingset's IBC handler
|
|
42
|
-
Type string
|
|
43
|
-
Method string
|
|
44
|
-
Packet
|
|
45
|
-
RelativeTimeoutNs uint64
|
|
46
|
-
Order string
|
|
47
|
-
Hops []string
|
|
48
|
-
Version string
|
|
49
|
-
Ack []byte
|
|
43
|
+
Type string `json:"type"` // IBC_METHOD
|
|
44
|
+
Method string `json:"method"`
|
|
45
|
+
Packet types.IBCPacket `json:"packet"`
|
|
46
|
+
RelativeTimeoutNs uint64 `json:"relativeTimeoutNs,string"`
|
|
47
|
+
Order string `json:"order"`
|
|
48
|
+
Hops []string `json:"hops"`
|
|
49
|
+
Version string `json:"version"`
|
|
50
|
+
Ack []byte `json:"ack"`
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
func stringToOrder(order string) channeltypes.Order {
|
|
@@ -121,21 +122,20 @@ func (ir Receiver) Receive(cctx context.Context, jsonRequest string) (jsonReply
|
|
|
121
122
|
timeoutTimestamp = uint64(ctx.BlockTime().UnixNano()) + msg.RelativeTimeoutNs
|
|
122
123
|
}
|
|
123
124
|
|
|
124
|
-
packet :=
|
|
125
|
-
|
|
126
|
-
msg.Packet.SourcePort, msg.Packet.SourceChannel,
|
|
127
|
-
msg.Packet.DestinationPort, msg.Packet.DestinationChannel,
|
|
128
|
-
msg.Packet.TimeoutHeight, timeoutTimestamp,
|
|
129
|
-
)
|
|
125
|
+
packet := types.CopyToIBCPacket(msg.Packet)
|
|
126
|
+
packet.TimeoutTimestamp = timeoutTimestamp
|
|
130
127
|
seq, err := impl.ReceiveSendPacket(ctx, packet)
|
|
131
128
|
if err == nil {
|
|
132
129
|
packet.Sequence = seq
|
|
133
|
-
bytes, err := json.Marshal(
|
|
130
|
+
bytes, err := json.Marshal(packet)
|
|
134
131
|
if err == nil {
|
|
135
132
|
jsonReply = string(bytes)
|
|
136
133
|
}
|
|
137
134
|
}
|
|
138
135
|
|
|
136
|
+
case "initOpenExecuted":
|
|
137
|
+
err = fmt.Errorf("initOpenExecuted not yet implemented")
|
|
138
|
+
|
|
139
139
|
case "tryOpenExecuted":
|
|
140
140
|
err = impl.ReceiveWriteOpenTryChannel(
|
|
141
141
|
ctx, msg.Packet,
|
|
@@ -8,8 +8,8 @@ import (
|
|
|
8
8
|
"strings"
|
|
9
9
|
"unicode"
|
|
10
10
|
|
|
11
|
-
"github.com/
|
|
12
|
-
"github.com/
|
|
11
|
+
"github.com/cosmos/gogoproto/jsonpb"
|
|
12
|
+
"github.com/cosmos/gogoproto/proto"
|
|
13
13
|
|
|
14
14
|
"github.com/cosmos/cosmos-sdk/codec"
|
|
15
15
|
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
|
@@ -17,7 +17,7 @@ import (
|
|
|
17
17
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
18
18
|
sdkaddress "github.com/cosmos/cosmos-sdk/types/address"
|
|
19
19
|
|
|
20
|
-
abci "github.com/
|
|
20
|
+
abci "github.com/cometbft/cometbft/abci/types"
|
|
21
21
|
|
|
22
22
|
"github.com/Agoric/agoric-sdk/golang/cosmos/x/vlocalchain/types"
|
|
23
23
|
)
|
|
@@ -12,6 +12,7 @@ import (
|
|
|
12
12
|
"github.com/Agoric/agoric-sdk/golang/cosmos/x/vlocalchain"
|
|
13
13
|
"github.com/Agoric/agoric-sdk/golang/cosmos/x/vlocalchain/types"
|
|
14
14
|
|
|
15
|
+
"github.com/cometbft/cometbft/libs/log"
|
|
15
16
|
"github.com/cosmos/cosmos-sdk/baseapp"
|
|
16
17
|
"github.com/cosmos/cosmos-sdk/store"
|
|
17
18
|
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
|
@@ -19,13 +20,12 @@ import (
|
|
|
19
20
|
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
|
20
21
|
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
|
|
21
22
|
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
|
|
22
|
-
transfertypes "github.com/cosmos/ibc-go/
|
|
23
|
-
"github.com/tendermint/tendermint/libs/log"
|
|
23
|
+
transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
|
|
24
24
|
|
|
25
|
-
"github.com/
|
|
26
|
-
"github.com/
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
dbm "github.com/cometbft/cometbft-db"
|
|
26
|
+
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
|
|
27
|
+
"github.com/cosmos/gogoproto/jsonpb"
|
|
28
|
+
"github.com/cosmos/gogoproto/proto"
|
|
29
29
|
)
|
|
30
30
|
|
|
31
31
|
var (
|
package/x/vstorage/README.md
CHANGED
|
@@ -128,11 +128,3 @@ $ curl -sS 'https://main.api.agoric.net/agoric/vstorage/children/published.commi
|
|
|
128
128
|
"pagination": null
|
|
129
129
|
}
|
|
130
130
|
```
|
|
131
|
-
|
|
132
|
-
## Arbitrary-response HTTP interface
|
|
133
|
-
|
|
134
|
-
This depends upon appModule `LegacyQuerierHandler` functionality that is [removed from cosmos-sdk as of v0.47](https://github.com/cosmos/cosmos-sdk/blob/fa4d87ef7e6d87aaccc94c337ffd2fe90fcb7a9d/CHANGELOG.md#api-breaking-changes-3)
|
|
135
|
-
|
|
136
|
-
[legacy querier](./keeper/querier.go)
|
|
137
|
-
* /custom/vstorage/children/$path
|
|
138
|
-
* /custom/vstorage/data/$path
|
package/x/vstorage/alias.go
CHANGED
package/x/vstorage/genesis.go
CHANGED
|
@@ -4,8 +4,8 @@ import (
|
|
|
4
4
|
"fmt"
|
|
5
5
|
|
|
6
6
|
"github.com/Agoric/agoric-sdk/golang/cosmos/x/vstorage/types"
|
|
7
|
+
abci "github.com/cometbft/cometbft/abci/types"
|
|
7
8
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
8
|
-
abci "github.com/tendermint/tendermint/abci/types"
|
|
9
9
|
)
|
|
10
10
|
|
|
11
11
|
func NewGenesisState() *types.GenesisState {
|
|
@@ -11,9 +11,11 @@ import (
|
|
|
11
11
|
"strings"
|
|
12
12
|
|
|
13
13
|
sdkmath "cosmossdk.io/math"
|
|
14
|
+
metrics "github.com/armon/go-metrics"
|
|
15
|
+
db "github.com/cometbft/cometbft-db"
|
|
14
16
|
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
|
17
|
+
"github.com/cosmos/cosmos-sdk/telemetry"
|
|
15
18
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
16
|
-
db "github.com/tendermint/tm-db"
|
|
17
19
|
|
|
18
20
|
agoric "github.com/Agoric/agoric-sdk/golang/cosmos/types"
|
|
19
21
|
"github.com/Agoric/agoric-sdk/golang/cosmos/x/vstorage/types"
|
|
@@ -117,6 +119,28 @@ func NewKeeper(storeKey storetypes.StoreKey) Keeper {
|
|
|
117
119
|
}
|
|
118
120
|
}
|
|
119
121
|
|
|
122
|
+
// size_increase and size_decrease metrics represent total writes and deletes *issued*
|
|
123
|
+
// respectively, which may differ from the total number of bytes committed/freed
|
|
124
|
+
// to/from the store due to the store's internal implementation.
|
|
125
|
+
var MetricKeyStoreSizeIncrease = []string{"store", "size_increase"}
|
|
126
|
+
var MetricKeyStoreSizeDecrease = []string{"store", "size_decrease"}
|
|
127
|
+
|
|
128
|
+
const MetricLabelStoreKey = "storeKey"
|
|
129
|
+
|
|
130
|
+
// reportStoreSizeMetrics exports store size increase/decrease metrics
|
|
131
|
+
// when Cosmos telemetry is enabled.
|
|
132
|
+
func (k Keeper) reportStoreSizeMetrics(increase int, decrease int) {
|
|
133
|
+
metricsLabel := []metrics.Label{
|
|
134
|
+
telemetry.NewLabel(MetricLabelStoreKey, k.storeKey.Name()),
|
|
135
|
+
}
|
|
136
|
+
if increase > 0 {
|
|
137
|
+
telemetry.IncrCounterWithLabels(MetricKeyStoreSizeIncrease, float32(increase), metricsLabel)
|
|
138
|
+
}
|
|
139
|
+
if decrease > 0 {
|
|
140
|
+
telemetry.IncrCounterWithLabels(MetricKeyStoreSizeDecrease, float32(decrease), metricsLabel)
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
120
144
|
// ExportStorage fetches all storage
|
|
121
145
|
func (k Keeper) ExportStorage(ctx sdk.Context) []*types.DataEntry {
|
|
122
146
|
return k.ExportStorageFromPrefix(ctx, "")
|
|
@@ -215,6 +239,8 @@ func (k Keeper) RemoveEntriesWithPrefix(ctx sdk.Context, pathPrefix string) {
|
|
|
215
239
|
keys := getEncodedKeysWithPrefixFromIterator(iterator, descendantPrefix)
|
|
216
240
|
|
|
217
241
|
for _, key := range keys {
|
|
242
|
+
rawValue := store.Get(key)
|
|
243
|
+
k.reportStoreSizeMetrics(0, len(key)+len(rawValue))
|
|
218
244
|
store.Delete(key)
|
|
219
245
|
}
|
|
220
246
|
|
|
@@ -366,18 +392,23 @@ func (k Keeper) SetStorage(ctx sdk.Context, entry agoric.KVEntry) {
|
|
|
366
392
|
store := ctx.KVStore(k.storeKey)
|
|
367
393
|
path := entry.Key()
|
|
368
394
|
encodedKey := types.PathToEncodedKey(path)
|
|
395
|
+
oldRawValue := store.Get(encodedKey)
|
|
369
396
|
|
|
370
397
|
if !entry.HasValue() {
|
|
371
398
|
if !k.HasChildren(ctx, path) {
|
|
372
399
|
// We have no children, can delete.
|
|
400
|
+
k.reportStoreSizeMetrics(0, len(encodedKey)+len(oldRawValue))
|
|
373
401
|
store.Delete(encodedKey)
|
|
374
402
|
} else {
|
|
403
|
+
// We have children, mark as an empty placeholder without deleting.
|
|
404
|
+
k.reportStoreSizeMetrics(len(types.EncodedNoDataValue), len(oldRawValue))
|
|
375
405
|
store.Set(encodedKey, types.EncodedNoDataValue)
|
|
376
406
|
}
|
|
377
407
|
} else {
|
|
378
408
|
// Update the value.
|
|
379
|
-
|
|
380
|
-
|
|
409
|
+
newRawValue := bytes.Join([][]byte{types.EncodedDataPrefix, []byte(entry.StringValue())}, []byte{})
|
|
410
|
+
k.reportStoreSizeMetrics(len(newRawValue), len(oldRawValue))
|
|
411
|
+
store.Set(encodedKey, newRawValue)
|
|
381
412
|
}
|
|
382
413
|
|
|
383
414
|
// Update our other parent children.
|
|
@@ -390,7 +421,9 @@ func (k Keeper) SetStorage(ctx sdk.Context, entry agoric.KVEntry) {
|
|
|
390
421
|
// this and further ancestors are needed, skip out
|
|
391
422
|
break
|
|
392
423
|
}
|
|
393
|
-
|
|
424
|
+
encodedAncestor := types.PathToEncodedKey(ancestor)
|
|
425
|
+
k.reportStoreSizeMetrics(0, len(encodedAncestor)+len(types.EncodedNoDataValue))
|
|
426
|
+
store.Delete(encodedAncestor)
|
|
394
427
|
}
|
|
395
428
|
} else {
|
|
396
429
|
// add placeholders as needed
|
|
@@ -400,7 +433,9 @@ func (k Keeper) SetStorage(ctx sdk.Context, entry agoric.KVEntry) {
|
|
|
400
433
|
// The ancestor exists, implying all further ancestors exist, so we can break.
|
|
401
434
|
break
|
|
402
435
|
}
|
|
403
|
-
|
|
436
|
+
encodedAncestor := types.PathToEncodedKey(ancestor)
|
|
437
|
+
k.reportStoreSizeMetrics(len(encodedAncestor)+len(types.EncodedNoDataValue), 0)
|
|
438
|
+
store.Set(encodedAncestor, types.EncodedNoDataValue)
|
|
404
439
|
}
|
|
405
440
|
}
|
|
406
441
|
}
|
|
@@ -11,10 +11,10 @@ import (
|
|
|
11
11
|
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
|
12
12
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
"github.com/
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
dbm "github.com/cometbft/cometbft-db"
|
|
15
|
+
abci "github.com/cometbft/cometbft/abci/types"
|
|
16
|
+
"github.com/cometbft/cometbft/libs/log"
|
|
17
|
+
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
|
|
18
18
|
)
|
|
19
19
|
|
|
20
20
|
var (
|
|
@@ -227,51 +227,51 @@ func TestStorageNotify(t *testing.T) {
|
|
|
227
227
|
{
|
|
228
228
|
Type: "storage",
|
|
229
229
|
Attributes: []abci.EventAttribute{
|
|
230
|
-
{Key:
|
|
231
|
-
{Key:
|
|
230
|
+
{Key: "path", Value: "notify.legacy"},
|
|
231
|
+
{Key: "value", Value: "legacyValue"},
|
|
232
232
|
},
|
|
233
233
|
},
|
|
234
234
|
{
|
|
235
235
|
Type: "state_change",
|
|
236
236
|
Attributes: []abci.EventAttribute{
|
|
237
|
-
{Key:
|
|
238
|
-
{Key:
|
|
239
|
-
{Key:
|
|
240
|
-
{Key:
|
|
237
|
+
{Key: "store", Value: "vstorage"},
|
|
238
|
+
{Key: "key", Value: "2\x00notify\x00legacy"},
|
|
239
|
+
{Key: "anckey", Value: "\x012\x00notify\x00legacy\x01"},
|
|
240
|
+
{Key: "value", Value: "legacyValue"},
|
|
241
241
|
},
|
|
242
242
|
},
|
|
243
243
|
{
|
|
244
244
|
Type: "storage",
|
|
245
245
|
Attributes: []abci.EventAttribute{
|
|
246
|
-
{Key:
|
|
247
|
-
{Key:
|
|
246
|
+
{Key: "path", Value: "notify.legacy2"},
|
|
247
|
+
{Key: "value", Value: "legacyValue2b"},
|
|
248
248
|
},
|
|
249
249
|
},
|
|
250
250
|
{
|
|
251
251
|
Type: "state_change",
|
|
252
252
|
Attributes: []abci.EventAttribute{
|
|
253
|
-
{Key:
|
|
254
|
-
{Key:
|
|
255
|
-
{Key:
|
|
256
|
-
{Key:
|
|
253
|
+
{Key: "store", Value: "vstorage"},
|
|
254
|
+
{Key: "key", Value: "2\x00notify\x00legacy2"},
|
|
255
|
+
{Key: "anckey", Value: "\x012\x00notify\x00legacy2\x01"},
|
|
256
|
+
{Key: "value", Value: "legacyValue2b"},
|
|
257
257
|
},
|
|
258
258
|
},
|
|
259
259
|
{
|
|
260
260
|
Type: "state_change",
|
|
261
261
|
Attributes: []abci.EventAttribute{
|
|
262
|
-
{Key:
|
|
263
|
-
{Key:
|
|
264
|
-
{Key:
|
|
265
|
-
{Key:
|
|
262
|
+
{Key: "store", Value: "vstorage"},
|
|
263
|
+
{Key: "key", Value: "2\x00notify\x00noLegacy"},
|
|
264
|
+
{Key: "anckey", Value: "\x012\x00notify\x00noLegacy\x01"},
|
|
265
|
+
{Key: "value", Value: "noLegacyValue"},
|
|
266
266
|
},
|
|
267
267
|
},
|
|
268
268
|
{
|
|
269
269
|
Type: "state_change",
|
|
270
270
|
Attributes: []abci.EventAttribute{
|
|
271
|
-
{Key:
|
|
272
|
-
{Key:
|
|
273
|
-
{Key:
|
|
274
|
-
{Key:
|
|
271
|
+
{Key: "store", Value: "vstorage"},
|
|
272
|
+
{Key: "key", Value: "2\x00notify\x00noLegacy2"},
|
|
273
|
+
{Key: "anckey", Value: "\x012\x00notify\x00noLegacy2\x01"},
|
|
274
|
+
{Key: "value", Value: "noLegacyValue2b"},
|
|
275
275
|
},
|
|
276
276
|
},
|
|
277
277
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
package keeper
|
|
2
2
|
|
|
3
3
|
import (
|
|
4
|
-
abci "github.com/
|
|
4
|
+
abci "github.com/cometbft/cometbft/abci/types"
|
|
5
5
|
|
|
6
6
|
sdkioerrors "cosmossdk.io/errors"
|
|
7
7
|
"github.com/cosmos/cosmos-sdk/codec"
|
|
@@ -26,37 +26,6 @@ func getVstorageEntryPath(urlPathSegments []string) (string, error) {
|
|
|
26
26
|
return urlPathSegments[0], nil
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
// NewQuerier returns the function for handling queries routed to this module.
|
|
30
|
-
// It performs its own routing based on the first slash-separated URL path
|
|
31
|
-
// segment (e.g., URL path `/data/foo.bar` is a request for the value associated
|
|
32
|
-
// with vstorage path "foo.bar", and `/children/foo.bar` is a request for the
|
|
33
|
-
// child path segments immediately underneath vstorage path "foo.bar" which may
|
|
34
|
-
// be used to extend it to a vstorage path such as "foo.bar.baz").
|
|
35
|
-
func NewQuerier(keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier {
|
|
36
|
-
return func(ctx sdk.Context, urlPathSegments []string, req abci.RequestQuery) (res []byte, err error) {
|
|
37
|
-
var queryType string
|
|
38
|
-
if len(urlPathSegments) > 0 {
|
|
39
|
-
queryType = urlPathSegments[0]
|
|
40
|
-
}
|
|
41
|
-
switch queryType {
|
|
42
|
-
case QueryData:
|
|
43
|
-
entryPath, entryPathErr := getVstorageEntryPath(urlPathSegments[1:])
|
|
44
|
-
if entryPathErr != nil {
|
|
45
|
-
return nil, entryPathErr
|
|
46
|
-
}
|
|
47
|
-
return queryData(ctx, entryPath, req, keeper, legacyQuerierCdc)
|
|
48
|
-
case QueryChildren:
|
|
49
|
-
entryPath, entryPathErr := getVstorageEntryPath(urlPathSegments[1:])
|
|
50
|
-
if entryPathErr != nil {
|
|
51
|
-
return nil, entryPathErr
|
|
52
|
-
}
|
|
53
|
-
return queryChildren(ctx, entryPath, req, keeper, legacyQuerierCdc)
|
|
54
|
-
default:
|
|
55
|
-
return nil, sdkioerrors.Wrap(sdkerrors.ErrUnknownRequest, "unknown vstorage query path")
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
29
|
// nolint: unparam
|
|
61
30
|
func queryData(ctx sdk.Context, path string, req abci.RequestQuery, keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) (res []byte, err error) {
|
|
62
31
|
entry := keeper.GetEntry(ctx, path)
|
|
@@ -2,22 +2,57 @@ package keeper
|
|
|
2
2
|
|
|
3
3
|
import (
|
|
4
4
|
"bytes"
|
|
5
|
+
"encoding/json"
|
|
5
6
|
"testing"
|
|
6
7
|
|
|
7
8
|
agoric "github.com/Agoric/agoric-sdk/golang/cosmos/types"
|
|
8
|
-
|
|
9
|
-
abci "github.com/tendermint/tendermint/abci/types"
|
|
9
|
+
"github.com/Agoric/agoric-sdk/golang/cosmos/x/vstorage/types"
|
|
10
10
|
|
|
11
11
|
sdkioerrors "cosmossdk.io/errors"
|
|
12
|
-
"github.com/cosmos/cosmos-sdk/
|
|
12
|
+
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
13
13
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
|
14
14
|
)
|
|
15
15
|
|
|
16
|
+
func runRpc(ctx sdk.Context, querier Querier, rpc string, args []string) (res []byte, err error) {
|
|
17
|
+
defer func() {
|
|
18
|
+
if r := recover(); r != nil {
|
|
19
|
+
err = sdkerrors.ErrInvalidRequest
|
|
20
|
+
}
|
|
21
|
+
}()
|
|
22
|
+
switch rpc {
|
|
23
|
+
case "children":
|
|
24
|
+
if len(args) != 1 {
|
|
25
|
+
return nil, sdkerrors.ErrInvalidRequest
|
|
26
|
+
}
|
|
27
|
+
req := &types.QueryChildrenRequest{Path: args[0]}
|
|
28
|
+
r, err := querier.Children(sdk.WrapSDKContext(ctx), req)
|
|
29
|
+
if err != nil {
|
|
30
|
+
return nil, err
|
|
31
|
+
}
|
|
32
|
+
return json.MarshalIndent(r, "", " ")
|
|
33
|
+
|
|
34
|
+
case "data":
|
|
35
|
+
if len(args) != 1 {
|
|
36
|
+
return nil, sdkerrors.ErrInvalidRequest
|
|
37
|
+
}
|
|
38
|
+
req := &types.QueryDataRequest{Path: args[0]}
|
|
39
|
+
r, err := querier.Data(sdk.WrapSDKContext(ctx), req)
|
|
40
|
+
if r != nil && r.Value == "" {
|
|
41
|
+
return nil, sdkerrors.ErrNotFound
|
|
42
|
+
}
|
|
43
|
+
if err != nil {
|
|
44
|
+
return nil, err
|
|
45
|
+
}
|
|
46
|
+
return json.MarshalIndent(r, "", " ")
|
|
47
|
+
default:
|
|
48
|
+
return nil, sdkerrors.ErrUnknownRequest
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
16
52
|
func TestQuerier(t *testing.T) {
|
|
17
53
|
testKit := makeTestKit()
|
|
18
54
|
ctx, keeper := testKit.ctx, testKit.vstorageKeeper
|
|
19
|
-
|
|
20
|
-
querier := NewQuerier(keeper, legacyQuerierCdc.LegacyAmino)
|
|
55
|
+
querier := Querier{keeper}
|
|
21
56
|
|
|
22
57
|
// Populate mock data
|
|
23
58
|
keeper.SetStorage(ctx, agoric.NewKVEntry("foo.bar", "42"))
|
|
@@ -99,7 +134,7 @@ func TestQuerier(t *testing.T) {
|
|
|
99
134
|
}...)
|
|
100
135
|
|
|
101
136
|
for _, desc := range testCases {
|
|
102
|
-
res, err :=
|
|
137
|
+
res, err := runRpc(ctx, querier, desc.path[0], desc.path[1:])
|
|
103
138
|
if desc.err != nil {
|
|
104
139
|
if err == nil {
|
|
105
140
|
t.Errorf("%s: got no error, want error %q", desc.label, *desc.err)
|
package/x/vstorage/module.go
CHANGED
|
@@ -15,8 +15,8 @@ import (
|
|
|
15
15
|
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
|
|
16
16
|
"github.com/cosmos/cosmos-sdk/types/module"
|
|
17
17
|
|
|
18
|
+
abci "github.com/cometbft/cometbft/abci/types"
|
|
18
19
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
19
|
-
abci "github.com/tendermint/tendermint/abci/types"
|
|
20
20
|
)
|
|
21
21
|
|
|
22
22
|
// type check to ensure the interface is properly implemented
|
|
@@ -90,19 +90,6 @@ func (AppModule) Name() string {
|
|
|
90
90
|
|
|
91
91
|
func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {}
|
|
92
92
|
|
|
93
|
-
func (am AppModule) Route() sdk.Route {
|
|
94
|
-
return sdk.NewRoute(types.RouterKey, NewHandler(am.keeper))
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
func (am AppModule) QuerierRoute() string {
|
|
98
|
-
return ModuleName
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// LegacyQuerierHandler returns the sdk.Querier for deployment module
|
|
102
|
-
func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier {
|
|
103
|
-
return keeper.NewQuerier(am.keeper, legacyQuerierCdc)
|
|
104
|
-
}
|
|
105
|
-
|
|
106
93
|
func (am AppModule) RegisterServices(cfg module.Configurator) {
|
|
107
94
|
querier := keeper.Querier{Keeper: am.keeper}
|
|
108
95
|
types.RegisterQueryServer(cfg.QueryServer(), querier)
|
|
@@ -10,14 +10,13 @@ import (
|
|
|
10
10
|
// - A "path" is a sequence of zero or more dot-separated nonempty segments
|
|
11
11
|
// using a restricted alphabet of ASCII alphanumerics plus underscore and dash,
|
|
12
12
|
// consistent with packages/internal/src/lib-chainStorage.js but not currently
|
|
13
|
-
// enforcing a length restriction on path segments.
|
|
14
|
-
//
|
|
15
|
-
// `"
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
// be reserved for adding escape sequences).
|
|
13
|
+
// enforcing a length restriction on path segments. So `""`, `"foo"`, and
|
|
14
|
+
// `"foo.bar__baz.qux--quux"` are paths but `"."`, `"foo/bar"`, `"fo\to"`, and
|
|
15
|
+
// `"foö"` are not. This alphabet might be expanded in the future, but such
|
|
16
|
+
// expansion SHOULD NOT include control characters (including those that are not
|
|
17
|
+
// ASCII, such as U+202E RIGHT-TO-LEFT OVERRIDE), slash `/` (which separates
|
|
18
|
+
// ABCI request path segments in e.g. `/agoric.vstorage.Query/Data`), or
|
|
19
|
+
// backslash `\` (which should be reserved for adding escape sequences).
|
|
21
20
|
//
|
|
22
21
|
// - An encoded key for a path is the path prefixed with its length (in ASCII
|
|
23
22
|
// digits), separated by nul, followed by the path with dots replaced with nul.
|
|
@@ -7,9 +7,9 @@ import (
|
|
|
7
7
|
context "context"
|
|
8
8
|
fmt "fmt"
|
|
9
9
|
query "github.com/cosmos/cosmos-sdk/types/query"
|
|
10
|
-
_ "github.com/
|
|
11
|
-
grpc1 "github.com/
|
|
12
|
-
proto "github.com/
|
|
10
|
+
_ "github.com/cosmos/gogoproto/gogoproto"
|
|
11
|
+
grpc1 "github.com/cosmos/gogoproto/grpc"
|
|
12
|
+
proto "github.com/cosmos/gogoproto/proto"
|
|
13
13
|
_ "google.golang.org/genproto/googleapis/api/annotations"
|
|
14
14
|
grpc "google.golang.org/grpc"
|
|
15
15
|
codes "google.golang.org/grpc/codes"
|
|
@@ -135,8 +135,10 @@ type QueryCapDataRequest struct {
|
|
|
135
135
|
ItemFormat string `protobuf:"bytes,3,opt,name=item_format,json=itemFormat,proto3" json:"itemFormat" yaml:"itemFormat"`
|
|
136
136
|
// remotableValueFormat indicates how to transform references to opaque but
|
|
137
137
|
// distinguishable Remotables into readable embedded representations.
|
|
138
|
-
// * "object" represents each Remotable as an `{ id, allegedName }` object, e.g. `{ "id": "board007", "allegedName":
|
|
139
|
-
//
|
|
138
|
+
// * "object" represents each Remotable as an `{ id, allegedName }` object, e.g. `{ "id": "board007", "allegedName":
|
|
139
|
+
// "IST brand" }`.
|
|
140
|
+
// * "string" represents each Remotable as a string with bracket-wrapped contents including its alleged name and id,
|
|
141
|
+
// e.g. "[Alleged: IST brand <board007>]".
|
|
140
142
|
RemotableValueFormat string `protobuf:"bytes,10,opt,name=remotable_value_format,json=remotableValueFormat,proto3" json:"remotableValueFormat" yaml:"remotableValueFormat"`
|
|
141
143
|
}
|
|
142
144
|
|
|
@@ -557,6 +559,7 @@ func _Query_Children_Handler(srv interface{}, ctx context.Context, dec func(inte
|
|
|
557
559
|
return interceptor(ctx, in, info, handler)
|
|
558
560
|
}
|
|
559
561
|
|
|
562
|
+
var Query_serviceDesc = _Query_serviceDesc
|
|
560
563
|
var _Query_serviceDesc = grpc.ServiceDesc{
|
|
561
564
|
ServiceName: "agoric.vstorage.Query",
|
|
562
565
|
HandlerType: (*QueryServer)(nil),
|
|
@@ -15,9 +15,9 @@ import (
|
|
|
15
15
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
16
16
|
|
|
17
17
|
agorictypes "github.com/Agoric/agoric-sdk/golang/cosmos/types"
|
|
18
|
-
"github.com/
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
dbm "github.com/cometbft/cometbft-db"
|
|
19
|
+
"github.com/cometbft/cometbft/libs/log"
|
|
20
|
+
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
|
|
21
21
|
)
|
|
22
22
|
|
|
23
23
|
var (
|
package/x/vtransfer/genesis.go
CHANGED
|
@@ -4,8 +4,8 @@ import (
|
|
|
4
4
|
"fmt"
|
|
5
5
|
|
|
6
6
|
"github.com/Agoric/agoric-sdk/golang/cosmos/x/vtransfer/types"
|
|
7
|
+
abci "github.com/cometbft/cometbft/abci/types"
|
|
7
8
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
8
|
-
abci "github.com/tendermint/tendermint/abci/types"
|
|
9
9
|
)
|
|
10
10
|
|
|
11
11
|
func NewGenesisState() *types.GenesisState {
|