@agoric/cosmos 0.35.0-u12.0 → 0.35.0-u14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +67 -0
- package/Makefile +25 -12
- package/ante/ante.go +7 -5
- package/ante/inbound_test.go +8 -0
- package/app/app.go +139 -108
- package/app/export.go +13 -9
- package/app/sim_test.go +4 -4
- package/cmd/agd/main.go +5 -3
- package/cmd/libdaemon/main.go +5 -2
- package/daemon/cmd/genaccounts.go +13 -9
- package/daemon/cmd/root.go +38 -17
- package/daemon/cmd/root_test.go +1 -1
- package/daemon/cmd/testnet.go +17 -6
- package/daemon/main.go +3 -2
- package/git-revision.txt +1 -1
- package/go.mod +117 -76
- package/go.sum +858 -210
- package/package.json +3 -3
- package/proto/agoric/vstorage/query.proto +53 -1
- package/scripts/protocgen.sh +12 -1
- package/third_party/proto/buf.yaml +1 -0
- package/third_party/proto/cosmos/base/query/v1beta1/pagination.proto +4 -1
- package/third_party/proto/cosmos/base/v1beta1/coin.proto +7 -4
- package/third_party/proto/cosmos/upgrade/v1beta1/upgrade.proto +16 -6
- package/third_party/proto/cosmos_proto/cosmos.proto +97 -0
- 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 +15 -1
- package/third_party/proto/ibc/core/client/v1/client.proto +9 -6
- package/upgradegaia.sh +13 -4
- package/vm/action.go +133 -0
- package/vm/action_test.go +129 -0
- package/vm/controller.go +9 -16
- package/vm/core_proposals.go +31 -0
- package/x/lien/keeper/account.go +16 -11
- package/x/lien/keeper/keeper.go +5 -4
- package/x/lien/keeper/keeper_test.go +9 -9
- package/x/lien/lien.go +6 -4
- package/x/lien/lien_test.go +20 -16
- package/x/swingset/abci.go +25 -33
- package/x/swingset/client/cli/query.go +2 -2
- package/x/swingset/client/cli/tx.go +48 -33
- package/x/swingset/client/proposal_handler.go +2 -17
- package/x/swingset/keeper/keeper.go +69 -15
- package/x/swingset/keeper/keeper_test.go +1 -1
- package/x/swingset/keeper/migrations.go +7 -2
- package/x/swingset/keeper/msg_server.go +66 -49
- package/x/swingset/keeper/proposal.go +14 -8
- package/x/swingset/keeper/querier.go +14 -6
- package/x/swingset/keeper/swing_store_exports_handler.go +5 -1
- package/x/swingset/proposal_handler.go +3 -3
- package/x/swingset/swingset.go +4 -2
- package/x/swingset/types/codec.go +2 -2
- package/x/swingset/types/default-params.go +22 -16
- package/x/swingset/types/expected_keepers.go +11 -0
- package/x/swingset/types/msgs.go +43 -2
- package/x/swingset/types/msgs.pb.go +16 -16
- package/x/swingset/types/params.go +74 -0
- package/x/swingset/types/params_test.go +116 -0
- package/x/swingset/types/proposal.go +5 -5
- package/x/swingset/types/types.go +30 -28
- package/x/vbank/keeper/keeper.go +3 -2
- package/x/vbank/keeper/querier.go +6 -2
- package/x/vbank/keeper/rewards.go +1 -1
- package/x/vbank/vbank.go +19 -17
- package/x/vbank/vbank_test.go +18 -18
- package/x/vibc/handler.go +3 -8
- package/x/vibc/ibc.go +79 -126
- 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/README.md +138 -0
- package/x/vstorage/capdata/capdata.go +298 -0
- package/x/vstorage/capdata/capdata_test.go +352 -0
- package/x/vstorage/client/cli/query.go +51 -4
- package/x/vstorage/keeper/grpc_query.go +221 -0
- package/x/vstorage/keeper/keeper.go +3 -2
- package/x/vstorage/keeper/keeper_grpc_test.go +300 -0
- package/x/vstorage/keeper/keeper_test.go +1 -1
- package/x/vstorage/keeper/querier.go +6 -2
- package/x/vstorage/keeper/querier_test.go +112 -0
- package/x/vstorage/types/query.pb.go +646 -36
- package/x/vstorage/types/query.pb.gw.go +119 -0
- package/x/vstorage/vstorage.go +16 -15
- package/x/vstorage/vstorage_test.go +5 -5
- package/x/swingset/legacy/v32/params.go +0 -37
- package/x/swingset/legacy/v32/params_test.go +0 -133
- /package/{src/index.cjs → index.cjs} +0 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
package keeper
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"bytes"
|
|
5
|
+
"testing"
|
|
6
|
+
|
|
7
|
+
agoric "github.com/Agoric/agoric-sdk/golang/cosmos/types"
|
|
8
|
+
|
|
9
|
+
abci "github.com/tendermint/tendermint/abci/types"
|
|
10
|
+
|
|
11
|
+
"github.com/cosmos/cosmos-sdk/codec"
|
|
12
|
+
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
func TestQuerier(t *testing.T) {
|
|
16
|
+
testKit := makeTestKit()
|
|
17
|
+
ctx, keeper := testKit.ctx, testKit.vstorageKeeper
|
|
18
|
+
legacyQuerierCdc := codec.NewAminoCodec(codec.NewLegacyAmino())
|
|
19
|
+
querier := NewQuerier(keeper, legacyQuerierCdc.LegacyAmino)
|
|
20
|
+
|
|
21
|
+
// Populate mock data
|
|
22
|
+
keeper.SetStorage(ctx, agoric.NewKVEntry("foo.bar", "42"))
|
|
23
|
+
keeper.SetStorage(ctx, agoric.NewKVEntry("foo.baz", "hello"))
|
|
24
|
+
|
|
25
|
+
type testCase struct {
|
|
26
|
+
label string
|
|
27
|
+
path []string
|
|
28
|
+
expected []byte
|
|
29
|
+
err *sdkerrors.Error
|
|
30
|
+
}
|
|
31
|
+
testCases := []testCase{}
|
|
32
|
+
|
|
33
|
+
// Test invalid endpoint
|
|
34
|
+
testCases = append(testCases, []testCase{
|
|
35
|
+
{label: "invalid endpoint",
|
|
36
|
+
path: []string{"foo"},
|
|
37
|
+
err: sdkerrors.ErrUnknownRequest,
|
|
38
|
+
},
|
|
39
|
+
}...)
|
|
40
|
+
|
|
41
|
+
// Test invalid arguments to valid data and children endpoints
|
|
42
|
+
for _, endpoint := range []string{"data", "children"} {
|
|
43
|
+
testCases = append(testCases, []testCase{
|
|
44
|
+
{label: endpoint + ": no entry path",
|
|
45
|
+
path: []string{endpoint},
|
|
46
|
+
err: sdkerrors.ErrInvalidRequest,
|
|
47
|
+
},
|
|
48
|
+
{label: endpoint + ": too many segments",
|
|
49
|
+
path: []string{endpoint, "foo", "bar"},
|
|
50
|
+
err: sdkerrors.ErrInvalidRequest,
|
|
51
|
+
},
|
|
52
|
+
{label: endpoint + ": invalid path",
|
|
53
|
+
path: []string{endpoint, ".", ""},
|
|
54
|
+
err: sdkerrors.ErrInvalidRequest,
|
|
55
|
+
},
|
|
56
|
+
}...)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Test data endpoint with valid vstorage path
|
|
60
|
+
testCases = append(testCases, []testCase{
|
|
61
|
+
{label: "data: non-existent path",
|
|
62
|
+
path: []string{"data", "bar"},
|
|
63
|
+
// DO NOT CHANGE
|
|
64
|
+
// The UI and CLI check for the specific cosmos-sdk error code & codespace
|
|
65
|
+
err: sdkerrors.ErrNotFound,
|
|
66
|
+
},
|
|
67
|
+
{label: "data: path with no data",
|
|
68
|
+
path: []string{"data", "foo"},
|
|
69
|
+
// DO NOT CHANGE
|
|
70
|
+
// The UI and CLI check for the specific cosmos-sdk error code & codespace
|
|
71
|
+
err: sdkerrors.ErrNotFound,
|
|
72
|
+
},
|
|
73
|
+
{label: "data: path with data",
|
|
74
|
+
path: []string{"data", "foo.bar"},
|
|
75
|
+
expected: []byte("{\n \"value\": \"42\"\n}"),
|
|
76
|
+
},
|
|
77
|
+
}...)
|
|
78
|
+
|
|
79
|
+
// Ensure stability of cosmos-sdk error codes
|
|
80
|
+
if codespace, code, _ := sdkerrors.ABCIInfo(sdkerrors.ErrNotFound, true); codespace != "sdk" || code != 38 {
|
|
81
|
+
t.Errorf("cosmos-sdk ErrNotFound has codespace %s, code %d, expected sdk/38", codespace, code)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Test children endpoint with valid vstorage path
|
|
85
|
+
testCases = append(testCases, []testCase{
|
|
86
|
+
{label: "children: non-existent path",
|
|
87
|
+
path: []string{"children", "bar"},
|
|
88
|
+
expected: []byte("{\n \"children\": []\n}"),
|
|
89
|
+
},
|
|
90
|
+
{label: "children: path with no children",
|
|
91
|
+
path: []string{"children", "foo.bar"},
|
|
92
|
+
expected: []byte("{\n \"children\": []\n}"),
|
|
93
|
+
},
|
|
94
|
+
{label: "children: path with children",
|
|
95
|
+
path: []string{"children", "foo"},
|
|
96
|
+
expected: []byte("{\n \"children\": [\n \"bar\",\n \"baz\"\n ]\n}"),
|
|
97
|
+
},
|
|
98
|
+
}...)
|
|
99
|
+
|
|
100
|
+
for _, desc := range testCases {
|
|
101
|
+
res, err := querier(ctx, desc.path, abci.RequestQuery{})
|
|
102
|
+
if desc.err != nil {
|
|
103
|
+
if err == nil {
|
|
104
|
+
t.Errorf("%s: got no error, want error %q", desc.label, *desc.err)
|
|
105
|
+
} else if codespace, code, _ := sdkerrors.ABCIInfo(err, true); codespace != desc.err.Codespace() || code != desc.err.ABCICode() {
|
|
106
|
+
t.Errorf("%s: got error %v, want error %q", desc.label, err, *desc.err)
|
|
107
|
+
}
|
|
108
|
+
} else if !bytes.Equal(res, desc.expected) {
|
|
109
|
+
t.Errorf("%s: wrong result: %#v, expected %#v", desc.label, string(res), string(desc.expected))
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|