@agoric/cosmos 0.34.2-dev-d6bb564.0 → 0.34.2-dev-fed2b5e.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/app/app.go +32 -25
- package/git-revision.txt +1 -1
- package/package.json +2 -2
- package/proto/agoric/swingset/genesis.proto +10 -0
- package/types/kv_entry_helpers.go +14 -0
- package/x/swingset/genesis.go +30 -8
- package/x/swingset/keeper/keeper.go +8 -4
- package/x/swingset/keeper/keeper_test.go +77 -0
- package/x/swingset/swingset.go +71 -0
- package/x/swingset/types/genesis.pb.go +308 -18
package/app/app.go
CHANGED
|
@@ -202,6 +202,7 @@ type GaiaApp struct { // nolint: golint
|
|
|
202
202
|
controllerInited bool
|
|
203
203
|
bootstrapNeeded bool
|
|
204
204
|
lienPort int
|
|
205
|
+
swingsetPort int
|
|
205
206
|
vbankPort int
|
|
206
207
|
vibcPort int
|
|
207
208
|
vstoragePort int
|
|
@@ -459,6 +460,7 @@ func NewAgoricApp(
|
|
|
459
460
|
app.VstorageKeeper, vbanktypes.ReservePoolName,
|
|
460
461
|
callToController,
|
|
461
462
|
)
|
|
463
|
+
app.swingsetPort = vm.RegisterPortHandler("swingset", swingset.NewPortHandler(app.SwingSetKeeper))
|
|
462
464
|
|
|
463
465
|
app.SwingStoreExportsHandler = *swingsetkeeper.NewSwingStoreExportsHandler(
|
|
464
466
|
app.Logger(),
|
|
@@ -477,11 +479,12 @@ func NewAgoricApp(
|
|
|
477
479
|
|
|
478
480
|
getSwingStoreExportDataShadowCopyReader := func(height int64) agorictypes.KVEntryReader {
|
|
479
481
|
ctx := app.NewUncachedContext(false, tmproto.Header{Height: height})
|
|
480
|
-
|
|
481
|
-
if
|
|
482
|
+
exportDataIterator := app.SwingSetKeeper.GetSwingStore(ctx).Iterator(nil, nil)
|
|
483
|
+
if !exportDataIterator.Valid() {
|
|
484
|
+
exportDataIterator.Close()
|
|
482
485
|
return nil
|
|
483
486
|
}
|
|
484
|
-
return agorictypes.
|
|
487
|
+
return agorictypes.NewKVIteratorReader(exportDataIterator)
|
|
485
488
|
}
|
|
486
489
|
app.SwingSetSnapshotter = *swingsetkeeper.NewExtensionSnapshotter(
|
|
487
490
|
bApp,
|
|
@@ -814,6 +817,8 @@ func upgrade11Handler(app *GaiaApp, targetUpgrade string) func(sdk.Context, upgr
|
|
|
814
817
|
// Record the plan to send to SwingSet
|
|
815
818
|
app.upgradePlan = &plan
|
|
816
819
|
|
|
820
|
+
// TODO: Migrate x/vstorage swingStore to x/swingset SwingStore
|
|
821
|
+
|
|
817
822
|
// Always run module migrations
|
|
818
823
|
mvm, err := app.mm.RunMigrations(ctx, app.configurator, fromVm)
|
|
819
824
|
if err != nil {
|
|
@@ -842,17 +847,18 @@ func normalizeModuleAccount(ctx sdk.Context, ak authkeeper.AccountKeeper, name s
|
|
|
842
847
|
}
|
|
843
848
|
|
|
844
849
|
type cosmosInitAction struct {
|
|
845
|
-
Type
|
|
846
|
-
ChainID
|
|
847
|
-
BlockTime
|
|
848
|
-
IsBootstrap
|
|
849
|
-
Params
|
|
850
|
-
SupplyCoins
|
|
851
|
-
UpgradePlan
|
|
852
|
-
LienPort
|
|
853
|
-
StoragePort
|
|
854
|
-
|
|
855
|
-
|
|
850
|
+
Type string `json:"type"`
|
|
851
|
+
ChainID string `json:"chainID"`
|
|
852
|
+
BlockTime int64 `json:"blockTime,omitempty"`
|
|
853
|
+
IsBootstrap bool `json:"isBootstrap"`
|
|
854
|
+
Params swingset.Params `json:"params"`
|
|
855
|
+
SupplyCoins sdk.Coins `json:"supplyCoins"`
|
|
856
|
+
UpgradePlan *upgradetypes.Plan `json:"upgradePlan,omitempty"`
|
|
857
|
+
LienPort int `json:"lienPort"`
|
|
858
|
+
StoragePort int `json:"storagePort"`
|
|
859
|
+
SwingsetPort int `json:"swingsetPort"`
|
|
860
|
+
VbankPort int `json:"vbankPort"`
|
|
861
|
+
VibcPort int `json:"vibcPort"`
|
|
856
862
|
}
|
|
857
863
|
|
|
858
864
|
// Name returns the name of the App
|
|
@@ -882,17 +888,18 @@ func (app *GaiaApp) initController(ctx sdk.Context, bootstrap bool) {
|
|
|
882
888
|
|
|
883
889
|
// Begin initializing the controller here.
|
|
884
890
|
action := &cosmosInitAction{
|
|
885
|
-
Type:
|
|
886
|
-
ChainID:
|
|
887
|
-
BlockTime:
|
|
888
|
-
IsBootstrap:
|
|
889
|
-
Params:
|
|
890
|
-
SupplyCoins:
|
|
891
|
-
UpgradePlan:
|
|
892
|
-
LienPort:
|
|
893
|
-
StoragePort:
|
|
894
|
-
|
|
895
|
-
|
|
891
|
+
Type: "AG_COSMOS_INIT",
|
|
892
|
+
ChainID: ctx.ChainID(),
|
|
893
|
+
BlockTime: blockTime,
|
|
894
|
+
IsBootstrap: bootstrap,
|
|
895
|
+
Params: app.SwingSetKeeper.GetParams(ctx),
|
|
896
|
+
SupplyCoins: sdk.NewCoins(app.BankKeeper.GetSupply(ctx, "uist")),
|
|
897
|
+
UpgradePlan: app.upgradePlan,
|
|
898
|
+
LienPort: app.lienPort,
|
|
899
|
+
StoragePort: app.vstoragePort,
|
|
900
|
+
SwingsetPort: app.swingsetPort,
|
|
901
|
+
VbankPort: app.vbankPort,
|
|
902
|
+
VibcPort: app.vibcPort,
|
|
896
903
|
}
|
|
897
904
|
// This really abuses `BlockingSend` to get back at `sendToController`
|
|
898
905
|
out, err := app.SwingSetKeeper.BlockingSend(ctx, action)
|
package/git-revision.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
fed2b5e
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/cosmos",
|
|
3
|
-
"version": "0.34.2-dev-
|
|
3
|
+
"version": "0.34.2-dev-fed2b5e.0+fed2b5e",
|
|
4
4
|
"description": "Connect JS to the Cosmos blockchain SDK",
|
|
5
5
|
"parsers": {
|
|
6
6
|
"js": "mjs"
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "fed2b5e4658fc5b55c794622aa1684a8093f1604"
|
|
39
39
|
}
|
|
@@ -13,4 +13,14 @@ message GenesisState {
|
|
|
13
13
|
Params params = 2 [(gogoproto.nullable) = false];
|
|
14
14
|
|
|
15
15
|
State state = 3 [(gogoproto.nullable) = false];
|
|
16
|
+
|
|
17
|
+
repeated SwingStoreExportDataEntry swing_store_export_data = 4 [
|
|
18
|
+
(gogoproto.jsontag) = "swingStoreExportData"
|
|
19
|
+
];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// A SwingStore "export data" entry.
|
|
23
|
+
message SwingStoreExportDataEntry {
|
|
24
|
+
string key = 1;
|
|
25
|
+
string value = 2;
|
|
16
26
|
}
|
|
@@ -5,6 +5,7 @@ import (
|
|
|
5
5
|
"fmt"
|
|
6
6
|
"io"
|
|
7
7
|
|
|
8
|
+
swingsettypes "github.com/Agoric/agoric-sdk/golang/cosmos/x/swingset/types"
|
|
8
9
|
vstoragetypes "github.com/Agoric/agoric-sdk/golang/cosmos/x/vstorage/types"
|
|
9
10
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
10
11
|
)
|
|
@@ -36,6 +37,8 @@ import (
|
|
|
36
37
|
// types are available:
|
|
37
38
|
// - NewVstorageDataEntriesReader constructs a reader from a slice of
|
|
38
39
|
// vstorage DataEntry values.
|
|
40
|
+
// - NewSwingStoreExportDataEntriesReader constructs a reader from a slice
|
|
41
|
+
// of SwingStoreExportDataEntry values.
|
|
39
42
|
// - NewJsonRawMessageKVEntriesReader constructs a reader from a slice of
|
|
40
43
|
// [key: string, value?: string | null] JSON array values.
|
|
41
44
|
// - NewJsonlKVEntryDecoderReader constructs a reader from an io.ReadCloser
|
|
@@ -154,6 +157,17 @@ func NewVstorageDataEntriesReader(vstorageDataEntries []*vstoragetypes.DataEntry
|
|
|
154
157
|
}
|
|
155
158
|
}
|
|
156
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
|
+
|
|
157
171
|
// NewJsonRawMessageKVEntriesReader creates a KVEntryReader backed by
|
|
158
172
|
// a json.RawMessage slice
|
|
159
173
|
func NewJsonRawMessageKVEntriesReader(jsonEntries []json.RawMessage) KVEntryReader {
|
package/x/swingset/genesis.go
CHANGED
|
@@ -8,10 +8,6 @@ import (
|
|
|
8
8
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
9
9
|
)
|
|
10
10
|
|
|
11
|
-
func NewGenesisState() *types.GenesisState {
|
|
12
|
-
return &types.GenesisState{}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
11
|
func ValidateGenesis(data *types.GenesisState) error {
|
|
16
12
|
if data == nil {
|
|
17
13
|
return fmt.Errorf("swingset genesis data cannot be nil")
|
|
@@ -24,7 +20,9 @@ func ValidateGenesis(data *types.GenesisState) error {
|
|
|
24
20
|
|
|
25
21
|
func DefaultGenesisState() *types.GenesisState {
|
|
26
22
|
return &types.GenesisState{
|
|
27
|
-
Params:
|
|
23
|
+
Params: types.DefaultParams(),
|
|
24
|
+
State: types.State{},
|
|
25
|
+
SwingStoreExportData: []*types.SwingStoreExportDataEntry{},
|
|
28
26
|
}
|
|
29
27
|
}
|
|
30
28
|
|
|
@@ -34,13 +32,37 @@ func InitGenesis(ctx sdk.Context, keeper Keeper, data *types.GenesisState) bool
|
|
|
34
32
|
keeper.SetParams(ctx, data.GetParams())
|
|
35
33
|
keeper.SetState(ctx, data.GetState())
|
|
36
34
|
|
|
35
|
+
swingStoreExportData := data.GetSwingStoreExportData()
|
|
36
|
+
if len(swingStoreExportData) > 0 {
|
|
37
|
+
// See https://github.com/Agoric/agoric-sdk/issues/6527
|
|
38
|
+
panic("genesis with swing-store state not implemented")
|
|
39
|
+
}
|
|
40
|
+
|
|
37
41
|
// TODO: bootstrap only if not restoring swing-store from genesis state
|
|
38
42
|
return true
|
|
39
43
|
}
|
|
40
44
|
|
|
41
45
|
func ExportGenesis(ctx sdk.Context, k Keeper) *types.GenesisState {
|
|
42
|
-
gs :=
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
gs := &types.GenesisState{
|
|
47
|
+
Params: k.GetParams(ctx),
|
|
48
|
+
State: k.GetState(ctx),
|
|
49
|
+
SwingStoreExportData: []*types.SwingStoreExportDataEntry{},
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Only export the swing-store shadow copy for now
|
|
53
|
+
// TODO:
|
|
54
|
+
// - perform state-sync export with check blockHeight (figure out how to
|
|
55
|
+
// handle export of historical height),
|
|
56
|
+
// - include swing-store artifacts in genesis state
|
|
57
|
+
// See https://github.com/Agoric/agoric-sdk/issues/6527
|
|
58
|
+
exportDataIterator := k.GetSwingStore(ctx).Iterator(nil, nil)
|
|
59
|
+
defer exportDataIterator.Close()
|
|
60
|
+
for ; exportDataIterator.Valid(); exportDataIterator.Next() {
|
|
61
|
+
entry := types.SwingStoreExportDataEntry{
|
|
62
|
+
Key: string(exportDataIterator.Key()),
|
|
63
|
+
Value: string(exportDataIterator.Value()),
|
|
64
|
+
}
|
|
65
|
+
gs.SwingStoreExportData = append(gs.SwingStoreExportData, &entry)
|
|
66
|
+
}
|
|
45
67
|
return gs
|
|
46
68
|
}
|
|
@@ -11,6 +11,7 @@ import (
|
|
|
11
11
|
|
|
12
12
|
"github.com/cosmos/cosmos-sdk/baseapp"
|
|
13
13
|
"github.com/cosmos/cosmos-sdk/codec"
|
|
14
|
+
"github.com/cosmos/cosmos-sdk/store/prefix"
|
|
14
15
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
15
16
|
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
|
|
16
17
|
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
|
|
@@ -20,7 +21,6 @@ import (
|
|
|
20
21
|
"github.com/Agoric/agoric-sdk/golang/cosmos/vm"
|
|
21
22
|
"github.com/Agoric/agoric-sdk/golang/cosmos/x/swingset/types"
|
|
22
23
|
vstoragekeeper "github.com/Agoric/agoric-sdk/golang/cosmos/x/vstorage/keeper"
|
|
23
|
-
vstoragetypes "github.com/Agoric/agoric-sdk/golang/cosmos/x/vstorage/types"
|
|
24
24
|
)
|
|
25
25
|
|
|
26
26
|
// Top-level paths for chain storage should remain synchronized with
|
|
@@ -37,7 +37,10 @@ const (
|
|
|
37
37
|
StoragePathSwingStore = "swingStore"
|
|
38
38
|
)
|
|
39
39
|
|
|
40
|
-
const
|
|
40
|
+
const (
|
|
41
|
+
stateKey = "state"
|
|
42
|
+
swingStoreKeyPrefix = "swingStore."
|
|
43
|
+
)
|
|
41
44
|
|
|
42
45
|
// Contextual information about the message source of an action on an inbound queue.
|
|
43
46
|
// This context should be unique per inboundQueueRecord.
|
|
@@ -435,8 +438,9 @@ func (k Keeper) SetMailbox(ctx sdk.Context, peer string, mailbox string) {
|
|
|
435
438
|
k.vstorageKeeper.LegacySetStorageAndNotify(ctx, agoric.NewKVEntry(path, mailbox))
|
|
436
439
|
}
|
|
437
440
|
|
|
438
|
-
func (k Keeper)
|
|
439
|
-
|
|
441
|
+
func (k Keeper) GetSwingStore(ctx sdk.Context) sdk.KVStore {
|
|
442
|
+
store := ctx.KVStore(k.storeKey)
|
|
443
|
+
return prefix.NewStore(store, []byte(swingStoreKeyPrefix))
|
|
440
444
|
}
|
|
441
445
|
|
|
442
446
|
func (k Keeper) PathToEncodedKey(path string) []byte {
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
package keeper
|
|
2
2
|
|
|
3
3
|
import (
|
|
4
|
+
"fmt"
|
|
5
|
+
"reflect"
|
|
4
6
|
"testing"
|
|
5
7
|
|
|
6
8
|
"github.com/Agoric/agoric-sdk/golang/cosmos/x/swingset/types"
|
|
9
|
+
"github.com/cosmos/cosmos-sdk/store"
|
|
10
|
+
prefixstore "github.com/cosmos/cosmos-sdk/store/prefix"
|
|
11
|
+
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
|
7
12
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
13
|
+
|
|
14
|
+
dbm "github.com/tendermint/tm-db"
|
|
8
15
|
)
|
|
9
16
|
|
|
10
17
|
func mkcoin(denom string) func(amt int64) sdk.Coin {
|
|
@@ -181,3 +188,73 @@ func Test_calculateFees(t *testing.T) {
|
|
|
181
188
|
})
|
|
182
189
|
}
|
|
183
190
|
}
|
|
191
|
+
|
|
192
|
+
var (
|
|
193
|
+
swingsetStoreKey = storetypes.NewKVStoreKey(types.StoreKey)
|
|
194
|
+
)
|
|
195
|
+
|
|
196
|
+
func makeTestStore() sdk.KVStore {
|
|
197
|
+
db := dbm.NewMemDB()
|
|
198
|
+
ms := store.NewCommitMultiStore(db)
|
|
199
|
+
ms.MountStoreWithDB(swingsetStoreKey, sdk.StoreTypeIAVL, db)
|
|
200
|
+
err := ms.LoadLatestVersion()
|
|
201
|
+
if err != nil {
|
|
202
|
+
panic(err)
|
|
203
|
+
}
|
|
204
|
+
kvStore := ms.GetKVStore(swingsetStoreKey)
|
|
205
|
+
prefixStore := prefixstore.NewStore(kvStore, []byte("swingStore."))
|
|
206
|
+
return prefixStore
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
func TestSwingStore(t *testing.T) {
|
|
210
|
+
store := makeTestStore()
|
|
211
|
+
|
|
212
|
+
// Test that we can store and retrieve a value.
|
|
213
|
+
store.Set([]byte("someKey"), []byte("someValue"))
|
|
214
|
+
if got := string(store.Get([]byte("someKey"))); got != "someValue" {
|
|
215
|
+
t.Errorf("got %q, want %q", got, "someValue")
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// Test that we can update and retrieve an updated value.
|
|
219
|
+
store.Set([]byte("someKey"), []byte("someNewValue"))
|
|
220
|
+
if got := string(store.Get([]byte("someKey"))); got != "someNewValue" {
|
|
221
|
+
t.Errorf("got %q, want %q", got, "someNewValue")
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// Test that we can store and retrieve empty values
|
|
225
|
+
store.Set([]byte("someEmptyKey"), []byte(""))
|
|
226
|
+
if got := store.Get([]byte("someEmptyKey")); got == nil || string(got) != "" {
|
|
227
|
+
t.Errorf("got %#v, want empty string", got)
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// Test that we can store and delete values.
|
|
231
|
+
store.Set([]byte("someOtherKey"), []byte("someOtherValue"))
|
|
232
|
+
store.Delete([]byte("someOtherKey"))
|
|
233
|
+
if store.Has([]byte("someOtherKey")) {
|
|
234
|
+
t.Errorf("has value, expected not")
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// Test that we can delete non existing keys (e.g. delete twice)
|
|
238
|
+
store.Delete([]byte("someMissingKey"))
|
|
239
|
+
|
|
240
|
+
// Check the iterated values
|
|
241
|
+
expectedEntries := [][2]string{
|
|
242
|
+
{"someEmptyKey", "[]byte{}"},
|
|
243
|
+
{"someKey", "[]byte{0x73, 0x6f, 0x6d, 0x65, 0x4e, 0x65, 0x77, 0x56, 0x61, 0x6c, 0x75, 0x65}"},
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
iter := store.Iterator(nil, nil)
|
|
247
|
+
gotEntries := [][2]string{}
|
|
248
|
+
for ; iter.Valid(); iter.Next() {
|
|
249
|
+
entry := [2]string{
|
|
250
|
+
string(iter.Key()),
|
|
251
|
+
fmt.Sprintf("%#v", iter.Value()),
|
|
252
|
+
}
|
|
253
|
+
gotEntries = append(gotEntries, entry)
|
|
254
|
+
}
|
|
255
|
+
iter.Close()
|
|
256
|
+
|
|
257
|
+
if !reflect.DeepEqual(gotEntries, expectedEntries) {
|
|
258
|
+
t.Errorf("got export %q, want %q", gotEntries, expectedEntries)
|
|
259
|
+
}
|
|
260
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
package swingset
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"encoding/json"
|
|
5
|
+
"fmt"
|
|
6
|
+
"io"
|
|
7
|
+
|
|
8
|
+
agoric "github.com/Agoric/agoric-sdk/golang/cosmos/types"
|
|
9
|
+
"github.com/Agoric/agoric-sdk/golang/cosmos/vm"
|
|
10
|
+
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
// portHandler implements vm.PortHandler
|
|
14
|
+
// for processing inbound messages from Swingset.
|
|
15
|
+
type portHandler struct {
|
|
16
|
+
keeper Keeper
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
type swingsetMessage struct {
|
|
20
|
+
Method string `json:"method"`
|
|
21
|
+
Args []json.RawMessage `json:"args"`
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const (
|
|
25
|
+
SwingStoreUpdateExportData = "swingStoreUpdateExportData"
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
// NewPortHandler returns a port handler for a swingset Keeper.
|
|
29
|
+
func NewPortHandler(k Keeper) vm.PortHandler {
|
|
30
|
+
return portHandler{keeper: k}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Receive implements the vm.PortHandler method.
|
|
34
|
+
// It receives and processes an inbound message, returning the
|
|
35
|
+
// JSON-serialized response or an error.
|
|
36
|
+
func (ph portHandler) Receive(ctx *vm.ControllerContext, str string) (string, error) {
|
|
37
|
+
var msg swingsetMessage
|
|
38
|
+
err := json.Unmarshal([]byte(str), &msg)
|
|
39
|
+
if err != nil {
|
|
40
|
+
return "", err
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
switch msg.Method {
|
|
44
|
+
case SwingStoreUpdateExportData:
|
|
45
|
+
return ph.handleSwingStoreUpdateExportData(ctx.Context, msg.Args)
|
|
46
|
+
|
|
47
|
+
default:
|
|
48
|
+
return "", fmt.Errorf("unrecognized swingset method %s", msg.Method)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
func (ph portHandler) handleSwingStoreUpdateExportData(ctx sdk.Context, entries []json.RawMessage) (ret string, err error) {
|
|
53
|
+
store := ph.keeper.GetSwingStore(ctx)
|
|
54
|
+
exportDataReader := agoric.NewJsonRawMessageKVEntriesReader(entries)
|
|
55
|
+
defer exportDataReader.Close()
|
|
56
|
+
for {
|
|
57
|
+
entry, err := exportDataReader.Read()
|
|
58
|
+
if err == io.EOF {
|
|
59
|
+
return "true", nil
|
|
60
|
+
} else if err != nil {
|
|
61
|
+
return ret, err
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
key := []byte(entry.Key())
|
|
65
|
+
if !entry.HasValue() {
|
|
66
|
+
store.Delete(key)
|
|
67
|
+
} else {
|
|
68
|
+
store.Set(key, []byte(entry.StringValue()))
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -25,8 +25,9 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
|
|
25
25
|
|
|
26
26
|
// The initial or exported state.
|
|
27
27
|
type GenesisState struct {
|
|
28
|
-
Params
|
|
29
|
-
State
|
|
28
|
+
Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"`
|
|
29
|
+
State State `protobuf:"bytes,3,opt,name=state,proto3" json:"state"`
|
|
30
|
+
SwingStoreExportData []*SwingStoreExportDataEntry `protobuf:"bytes,4,rep,name=swing_store_export_data,json=swingStoreExportData,proto3" json:"swingStoreExportData"`
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
func (m *GenesisState) Reset() { *m = GenesisState{} }
|
|
@@ -76,29 +77,96 @@ func (m *GenesisState) GetState() State {
|
|
|
76
77
|
return State{}
|
|
77
78
|
}
|
|
78
79
|
|
|
80
|
+
func (m *GenesisState) GetSwingStoreExportData() []*SwingStoreExportDataEntry {
|
|
81
|
+
if m != nil {
|
|
82
|
+
return m.SwingStoreExportData
|
|
83
|
+
}
|
|
84
|
+
return nil
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// A SwingStore "export data" entry.
|
|
88
|
+
type SwingStoreExportDataEntry struct {
|
|
89
|
+
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
|
|
90
|
+
Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
func (m *SwingStoreExportDataEntry) Reset() { *m = SwingStoreExportDataEntry{} }
|
|
94
|
+
func (m *SwingStoreExportDataEntry) String() string { return proto.CompactTextString(m) }
|
|
95
|
+
func (*SwingStoreExportDataEntry) ProtoMessage() {}
|
|
96
|
+
func (*SwingStoreExportDataEntry) Descriptor() ([]byte, []int) {
|
|
97
|
+
return fileDescriptor_49b057311de9d296, []int{1}
|
|
98
|
+
}
|
|
99
|
+
func (m *SwingStoreExportDataEntry) XXX_Unmarshal(b []byte) error {
|
|
100
|
+
return m.Unmarshal(b)
|
|
101
|
+
}
|
|
102
|
+
func (m *SwingStoreExportDataEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
103
|
+
if deterministic {
|
|
104
|
+
return xxx_messageInfo_SwingStoreExportDataEntry.Marshal(b, m, deterministic)
|
|
105
|
+
} else {
|
|
106
|
+
b = b[:cap(b)]
|
|
107
|
+
n, err := m.MarshalToSizedBuffer(b)
|
|
108
|
+
if err != nil {
|
|
109
|
+
return nil, err
|
|
110
|
+
}
|
|
111
|
+
return b[:n], nil
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
func (m *SwingStoreExportDataEntry) XXX_Merge(src proto.Message) {
|
|
115
|
+
xxx_messageInfo_SwingStoreExportDataEntry.Merge(m, src)
|
|
116
|
+
}
|
|
117
|
+
func (m *SwingStoreExportDataEntry) XXX_Size() int {
|
|
118
|
+
return m.Size()
|
|
119
|
+
}
|
|
120
|
+
func (m *SwingStoreExportDataEntry) XXX_DiscardUnknown() {
|
|
121
|
+
xxx_messageInfo_SwingStoreExportDataEntry.DiscardUnknown(m)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
var xxx_messageInfo_SwingStoreExportDataEntry proto.InternalMessageInfo
|
|
125
|
+
|
|
126
|
+
func (m *SwingStoreExportDataEntry) GetKey() string {
|
|
127
|
+
if m != nil {
|
|
128
|
+
return m.Key
|
|
129
|
+
}
|
|
130
|
+
return ""
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
func (m *SwingStoreExportDataEntry) GetValue() string {
|
|
134
|
+
if m != nil {
|
|
135
|
+
return m.Value
|
|
136
|
+
}
|
|
137
|
+
return ""
|
|
138
|
+
}
|
|
139
|
+
|
|
79
140
|
func init() {
|
|
80
141
|
proto.RegisterType((*GenesisState)(nil), "agoric.swingset.GenesisState")
|
|
142
|
+
proto.RegisterType((*SwingStoreExportDataEntry)(nil), "agoric.swingset.SwingStoreExportDataEntry")
|
|
81
143
|
}
|
|
82
144
|
|
|
83
145
|
func init() { proto.RegisterFile("agoric/swingset/genesis.proto", fileDescriptor_49b057311de9d296) }
|
|
84
146
|
|
|
85
147
|
var fileDescriptor_49b057311de9d296 = []byte{
|
|
86
|
-
//
|
|
87
|
-
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
148
|
+
// 334 bytes of a gzipped FileDescriptorProto
|
|
149
|
+
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0xcf, 0x4b, 0x02, 0x41,
|
|
150
|
+
0x1c, 0xc5, 0x77, 0xf2, 0x07, 0x38, 0x06, 0xc5, 0x22, 0xb9, 0x09, 0x8d, 0xe2, 0x49, 0x82, 0x76,
|
|
151
|
+
0xc0, 0xe8, 0x52, 0xa7, 0x2c, 0xe9, 0x1a, 0x2b, 0x5d, 0xba, 0xc8, 0xa8, 0xc3, 0xb4, 0xa8, 0x3b,
|
|
152
|
+
0xcb, 0x7c, 0xc7, 0x52, 0xfa, 0x27, 0xfa, 0x13, 0xfa, 0x73, 0x3c, 0x7a, 0xec, 0x24, 0xa1, 0x97,
|
|
153
|
+
0xe8, 0x6f, 0xe8, 0x10, 0x3b, 0xa3, 0x04, 0x6a, 0xb7, 0xb7, 0xfb, 0x79, 0xef, 0x0d, 0x33, 0x0f,
|
|
154
|
+
0x9f, 0x30, 0x21, 0x55, 0xd8, 0xa5, 0xf0, 0x12, 0x46, 0x02, 0xb8, 0xa6, 0x82, 0x47, 0x1c, 0x42,
|
|
155
|
+
0xf0, 0x63, 0x25, 0xb5, 0x74, 0x0f, 0x2c, 0xf6, 0xd7, 0xb8, 0x54, 0x10, 0x52, 0x48, 0xc3, 0x68,
|
|
156
|
+
0xa2, 0xac, 0xad, 0x44, 0x36, 0x5b, 0xd6, 0xc2, 0xf2, 0xea, 0x0f, 0xc2, 0xfb, 0x77, 0xb6, 0xb8,
|
|
157
|
+
0xa5, 0x99, 0xe6, 0xee, 0x05, 0xce, 0xc6, 0x4c, 0xb1, 0x21, 0x78, 0x7b, 0x15, 0x54, 0xcb, 0xd7,
|
|
158
|
+
0x8b, 0xfe, 0xc6, 0x41, 0xfe, 0xbd, 0xc1, 0x8d, 0xf4, 0x74, 0x5e, 0x76, 0x82, 0x95, 0xd9, 0xad,
|
|
159
|
+
0xe3, 0x0c, 0x24, 0x79, 0x2f, 0x65, 0x52, 0x47, 0x5b, 0x29, 0xd3, 0xbe, 0x0a, 0x59, 0xab, 0xfb,
|
|
160
|
+
0x8a, 0x8b, 0x06, 0xb7, 0x41, 0x4b, 0xc5, 0xdb, 0x7c, 0x1c, 0x4b, 0xa5, 0xdb, 0x3d, 0xa6, 0x99,
|
|
161
|
+
0x97, 0xae, 0xa4, 0x6a, 0xf9, 0xfa, 0xe9, 0x76, 0x4b, 0x22, 0x5a, 0x89, 0xbd, 0x69, 0xdc, 0xb7,
|
|
162
|
+
0x4c, 0xb3, 0x66, 0xa4, 0xd5, 0xa4, 0xe1, 0x7d, 0xcf, 0xcb, 0x05, 0xd8, 0x81, 0x83, 0x9d, 0x7f,
|
|
163
|
+
0x2f, 0xd3, 0x5f, 0xef, 0x65, 0xa7, 0x7a, 0x83, 0x8f, 0xff, 0xad, 0x74, 0x0f, 0x71, 0xaa, 0xcf,
|
|
164
|
+
0x27, 0x1e, 0xaa, 0xa0, 0x5a, 0x2e, 0x48, 0xa4, 0x5b, 0xc0, 0x99, 0x67, 0x36, 0x18, 0x71, 0xf3,
|
|
165
|
+
0x36, 0xb9, 0xc0, 0x7e, 0x34, 0x1e, 0xa6, 0x0b, 0x82, 0x66, 0x0b, 0x82, 0x3e, 0x17, 0x04, 0xbd,
|
|
166
|
+
0x2d, 0x89, 0x33, 0x5b, 0x12, 0xe7, 0x63, 0x49, 0x9c, 0xc7, 0x2b, 0x11, 0xea, 0xa7, 0x51, 0xc7,
|
|
167
|
+
0xef, 0xca, 0x21, 0xbd, 0xb6, 0x43, 0xd8, 0x1b, 0x9d, 0x41, 0xaf, 0x4f, 0x85, 0x1c, 0xb0, 0x48,
|
|
168
|
+
0xd0, 0xae, 0x84, 0xa1, 0x04, 0x3a, 0xfe, 0xdb, 0x48, 0x4f, 0x62, 0x0e, 0x9d, 0xac, 0x59, 0xe8,
|
|
169
|
+
0xfc, 0x37, 0x00, 0x00, 0xff, 0xff, 0x94, 0xe9, 0x22, 0x36, 0x09, 0x02, 0x00, 0x00,
|
|
102
170
|
}
|
|
103
171
|
|
|
104
172
|
func (m *GenesisState) Marshal() (dAtA []byte, err error) {
|
|
@@ -121,6 +189,20 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|
|
121
189
|
_ = i
|
|
122
190
|
var l int
|
|
123
191
|
_ = l
|
|
192
|
+
if len(m.SwingStoreExportData) > 0 {
|
|
193
|
+
for iNdEx := len(m.SwingStoreExportData) - 1; iNdEx >= 0; iNdEx-- {
|
|
194
|
+
{
|
|
195
|
+
size, err := m.SwingStoreExportData[iNdEx].MarshalToSizedBuffer(dAtA[:i])
|
|
196
|
+
if err != nil {
|
|
197
|
+
return 0, err
|
|
198
|
+
}
|
|
199
|
+
i -= size
|
|
200
|
+
i = encodeVarintGenesis(dAtA, i, uint64(size))
|
|
201
|
+
}
|
|
202
|
+
i--
|
|
203
|
+
dAtA[i] = 0x22
|
|
204
|
+
}
|
|
205
|
+
}
|
|
124
206
|
{
|
|
125
207
|
size, err := m.State.MarshalToSizedBuffer(dAtA[:i])
|
|
126
208
|
if err != nil {
|
|
@@ -144,6 +226,43 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|
|
144
226
|
return len(dAtA) - i, nil
|
|
145
227
|
}
|
|
146
228
|
|
|
229
|
+
func (m *SwingStoreExportDataEntry) Marshal() (dAtA []byte, err error) {
|
|
230
|
+
size := m.Size()
|
|
231
|
+
dAtA = make([]byte, size)
|
|
232
|
+
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
|
233
|
+
if err != nil {
|
|
234
|
+
return nil, err
|
|
235
|
+
}
|
|
236
|
+
return dAtA[:n], nil
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
func (m *SwingStoreExportDataEntry) MarshalTo(dAtA []byte) (int, error) {
|
|
240
|
+
size := m.Size()
|
|
241
|
+
return m.MarshalToSizedBuffer(dAtA[:size])
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
func (m *SwingStoreExportDataEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|
245
|
+
i := len(dAtA)
|
|
246
|
+
_ = i
|
|
247
|
+
var l int
|
|
248
|
+
_ = l
|
|
249
|
+
if len(m.Value) > 0 {
|
|
250
|
+
i -= len(m.Value)
|
|
251
|
+
copy(dAtA[i:], m.Value)
|
|
252
|
+
i = encodeVarintGenesis(dAtA, i, uint64(len(m.Value)))
|
|
253
|
+
i--
|
|
254
|
+
dAtA[i] = 0x12
|
|
255
|
+
}
|
|
256
|
+
if len(m.Key) > 0 {
|
|
257
|
+
i -= len(m.Key)
|
|
258
|
+
copy(dAtA[i:], m.Key)
|
|
259
|
+
i = encodeVarintGenesis(dAtA, i, uint64(len(m.Key)))
|
|
260
|
+
i--
|
|
261
|
+
dAtA[i] = 0xa
|
|
262
|
+
}
|
|
263
|
+
return len(dAtA) - i, nil
|
|
264
|
+
}
|
|
265
|
+
|
|
147
266
|
func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int {
|
|
148
267
|
offset -= sovGenesis(v)
|
|
149
268
|
base := offset
|
|
@@ -165,6 +284,29 @@ func (m *GenesisState) Size() (n int) {
|
|
|
165
284
|
n += 1 + l + sovGenesis(uint64(l))
|
|
166
285
|
l = m.State.Size()
|
|
167
286
|
n += 1 + l + sovGenesis(uint64(l))
|
|
287
|
+
if len(m.SwingStoreExportData) > 0 {
|
|
288
|
+
for _, e := range m.SwingStoreExportData {
|
|
289
|
+
l = e.Size()
|
|
290
|
+
n += 1 + l + sovGenesis(uint64(l))
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
return n
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
func (m *SwingStoreExportDataEntry) Size() (n int) {
|
|
297
|
+
if m == nil {
|
|
298
|
+
return 0
|
|
299
|
+
}
|
|
300
|
+
var l int
|
|
301
|
+
_ = l
|
|
302
|
+
l = len(m.Key)
|
|
303
|
+
if l > 0 {
|
|
304
|
+
n += 1 + l + sovGenesis(uint64(l))
|
|
305
|
+
}
|
|
306
|
+
l = len(m.Value)
|
|
307
|
+
if l > 0 {
|
|
308
|
+
n += 1 + l + sovGenesis(uint64(l))
|
|
309
|
+
}
|
|
168
310
|
return n
|
|
169
311
|
}
|
|
170
312
|
|
|
@@ -269,6 +411,154 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error {
|
|
|
269
411
|
return err
|
|
270
412
|
}
|
|
271
413
|
iNdEx = postIndex
|
|
414
|
+
case 4:
|
|
415
|
+
if wireType != 2 {
|
|
416
|
+
return fmt.Errorf("proto: wrong wireType = %d for field SwingStoreExportData", wireType)
|
|
417
|
+
}
|
|
418
|
+
var msglen int
|
|
419
|
+
for shift := uint(0); ; shift += 7 {
|
|
420
|
+
if shift >= 64 {
|
|
421
|
+
return ErrIntOverflowGenesis
|
|
422
|
+
}
|
|
423
|
+
if iNdEx >= l {
|
|
424
|
+
return io.ErrUnexpectedEOF
|
|
425
|
+
}
|
|
426
|
+
b := dAtA[iNdEx]
|
|
427
|
+
iNdEx++
|
|
428
|
+
msglen |= int(b&0x7F) << shift
|
|
429
|
+
if b < 0x80 {
|
|
430
|
+
break
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
if msglen < 0 {
|
|
434
|
+
return ErrInvalidLengthGenesis
|
|
435
|
+
}
|
|
436
|
+
postIndex := iNdEx + msglen
|
|
437
|
+
if postIndex < 0 {
|
|
438
|
+
return ErrInvalidLengthGenesis
|
|
439
|
+
}
|
|
440
|
+
if postIndex > l {
|
|
441
|
+
return io.ErrUnexpectedEOF
|
|
442
|
+
}
|
|
443
|
+
m.SwingStoreExportData = append(m.SwingStoreExportData, &SwingStoreExportDataEntry{})
|
|
444
|
+
if err := m.SwingStoreExportData[len(m.SwingStoreExportData)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
|
445
|
+
return err
|
|
446
|
+
}
|
|
447
|
+
iNdEx = postIndex
|
|
448
|
+
default:
|
|
449
|
+
iNdEx = preIndex
|
|
450
|
+
skippy, err := skipGenesis(dAtA[iNdEx:])
|
|
451
|
+
if err != nil {
|
|
452
|
+
return err
|
|
453
|
+
}
|
|
454
|
+
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
|
455
|
+
return ErrInvalidLengthGenesis
|
|
456
|
+
}
|
|
457
|
+
if (iNdEx + skippy) > l {
|
|
458
|
+
return io.ErrUnexpectedEOF
|
|
459
|
+
}
|
|
460
|
+
iNdEx += skippy
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
if iNdEx > l {
|
|
465
|
+
return io.ErrUnexpectedEOF
|
|
466
|
+
}
|
|
467
|
+
return nil
|
|
468
|
+
}
|
|
469
|
+
func (m *SwingStoreExportDataEntry) Unmarshal(dAtA []byte) error {
|
|
470
|
+
l := len(dAtA)
|
|
471
|
+
iNdEx := 0
|
|
472
|
+
for iNdEx < l {
|
|
473
|
+
preIndex := iNdEx
|
|
474
|
+
var wire uint64
|
|
475
|
+
for shift := uint(0); ; shift += 7 {
|
|
476
|
+
if shift >= 64 {
|
|
477
|
+
return ErrIntOverflowGenesis
|
|
478
|
+
}
|
|
479
|
+
if iNdEx >= l {
|
|
480
|
+
return io.ErrUnexpectedEOF
|
|
481
|
+
}
|
|
482
|
+
b := dAtA[iNdEx]
|
|
483
|
+
iNdEx++
|
|
484
|
+
wire |= uint64(b&0x7F) << shift
|
|
485
|
+
if b < 0x80 {
|
|
486
|
+
break
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
fieldNum := int32(wire >> 3)
|
|
490
|
+
wireType := int(wire & 0x7)
|
|
491
|
+
if wireType == 4 {
|
|
492
|
+
return fmt.Errorf("proto: SwingStoreExportDataEntry: wiretype end group for non-group")
|
|
493
|
+
}
|
|
494
|
+
if fieldNum <= 0 {
|
|
495
|
+
return fmt.Errorf("proto: SwingStoreExportDataEntry: illegal tag %d (wire type %d)", fieldNum, wire)
|
|
496
|
+
}
|
|
497
|
+
switch fieldNum {
|
|
498
|
+
case 1:
|
|
499
|
+
if wireType != 2 {
|
|
500
|
+
return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType)
|
|
501
|
+
}
|
|
502
|
+
var stringLen uint64
|
|
503
|
+
for shift := uint(0); ; shift += 7 {
|
|
504
|
+
if shift >= 64 {
|
|
505
|
+
return ErrIntOverflowGenesis
|
|
506
|
+
}
|
|
507
|
+
if iNdEx >= l {
|
|
508
|
+
return io.ErrUnexpectedEOF
|
|
509
|
+
}
|
|
510
|
+
b := dAtA[iNdEx]
|
|
511
|
+
iNdEx++
|
|
512
|
+
stringLen |= uint64(b&0x7F) << shift
|
|
513
|
+
if b < 0x80 {
|
|
514
|
+
break
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
intStringLen := int(stringLen)
|
|
518
|
+
if intStringLen < 0 {
|
|
519
|
+
return ErrInvalidLengthGenesis
|
|
520
|
+
}
|
|
521
|
+
postIndex := iNdEx + intStringLen
|
|
522
|
+
if postIndex < 0 {
|
|
523
|
+
return ErrInvalidLengthGenesis
|
|
524
|
+
}
|
|
525
|
+
if postIndex > l {
|
|
526
|
+
return io.ErrUnexpectedEOF
|
|
527
|
+
}
|
|
528
|
+
m.Key = string(dAtA[iNdEx:postIndex])
|
|
529
|
+
iNdEx = postIndex
|
|
530
|
+
case 2:
|
|
531
|
+
if wireType != 2 {
|
|
532
|
+
return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType)
|
|
533
|
+
}
|
|
534
|
+
var stringLen uint64
|
|
535
|
+
for shift := uint(0); ; shift += 7 {
|
|
536
|
+
if shift >= 64 {
|
|
537
|
+
return ErrIntOverflowGenesis
|
|
538
|
+
}
|
|
539
|
+
if iNdEx >= l {
|
|
540
|
+
return io.ErrUnexpectedEOF
|
|
541
|
+
}
|
|
542
|
+
b := dAtA[iNdEx]
|
|
543
|
+
iNdEx++
|
|
544
|
+
stringLen |= uint64(b&0x7F) << shift
|
|
545
|
+
if b < 0x80 {
|
|
546
|
+
break
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
intStringLen := int(stringLen)
|
|
550
|
+
if intStringLen < 0 {
|
|
551
|
+
return ErrInvalidLengthGenesis
|
|
552
|
+
}
|
|
553
|
+
postIndex := iNdEx + intStringLen
|
|
554
|
+
if postIndex < 0 {
|
|
555
|
+
return ErrInvalidLengthGenesis
|
|
556
|
+
}
|
|
557
|
+
if postIndex > l {
|
|
558
|
+
return io.ErrUnexpectedEOF
|
|
559
|
+
}
|
|
560
|
+
m.Value = string(dAtA[iNdEx:postIndex])
|
|
561
|
+
iNdEx = postIndex
|
|
272
562
|
default:
|
|
273
563
|
iNdEx = preIndex
|
|
274
564
|
skippy, err := skipGenesis(dAtA[iNdEx:])
|