@agoric/cosmos 0.34.2-dev-3c8aafe.0 → 0.34.2-dev-74fbe43.0.74fbe43
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 +6 -2
- package/ante/ante.go +2 -2
- package/ante/inbound.go +1 -2
- package/ante/inbound_test.go +3 -1
- package/ante/vm_admission.go +1 -2
- package/app/app.go +256 -174
- package/app/encoding.go +6 -3
- package/app/export.go +50 -21
- package/app/genesis.go +7 -5
- package/app/params/encoding.go +1 -1
- package/app/params/proto.go +6 -4
- package/app/sim_test.go +11 -13
- package/app/txconfig/tx_config.go +169 -0
- package/app/upgrade.go +40 -90
- package/cmd/agd/agvm.go +1 -1
- package/cmd/agd/main.go +1 -1
- package/cmd/libdaemon/main.go +2 -2
- package/daemon/cmd/root.go +99 -30
- package/daemon/cmd/root_test.go +12 -27
- package/daemon/main.go +2 -9
- package/git-revision.txt +1 -1
- package/go.mod +130 -109
- package/go.sum +228 -469
- package/package.json +2 -2
- package/proto/agoric/swingset/msgs.proto +72 -9
- package/proto/agoric/swingset/swingset.proto +7 -2
- package/proto/agoric/vbank/vbank.proto +1 -1
- package/proto/agoric/vibc/msgs.proto +4 -0
- package/scripts/mockgen.sh +4 -0
- package/tests/e2e/vbank/vbank_test.go +172 -0
- package/tests/integrations/types/aminojson_test.go +214 -0
- package/tests/integrations/vbank/vbank_test.go +349 -0
- package/third_party/proto/amino/amino.proto +6 -1
- package/third_party/proto/cosmos/base/v1beta1/coin.proto +18 -5
- package/third_party/proto/cosmos/upgrade/v1beta1/upgrade.proto +4 -8
- package/third_party/proto/ibc/core/channel/v1/channel.proto +42 -17
- package/third_party/proto/ibc/core/client/v1/client.proto +48 -40
- 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/types/kv_entry_helpers.go +3 -27
- package/types/kv_entry_helpers_test.go +2 -2
- package/types/legacy_address_encoder.go +58 -0
- package/vm/proto_json_test.go +1 -1
- package/vm/server.go +2 -1
- package/x/swingset/abci.go +2 -2
- package/x/swingset/client/cli/tx.go +16 -14
- package/x/swingset/config.go +1 -1
- package/x/swingset/genesis.go +2 -1
- package/x/swingset/handler.go +2 -1
- package/x/swingset/keeper/extension_snapshotter.go +14 -5
- package/x/swingset/keeper/extension_snapshotter_test.go +1 -1
- package/x/swingset/keeper/keeper.go +28 -23
- package/x/swingset/keeper/keeper_test.go +10 -7
- package/x/swingset/keeper/msg_server.go +52 -5
- package/x/swingset/keeper/msg_server_test.go +121 -0
- package/x/swingset/keeper/proposal.go +4 -0
- package/x/swingset/keeper/querier.go +1 -1
- 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/keeper/test_utils.go +2 -2
- package/x/swingset/module.go +20 -22
- package/x/swingset/testing/queue.go +5 -2
- package/x/swingset/testutil/mocks.go +379 -0
- package/x/swingset/types/codec.go +10 -5
- package/x/swingset/types/default-params.go +13 -12
- package/x/swingset/types/expected_keepers.go +29 -4
- package/x/swingset/types/msgs.go +51 -36
- package/x/swingset/types/msgs.pb.go +561 -51
- package/x/swingset/types/params_test.go +21 -20
- package/x/swingset/types/swingset.pb.go +67 -61
- package/x/vbank/genesis.go +13 -9
- package/x/vbank/handler.go +2 -1
- package/x/vbank/keeper/grpc_query.go +4 -1
- package/x/vbank/keeper/keeper.go +108 -23
- package/x/vbank/keeper/querier.go +4 -1
- package/x/vbank/keeper/rewards.go +10 -5
- package/x/vbank/module.go +47 -75
- package/x/vbank/types/expected_keepers.go +15 -10
- package/x/vbank/types/key.go +3 -0
- package/x/vbank/types/params.go +4 -3
- package/x/vbank/types/vbank.pb.go +41 -40
- package/x/vbank/vbank.go +29 -11
- package/x/vbank/vbank_test.go +213 -154
- package/x/vibc/handler.go +2 -1
- package/x/vibc/keeper/keeper.go +10 -10
- package/x/vibc/keeper/migrations.go +1 -1
- package/x/vibc/keeper/triggers.go +1 -1
- package/x/vibc/module.go +5 -22
- package/x/vibc/types/codec.go +2 -1
- package/x/vibc/types/expected_keepers.go +7 -5
- package/x/vibc/types/ibc_module.go +5 -5
- package/x/vibc/types/msgs.go +30 -7
- package/x/vibc/types/msgs.pb.go +29 -25
- package/x/vibc/types/receiver.go +2 -2
- package/x/vlocalchain/handler.go +2 -1
- package/x/vlocalchain/keeper/keeper.go +17 -5
- package/x/vlocalchain/keeper/keeper_test.go +3 -2
- package/x/vlocalchain/types/expected_keepers.go +7 -4
- package/x/vlocalchain/vlocalchain_test.go +38 -26
- package/x/vstorage/genesis.go +10 -10
- package/x/vstorage/handler.go +2 -1
- package/x/vstorage/keeper/grpc_query.go +1 -1
- package/x/vstorage/keeper/keeper.go +72 -50
- package/x/vstorage/keeper/keeper_test.go +74 -54
- package/x/vstorage/keeper/querier.go +1 -1
- package/x/vstorage/module.go +27 -13
- package/x/vstorage/testing/queue.go +5 -3
- package/x/vstorage/vstorage.go +10 -9
- package/x/vstorage/vstorage_test.go +24 -18
- package/x/vtransfer/genesis.go +1 -3
- package/x/vtransfer/handler.go +3 -2
- package/x/vtransfer/ibc_middleware.go +5 -5
- package/x/vtransfer/ibc_middleware_test.go +43 -29
- package/x/vtransfer/keeper/keeper.go +35 -33
- package/x/vtransfer/module.go +8 -11
- package/x/vtransfer/types/expected_keepers.go +3 -3
- package/x/vtransfer/utils_test.go +26 -11
- package/daemon/cmd/testnet.go +0 -539
|
@@ -2,20 +2,20 @@ syntax = "proto3";
|
|
|
2
2
|
|
|
3
3
|
package ibc.core.client.v1;
|
|
4
4
|
|
|
5
|
-
option go_package = "github.com/cosmos/ibc-go/
|
|
5
|
+
option go_package = "github.com/cosmos/ibc-go/v8/modules/core/02-client/types";
|
|
6
6
|
|
|
7
|
-
import "gogoproto/gogo.proto";
|
|
8
|
-
import "google/protobuf/any.proto";
|
|
9
7
|
import "cosmos/upgrade/v1beta1/upgrade.proto";
|
|
10
8
|
import "cosmos_proto/cosmos.proto";
|
|
9
|
+
import "gogoproto/gogo.proto";
|
|
10
|
+
import "google/protobuf/any.proto";
|
|
11
11
|
|
|
12
12
|
// IdentifiedClientState defines a client state with an additional client
|
|
13
13
|
// identifier field.
|
|
14
14
|
message IdentifiedClientState {
|
|
15
15
|
// client identifier
|
|
16
|
-
string client_id = 1
|
|
16
|
+
string client_id = 1;
|
|
17
17
|
// client state
|
|
18
|
-
google.protobuf.Any client_state = 2
|
|
18
|
+
google.protobuf.Any client_state = 2;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
// ConsensusStateWithHeight defines a consensus state with an additional height
|
|
@@ -24,26 +24,58 @@ message ConsensusStateWithHeight {
|
|
|
24
24
|
// consensus state height
|
|
25
25
|
Height height = 1 [(gogoproto.nullable) = false];
|
|
26
26
|
// consensus state
|
|
27
|
-
google.protobuf.Any consensus_state = 2
|
|
27
|
+
google.protobuf.Any consensus_state = 2;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
// ClientConsensusStates defines all the stored consensus states for a given
|
|
31
31
|
// client.
|
|
32
32
|
message ClientConsensusStates {
|
|
33
33
|
// client identifier
|
|
34
|
-
string client_id = 1
|
|
34
|
+
string client_id = 1;
|
|
35
35
|
// consensus states and their heights associated with the client
|
|
36
|
-
repeated ConsensusStateWithHeight consensus_states = 2
|
|
37
|
-
|
|
36
|
+
repeated ConsensusStateWithHeight consensus_states = 2 [(gogoproto.nullable) = false];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Height is a monotonically increasing data type
|
|
40
|
+
// that can be compared against another Height for the purposes of updating and
|
|
41
|
+
// freezing clients
|
|
42
|
+
//
|
|
43
|
+
// Normally the RevisionHeight is incremented at each height while keeping
|
|
44
|
+
// RevisionNumber the same. However some consensus algorithms may choose to
|
|
45
|
+
// reset the height in certain conditions e.g. hard forks, state-machine
|
|
46
|
+
// breaking changes In these cases, the RevisionNumber is incremented so that
|
|
47
|
+
// height continues to be monitonically increasing even as the RevisionHeight
|
|
48
|
+
// gets reset
|
|
49
|
+
message Height {
|
|
50
|
+
option (gogoproto.goproto_getters) = false;
|
|
51
|
+
option (gogoproto.goproto_stringer) = false;
|
|
52
|
+
|
|
53
|
+
// the revision that the client is currently on
|
|
54
|
+
uint64 revision_number = 1;
|
|
55
|
+
// the height within the given revision
|
|
56
|
+
uint64 revision_height = 2;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Params defines the set of IBC light client parameters.
|
|
60
|
+
message Params {
|
|
61
|
+
// allowed_clients defines the list of allowed client state types which can be created
|
|
62
|
+
// and interacted with. If a client type is removed from the allowed clients list, usage
|
|
63
|
+
// of this client will be disabled until it is added again to the list.
|
|
64
|
+
repeated string allowed_clients = 1;
|
|
38
65
|
}
|
|
39
66
|
|
|
40
|
-
// ClientUpdateProposal is a governance proposal. If it passes, the substitute
|
|
67
|
+
// ClientUpdateProposal is a legacy governance proposal. If it passes, the substitute
|
|
41
68
|
// client's latest consensus state is copied over to the subject client. The proposal
|
|
42
69
|
// handler may fail if the subject and the substitute do not match in client and
|
|
43
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.
|
|
44
73
|
message ClientUpdateProposal {
|
|
45
|
-
option
|
|
74
|
+
option deprecated = true;
|
|
75
|
+
|
|
46
76
|
option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";
|
|
77
|
+
option (gogoproto.goproto_getters) = false;
|
|
78
|
+
|
|
47
79
|
// the title of the update proposal
|
|
48
80
|
string title = 1;
|
|
49
81
|
// the description of the proposal
|
|
@@ -57,11 +89,15 @@ message ClientUpdateProposal {
|
|
|
57
89
|
|
|
58
90
|
// UpgradeProposal is a gov Content type for initiating an IBC breaking
|
|
59
91
|
// upgrade.
|
|
92
|
+
//
|
|
93
|
+
// Deprecated: Please use MsgIBCSoftwareUpgrade in favour of this message type.
|
|
60
94
|
message UpgradeProposal {
|
|
95
|
+
option deprecated = true;
|
|
96
|
+
|
|
97
|
+
option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";
|
|
61
98
|
option (gogoproto.goproto_getters) = false;
|
|
62
99
|
option (gogoproto.goproto_stringer) = false;
|
|
63
100
|
option (gogoproto.equal) = true;
|
|
64
|
-
option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";
|
|
65
101
|
|
|
66
102
|
string title = 1;
|
|
67
103
|
string description = 2;
|
|
@@ -75,31 +111,3 @@ message UpgradeProposal {
|
|
|
75
111
|
// planned chain upgrades
|
|
76
112
|
google.protobuf.Any upgraded_client_state = 4 [(gogoproto.moretags) = "yaml:\"upgraded_client_state\""];
|
|
77
113
|
}
|
|
78
|
-
|
|
79
|
-
// Height is a monotonically increasing data type
|
|
80
|
-
// that can be compared against another Height for the purposes of updating and
|
|
81
|
-
// freezing clients
|
|
82
|
-
//
|
|
83
|
-
// Normally the RevisionHeight is incremented at each height while keeping
|
|
84
|
-
// RevisionNumber the same. However some consensus algorithms may choose to
|
|
85
|
-
// reset the height in certain conditions e.g. hard forks, state-machine
|
|
86
|
-
// breaking changes In these cases, the RevisionNumber is incremented so that
|
|
87
|
-
// height continues to be monitonically increasing even as the RevisionHeight
|
|
88
|
-
// gets reset
|
|
89
|
-
message Height {
|
|
90
|
-
option (gogoproto.goproto_getters) = false;
|
|
91
|
-
option (gogoproto.goproto_stringer) = false;
|
|
92
|
-
|
|
93
|
-
// the revision that the client is currently on
|
|
94
|
-
uint64 revision_number = 1 [(gogoproto.moretags) = "yaml:\"revision_number\""];
|
|
95
|
-
// the height within the given revision
|
|
96
|
-
uint64 revision_height = 2 [(gogoproto.moretags) = "yaml:\"revision_height\""];
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// Params defines the set of IBC light client parameters.
|
|
100
|
-
message Params {
|
|
101
|
-
// allowed_clients defines the list of allowed client state types which can be created
|
|
102
|
-
// and interacted with. If a client type is removed from the allowed clients list, usage
|
|
103
|
-
// of this client will be disabled until it is added again to the list.
|
|
104
|
-
repeated string allowed_clients = 1 [(gogoproto.moretags) = "yaml:\"allowed_clients\""];
|
|
105
|
-
}
|
package/types/address_hooks.go
CHANGED
|
@@ -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/
|
|
11
|
-
ibcexported "github.com/cosmos/ibc-go/
|
|
10
|
+
transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
|
|
11
|
+
ibcexported "github.com/cosmos/ibc-go/v8/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/
|
|
12
|
-
clienttypes "github.com/cosmos/ibc-go/
|
|
13
|
-
channeltypes "github.com/cosmos/ibc-go/
|
|
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"
|
|
14
14
|
|
|
15
15
|
agtypes "github.com/Agoric/agoric-sdk/golang/cosmos/types"
|
|
16
16
|
)
|
package/types/ibc_packet.go
CHANGED
|
@@ -3,9 +3,9 @@ package types
|
|
|
3
3
|
import (
|
|
4
4
|
"encoding/json"
|
|
5
5
|
|
|
6
|
-
clienttypes "github.com/cosmos/ibc-go/
|
|
7
|
-
channeltypes "github.com/cosmos/ibc-go/
|
|
8
|
-
"github.com/cosmos/ibc-go/
|
|
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"
|
|
9
9
|
)
|
|
10
10
|
|
|
11
11
|
var _ json.Marshaler = IBCPacket{}
|
package/types/ibc_packet_test.go
CHANGED
|
@@ -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/
|
|
15
|
-
channeltypes "github.com/cosmos/ibc-go/
|
|
16
|
-
ibcexported "github.com/cosmos/ibc-go/
|
|
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"
|
|
17
17
|
)
|
|
18
18
|
|
|
19
19
|
func CreateTestChannelPacket() channeltypes.Packet {
|
|
@@ -5,9 +5,7 @@ import (
|
|
|
5
5
|
"fmt"
|
|
6
6
|
"io"
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
vstoragetypes "github.com/Agoric/agoric-sdk/golang/cosmos/x/vstorage/types"
|
|
10
|
-
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
8
|
+
storetypes "cosmossdk.io/store/types"
|
|
11
9
|
)
|
|
12
10
|
|
|
13
11
|
// These helpers facilitate handling KVEntry streams, in particular for the
|
|
@@ -63,11 +61,11 @@ var _ KVEntryReader = &kvIteratorReader{}
|
|
|
63
61
|
|
|
64
62
|
// kvIteratorReader is a KVEntryReader backed by an sdk.Iterator
|
|
65
63
|
type kvIteratorReader struct {
|
|
66
|
-
iter
|
|
64
|
+
iter storetypes.Iterator
|
|
67
65
|
}
|
|
68
66
|
|
|
69
67
|
// NewKVIteratorReader returns a KVEntryReader backed by an sdk.Iterator.
|
|
70
|
-
func NewKVIteratorReader(iter
|
|
68
|
+
func NewKVIteratorReader(iter storetypes.Iterator) KVEntryReader {
|
|
71
69
|
return &kvIteratorReader{
|
|
72
70
|
iter: iter,
|
|
73
71
|
}
|
|
@@ -146,28 +144,6 @@ func (reader *kvEntriesReader[any]) Close() error {
|
|
|
146
144
|
return nil
|
|
147
145
|
}
|
|
148
146
|
|
|
149
|
-
// NewVstorageDataEntriesReader creates a KVEntryReader backed by a
|
|
150
|
-
// vstorage DataEntry slice
|
|
151
|
-
func NewVstorageDataEntriesReader(vstorageDataEntries []*vstoragetypes.DataEntry) KVEntryReader {
|
|
152
|
-
return &kvEntriesReader[*vstoragetypes.DataEntry]{
|
|
153
|
-
entries: vstorageDataEntries,
|
|
154
|
-
toKVEntry: func(sourceEntry *vstoragetypes.DataEntry) (KVEntry, error) {
|
|
155
|
-
return NewKVEntry(sourceEntry.Path, sourceEntry.Value), nil
|
|
156
|
-
},
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// NewSwingStoreExportDataEntriesReader creates a KVEntryReader backed by
|
|
161
|
-
// a SwingStoreExportDataEntry slice
|
|
162
|
-
func NewSwingStoreExportDataEntriesReader(exportDataEntries []*swingsettypes.SwingStoreExportDataEntry) KVEntryReader {
|
|
163
|
-
return &kvEntriesReader[*swingsettypes.SwingStoreExportDataEntry]{
|
|
164
|
-
entries: exportDataEntries,
|
|
165
|
-
toKVEntry: func(sourceEntry *swingsettypes.SwingStoreExportDataEntry) (KVEntry, error) {
|
|
166
|
-
return NewKVEntry(sourceEntry.Key, sourceEntry.Value), nil
|
|
167
|
-
},
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
147
|
// NewJsonRawMessageKVEntriesReader creates a KVEntryReader backed by
|
|
172
148
|
// a json.RawMessage slice
|
|
173
149
|
func NewJsonRawMessageKVEntriesReader(jsonEntries []json.RawMessage) KVEntryReader {
|
|
@@ -7,7 +7,7 @@ import (
|
|
|
7
7
|
"strings"
|
|
8
8
|
"testing"
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
storetypes "cosmossdk.io/store/types"
|
|
11
11
|
)
|
|
12
12
|
|
|
13
13
|
func toKVEntryIdentity(entry KVEntry) (KVEntry, error) {
|
|
@@ -99,7 +99,7 @@ type kvEntryReaderIterator struct {
|
|
|
99
99
|
|
|
100
100
|
// newKVEntryReaderIterator creates an iterator over a KVEntryReader.
|
|
101
101
|
// KVEntry keys and values are reported as []byte from the reader in order.
|
|
102
|
-
func newKVEntryReaderIterator(reader KVEntryReader)
|
|
102
|
+
func newKVEntryReaderIterator(reader KVEntryReader) storetypes.Iterator {
|
|
103
103
|
iter := &kvEntryReaderIterator{
|
|
104
104
|
reader: reader,
|
|
105
105
|
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
package types
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"encoding/json"
|
|
5
|
+
fmt "fmt"
|
|
6
|
+
io "io"
|
|
7
|
+
|
|
8
|
+
"cosmossdk.io/x/tx/signing/aminojson"
|
|
9
|
+
types "github.com/cosmos/cosmos-sdk/types"
|
|
10
|
+
"google.golang.org/protobuf/reflect/protoreflect"
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
func marshalJson(value interface{}, w io.Writer) error {
|
|
14
|
+
marshalledAddr, err := json.Marshal(value)
|
|
15
|
+
if err != nil {
|
|
16
|
+
return err
|
|
17
|
+
}
|
|
18
|
+
_, err = w.Write(marshalledAddr)
|
|
19
|
+
return err
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
func LegacyAddressEncoder(_enc *aminojson.Encoder, value protoreflect.Value, w io.Writer) error {
|
|
23
|
+
switch valueAddress := value.Interface().(type) {
|
|
24
|
+
case []byte:
|
|
25
|
+
if len(valueAddress) == 0 {
|
|
26
|
+
err := marshalJson("", w)
|
|
27
|
+
return err
|
|
28
|
+
}
|
|
29
|
+
err := types.VerifyAddressFormat(valueAddress)
|
|
30
|
+
if err != nil {
|
|
31
|
+
return err
|
|
32
|
+
}
|
|
33
|
+
var accAddr types.AccAddress = valueAddress
|
|
34
|
+
err = marshalJson(accAddr, w)
|
|
35
|
+
if err != nil {
|
|
36
|
+
return err
|
|
37
|
+
}
|
|
38
|
+
return nil
|
|
39
|
+
|
|
40
|
+
case string:
|
|
41
|
+
if valueAddress == "" {
|
|
42
|
+
err := marshalJson(valueAddress, w)
|
|
43
|
+
return err
|
|
44
|
+
}
|
|
45
|
+
accAddr, err := types.AccAddressFromBech32(valueAddress)
|
|
46
|
+
if err != nil {
|
|
47
|
+
return err
|
|
48
|
+
}
|
|
49
|
+
err = marshalJson(accAddr, w)
|
|
50
|
+
if err != nil {
|
|
51
|
+
return err
|
|
52
|
+
}
|
|
53
|
+
return nil
|
|
54
|
+
|
|
55
|
+
default:
|
|
56
|
+
return fmt.Errorf("address cannot be encoded wrong type")
|
|
57
|
+
}
|
|
58
|
+
}
|
package/vm/proto_json_test.go
CHANGED
|
@@ -46,7 +46,7 @@ func TestProtoJSONMarshal(t *testing.T) {
|
|
|
46
46
|
{
|
|
47
47
|
"MsgDelegate",
|
|
48
48
|
func() interface{} {
|
|
49
|
-
return stakingtypes.NewMsgDelegate(accAddr, valAddr, coin)
|
|
49
|
+
return stakingtypes.NewMsgDelegate(accAddr.String(), valAddr.String(), coin)
|
|
50
50
|
},
|
|
51
51
|
`{"delegatorAddress":"cosmos1qy352eufjjmc9c","validatorAddress":"cosmosvaloper1npm9gvss52mlmk","amount":{"denom":"uatom","amount":"1234567"}}`,
|
|
52
52
|
},
|
package/vm/server.go
CHANGED
|
@@ -5,6 +5,7 @@ import (
|
|
|
5
5
|
"fmt"
|
|
6
6
|
"sync"
|
|
7
7
|
|
|
8
|
+
storetypes "cosmossdk.io/store/types"
|
|
8
9
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
9
10
|
)
|
|
10
11
|
|
|
@@ -45,7 +46,7 @@ func (s *AgdServer) SetControllerContext(ctx sdk.Context) func() {
|
|
|
45
46
|
// own meter usage.
|
|
46
47
|
s.mtx.Lock()
|
|
47
48
|
defer s.mtx.Unlock()
|
|
48
|
-
s.currentCtx = sdk.WrapSDKContext(ctx.WithGasMeter(
|
|
49
|
+
s.currentCtx = sdk.WrapSDKContext(ctx.WithGasMeter(storetypes.NewInfiniteGasMeter()))
|
|
49
50
|
return func() {
|
|
50
51
|
s.mtx.Lock()
|
|
51
52
|
defer s.mtx.Unlock()
|
package/x/swingset/abci.go
CHANGED
|
@@ -32,7 +32,7 @@ type afterCommitBlockAction struct {
|
|
|
32
32
|
*vm.ActionHeader `actionType:"AFTER_COMMIT_BLOCK"`
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
func BeginBlock(ctx sdk.Context,
|
|
35
|
+
func BeginBlock(ctx sdk.Context, keeper Keeper) error {
|
|
36
36
|
defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker)
|
|
37
37
|
|
|
38
38
|
action := beginBlockAction{
|
|
@@ -53,7 +53,7 @@ func BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock, keeper Keeper) erro
|
|
|
53
53
|
var endBlockHeight int64
|
|
54
54
|
var endBlockTime int64
|
|
55
55
|
|
|
56
|
-
func EndBlock(ctx sdk.Context,
|
|
56
|
+
func EndBlock(ctx sdk.Context, keeper Keeper) ([]abci.ValidatorUpdate, error) {
|
|
57
57
|
defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyEndBlocker)
|
|
58
58
|
|
|
59
59
|
action := endBlockAction{}
|
|
@@ -83,10 +83,6 @@ is an "Ack" integer.`,
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
msg := types.NewMsgDeliverInbound(msgs, cctx.GetFromAddress())
|
|
86
|
-
if err := msg.ValidateBasic(); err != nil {
|
|
87
|
-
return err
|
|
88
|
-
}
|
|
89
|
-
|
|
90
86
|
return tx.GenerateOrBroadcastTxCLI(cctx, cmd.Flags(), msg)
|
|
91
87
|
},
|
|
92
88
|
}
|
|
@@ -130,9 +126,6 @@ https://github.com/endojs/endo/tree/master/packages/bundle-source`,
|
|
|
130
126
|
}
|
|
131
127
|
|
|
132
128
|
msg := types.NewMsgInstallBundle(jsonIn, cctx.GetFromAddress())
|
|
133
|
-
if err := msg.ValidateBasic(); err != nil {
|
|
134
|
-
return err
|
|
135
|
-
}
|
|
136
129
|
|
|
137
130
|
compress, err := cmd.Flags().GetBool(FlagCompress)
|
|
138
131
|
if err != nil {
|
|
@@ -144,7 +137,6 @@ https://github.com/endojs/endo/tree/master/packages/bundle-source`,
|
|
|
144
137
|
return err
|
|
145
138
|
}
|
|
146
139
|
// re-validate to be sure
|
|
147
|
-
err = msg.ValidateBasic()
|
|
148
140
|
if err != nil {
|
|
149
141
|
return err
|
|
150
142
|
}
|
|
@@ -215,13 +207,23 @@ func GetCmdWalletAction() *cobra.Command {
|
|
|
215
207
|
if err != nil {
|
|
216
208
|
return err
|
|
217
209
|
}
|
|
210
|
+
|
|
218
211
|
var msg sdk.Msg
|
|
212
|
+
|
|
213
|
+
// If spend is true, we create a MsgWalletSpendAction, otherwise a MsgWalletAction.
|
|
214
|
+
// This is a bit of a hack, but it allows us to use the same command for both types of actions.
|
|
215
|
+
// The MsgWalletSpendAction is a special case that allows the action to spend assets.
|
|
216
|
+
// The MsgWalletAction is a general action that does not allow spending.
|
|
219
217
|
if spend {
|
|
220
|
-
|
|
218
|
+
m := types.NewMsgWalletSpendAction(owner, action)
|
|
219
|
+
err = m.ValidateBasic()
|
|
220
|
+
msg = m
|
|
221
221
|
} else {
|
|
222
|
-
|
|
222
|
+
m := types.NewMsgWalletAction(owner, action)
|
|
223
|
+
err = m.ValidateBasic()
|
|
224
|
+
msg = m
|
|
223
225
|
}
|
|
224
|
-
|
|
226
|
+
|
|
225
227
|
if err != nil {
|
|
226
228
|
return err
|
|
227
229
|
}
|
|
@@ -304,12 +306,12 @@ Specify at least one pair of permit.json and code.js files`,
|
|
|
304
306
|
return err
|
|
305
307
|
}
|
|
306
308
|
|
|
307
|
-
|
|
308
|
-
if err != nil {
|
|
309
|
+
if err = content.ValidateBasic(); err != nil {
|
|
309
310
|
return err
|
|
310
311
|
}
|
|
311
312
|
|
|
312
|
-
|
|
313
|
+
msg, err := govv1beta1.NewMsgSubmitProposal(content, deposit, from)
|
|
314
|
+
if err != nil {
|
|
313
315
|
return err
|
|
314
316
|
}
|
|
315
317
|
|
package/x/swingset/config.go
CHANGED
|
@@ -6,10 +6,10 @@ import (
|
|
|
6
6
|
|
|
7
7
|
"github.com/spf13/viper"
|
|
8
8
|
|
|
9
|
+
pruningtypes "cosmossdk.io/store/pruning/types"
|
|
9
10
|
"github.com/cosmos/cosmos-sdk/client/flags"
|
|
10
11
|
serverconfig "github.com/cosmos/cosmos-sdk/server/config"
|
|
11
12
|
servertypes "github.com/cosmos/cosmos-sdk/server/types"
|
|
12
|
-
pruningtypes "github.com/cosmos/cosmos-sdk/store/pruning/types"
|
|
13
13
|
|
|
14
14
|
"github.com/Agoric/agoric-sdk/golang/cosmos/util"
|
|
15
15
|
)
|
package/x/swingset/genesis.go
CHANGED
|
@@ -10,6 +10,7 @@ import (
|
|
|
10
10
|
"io"
|
|
11
11
|
"strings"
|
|
12
12
|
|
|
13
|
+
storetypes "cosmossdk.io/store/types"
|
|
13
14
|
agoric "github.com/Agoric/agoric-sdk/golang/cosmos/types"
|
|
14
15
|
"github.com/Agoric/agoric-sdk/golang/cosmos/x/swingset/keeper"
|
|
15
16
|
"github.com/Agoric/agoric-sdk/golang/cosmos/x/swingset/types"
|
|
@@ -204,7 +205,7 @@ func ExportGenesis(
|
|
|
204
205
|
type swingStoreGenesisEventHandler struct {
|
|
205
206
|
exportDir string
|
|
206
207
|
snapshotHeight uint64
|
|
207
|
-
swingStore
|
|
208
|
+
swingStore storetypes.KVStore
|
|
208
209
|
hasher hash.Hash
|
|
209
210
|
exportMode string
|
|
210
211
|
}
|
package/x/swingset/handler.go
CHANGED
|
@@ -6,12 +6,13 @@ import (
|
|
|
6
6
|
"github.com/Agoric/agoric-sdk/golang/cosmos/x/swingset/keeper"
|
|
7
7
|
|
|
8
8
|
sdkioerrors "cosmossdk.io/errors"
|
|
9
|
+
"github.com/cosmos/cosmos-sdk/baseapp"
|
|
9
10
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
10
11
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
|
11
12
|
)
|
|
12
13
|
|
|
13
14
|
// NewHandler returns a handler for "swingset" type messages.
|
|
14
|
-
func NewHandler(k Keeper)
|
|
15
|
+
func NewHandler(k Keeper) baseapp.MsgServiceHandler {
|
|
15
16
|
msgServer := keeper.NewMsgServerImpl(k)
|
|
16
17
|
|
|
17
18
|
return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) {
|
|
@@ -7,11 +7,11 @@ import (
|
|
|
7
7
|
"io"
|
|
8
8
|
"math"
|
|
9
9
|
|
|
10
|
+
"cosmossdk.io/log"
|
|
11
|
+
snapshots "cosmossdk.io/store/snapshots/types"
|
|
10
12
|
agoric "github.com/Agoric/agoric-sdk/golang/cosmos/types"
|
|
11
13
|
"github.com/Agoric/agoric-sdk/golang/cosmos/x/swingset/types"
|
|
12
|
-
"github.com/cometbft/cometbft/libs/log"
|
|
13
14
|
"github.com/cosmos/cosmos-sdk/baseapp"
|
|
14
|
-
snapshots "github.com/cosmos/cosmos-sdk/snapshots/types"
|
|
15
15
|
)
|
|
16
16
|
|
|
17
17
|
// This module implements a Cosmos ExtensionSnapshotter to capture and restore
|
|
@@ -77,10 +77,19 @@ func NewExtensionSnapshotter(
|
|
|
77
77
|
swingStoreExportsHandler *SwingStoreExportsHandler,
|
|
78
78
|
getSwingStoreExportDataShadowCopyReader func(height int64) agoric.KVEntryReader,
|
|
79
79
|
) *ExtensionSnapshotter {
|
|
80
|
+
isConfigured := func() bool {
|
|
81
|
+
return app.SnapshotManager() != nil
|
|
82
|
+
}
|
|
83
|
+
takeAppSnapshot := func(height int64) {
|
|
84
|
+
if isConfigured() {
|
|
85
|
+
app.SnapshotManager().Snapshot(height)
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
logger := app.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName), "submodule", "extension snapshotter")
|
|
80
89
|
return &ExtensionSnapshotter{
|
|
81
|
-
isConfigured:
|
|
82
|
-
takeAppSnapshot:
|
|
83
|
-
logger:
|
|
90
|
+
isConfigured: isConfigured,
|
|
91
|
+
takeAppSnapshot: takeAppSnapshot,
|
|
92
|
+
logger: logger,
|
|
84
93
|
swingStoreExportsHandler: swingStoreExportsHandler,
|
|
85
94
|
getSwingStoreExportDataShadowCopyReader: getSwingStoreExportDataShadowCopyReader,
|
|
86
95
|
activeSnapshot: nil,
|