@agoric/cosmos 0.34.2-dev-d941b39.0 → 0.34.2-dev-3aa5d66.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/git-revision.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
3aa5d66
|
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-3aa5d66.0+3aa5d66",
|
|
4
4
|
"description": "Connect JS to the Cosmos blockchain SDK",
|
|
5
5
|
"parsers": {
|
|
6
6
|
"js": "mjs"
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"typeCoverage": {
|
|
40
40
|
"atLeast": 0
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "3aa5d6635dd781372c3c43ae04512773bf4a84c0"
|
|
43
43
|
}
|
|
@@ -17,6 +17,10 @@ message GenesisState {
|
|
|
17
17
|
repeated SwingStoreExportDataEntry swing_store_export_data = 4 [
|
|
18
18
|
(gogoproto.jsontag) = "swingStoreExportData"
|
|
19
19
|
];
|
|
20
|
+
|
|
21
|
+
string swing_store_export_data_hash = 5 [
|
|
22
|
+
(gogoproto.jsontag) = "swingStoreExportDataHash"
|
|
23
|
+
];
|
|
20
24
|
}
|
|
21
25
|
|
|
22
26
|
// A SwingStore "export data" entry.
|
|
@@ -232,3 +232,45 @@ func EncodeKVEntryReaderToJsonl(reader KVEntryReader, bytesWriter io.Writer) (er
|
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
|
+
|
|
236
|
+
var _ KVEntryReader = &kvHookingReader{}
|
|
237
|
+
|
|
238
|
+
// kvHookingReader is a KVEntryReader backed by another KVEntryReader which
|
|
239
|
+
// provides callbacks for read and close
|
|
240
|
+
type kvHookingReader struct {
|
|
241
|
+
reader KVEntryReader
|
|
242
|
+
onRead func(entry KVEntry) error
|
|
243
|
+
onClose func() error
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// NewKVHookingReader returns a KVEntryReader backed by another KVEntryReader
|
|
247
|
+
func NewKVHookingReader(reader KVEntryReader, onRead func(entry KVEntry) error, onClose func() error) KVEntryReader {
|
|
248
|
+
return &kvHookingReader{
|
|
249
|
+
reader,
|
|
250
|
+
onRead,
|
|
251
|
+
onClose,
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// Read yields the next KVEntry from the source reader
|
|
256
|
+
// Implements KVEntryReader
|
|
257
|
+
func (hr kvHookingReader) Read() (next KVEntry, err error) {
|
|
258
|
+
next, err = hr.reader.Read()
|
|
259
|
+
|
|
260
|
+
if err == nil {
|
|
261
|
+
err = hr.onRead(next)
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
return next, err
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// Close releases the underlying source reader
|
|
268
|
+
// Implements KVEntryReader
|
|
269
|
+
func (hr kvHookingReader) Close() error {
|
|
270
|
+
err := hr.reader.Close()
|
|
271
|
+
if err == nil {
|
|
272
|
+
err = hr.onClose()
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
return err
|
|
276
|
+
}
|
package/x/swingset/genesis.go
CHANGED
|
@@ -2,7 +2,13 @@ package swingset
|
|
|
2
2
|
|
|
3
3
|
import (
|
|
4
4
|
// "os"
|
|
5
|
+
"bytes"
|
|
6
|
+
"crypto/sha256"
|
|
7
|
+
"encoding/hex"
|
|
8
|
+
"encoding/json"
|
|
5
9
|
"fmt"
|
|
10
|
+
"hash"
|
|
11
|
+
"strings"
|
|
6
12
|
|
|
7
13
|
agoric "github.com/Agoric/agoric-sdk/golang/cosmos/types"
|
|
8
14
|
"github.com/Agoric/agoric-sdk/golang/cosmos/x/swingset/keeper"
|
|
@@ -35,8 +41,10 @@ func InitGenesis(ctx sdk.Context, k Keeper, swingStoreExportsHandler *SwingStore
|
|
|
35
41
|
k.SetState(ctx, data.GetState())
|
|
36
42
|
|
|
37
43
|
swingStoreExportData := data.GetSwingStoreExportData()
|
|
38
|
-
if len(swingStoreExportData) == 0 {
|
|
44
|
+
if len(swingStoreExportData) == 0 && data.SwingStoreExportDataHash == "" {
|
|
39
45
|
return true
|
|
46
|
+
} else if data.SwingStoreExportDataHash != "" && len(swingStoreExportData) > 0 {
|
|
47
|
+
panic("Swingset genesis state cannot have both export data and hash of export data")
|
|
40
48
|
}
|
|
41
49
|
|
|
42
50
|
artifactProvider, err := keeper.OpenSwingStoreExportDirectory(swingStoreExportDir)
|
|
@@ -46,15 +54,62 @@ func InitGenesis(ctx sdk.Context, k Keeper, swingStoreExportsHandler *SwingStore
|
|
|
46
54
|
|
|
47
55
|
swingStore := k.GetSwingStore(ctx)
|
|
48
56
|
|
|
49
|
-
for _, entry := range swingStoreExportData {
|
|
50
|
-
swingStore.Set([]byte(entry.Key), []byte(entry.Value))
|
|
51
|
-
}
|
|
52
|
-
|
|
53
57
|
snapshotHeight := uint64(ctx.BlockHeight())
|
|
54
58
|
|
|
55
|
-
getExportDataReader
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
var getExportDataReader func() (agoric.KVEntryReader, error)
|
|
60
|
+
|
|
61
|
+
if len(swingStoreExportData) > 0 {
|
|
62
|
+
for _, entry := range swingStoreExportData {
|
|
63
|
+
swingStore.Set([]byte(entry.Key), []byte(entry.Value))
|
|
64
|
+
}
|
|
65
|
+
getExportDataReader = func() (agoric.KVEntryReader, error) {
|
|
66
|
+
exportDataIterator := swingStore.Iterator(nil, nil)
|
|
67
|
+
return agoric.NewKVIteratorReader(exportDataIterator), nil
|
|
68
|
+
}
|
|
69
|
+
} else {
|
|
70
|
+
hashParts := strings.SplitN(data.SwingStoreExportDataHash, ":", 2)
|
|
71
|
+
if len(hashParts) != 2 {
|
|
72
|
+
panic(fmt.Errorf("invalid swing-store export data hash %s", data.SwingStoreExportDataHash))
|
|
73
|
+
}
|
|
74
|
+
if hashParts[0] != "sha256" {
|
|
75
|
+
panic(fmt.Errorf("invalid swing-store export data hash algorithm %s, expected sha256", hashParts[0]))
|
|
76
|
+
}
|
|
77
|
+
sha256Hash, err := hex.DecodeString(hashParts[1])
|
|
78
|
+
if err != nil {
|
|
79
|
+
panic(err)
|
|
80
|
+
}
|
|
81
|
+
getExportDataReader = func() (agoric.KVEntryReader, error) {
|
|
82
|
+
kvReader, err := artifactProvider.GetExportDataReader()
|
|
83
|
+
if err != nil {
|
|
84
|
+
return nil, err
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if kvReader == nil {
|
|
88
|
+
return nil, fmt.Errorf("swing-store export has no export data")
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
hasher := sha256.New()
|
|
92
|
+
encoder := json.NewEncoder(hasher)
|
|
93
|
+
encoder.SetEscapeHTML(false)
|
|
94
|
+
|
|
95
|
+
return agoric.NewKVHookingReader(kvReader, func(entry agoric.KVEntry) error {
|
|
96
|
+
key := []byte(entry.Key())
|
|
97
|
+
|
|
98
|
+
if !entry.HasValue() {
|
|
99
|
+
swingStore.Delete(key)
|
|
100
|
+
} else {
|
|
101
|
+
swingStore.Set(key, []byte(entry.StringValue()))
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return encoder.Encode(entry)
|
|
105
|
+
}, func() error {
|
|
106
|
+
sum := hasher.Sum(nil)
|
|
107
|
+
if !bytes.Equal(sum, sha256Hash) {
|
|
108
|
+
return fmt.Errorf("swing-store data sha256sum didn't match. expected %x, got %x", sha256Hash, sum)
|
|
109
|
+
}
|
|
110
|
+
return nil
|
|
111
|
+
}), nil
|
|
112
|
+
}
|
|
58
113
|
}
|
|
59
114
|
|
|
60
115
|
err = swingStoreExportsHandler.RestoreExport(
|
|
@@ -79,25 +134,17 @@ func ExportGenesis(ctx sdk.Context, k Keeper, swingStoreExportsHandler *SwingSto
|
|
|
79
134
|
gs := &types.GenesisState{
|
|
80
135
|
Params: k.GetParams(ctx),
|
|
81
136
|
State: k.GetState(ctx),
|
|
82
|
-
SwingStoreExportData:
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
exportDataIterator := k.GetSwingStore(ctx).Iterator(nil, nil)
|
|
86
|
-
defer exportDataIterator.Close()
|
|
87
|
-
for ; exportDataIterator.Valid(); exportDataIterator.Next() {
|
|
88
|
-
entry := types.SwingStoreExportDataEntry{
|
|
89
|
-
Key: string(exportDataIterator.Key()),
|
|
90
|
-
Value: string(exportDataIterator.Value()),
|
|
91
|
-
}
|
|
92
|
-
gs.SwingStoreExportData = append(gs.SwingStoreExportData, &entry)
|
|
137
|
+
SwingStoreExportData: nil,
|
|
93
138
|
}
|
|
94
139
|
|
|
95
140
|
snapshotHeight := uint64(ctx.BlockHeight())
|
|
96
141
|
|
|
142
|
+
eventHandler := swingStoreGenesisEventHandler{exportDir: swingStoreExportDir, snapshotHeight: snapshotHeight, swingStore: k.GetSwingStore(ctx), hasher: sha256.New()}
|
|
143
|
+
|
|
97
144
|
err := swingStoreExportsHandler.InitiateExport(
|
|
98
145
|
// The export will fail if the export of a historical height was requested
|
|
99
146
|
snapshotHeight,
|
|
100
|
-
|
|
147
|
+
eventHandler,
|
|
101
148
|
keeper.SwingStoreExportOptions{
|
|
102
149
|
ArtifactMode: keeper.SwingStoreArtifactModeOperational,
|
|
103
150
|
ExportDataMode: keeper.SwingStoreExportDataModeSkip,
|
|
@@ -112,12 +159,16 @@ func ExportGenesis(ctx sdk.Context, k Keeper, swingStoreExportsHandler *SwingSto
|
|
|
112
159
|
panic(err)
|
|
113
160
|
}
|
|
114
161
|
|
|
162
|
+
gs.SwingStoreExportDataHash = fmt.Sprintf("sha256:%x", eventHandler.hasher.Sum(nil))
|
|
163
|
+
|
|
115
164
|
return gs
|
|
116
165
|
}
|
|
117
166
|
|
|
118
167
|
type swingStoreGenesisEventHandler struct {
|
|
119
168
|
exportDir string
|
|
120
169
|
snapshotHeight uint64
|
|
170
|
+
swingStore sdk.KVStore
|
|
171
|
+
hasher hash.Hash
|
|
121
172
|
}
|
|
122
173
|
|
|
123
174
|
func (eventHandler swingStoreGenesisEventHandler) OnExportStarted(height uint64, retrieveSwingStoreExport func() error) error {
|
|
@@ -131,7 +182,17 @@ func (eventHandler swingStoreGenesisEventHandler) OnExportRetrieved(provider kee
|
|
|
131
182
|
|
|
132
183
|
artifactsProvider := keeper.SwingStoreExportProvider{
|
|
133
184
|
GetExportDataReader: func() (agoric.KVEntryReader, error) {
|
|
134
|
-
|
|
185
|
+
exportDataIterator := eventHandler.swingStore.Iterator(nil, nil)
|
|
186
|
+
kvReader := agoric.NewKVIteratorReader(exportDataIterator)
|
|
187
|
+
eventHandler.hasher.Reset()
|
|
188
|
+
encoder := json.NewEncoder(eventHandler.hasher)
|
|
189
|
+
encoder.SetEscapeHTML(false)
|
|
190
|
+
|
|
191
|
+
return agoric.NewKVHookingReader(kvReader, func(entry agoric.KVEntry) error {
|
|
192
|
+
return encoder.Encode(entry)
|
|
193
|
+
}, func() error {
|
|
194
|
+
return nil
|
|
195
|
+
}), nil
|
|
135
196
|
},
|
|
136
197
|
ReadNextArtifact: provider.ReadNextArtifact,
|
|
137
198
|
}
|
|
@@ -787,7 +787,18 @@ func (exportsHandler SwingStoreExportsHandler) RestoreExport(provider SwingStore
|
|
|
787
787
|
// a jsonl-like file, before saving the export manifest linking these together.
|
|
788
788
|
// The export manifest filename and overall export format is common with the JS
|
|
789
789
|
// swing-store import/export logic.
|
|
790
|
-
func WriteSwingStoreExportToDirectory(provider SwingStoreExportProvider, exportDir string) error {
|
|
790
|
+
func WriteSwingStoreExportToDirectory(provider SwingStoreExportProvider, exportDir string) (err error) {
|
|
791
|
+
handleDeferError := func(fn func() error) {
|
|
792
|
+
deferError := fn()
|
|
793
|
+
if err == nil {
|
|
794
|
+
err = deferError
|
|
795
|
+
} else if deferError != nil {
|
|
796
|
+
// Safe to wrap error and use detailed error info since this error
|
|
797
|
+
// will not go back into swingset layers
|
|
798
|
+
err = sdkioerrors.Wrapf(err, "deferred error %+v", deferError)
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
|
|
791
802
|
manifest := exportManifest{
|
|
792
803
|
BlockHeight: provider.BlockHeight,
|
|
793
804
|
}
|
|
@@ -798,14 +809,14 @@ func WriteSwingStoreExportToDirectory(provider SwingStoreExportProvider, exportD
|
|
|
798
809
|
}
|
|
799
810
|
|
|
800
811
|
if exportDataReader != nil {
|
|
801
|
-
defer exportDataReader.Close
|
|
812
|
+
defer handleDeferError(exportDataReader.Close)
|
|
802
813
|
|
|
803
814
|
manifest.Data = exportDataFilename
|
|
804
815
|
exportDataFile, err := os.OpenFile(filepath.Join(exportDir, exportDataFilename), os.O_CREATE|os.O_WRONLY, exportedFilesMode)
|
|
805
816
|
if err != nil {
|
|
806
817
|
return err
|
|
807
818
|
}
|
|
808
|
-
defer exportDataFile.Close
|
|
819
|
+
defer handleDeferError(exportDataFile.Close)
|
|
809
820
|
|
|
810
821
|
err = agoric.EncodeKVEntryReaderToJsonl(exportDataReader, exportDataFile)
|
|
811
822
|
if err != nil {
|
|
@@ -25,9 +25,10 @@ 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
|
|
30
|
-
SwingStoreExportData
|
|
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"`
|
|
31
|
+
SwingStoreExportDataHash string `protobuf:"bytes,5,opt,name=swing_store_export_data_hash,json=swingStoreExportDataHash,proto3" json:"swingStoreExportDataHash"`
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
func (m *GenesisState) Reset() { *m = GenesisState{} }
|
|
@@ -84,6 +85,13 @@ func (m *GenesisState) GetSwingStoreExportData() []*SwingStoreExportDataEntry {
|
|
|
84
85
|
return nil
|
|
85
86
|
}
|
|
86
87
|
|
|
88
|
+
func (m *GenesisState) GetSwingStoreExportDataHash() string {
|
|
89
|
+
if m != nil {
|
|
90
|
+
return m.SwingStoreExportDataHash
|
|
91
|
+
}
|
|
92
|
+
return ""
|
|
93
|
+
}
|
|
94
|
+
|
|
87
95
|
// A SwingStore "export data" entry.
|
|
88
96
|
type SwingStoreExportDataEntry struct {
|
|
89
97
|
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
|
|
@@ -145,28 +153,30 @@ func init() {
|
|
|
145
153
|
func init() { proto.RegisterFile("agoric/swingset/genesis.proto", fileDescriptor_49b057311de9d296) }
|
|
146
154
|
|
|
147
155
|
var fileDescriptor_49b057311de9d296 = []byte{
|
|
148
|
-
//
|
|
149
|
-
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74,
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
156
|
+
// 363 bytes of a gzipped FileDescriptorProto
|
|
157
|
+
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0xcd, 0x4a, 0xc3, 0x40,
|
|
158
|
+
0x14, 0x85, 0x93, 0xfe, 0x41, 0xa7, 0x82, 0x12, 0x8a, 0x8d, 0xa5, 0x26, 0xa5, 0xab, 0x22, 0x98,
|
|
159
|
+
0x40, 0xc5, 0x8d, 0xae, 0x8c, 0x16, 0x5d, 0x4a, 0x8a, 0x1b, 0x11, 0xc2, 0xb4, 0x1d, 0x26, 0xa1,
|
|
160
|
+
0x6d, 0x26, 0xe4, 0x4e, 0xb5, 0xc5, 0x97, 0xf0, 0x11, 0x7c, 0x9c, 0x2e, 0xbb, 0x14, 0x17, 0x45,
|
|
161
|
+
0xda, 0x8d, 0xf4, 0x29, 0x24, 0x33, 0x2d, 0x42, 0x7f, 0x76, 0x27, 0xf9, 0xce, 0x39, 0x37, 0xdc,
|
|
162
|
+
0x1b, 0x74, 0x8a, 0x29, 0x8b, 0x83, 0x8e, 0x0d, 0x6f, 0x41, 0x48, 0x81, 0x70, 0x9b, 0x92, 0x90,
|
|
163
|
+
0x40, 0x00, 0x56, 0x14, 0x33, 0xce, 0xb4, 0x43, 0x89, 0xad, 0x35, 0x2e, 0x17, 0x29, 0xa3, 0x4c,
|
|
164
|
+
0x30, 0x3b, 0x51, 0xd2, 0x56, 0x36, 0x36, 0x5b, 0xd6, 0x42, 0xf2, 0xda, 0x77, 0x0a, 0x1d, 0xdc,
|
|
165
|
+
0xcb, 0xe2, 0x16, 0xc7, 0x9c, 0x68, 0x97, 0x28, 0x17, 0xe1, 0x18, 0x0f, 0x40, 0x4f, 0x55, 0xd5,
|
|
166
|
+
0x7a, 0xa1, 0x51, 0xb2, 0x36, 0x06, 0x59, 0x8f, 0x02, 0x3b, 0x99, 0xc9, 0xcc, 0x54, 0xdc, 0x95,
|
|
167
|
+
0x59, 0x6b, 0xa0, 0x2c, 0x24, 0x79, 0x3d, 0x2d, 0x52, 0xc7, 0x5b, 0x29, 0xd1, 0xbe, 0x0a, 0x49,
|
|
168
|
+
0xab, 0xf6, 0x8e, 0x4a, 0x02, 0x7b, 0xc0, 0x59, 0x4c, 0x3c, 0x32, 0x8a, 0x58, 0xcc, 0xbd, 0x2e,
|
|
169
|
+
0xe6, 0x58, 0xcf, 0x54, 0xd3, 0xf5, 0x42, 0xe3, 0x6c, 0xbb, 0x25, 0x11, 0xad, 0xc4, 0xde, 0x14,
|
|
170
|
+
0xee, 0x3b, 0xcc, 0x71, 0x33, 0xe4, 0xf1, 0xd8, 0xd1, 0x97, 0x33, 0xb3, 0x08, 0x3b, 0xb0, 0xbb,
|
|
171
|
+
0xf3, 0xad, 0xf6, 0x82, 0x2a, 0x7b, 0x86, 0x7b, 0x3e, 0x06, 0x5f, 0xcf, 0x56, 0xd5, 0x7a, 0xde,
|
|
172
|
+
0xa9, 0x2c, 0x67, 0xa6, 0xbe, 0x2b, 0xff, 0x80, 0xc1, 0x77, 0xf7, 0x92, 0xab, 0xcc, 0xef, 0xa7,
|
|
173
|
+
0xa9, 0xd4, 0x6e, 0xd1, 0xc9, 0xde, 0x0f, 0xd6, 0x8e, 0x50, 0xba, 0x47, 0xc6, 0xba, 0x9a, 0xcc,
|
|
174
|
+
0x71, 0x13, 0xa9, 0x15, 0x51, 0xf6, 0x15, 0xf7, 0x87, 0x44, 0x6c, 0x3e, 0xef, 0xca, 0x07, 0xe7,
|
|
175
|
+
0x69, 0x32, 0x37, 0xd4, 0xe9, 0xdc, 0x50, 0x7f, 0xe6, 0x86, 0xfa, 0xb1, 0x30, 0x94, 0xe9, 0xc2,
|
|
176
|
+
0x50, 0xbe, 0x16, 0x86, 0xf2, 0x7c, 0x4d, 0x03, 0xee, 0x0f, 0xdb, 0x56, 0x87, 0x0d, 0xec, 0x1b,
|
|
177
|
+
0x79, 0x66, 0xb9, 0xaf, 0x73, 0xe8, 0xf6, 0x6c, 0xca, 0xfa, 0x38, 0xa4, 0x76, 0x87, 0xc1, 0x80,
|
|
178
|
+
0x81, 0x3d, 0xfa, 0xff, 0x03, 0xf8, 0x38, 0x22, 0xd0, 0xce, 0x89, 0xfb, 0x5f, 0xfc, 0x05, 0x00,
|
|
179
|
+
0x00, 0xff, 0xff, 0x1b, 0x95, 0x41, 0xea, 0x67, 0x02, 0x00, 0x00,
|
|
170
180
|
}
|
|
171
181
|
|
|
172
182
|
func (m *GenesisState) Marshal() (dAtA []byte, err error) {
|
|
@@ -189,6 +199,13 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|
|
189
199
|
_ = i
|
|
190
200
|
var l int
|
|
191
201
|
_ = l
|
|
202
|
+
if len(m.SwingStoreExportDataHash) > 0 {
|
|
203
|
+
i -= len(m.SwingStoreExportDataHash)
|
|
204
|
+
copy(dAtA[i:], m.SwingStoreExportDataHash)
|
|
205
|
+
i = encodeVarintGenesis(dAtA, i, uint64(len(m.SwingStoreExportDataHash)))
|
|
206
|
+
i--
|
|
207
|
+
dAtA[i] = 0x2a
|
|
208
|
+
}
|
|
192
209
|
if len(m.SwingStoreExportData) > 0 {
|
|
193
210
|
for iNdEx := len(m.SwingStoreExportData) - 1; iNdEx >= 0; iNdEx-- {
|
|
194
211
|
{
|
|
@@ -290,6 +307,10 @@ func (m *GenesisState) Size() (n int) {
|
|
|
290
307
|
n += 1 + l + sovGenesis(uint64(l))
|
|
291
308
|
}
|
|
292
309
|
}
|
|
310
|
+
l = len(m.SwingStoreExportDataHash)
|
|
311
|
+
if l > 0 {
|
|
312
|
+
n += 1 + l + sovGenesis(uint64(l))
|
|
313
|
+
}
|
|
293
314
|
return n
|
|
294
315
|
}
|
|
295
316
|
|
|
@@ -445,6 +466,38 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error {
|
|
|
445
466
|
return err
|
|
446
467
|
}
|
|
447
468
|
iNdEx = postIndex
|
|
469
|
+
case 5:
|
|
470
|
+
if wireType != 2 {
|
|
471
|
+
return fmt.Errorf("proto: wrong wireType = %d for field SwingStoreExportDataHash", wireType)
|
|
472
|
+
}
|
|
473
|
+
var stringLen uint64
|
|
474
|
+
for shift := uint(0); ; shift += 7 {
|
|
475
|
+
if shift >= 64 {
|
|
476
|
+
return ErrIntOverflowGenesis
|
|
477
|
+
}
|
|
478
|
+
if iNdEx >= l {
|
|
479
|
+
return io.ErrUnexpectedEOF
|
|
480
|
+
}
|
|
481
|
+
b := dAtA[iNdEx]
|
|
482
|
+
iNdEx++
|
|
483
|
+
stringLen |= uint64(b&0x7F) << shift
|
|
484
|
+
if b < 0x80 {
|
|
485
|
+
break
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
intStringLen := int(stringLen)
|
|
489
|
+
if intStringLen < 0 {
|
|
490
|
+
return ErrInvalidLengthGenesis
|
|
491
|
+
}
|
|
492
|
+
postIndex := iNdEx + intStringLen
|
|
493
|
+
if postIndex < 0 {
|
|
494
|
+
return ErrInvalidLengthGenesis
|
|
495
|
+
}
|
|
496
|
+
if postIndex > l {
|
|
497
|
+
return io.ErrUnexpectedEOF
|
|
498
|
+
}
|
|
499
|
+
m.SwingStoreExportDataHash = string(dAtA[iNdEx:postIndex])
|
|
500
|
+
iNdEx = postIndex
|
|
448
501
|
default:
|
|
449
502
|
iNdEx = preIndex
|
|
450
503
|
skippy, err := skipGenesis(dAtA[iNdEx:])
|