-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathe2e_gov_test.go
500 lines (438 loc) · 20.4 KB
/
e2e_gov_test.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
package e2e
import (
"context"
"fmt"
"path/filepath"
"strconv"
"strings"
"time"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
govtypes "github.com/atomone-hub/atomone/x/gov/types"
govtypesv1 "github.com/atomone-hub/atomone/x/gov/types/v1"
govtypesv1beta1 "github.com/atomone-hub/atomone/x/gov/types/v1beta1"
photontypes "github.com/atomone-hub/atomone/x/photon/types"
)
/*
testGovSoftwareUpgrade tests passing a gov proposal to upgrade the chain at a given height.
Test Benchmarks:
1. Submission, deposit and vote of message based proposal to upgrade the chain at a height (current height + buffer)
2. Validation that chain halted at upgrade height
3. Teardown & restart chains
4. Reset proposalCounter so subsequent tests have the correct last effective proposal id for chainA
TODO: Perform upgrade in place of chain restart
*/
func (s *IntegrationTestSuite) testGovSoftwareUpgrade() {
s.Run("software upgrade", func() {
chainAAPIEndpoint := fmt.Sprintf("http://%s", s.valResources[s.chainA.id][0].GetHostPort("1317/tcp"))
senderAddress, _ := s.chainA.validators[0].keyInfo.GetAddress()
sender := senderAddress.String()
height := s.getLatestBlockHeight(s.chainA, 0)
proposalHeight := height + govProposalBlockBuffer
// Gov tests may be run in arbitrary order, each test must increment proposalCounter to have the correct proposal id to submit and query
proposalCounter++
submitGovFlags := []string{
"software-upgrade",
"Upgrade-0",
"--title='Upgrade V0'",
"--description='Software Upgrade'",
"--no-validate",
fmt.Sprintf("--upgrade-height=%d", proposalHeight),
"--upgrade-info=my-info",
}
depositGovFlags := []string{strconv.Itoa(proposalCounter), depositAmount.String()}
voteGovFlags := []string{strconv.Itoa(proposalCounter), "yes=0.8,no=0.1,abstain=0.1"}
s.submitLegacyGovProposal(chainAAPIEndpoint, sender, proposalCounter, upgradetypes.ProposalTypeSoftwareUpgrade, submitGovFlags, depositGovFlags, voteGovFlags, "weighted-vote", true)
s.verifyChainHaltedAtUpgradeHeight(s.chainA, 0, proposalHeight)
s.T().Logf("Successfully halted chain at height %d", proposalHeight)
s.TearDownSuite()
s.T().Logf("Restarting containers")
s.SetupSuite()
s.Require().Eventually(
func() bool {
return s.getLatestBlockHeight(s.chainA, 0) > 0
},
30*time.Second,
time.Second,
)
proposalCounter = 0
})
}
/*
testGovCancelSoftwareUpgrade tests passing a gov proposal that cancels a pending upgrade.
Test Benchmarks:
1. Submission, deposit and vote of message based proposal to upgrade the chain at a height (current height + buffer)
2. Submission, deposit and vote of message based proposal to cancel the pending upgrade
3. Validation that the chain produced blocks past the intended upgrade height
*/
func (s *IntegrationTestSuite) testGovCancelSoftwareUpgrade() {
s.Run("cancel software upgrade", func() {
chainAAPIEndpoint := fmt.Sprintf("http://%s", s.valResources[s.chainA.id][0].GetHostPort("1317/tcp"))
senderAddress, _ := s.chainA.validators[0].keyInfo.GetAddress()
sender := senderAddress.String()
height := s.getLatestBlockHeight(s.chainA, 0)
proposalHeight := height + 50
// Gov tests may be run in arbitrary order, each test must increment proposalCounter to have the correct proposal id to submit and query
proposalCounter++
submitGovFlags := []string{
"software-upgrade",
"Upgrade-1",
"--title='Upgrade V1'",
"--description='Software Upgrade'",
"--no-validate",
fmt.Sprintf("--upgrade-height=%d", proposalHeight),
}
depositGovFlags := []string{strconv.Itoa(proposalCounter), depositAmount.String()}
voteGovFlags := []string{strconv.Itoa(proposalCounter), "yes"}
s.submitLegacyGovProposal(chainAAPIEndpoint, sender, proposalCounter, upgradetypes.ProposalTypeSoftwareUpgrade, submitGovFlags, depositGovFlags, voteGovFlags, "vote", true)
proposalCounter++
submitGovFlags = []string{"cancel-software-upgrade", "--title='Upgrade V1'", "--description='Software Upgrade'"}
depositGovFlags = []string{strconv.Itoa(proposalCounter), depositAmount.String()}
voteGovFlags = []string{strconv.Itoa(proposalCounter), "yes"}
s.submitLegacyGovProposal(chainAAPIEndpoint, sender, proposalCounter, upgradetypes.ProposalTypeCancelSoftwareUpgrade, submitGovFlags, depositGovFlags, voteGovFlags, "vote", true)
s.verifyChainPassesUpgradeHeight(s.chainA, 0, proposalHeight)
s.T().Logf("Successfully canceled upgrade at height %d", proposalHeight)
})
}
/*
testGovCommunityPoolSpend tests passing a community spend proposal.
Test Benchmarks:
1. Fund Community Pool
2. Submission, deposit and vote of proposal to spend from the community pool to send atoms to a recipient
3. Validation that the recipient balance has increased by proposal amount
*/
func (s *IntegrationTestSuite) testGovCommunityPoolSpend() {
s.Run("community pool spend", func() {
s.fundCommunityPool()
chainAAPIEndpoint := fmt.Sprintf("http://%s", s.valResources[s.chainA.id][0].GetHostPort("1317/tcp"))
senderAddress, _ := s.chainA.validators[0].keyInfo.GetAddress()
sender := senderAddress.String()
recipientAddress, _ := s.chainA.validators[1].keyInfo.GetAddress()
recipient := recipientAddress.String()
sendAmount := sdk.NewInt64Coin(uatoneDenom, 10_000_000) // 10atone
s.writeGovCommunitySpendProposal(s.chainA, sendAmount, recipient)
beforeSenderBalance, err := getSpecificBalance(chainAAPIEndpoint, sender, uatoneDenom)
s.Require().NoError(err)
beforeRecipientBalance, err := getSpecificBalance(chainAAPIEndpoint, recipient, uatoneDenom)
s.Require().NoError(err)
// Gov tests may be run in arbitrary order, each test must increment proposalCounter to have the correct proposal id to submit and query
proposalCounter++
submitGovFlags := []string{configFile(proposalCommunitySpendFilename)}
depositGovFlags := []string{strconv.Itoa(proposalCounter), depositAmount.String()}
voteGovFlags := []string{strconv.Itoa(proposalCounter), "yes"}
s.submitGovProposal(chainAAPIEndpoint, sender, proposalCounter, "CommunityPoolSpend", submitGovFlags, depositGovFlags, voteGovFlags, "vote", govtypesv1beta1.StatusPassed)
// Check that sender is refunded with the proposal deposit
s.Require().Eventually(
func() bool {
afterSenderBalance, err := getSpecificBalance(chainAAPIEndpoint, sender, uatoneDenom)
s.Require().NoError(err)
return afterSenderBalance.IsEqual(beforeSenderBalance)
},
10*time.Second,
time.Second,
)
// Check that recipient received the community pool spend
s.Require().Eventually(
func() bool {
afterRecipientBalance, err := getSpecificBalance(chainAAPIEndpoint, recipient, uatoneDenom)
s.Require().NoError(err)
return afterRecipientBalance.Sub(sendAmount).IsEqual(beforeRecipientBalance)
},
10*time.Second,
time.Second,
)
})
s.Run("community pool spend with number of no votes exceeds threshold", func() {
s.fundCommunityPool()
chainAAPIEndpoint := fmt.Sprintf("http://%s", s.valResources[s.chainA.id][0].GetHostPort("1317/tcp"))
senderAddress, _ := s.chainA.validators[0].keyInfo.GetAddress()
sender := senderAddress.String()
recipientAddress, _ := s.chainA.validators[1].keyInfo.GetAddress()
recipient := recipientAddress.String()
sendAmount := sdk.NewInt64Coin(uatoneDenom, 10_000_000) // 10atone
s.writeGovCommunitySpendProposal(s.chainA, sendAmount, recipient)
beforeSenderBalance, err := getSpecificBalance(chainAAPIEndpoint, sender, uatoneDenom)
s.Require().NoError(err)
beforeRecipientBalance, err := getSpecificBalance(chainAAPIEndpoint, recipient, uatoneDenom)
s.Require().NoError(err)
// Gov tests may be run in arbitrary order, each test must increment proposalCounter to have the correct proposal id to submit and query
proposalCounter++
submitGovFlags := []string{configFile(proposalCommunitySpendFilename)}
depositGovFlags := []string{strconv.Itoa(proposalCounter), depositAmount.String()}
voteGovFlags := []string{strconv.Itoa(proposalCounter), "no"}
s.submitGovProposal(chainAAPIEndpoint, sender, proposalCounter, "CommunityPoolSpend", submitGovFlags, depositGovFlags, voteGovFlags, "vote", govtypesv1beta1.StatusRejected)
// Check that sender is not refunded with the proposal deposit
s.Require().Eventually(
func() bool {
afterSenderBalance, err := getSpecificBalance(chainAAPIEndpoint, sender, uatoneDenom)
s.Require().NoError(err)
return afterSenderBalance.Add(depositAmount).Add(initialDepositAmount).
IsEqual(beforeSenderBalance)
},
10*time.Second,
time.Second,
)
// Check that recipient didnt receive the community pool spend since the
// proposal was rejected
s.Require().Eventually(
func() bool {
afterRecipientBalance, err := getSpecificBalance(chainAAPIEndpoint, recipient, uatoneDenom)
s.Require().NoError(err)
return afterRecipientBalance.IsEqual(beforeRecipientBalance)
},
10*time.Second,
time.Second,
)
})
}
// testGovParamChange tests passing a param change proposal.
func (s *IntegrationTestSuite) testGovParamChange() {
s.Run("staking param change", func() {
// check existing params
chainAAPIEndpoint := fmt.Sprintf("http://%s", s.valResources[s.chainA.id][0].GetHostPort("1317/tcp"))
senderAddress, _ := s.chainA.validators[0].keyInfo.GetAddress()
sender := senderAddress.String()
params := s.queryStakingParams(chainAAPIEndpoint)
oldMaxValidator := params.Params.MaxValidators
// add 10 to actual max validators
params.Params.MaxValidators = oldMaxValidator + 10
s.writeStakingParamChangeProposal(s.chainA, params.Params)
// Gov tests may be run in arbitrary order, each test must increment proposalCounter to have the correct proposal id to submit and query
proposalCounter++
submitGovFlags := []string{configFile(proposalParamChangeFilename)}
depositGovFlags := []string{strconv.Itoa(proposalCounter), depositAmount.String()}
voteGovFlags := []string{strconv.Itoa(proposalCounter), "yes"}
s.submitGovProposal(chainAAPIEndpoint, sender, proposalCounter, "cosmos.staking.v1beta1.MsgUpdateParams", submitGovFlags, depositGovFlags, voteGovFlags, "vote", govtypesv1beta1.StatusPassed)
newParams := s.queryStakingParams(chainAAPIEndpoint)
s.Assert().NotEqual(oldMaxValidator, newParams.Params.MaxValidators)
})
s.Run("photon param change", func() {
// check existing params
chainAAPIEndpoint := fmt.Sprintf("http://%s", s.valResources[s.chainA.id][0].GetHostPort("1317/tcp"))
senderAddress, _ := s.chainA.validators[0].keyInfo.GetAddress()
sender := senderAddress.String()
params := s.queryPhotonParams(chainAAPIEndpoint)
// toggle param mint_disabled
oldMintDisabled := params.Params.MintDisabled
s.Require().False(oldMintDisabled, "expected photon param mint disabled to be false")
params.Params.MintDisabled = true
s.writePhotonParamChangeProposal(s.chainA, params.Params)
// Gov tests may be run in arbitrary order, each test must increment proposalCounter to have the correct proposal id to submit and query
proposalCounter++
submitGovFlags := []string{configFile(proposalParamChangeFilename)}
depositGovFlags := []string{strconv.Itoa(proposalCounter), depositAmount.String()}
voteGovFlags := []string{strconv.Itoa(proposalCounter), "yes"}
s.submitGovProposal(chainAAPIEndpoint, sender, proposalCounter, "atomone.photon.v1.MsgUpdateParams", submitGovFlags, depositGovFlags, voteGovFlags, "vote", govtypesv1beta1.StatusPassed)
newParams := s.queryPhotonParams(chainAAPIEndpoint)
s.Assert().True(newParams.Params.MintDisabled, "expected photon param mint disabled to be true")
// Revert change or mint photon test will fail
params.Params.MintDisabled = false
proposalCounter++
depositGovFlags = []string{strconv.Itoa(proposalCounter), depositAmount.String()}
voteGovFlags = []string{strconv.Itoa(proposalCounter), "yes"}
s.writePhotonParamChangeProposal(s.chainA, params.Params)
s.submitGovProposal(chainAAPIEndpoint, sender, proposalCounter, "atomone.photon.v1.MsgUpdateParams", submitGovFlags, depositGovFlags, voteGovFlags, "vote", govtypesv1beta1.StatusPassed)
newParams = s.queryPhotonParams(chainAAPIEndpoint)
s.Require().False(newParams.Params.MintDisabled, "expected photon param mint disabled to be false")
})
}
func (s *IntegrationTestSuite) testGovConstitutionAmendment() {
s.Run("constitution amendment", func() {
chainAAPIEndpoint := fmt.Sprintf("http://%s", s.valResources[s.chainA.id][0].GetHostPort("1317/tcp"))
senderAddress, _ := s.chainA.validators[0].keyInfo.GetAddress()
sender := senderAddress.String()
newConstitution := "New test constitution"
amendmentMsg := s.generateConstitutionAmendment(s.chainA, newConstitution)
s.writeGovConstitutionAmendmentProposal(s.chainA, amendmentMsg.Amendment)
// Gov tests may be run in arbitrary order, each test must increment proposalCounter to have the correct proposal id to submit and query
proposalCounter++
submitGovFlags := []string{configFile(proposalConstitutionAmendmentFilename)}
depositGovFlags := []string{strconv.Itoa(proposalCounter), depositAmount.String()}
voteGovFlags := []string{strconv.Itoa(proposalCounter), "yes"}
s.submitGovProposal(chainAAPIEndpoint, sender, proposalCounter, "gov/MsgSubmitProposal", submitGovFlags, depositGovFlags, voteGovFlags, "vote", govtypesv1beta1.StatusPassed)
s.Require().Eventually(
func() bool {
res := s.queryConstitution(chainAAPIEndpoint)
return res.Constitution == newConstitution
},
10*time.Second,
time.Second,
)
})
}
func (s *IntegrationTestSuite) submitLegacyGovProposal(chainAAPIEndpoint, sender string, proposalID int, proposalType string, submitFlags []string, depositFlags []string, voteFlags []string, voteCommand string, withDeposit bool) {
s.T().Logf("Submitting Gov Proposal: %s", proposalType)
// min deposit of 1000uatone is required in e2e tests, otherwise the gov antehandler causes the proposal to be dropped
sflags := submitFlags
if withDeposit {
sflags = append(sflags, "--deposit="+initialDepositAmount.String())
}
s.submitGovCommand(chainAAPIEndpoint, sender, proposalID, "submit-legacy-proposal", sflags, govtypesv1beta1.StatusDepositPeriod)
s.T().Logf("Depositing Gov Proposal: %s", proposalType)
s.submitGovCommand(chainAAPIEndpoint, sender, proposalID, "deposit", depositFlags, govtypesv1beta1.StatusVotingPeriod)
s.T().Logf("Voting Gov Proposal: %s", proposalType)
s.submitGovCommand(chainAAPIEndpoint, sender, proposalID, voteCommand, voteFlags, govtypesv1beta1.StatusPassed)
}
// NOTE: in SDK >= v0.47 the submit-proposal does not have a --deposit flag
// Instead, the deposit is added to the "deposit" field of the proposal JSON (usually stored as a file)
// you can use `atomoned tx gov draft-proposal` to create a proposal file that you can use
// min initial deposit of 100uatone is required in e2e tests, otherwise the proposal would be dropped
func (s *IntegrationTestSuite) submitGovProposal(chainAAPIEndpoint, sender string, proposalID int, proposalType string, submitFlags []string, depositFlags []string, voteFlags []string, voteCommand string, expectedStatusAfterVote govtypesv1beta1.ProposalStatus) {
s.T().Logf("Submitting Gov Proposal: %s", proposalType)
sflags := submitFlags
s.submitGovCommand(chainAAPIEndpoint, sender, proposalID, "submit-proposal", sflags, govtypesv1beta1.StatusDepositPeriod)
s.T().Logf("Depositing Gov Proposal: %s", proposalType)
s.submitGovCommand(chainAAPIEndpoint, sender, proposalID, "deposit", depositFlags, govtypesv1beta1.StatusVotingPeriod)
s.T().Logf("Voting Gov Proposal: %s", proposalType)
s.submitGovCommand(chainAAPIEndpoint, sender, proposalID, voteCommand, voteFlags, expectedStatusAfterVote)
}
func (s *IntegrationTestSuite) verifyChainHaltedAtUpgradeHeight(c *chain, valIdx int, upgradeHeight int64) {
s.Require().Eventually(
func() bool {
currentHeight := s.getLatestBlockHeight(c, valIdx)
return currentHeight == upgradeHeight
},
30*time.Second,
time.Second,
)
counter := 0
s.Require().Eventually(
func() bool {
currentHeight := s.getLatestBlockHeight(c, valIdx)
if currentHeight > upgradeHeight {
return false
}
if currentHeight == upgradeHeight {
counter++
}
return counter >= 2
},
8*time.Second,
time.Second,
)
}
func (s *IntegrationTestSuite) verifyChainPassesUpgradeHeight(c *chain, valIdx int, upgradeHeight int64) {
var currentHeight int64
s.Require().Eventually(
func() bool {
currentHeight = s.getLatestBlockHeight(c, valIdx)
return currentHeight > upgradeHeight
},
30*time.Second,
time.Second,
"expected chain height greater than %d: got %d", upgradeHeight, currentHeight,
)
}
func (s *IntegrationTestSuite) submitGovCommand(chainAAPIEndpoint, sender string, proposalID int, govCommand string, proposalFlags []string, expectedSuccessStatus govtypesv1beta1.ProposalStatus) {
s.runGovExec(s.chainA, 0, sender, govCommand, proposalFlags)
s.Require().Eventually(
func() bool {
proposal, err := queryGovProposal(chainAAPIEndpoint, proposalID)
s.Require().NoError(err)
return proposal.GetProposal().Status == expectedSuccessStatus
},
15*time.Second,
time.Second,
)
}
func (s *IntegrationTestSuite) writeStakingParamChangeProposal(c *chain, params stakingtypes.Params) {
govModuleAddress := authtypes.NewModuleAddress(govtypes.ModuleName).String()
template := `
{
"messages":[
{
"@type": "/cosmos.staking.v1beta1.MsgUpdateParams",
"authority": "%s",
"params": %s
}
],
"deposit": "%s",
"proposer": "Proposing staking param change",
"metadata": "",
"title": "Change in staking params",
"summary": "summary"
}
`
propMsgBody := fmt.Sprintf(template, govModuleAddress, cdc.MustMarshalJSON(¶ms), initialDepositAmount)
err := writeFile(filepath.Join(c.validators[0].configDir(), "config", proposalParamChangeFilename), []byte(propMsgBody))
s.Require().NoError(err)
}
func (s *IntegrationTestSuite) writePhotonParamChangeProposal(c *chain, params photontypes.Params) {
govModuleAddress := authtypes.NewModuleAddress(govtypes.ModuleName).String()
template := `
{
"messages":[
{
"@type": "/atomone.photon.v1.MsgUpdateParams",
"authority": "%s",
"params": %s
}
],
"deposit": "%s",
"proposer": "Proposing photon param change",
"metadata": "",
"title": "Change in photon params",
"summary": "summary"
}
`
propMsgBody := fmt.Sprintf(template, govModuleAddress, cdc.MustMarshalJSON(¶ms), initialDepositAmount)
err := writeFile(filepath.Join(c.validators[0].configDir(), "config", proposalParamChangeFilename), []byte(propMsgBody))
s.Require().NoError(err)
}
func (s *IntegrationTestSuite) writeGovConstitutionAmendmentProposal(c *chain, amendment string) {
govModuleAddress := authtypes.NewModuleAddress(govtypes.ModuleName).String()
// escape newlines in amendment
amendment = strings.ReplaceAll(amendment, "\n", "\\n")
template := `
{
"messages":[
{
"@type": "/atomone.gov.v1.MsgProposeConstitutionAmendment",
"authority": "%s",
"amendment": "%s"
}
],
"deposit": "%s",
"proposer": "Proposing validator address",
"metadata": "Constitution Amendment",
"title": "Constitution Amendment",
"summary": "summary"
}
`
propMsgBody := fmt.Sprintf(template, govModuleAddress, amendment, initialDepositAmount)
err := writeFile(filepath.Join(c.validators[0].configDir(), "config", proposalConstitutionAmendmentFilename), []byte(propMsgBody))
s.Require().NoError(err)
}
func (s *IntegrationTestSuite) generateConstitutionAmendment(c *chain, newConstitution string) govtypesv1.MsgProposeConstitutionAmendment {
err := writeFile(filepath.Join(c.validators[0].configDir(), "config", newConstitutionFilename), []byte(newConstitution))
s.Require().NoError(err)
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()
govCommand := "generate-constitution-amendment"
cmd := []string{
atomonedBinary,
txCommand,
govtypes.ModuleName,
govCommand,
configFile(newConstitutionFilename),
}
s.T().Logf("Executing atomoned tx gov %s on chain %s", govCommand, c.id)
var msg govtypesv1.MsgProposeConstitutionAmendment
s.executeAtomoneTxCommand(ctx, c, cmd, 0, s.parseGenerateConstitutionAmendmentOutput(&msg))
s.T().Logf("Successfully executed %s", govCommand)
s.Require().NoError(err)
return msg
}
func (s *IntegrationTestSuite) parseGenerateConstitutionAmendmentOutput(msg *govtypesv1.MsgProposeConstitutionAmendment) func([]byte, []byte) bool {
return func(stdOut []byte, stdErr []byte) bool {
if len(stdErr) > 0 {
s.T().Logf("Error: %s", string(stdErr))
return false
}
err := cdc.UnmarshalJSON(stdOut, msg)
s.Require().NoError(err)
return true
}
}