-
Notifications
You must be signed in to change notification settings - Fork 122
/
state.go
654 lines (543 loc) · 19.1 KB
/
state.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
package v4
import (
"bufio"
"fmt"
"log"
"os/exec"
"regexp"
"strconv"
"time"
gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
e2e "github.com/cosmos/interchain-security/v5/tests/e2e/testlib"
"gopkg.in/yaml.v2"
"github.com/kylelemons/godebug/pretty"
"github.com/tidwall/gjson"
)
type (
ChainID = e2e.ChainID
ValidatorID = e2e.ValidatorID
ChainState = e2e.ChainState
Proposal = e2e.Proposal
Rewards = e2e.Rewards
TextProposal = e2e.TextProposal
UpgradeProposal = e2e.UpgradeProposal
ConsumerAdditionProposal = e2e.ConsumerAdditionProposal
ConsumerRemovalProposal = e2e.ConsumerRemovalProposal
IBCTransferParams = e2e.IBCTransferParams
IBCTransferParamsProposal = e2e.IBCTransferParamsProposal
Param = e2e.Param
ParamsProposal = e2e.ParamsProposal
ValidatorConfig = e2e.ValidatorConfig
ChainConfig = e2e.ChainConfig
ContainerConfig = e2e.ContainerConfig
TargetDriver = e2e.TargetDriver
)
type State map[ChainID]ChainState
type Commands struct {
ContainerConfig ContainerConfig // FIXME only needed for 'Now' time tracking
ValidatorConfigs map[ValidatorID]ValidatorConfig
ChainConfigs map[ChainID]ChainConfig
Target e2e.PlatformDriver
}
func (tr Commands) ExecCommand(name string, arg ...string) *exec.Cmd {
return tr.Target.ExecCommand(name, arg...)
}
func (tr Commands) ExecDetachedCommand(name string, args ...string) *exec.Cmd {
return tr.Target.ExecDetachedCommand(name, args...)
}
func (tr Commands) GetTestScriptPath(isConsumer bool, script string) string {
return tr.Target.GetTestScriptPath(isConsumer, script)
}
func (tr Commands) GetBlockHeight(chain ChainID) uint {
binaryName := tr.ChainConfigs[chain].BinaryName
bz, err := tr.Target.ExecCommand(binaryName,
"query", "tendermint-validator-set",
`--node`, tr.GetQueryNode(chain),
).CombinedOutput()
if err != nil {
log.Fatal(err, "\n", string(bz))
}
blockHeightRegex := regexp.MustCompile(`block_height: "(\d+)"`)
blockHeight, err := strconv.Atoi(blockHeightRegex.FindStringSubmatch(string(bz))[1])
if err != nil {
log.Fatal(err)
}
return uint(blockHeight)
}
func (tr Commands) waitUntilBlock(chain ChainID, block uint, timeout time.Duration) {
start := time.Now()
for {
thisBlock := tr.GetBlockHeight(chain)
if thisBlock >= block {
return
}
if time.Since(start) > timeout {
panic(fmt.Sprintf("\n\n\nwaitBlocks method has timed out after: %s\n\n", timeout))
}
time.Sleep(500 * time.Millisecond)
}
}
type ValPubKey struct {
Value string `yaml:"value"`
}
type TmValidatorSetYaml struct {
Total string `yaml:"total"`
Validators []struct {
Address string `yaml:"address"`
VotingPower string `yaml:"voting_power"`
PubKey ValPubKey `yaml:"pub_key"`
}
}
func (tr Commands) GetValPower(chain ChainID, validator ValidatorID) uint {
/* if *verbose {
log.Println("getting validator power for chain: ", chain, " validator: ", validator)
}
*/
binaryName := tr.ChainConfigs[chain].BinaryName
command := tr.Target.ExecCommand(binaryName,
"query", "tendermint-validator-set",
`--node`, tr.GetQueryNode(chain),
)
bz, err := command.CombinedOutput()
if err != nil {
log.Fatalf("encountered an error when executing command '%s': %v, output: %s", command.String(), err, string(bz))
}
valset := TmValidatorSetYaml{}
err = yaml.Unmarshal(bz, &valset)
if err != nil {
log.Fatalf("yaml.Unmarshal returned an error while unmarshalling validator set: %v, input: %s", err, string(bz))
}
total, err := strconv.Atoi(valset.Total)
if err != nil {
log.Fatalf("v4: strconv.Atoi returned an error while converting total for validator set: %v, input: %s, validator set: %s, src: %s",
err, valset.Total, pretty.Sprint(valset), string(bz))
}
if total != len(valset.Validators) {
log.Fatalf("Total number of validators %v does not match number of validators in list %v. Probably a query pagination issue. Validator set: %v",
valset.Total, uint(len(valset.Validators)), pretty.Sprint(valset))
}
for _, val := range valset.Validators {
if chain == ChainID("provi") {
// use binary with Bech32Prefix set to ProviderAccountPrefix
if val.Address != tr.ValidatorConfigs[validator].ValconsAddress {
continue
}
} else {
// use binary with Bech32Prefix set to ConsumerAccountPrefix
if val.Address != tr.ValidatorConfigs[validator].ValconsAddressOnConsumer &&
val.Address != tr.ValidatorConfigs[validator].ConsumerValconsAddress {
continue
}
}
votingPower, err := strconv.Atoi(val.VotingPower)
if err != nil {
log.Fatalf("strconv.Atoi returned an error while converting validator voting power: %v, voting power string: %s, validator set: %s", err, val.VotingPower, pretty.Sprint(valset))
}
return uint(votingPower)
}
// Validator not in set, its validator power is zero.
return 0
}
func (tr Commands) GetReward(chain ChainID, validator ValidatorID, blockHeight uint, isNativeDenom bool) float64 {
valCfg := tr.ValidatorConfigs[validator]
delAddresss := valCfg.DelAddress
if chain != ChainID("provi") {
// use binary with Bech32Prefix set to ConsumerAccountPrefix
if valCfg.UseConsumerKey {
delAddresss = valCfg.ConsumerDelAddress
} else {
// use the same address as on the provider but with different prefix
delAddresss = valCfg.DelAddressOnConsumer
}
}
binaryName := tr.ChainConfigs[chain].BinaryName
bz, err := tr.Target.ExecCommand(binaryName,
"query", "distribution", "rewards",
delAddresss,
`--height`, fmt.Sprint(blockHeight),
`--node`, tr.GetQueryNode(chain),
`-o`, `json`,
).CombinedOutput()
if err != nil {
log.Fatal(err, "\n", string(bz))
}
denomCondition := `total.#(denom!="stake").amount`
if isNativeDenom {
denomCondition = `total.#(denom=="stake").amount`
}
return gjson.Get(string(bz), denomCondition).Float()
}
func (tr Commands) GetBalance(chain ChainID, validator ValidatorID) uint {
valCfg := tr.ValidatorConfigs[validator]
valDelAddress := valCfg.DelAddress
if chain != ChainID("provi") {
// use binary with Bech32Prefix set to ConsumerAccountPrefix
if valCfg.UseConsumerKey {
valDelAddress = valCfg.ConsumerDelAddress
} else {
// use the same address as on the provider but with different prefix
valDelAddress = valCfg.DelAddressOnConsumer
}
}
binaryName := tr.ChainConfigs[chain].BinaryName
cmd := tr.Target.ExecCommand(binaryName,
"query", "bank", "balances",
valDelAddress,
`--node`, tr.GetQueryNode(chain),
`-o`, `json`,
)
bz, err := cmd.CombinedOutput()
if err != nil {
log.Fatal("getBalance() failed: ", cmd, ": ", err, "\n", string(bz))
}
amount := gjson.Get(string(bz), `balances.#(denom=="stake").amount`)
return uint(amount.Uint())
}
// interchain-securityd query gov proposals
func (tr Commands) GetProposal(chain ChainID, proposal uint) Proposal {
var noProposalRegex = regexp.MustCompile(`doesn't exist: key not found`)
binaryName := tr.ChainConfigs[chain].BinaryName
bz, err := tr.Target.ExecCommand(binaryName,
"query", "gov", "proposal",
fmt.Sprint(proposal),
`--node`, tr.GetQueryNode(chain),
`-o`, `json`,
).CombinedOutput()
prop := TextProposal{}
if err != nil {
if noProposalRegex.Match(bz) {
return prop
}
log.Fatal(err, "\n", string(bz))
}
propType := gjson.Get(string(bz), `messages.0.content.@type`).String()
deposit := gjson.Get(string(bz), `total_deposit.#(denom=="stake").amount`).Uint()
status := gjson.Get(string(bz), `status`).String()
// This is a breaking change in the query output for proposals: bug in SDK??
proposal_value, exists := gov.ProposalStatus_value[status]
if !exists {
panic("invalid proposal status value: " + status)
}
status = strconv.Itoa(int(proposal_value))
chainConfigs := tr.ChainConfigs
containerConfig := tr.ContainerConfig
switch propType {
case "/cosmos.gov.v1beta1.TextProposal":
title := gjson.Get(string(bz), `content.title`).String()
description := gjson.Get(string(bz), `content.description`).String()
return TextProposal{
Deposit: uint(deposit),
Status: status,
Title: title,
Description: description,
}
case "/interchain_security.ccv.provider.v1.ConsumerAdditionProposal":
chainId := gjson.Get(string(bz), `messages.0.content.chain_id`).String()
spawnTime := gjson.Get(string(bz), `messages.0.content.spawn_time`).Time().Sub(containerConfig.Now)
var chain ChainID
for i, conf := range chainConfigs {
if string(conf.ChainId) == chainId {
chain = i
break
}
}
return ConsumerAdditionProposal{
Deposit: uint(deposit),
Status: status,
Chain: chain,
SpawnTime: int(spawnTime.Milliseconds()),
InitialHeight: clienttypes.Height{
RevisionNumber: gjson.Get(string(bz), `messages.0.content.initial_height.revision_number`).Uint(),
RevisionHeight: gjson.Get(string(bz), `messages.0.content.initial_height.revision_height`).Uint(),
},
}
case "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal":
height := gjson.Get(string(bz), `messages.0.content.plan.height`).Uint()
title := gjson.Get(string(bz), `messages.0.content.plan.name`).String()
return UpgradeProposal{
Deposit: uint(deposit),
Status: status,
UpgradeHeight: height,
Title: title,
Type: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal",
}
case "/interchain_security.ccv.provider.v1.ConsumerRemovalProposal":
chainId := gjson.Get(string(bz), `messages.0.content.chain_id`).String()
stopTime := gjson.Get(string(bz), `messages.0.content.stop_time`).Time().Sub(containerConfig.Now)
var chain ChainID
for i, conf := range chainConfigs {
if string(conf.ChainId) == chainId {
chain = i
break
}
}
return ConsumerRemovalProposal{
Deposit: uint(deposit),
Status: status,
Chain: chain,
StopTime: int(stopTime.Milliseconds()),
}
case "/cosmos.params.v1beta1.ParameterChangeProposal":
return ParamsProposal{
Deposit: uint(deposit),
Status: status,
Subspace: gjson.Get(string(bz), `messages.0.content.changes.0.subspace`).String(),
Key: gjson.Get(string(bz), `messages.0.content.changes.0.key`).String(),
Value: gjson.Get(string(bz), `messages.0.content.changes.0.value`).String(),
}
}
log.Fatal("unknown proposal type", string(bz))
return nil
}
func (tr Commands) GetValStakedTokens(chain ChainID, valoperAddress string) uint {
binaryName := tr.ChainConfigs[chain].BinaryName
bz, err := tr.Target.ExecCommand(binaryName,
"query", "staking", "validator",
valoperAddress,
`--node`, tr.GetQueryNode(chain),
`-o`, `json`,
).CombinedOutput()
if err != nil {
log.Fatal(err, "\n", string(bz))
}
amount := gjson.Get(string(bz), `tokens`)
return uint(amount.Uint())
}
func (tr Commands) GetParam(chain ChainID, param Param) string {
binaryName := tr.ChainConfigs[chain].BinaryName
bz, err := tr.Target.ExecCommand(binaryName,
"query", "params", "subspace",
param.Subspace,
param.Key,
`--node`, tr.GetQueryNode(chain),
`-o`, `json`,
).CombinedOutput()
if err != nil {
log.Fatal(err, "\n", string(bz))
}
value := gjson.Get(string(bz), `value`)
return value.String()
}
// GetConsumerChains returns a list of consumer chains that're being secured by the provider chain,
// determined by querying the provider chain.
func (tr Commands) GetConsumerChains(chain ChainID) map[ChainID]bool {
binaryName := tr.ChainConfigs[chain].BinaryName
cmd := tr.Target.ExecCommand(binaryName,
"query", "provider", "list-consumer-chains",
`--node`, tr.GetQueryNode(chain),
`-o`, `json`,
)
bz, err := cmd.CombinedOutput()
if err != nil {
log.Fatal(err, "\n", string(bz))
}
arr := gjson.Get(string(bz), "chains").Array()
chains := make(map[ChainID]bool)
for _, c := range arr {
id := c.Get("chain_id").String()
chains[ChainID(id)] = true
}
return chains
}
func (tr Commands) GetConsumerAddress(consumerChain ChainID, validator ValidatorID) string {
binaryName := tr.ChainConfigs[ChainID("provi")].BinaryName
cmd := tr.Target.ExecCommand(binaryName,
"query", "provider", "validator-consumer-key",
string(consumerChain), tr.ValidatorConfigs[validator].ValconsAddress,
`--node`, tr.GetQueryNode(ChainID("provi")),
`-o`, `json`,
)
bz, err := cmd.CombinedOutput()
if err != nil {
log.Fatal(err, "\n", string(bz))
}
addr := gjson.Get(string(bz), "consumer_address").String()
return addr
}
func (tr Commands) GetProviderAddressFromConsumer(consumerChain ChainID, validator ValidatorID) string {
binaryName := tr.ChainConfigs[ChainID("provi")].BinaryName
cmd := tr.Target.ExecCommand(binaryName,
"query", "provider", "validator-provider-key",
string(consumerChain), tr.ValidatorConfigs[validator].ConsumerValconsAddressOnProvider,
`--node`, tr.GetQueryNode(ChainID("provi")),
`-o`, `json`,
)
bz, err := cmd.CombinedOutput()
if err != nil {
log.Println("error running ", cmd)
log.Fatal(err, "\n", string(bz))
}
addr := gjson.Get(string(bz), "provider_address").String()
return addr
}
func (tr Commands) GetSlashMeter() int64 {
binaryName := tr.ChainConfigs[ChainID("provi")].BinaryName
cmd := tr.Target.ExecCommand(binaryName,
"query", "provider", "throttle-state",
`--node`, tr.GetQueryNode(ChainID("provi")),
`-o`, `json`,
)
bz, err := cmd.CombinedOutput()
if err != nil {
log.Fatal(err, "\n", string(bz))
}
slashMeter := gjson.Get(string(bz), "slash_meter")
return slashMeter.Int()
}
func (tr Commands) GetRegisteredConsumerRewardDenoms(chain ChainID) []string {
binaryName := tr.ChainConfigs[chain].BinaryName
cmd := tr.Target.ExecCommand(binaryName,
"query", "provider", "registered-consumer-reward-denoms",
`--node`, tr.GetQueryNode(chain),
`-o`, `json`,
)
bz, err := cmd.CombinedOutput()
if err != nil {
log.Fatal(err, "\n", string(bz))
}
denoms := gjson.Get(string(bz), "denoms").Array()
rewardDenoms := make([]string, len(denoms))
for i, d := range denoms {
rewardDenoms[i] = d.String()
}
return rewardDenoms
}
func (tr Commands) GetPendingPacketQueueSize(chain ChainID) uint {
binaryName := tr.ChainConfigs[chain].BinaryName
cmd := tr.Target.ExecCommand(binaryName,
"query", "ccvconsumer", "throttle-state",
`--node`, tr.GetQueryNode(chain),
`-o`, `json`,
)
bz, err := cmd.CombinedOutput()
if err != nil {
log.Fatal(err, "\n", string(bz))
}
if !gjson.ValidBytes(bz) {
panic("invalid json response from query ccvconsumer throttle-state: " + string(bz))
}
packetData := gjson.Get(string(bz), "packet_data_queue").Array()
return uint(len(packetData))
}
func (tr Commands) GetValidatorIP(chain ChainID, validator ValidatorID) string {
return tr.ChainConfigs[chain].IpPrefix + "." + tr.ValidatorConfigs[validator].IpSuffix
}
// getQueryNode returns query node tcp address on chain.
func (tr Commands) GetQueryNode(chain ChainID) string {
return fmt.Sprintf("tcp://%s", tr.GetQueryNodeRPCAddress(chain))
}
func (tr Commands) GetQueryNodeRPCAddress(chain ChainID) string {
return fmt.Sprintf("%s:26658", tr.GetQueryNodeIP(chain))
}
// getQueryNodeIP returns query node IP for chain,
// ipSuffix is hardcoded to be 253 on all query nodes
// except for "sover" chain where there's only one node
func (tr Commands) GetQueryNodeIP(chain ChainID) string {
if chain == ChainID("sover") {
// return address of first and only validator
return fmt.Sprintf("%s.%s",
tr.ChainConfigs[chain].IpPrefix,
tr.ValidatorConfigs[ValidatorID("alice")].IpSuffix)
}
return fmt.Sprintf("%s.253", tr.ChainConfigs[chain].IpPrefix)
}
func (tr Commands) curlJsonRPCRequest(method, params, address string) {
cmd_template := `curl -H 'Content-Type: application/json' -H 'Accept:application/json' --data '{"jsonrpc":"2.0","method":"%s","params":%s,"id":1}' %s`
cmd := tr.Target.ExecCommand("bash", "-c", fmt.Sprintf(cmd_template, method, params, address))
verbosity := false
e2e.ExecuteCommandWithVerbosity(cmd, "curlJsonRPCRequest", verbosity)
}
// GetClientFrozenHeight returns the frozen height for a client with the given client ID
// by querying the hosting chain with the given chainID
func (tr Commands) GetClientFrozenHeight(chain ChainID, clientID string) (uint64, uint64) {
//#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments.
//cmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[ChainID("provi")].BinaryName,
binaryName := tr.ChainConfigs[ChainID("provi")].BinaryName
cmd := tr.Target.ExecCommand(binaryName,
"query", "ibc", "client", "state", clientID,
`--node`, tr.GetQueryNode(ChainID("provi")),
`-o`, `json`,
)
bz, err := cmd.CombinedOutput()
if err != nil {
log.Fatal(err, "\n", string(bz))
}
frozenHeight := gjson.Get(string(bz), "client_state.frozen_height")
revHeight, err := strconv.Atoi(frozenHeight.Get("revision_height").String())
if err != nil {
log.Fatal(err, "\n", string(bz))
}
revNumber, err := strconv.Atoi(frozenHeight.Get("revision_number").String())
if err != nil {
log.Fatal(err, "\n", string(bz))
}
return uint64(revHeight), uint64(revNumber)
}
func (tr Commands) GetTrustedHeight(
chain ChainID,
clientID string,
index int,
) (uint64, uint64) {
//#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments.
//configureNodeCmd := exec.Command("docker", "exec", tc.testConfig.containerConfig.InstanceName, "hermes",
configureNodeCmd := tr.Target.ExecCommand("hermes",
"--json", "query", "client", "consensus", "--chain", string(chain),
`--client`, clientID,
)
cmdReader, err := configureNodeCmd.StdoutPipe()
if err != nil {
log.Fatal(err)
}
configureNodeCmd.Stderr = configureNodeCmd.Stdout
if err := configureNodeCmd.Start(); err != nil {
log.Fatal(err)
}
scanner := bufio.NewScanner(cmdReader)
var trustedHeight gjson.Result
// iterate on the relayer's response
// and parse the the command "result"
for scanner.Scan() {
out := scanner.Text()
if len(gjson.Get(out, "result").Array()) > 0 {
trustedHeight = gjson.Get(out, "result").Array()[index]
break
}
}
revHeight, err := strconv.Atoi(trustedHeight.Get("revision_height").String())
if err != nil {
log.Fatal(err)
}
revNumber, err := strconv.Atoi(trustedHeight.Get("revision_number").String())
if err != nil {
log.Fatal(err)
}
return uint64(revHeight), uint64(revNumber)
}
func (tr Commands) GetProposedConsumerChains(chain ChainID) []string {
//#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments.
//bz, err := exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[chain].BinaryName,
binaryName := tr.ChainConfigs[chain].BinaryName
bz, err := tr.Target.ExecCommand(binaryName,
"query", "provider", "list-proposed-consumer-chains",
`--node`, tr.GetQueryNode(chain),
`-o`, `json`,
).CombinedOutput()
if err != nil {
log.Fatal(err, "\n", string(bz))
}
arr := gjson.Get(string(bz), "proposedChains").Array()
chains := []string{}
for _, c := range arr {
cid := c.Get("chainID").String()
chains = append(chains, cid)
}
return chains
}
// Breaking forward compatibility
func (tr Commands) GetIBCTransferParams(chain ChainID) IBCTransferParams {
panic("'GetIBCTransferParams' is not implemented in this version")
}
func uintPtr(i uint) *uint {
return &i
}