Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spike to test feasibility of downgrade to v0.45 #1902

Merged
merged 31 commits into from
Nov 30, 2022
Merged
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
663e14f
pause
okwme Nov 15, 2022
64cc456
no vscode errors
okwme Nov 16, 2022
0fe4e8c
Merge branch 'main' into okwme/downgrade-v0-45
okwme Nov 16, 2022
fc8f2be
rewrite go.sum, go.work.sum and fix amino import
okwme Nov 16, 2022
fca3ab5
Merge branch 'main' into okwme/downgrade-v0-45
okwme Nov 16, 2022
5e7bd79
remove mauth docs
okwme Nov 16, 2022
d7e19d0
gofumpt
okwme Nov 16, 2022
180ca63
fix find
okwme Nov 16, 2022
75d0f9a
cant get docker to build locally
okwme Nov 16, 2022
824c208
debug ibc test
okwme Nov 16, 2022
5169a9b
fix ibc test
okwme Nov 16, 2022
43f495b
merge with main
okwme Nov 17, 2022
e7f9145
passing e2e
okwme Nov 17, 2022
02b3256
clean up commented out tests
okwme Nov 17, 2022
a266175
remove more mauth
okwme Nov 17, 2022
283ab55
forgot to save
okwme Nov 17, 2022
8435cc4
merge with main
okwme Nov 17, 2022
61743e1
Merge branch 'main' into okwme/downgrade-v0-45
okwme Nov 17, 2022
e55d9b2
merge with main
okwme Nov 17, 2022
3601da2
add back middleware test
okwme Nov 18, 2022
8f846a8
Merge branch 'main' into okwme/downgrade-v0-45
okwme Nov 18, 2022
18ccf80
fix upgrade
okwme Nov 18, 2022
785b267
fix test setup
okwme Nov 18, 2022
ed9c986
add TODO note
okwme Nov 18, 2022
0673b1b
remove multihop test
okwme Nov 18, 2022
1ed082c
Update docs/modules/gov.md
okwme Nov 30, 2022
ced396b
Update tests/e2e/query.go
okwme Nov 30, 2022
fd56668
remove groups and gov docs
okwme Nov 30, 2022
29fd7f0
Merge branch 'main' into okwme/downgrade-v0-45
okwme Nov 30, 2022
6b6583a
laurens comment re moduleAccountAddress
okwme Nov 30, 2022
63f45f9
remove commented code that should not be added back
okwme Nov 30, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
merge with main
okwme committed Nov 17, 2022

Verified

This commit was signed with the committer’s verified signature.
okwme billy rennekamp
commit 8435cc4e6424842efb41f14d977f635840f92836
30 changes: 30 additions & 0 deletions tests/e2e/e2e_exec_test.go
Original file line number Diff line number Diff line change
@@ -290,6 +290,36 @@ func (s *IntegrationTestSuite) execBankSend(
s.executeGaiaTxCommand(ctx, c, gaiaCommand, valIdx, s.expectErrExecValidation(c, valIdx, expectErr))
}

type txBankSend struct {
from string
to string
amt string
fees string
log string
expectErr bool
}

func (s *IntegrationTestSuite) execBankSendBatch(
c *chain,
valIdx int,
txs ...txBankSend,
) int {
sucessBankSendCount := 0

for i := range txs {
s.T().Logf(txs[i].log)

s.execBankSend(c, valIdx, txs[i].from, txs[i].to, txs[i].amt, txs[i].fees, txs[i].expectErr)
if !txs[i].expectErr {
if !txs[i].expectErr {
sucessBankSendCount++
}
}
}

return sucessBankSendCount
}

func (s *IntegrationTestSuite) execWithdrawAllRewards(c *chain, valIdx int, payee, fees string, expectErr bool) {
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()
44 changes: 44 additions & 0 deletions tests/e2e/e2e_globalfee_proposal_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package e2e

import (
"fmt"
"time"

sdk "github.com/cosmos/cosmos-sdk/types"
gov "github.com/cosmos/cosmos-sdk/x/gov/types"
)

func (s *IntegrationTestSuite) govProposeNewGlobalfee(newGlobalfee sdk.DecCoins, proposalCounter int, submitter string, fees string) {
s.writeGovParamChangeProposalGlobalFees(s.chainA, newGlobalfee)
chainAAPIEndpoint := fmt.Sprintf("http://%s", s.valResources[s.chainA.id][0].GetHostPort("1317/tcp"))
// gov proposing new fees
s.T().Logf("Proposal number: %d", proposalCounter)
s.T().Logf("Submitting, deposit and vote legacy Gov Proposal: change global fee to %s", newGlobalfee.String())
s.submitLegacyGovProposal(chainAAPIEndpoint, submitter, fees, "param-change", proposalCounter, configFile(proposalGlobalFee))
s.depositGovProposal(chainAAPIEndpoint, submitter, fees, proposalCounter)
s.voteGovProposal(chainAAPIEndpoint, submitter, fees, proposalCounter, "yes", false)

// query the proposal status and new fee
s.Require().Eventually(
func() bool {
proposal, err := queryGovProposal(chainAAPIEndpoint, proposalCounter)
s.Require().NoError(err)
return proposal.GetProposal().Status == gov.StatusPassed
},
15*time.Second,
5*time.Second,
)

s.Require().Eventually(
func() bool {
globalFees, err := queryGlobalFees(chainAAPIEndpoint)
s.T().Logf("After gov new global fee proposal: %s", globalFees.String())
s.Require().NoError(err)

// attention: if global fee is empty, when query globalfee, it shows empty rather than default ante.DefaultZeroGlobalFee() = 0uatom.
return globalFees.IsEqual(newGlobalfee)
},
15*time.Second,
5*time.Second,
)
}
227 changes: 112 additions & 115 deletions tests/e2e/e2e_gov_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package e2e

import (
"fmt"
"time"

sdk "github.com/cosmos/cosmos-sdk/types"
@@ -17,48 +18,47 @@ Test Benchmarks:
4. Submission, deposit and vote of message based proposal to send funds from the gov account to a recipient account
5. Validation that funds have been deposited to recipient account
*/
// func (s *IntegrationTestSuite) SendTokensFromNewGovAccount() {
// s.writeGovProposals(s.chainA)
// chainAAPIEndpoint := fmt.Sprintf("http://%s", s.valResources[s.chainA.id][0].GetHostPort("1317/tcp"))
// senderAddress, err := s.chainA.validators[0].keyInfo.GetAddress()
// s.Require().NoError(err)
// sender := senderAddress.String()
// // Gov tests may be run in arbitrary order, each test must increment proposalCounter to have the correct proposal id to submit and query
// proposalCounter++
// s.T().Logf("Proposal number: %d", proposalCounter)

// s.fundCommunityPool(chainAAPIEndpoint, sender)

// s.T().Logf("Submitting Legacy Gov Proposal: Community Spend Funding Gov Module")
// s.submitLegacyGovProposal(chainAAPIEndpoint, sender, standardFees.String(), "community-pool-spend", proposalCounter, configFile("proposal.json"))
// s.T().Logf("Depositing Legacy Gov Proposal: Community Spend Funding Gov Module")
// s.depositGovProposal(chainAAPIEndpoint, sender, standardFees.String(), proposalCounter)
// s.T().Logf("Voting Legacy Gov Proposal: Community Spend Funding Gov Module")
// s.voteGovProposal(chainAAPIEndpoint, sender, standardFees.String(), proposalCounter, "yes", false)

// initialGovBalance, err := getSpecificBalance(chainAAPIEndpoint, govModuleAddress, uatomDenom)
// s.Require().NoError(err)
// proposalCounter++

// s.T().Logf("Submitting Gov Proposal: Sending Tokens from Gov Module to Recipient")
// s.submitNewGovProposal(chainAAPIEndpoint, sender, proposalCounter, configFile("proposal_2.json"))
// s.T().Logf("Depositing Gov Proposal: Sending Tokens from Gov Module to Recipient")
// s.depositGovProposal(chainAAPIEndpoint, sender, standardFees.String(), proposalCounter)
// s.T().Logf("Voting Gov Proposal: Sending Tokens from Gov Module to Recipient")
// s.voteGovProposal(chainAAPIEndpoint, sender, standardFees.String(), proposalCounter, "yes", false)
// s.Require().Eventually(
// func() bool {
// newGovBalance, err := getSpecificBalance(chainAAPIEndpoint, govModuleAddress, uatomDenom)
// s.Require().NoError(err)

// recipientBalance, err := getSpecificBalance(chainAAPIEndpoint, govSendMsgRecipientAddress, uatomDenom)
// s.Require().NoError(err)
// return newGovBalance.IsEqual(initialGovBalance.Sub(sendGovAmount)) && recipientBalance.Equal(initialGovBalance.Sub(newGovBalance))
// },
// 15*time.Second,
// 5*time.Second,
// )
// }
func (s *IntegrationTestSuite) SendTokensFromNewGovAccount() {
s.writeGovProposals(s.chainA)
chainAAPIEndpoint := fmt.Sprintf("http://%s", s.valResources[s.chainA.id][0].GetHostPort("1317/tcp"))
senderAddress := s.chainA.validators[0].keyInfo.GetAddress()
sender := senderAddress.String()
// Gov tests may be run in arbitrary order, each test must increment proposalCounter to have the correct proposal id to submit and query
proposalCounter++
s.T().Logf("Proposal number: %d", proposalCounter)

s.fundCommunityPool(chainAAPIEndpoint, sender)

s.T().Logf("Submitting Legacy Gov Proposal: Community Spend Funding Gov Module")
s.submitLegacyGovProposal(chainAAPIEndpoint, sender, standardFees.String(), "community-pool-spend", proposalCounter, configFile("proposal.json"))
s.T().Logf("Depositing Legacy Gov Proposal: Community Spend Funding Gov Module")
s.depositGovProposal(chainAAPIEndpoint, sender, standardFees.String(), proposalCounter)
s.T().Logf("Voting Legacy Gov Proposal: Community Spend Funding Gov Module")
s.voteGovProposal(chainAAPIEndpoint, sender, standardFees.String(), proposalCounter, "yes", false)

initialGovBalance, err := getSpecificBalance(chainAAPIEndpoint, govModuleAddress, uatomDenom)
s.Require().NoError(err)
proposalCounter++

s.T().Logf("Submitting Gov Proposal: Sending Tokens from Gov Module to Recipient")
s.submitNewGovProposal(chainAAPIEndpoint, sender, proposalCounter, configFile("proposal_2.json"))
s.T().Logf("Depositing Gov Proposal: Sending Tokens from Gov Module to Recipient")
s.depositGovProposal(chainAAPIEndpoint, sender, standardFees.String(), proposalCounter)
s.T().Logf("Voting Gov Proposal: Sending Tokens from Gov Module to Recipient")
s.voteGovProposal(chainAAPIEndpoint, sender, standardFees.String(), proposalCounter, "yes", false)
s.Require().Eventually(
func() bool {
newGovBalance, err := getSpecificBalance(chainAAPIEndpoint, govModuleAddress, uatomDenom)
s.Require().NoError(err)

recipientBalance, err := getSpecificBalance(chainAAPIEndpoint, govSendMsgRecipientAddress, uatomDenom)
s.Require().NoError(err)
return newGovBalance.IsEqual(initialGovBalance.Sub(sendGovAmount)) && recipientBalance.Equal(initialGovBalance.Sub(newGovBalance))
},
15*time.Second,
5*time.Second,
)
}

/*
GovSoftwareUpgrade tests passing a gov proposal to upgrade the chain at a given height.
@@ -69,47 +69,44 @@ Test Benchmarks:
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) GovSoftwareUpgrade() {
// chainAAPIEndpoint := fmt.Sprintf("http://%s", s.valResources[s.chainA.id][0].GetHostPort("1317/tcp"))
// senderAddress, err := s.chainA.validators[0].keyInfo.GetAddress()
// s.Require().NoError(err)
// 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++

// s.T().Logf("Writing proposal %d on chain %s", proposalCounter, s.chainA.id)
// s.writeGovUpgradeSoftwareProposal(s.chainA, proposalHeight)

// s.T().Logf("Submitting Gov Proposal: Software Upgrade")
// s.submitNewGovProposal(chainAAPIEndpoint, sender, proposalCounter, configFile("proposal_3.json"))
// s.T().Logf("Depositing Gov Proposal: Software Upgrade")
// s.depositGovProposal(chainAAPIEndpoint, sender, standardFees.String(), proposalCounter)
// s.T().Logf("Weighted Voting Gov Proposal: Software Upgrade")
// s.voteGovProposal(chainAAPIEndpoint, sender, standardFees.String(), proposalCounter, "yes=0.8,no=0.1,abstain=0.05,no_with_veto=0.05", 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 {
// h := s.getLatestBlockHeight(s.chainA, 0)
// s.Require().NoError(err)

// return h > 0
// },
// 30*time.Second,
// 5*time.Second,
// )

// proposalCounter = 0
// }
func (s *IntegrationTestSuite) GovSoftwareUpgrade() {
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++

s.T().Logf("Writing proposal %d on chain %s", proposalCounter, s.chainA.id)
s.writeGovUpgradeSoftwareProposal(s.chainA, proposalHeight)

s.T().Logf("Submitting Gov Proposal: Software Upgrade")
s.submitNewGovProposal(chainAAPIEndpoint, sender, proposalCounter, configFile("proposal_3.json"))
s.T().Logf("Depositing Gov Proposal: Software Upgrade")
s.depositGovProposal(chainAAPIEndpoint, sender, standardFees.String(), proposalCounter)
s.T().Logf("Weighted Voting Gov Proposal: Software Upgrade")
s.voteGovProposal(chainAAPIEndpoint, sender, standardFees.String(), proposalCounter, "yes=0.8,no=0.1,abstain=0.05,no_with_veto=0.05", 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 {
h := s.getLatestBlockHeight(s.chainA, 0)
return h > 0
},
30*time.Second,
5*time.Second,
)

proposalCounter = 0
}

/*
GovCancelSoftwareUpgrade tests passing a gov proposal that cancels a pending upgrade.
@@ -118,38 +115,38 @@ Test Benchmarks:
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) GovCancelSoftwareUpgrade() {

// chainAAPIEndpoint := fmt.Sprintf("http://%s", s.valResources[s.chainA.id][0].GetHostPort("1317/tcp"))
// senderAddress, err := s.chainA.validators[0].keyInfo.GetAddress()
// s.Require().NoError(err)
// 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++

// s.T().Logf("Writing proposal %d on chain %s", proposalCounter, s.chainA.id)
// s.writeGovUpgradeSoftwareProposal(s.chainA, proposalHeight)

// s.T().Logf("Submitting Gov Proposal: Software Upgrade")
// s.submitNewGovProposal(chainAAPIEndpoint, sender, proposalCounter, configFile("proposal_3.json"))
// s.depositGovProposal(chainAAPIEndpoint, sender, standardFees.String(), proposalCounter)
// s.voteGovProposal(chainAAPIEndpoint, sender, standardFees.String(), proposalCounter, "yes", false)

// proposalCounter++

// s.T().Logf("Writing proposal %d on chain %s", proposalCounter, s.chainA.id)
// s.writeGovCancelUpgradeSoftwareProposal(s.chainA)

// s.T().Logf("Submitting Gov Proposal: Cancel Software Upgrade")
// s.submitNewGovProposal(chainAAPIEndpoint, sender, proposalCounter, configFile("proposal_4.json"))
// s.depositGovProposal(chainAAPIEndpoint, sender, standardFees.String(), proposalCounter)
// s.voteGovProposal(chainAAPIEndpoint, sender, standardFees.String(), proposalCounter, "yes", false)

// s.verifyChainPassesUpgradeHeight(s.chainA, 0, proposalHeight)
// s.T().Logf("Successfully canceled upgrade at height %d", proposalHeight)
// }
func (s *IntegrationTestSuite) GovCancelSoftwareUpgrade() {

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++

s.T().Logf("Writing proposal %d on chain %s", proposalCounter, s.chainA.id)
s.writeGovUpgradeSoftwareProposal(s.chainA, proposalHeight)

s.T().Logf("Submitting Gov Proposal: Software Upgrade")
s.submitNewGovProposal(chainAAPIEndpoint, sender, proposalCounter, configFile("proposal_3.json"))
s.depositGovProposal(chainAAPIEndpoint, sender, standardFees.String(), proposalCounter)
s.voteGovProposal(chainAAPIEndpoint, sender, standardFees.String(), proposalCounter, "yes", false)

proposalCounter++

s.T().Logf("Writing proposal %d on chain %s", proposalCounter, s.chainA.id)
s.writeGovCancelUpgradeSoftwareProposal(s.chainA)

s.T().Logf("Submitting Gov Proposal: Cancel Software Upgrade")
s.submitNewGovProposal(chainAAPIEndpoint, sender, proposalCounter, configFile("proposal_4.json"))
s.depositGovProposal(chainAAPIEndpoint, sender, standardFees.String(), proposalCounter)
s.voteGovProposal(chainAAPIEndpoint, sender, standardFees.String(), proposalCounter, "yes", false)

s.verifyChainPassesUpgradeHeight(s.chainA, 0, proposalHeight)
s.T().Logf("Successfully canceled upgrade at height %d", proposalHeight)
}

/*
fundCommunityPool tests the funding of the community pool on behalf of the distribution module.
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.