Skip to content

Commit

Permalink
deps!: use cosmos-sdk v47-lsm and ics 3.3.x-lsm (#2920)
Browse files Browse the repository at this point in the history
* deps!: use cosmos-sdk v47-lsm and ics 3.3.x-lsm

* fix: correctly use submit-proposal tx in gov e2e
  • Loading branch information
MSalopek authored Feb 2, 2024
1 parent 650e9e1 commit af052c7
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 33 deletions.
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ replace (
github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0

// Use special SDK v0.47.x release with support for both ICS and LSM
github.com/cosmos/cosmos-sdk => github.com/cosmos/cosmos-sdk v0.47.7-0.20240131111736-17d5f73db4ab
github.com/cosmos/cosmos-sdk => github.com/cosmos/cosmos-sdk v0.47.7-0.20240202092001-7a03edbbb4fb

// TODO: remove it: https://github.com/cosmos/cosmos-sdk/issues/13134
github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2
Expand All @@ -234,3 +234,5 @@ replace (
// the following version across all dependencies.
google.golang.org/grpc => google.golang.org/grpc v1.54.0
)

replace github.com/cosmos/interchain-security/v3 => github.com/cosmos/interchain-security/v3 v3.3.1-0.20240201164551-bde0df5adfef
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -600,8 +600,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk=
github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis=
github.com/cosmos/cosmos-proto v1.0.0-beta.2 h1:X3OKvWgK9Gsejo0F1qs5l8Qn6xJV/AzgIWR2wZ8Nua8=
github.com/cosmos/cosmos-proto v1.0.0-beta.2/go.mod h1:+XRCLJ14pr5HFEHIUcn51IKXD1Fy3rkEQqt4WqmN4V0=
github.com/cosmos/cosmos-sdk v0.47.7-0.20240131111736-17d5f73db4ab h1:RayaSUazD63ZBcvw7DQ3RZ247ao7jwp6SWkiinUqnhQ=
github.com/cosmos/cosmos-sdk v0.47.7-0.20240131111736-17d5f73db4ab/go.mod h1:Rx0pFb7vaFKsgRjFpBzUB+1HT4sQm11MHADdkpJlvuc=
github.com/cosmos/cosmos-sdk v0.47.7-0.20240202092001-7a03edbbb4fb h1:DkGuGNs3PIndGvPysqME2QsEsz5JFeNsg9hmNSM8YEk=
github.com/cosmos/cosmos-sdk v0.47.7-0.20240202092001-7a03edbbb4fb/go.mod h1:Rx0pFb7vaFKsgRjFpBzUB+1HT4sQm11MHADdkpJlvuc=
github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y=
github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY=
github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw=
Expand All @@ -618,8 +618,8 @@ github.com/cosmos/ibc-go/v7 v7.3.1 h1:bil1IjnHdyWDASFYKfwdRiNtFP6WK3osW7QFEAgU4I
github.com/cosmos/ibc-go/v7 v7.3.1/go.mod h1:wvx4pPBofe5ZdMNV3OFRxSI4auEP5Qfqf8JXLLNV04g=
github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM=
github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0=
github.com/cosmos/interchain-security/v3 v3.3.0 h1:bY+C7kV/A3ZTSxrl9ObPVC2c3uq0i+RaCSkNiLW+3i4=
github.com/cosmos/interchain-security/v3 v3.3.0/go.mod h1:oeYBia11vnQ+45Hv/Ti3TkjJQcrmB2Ob0qD+FB7Qt2A=
github.com/cosmos/interchain-security/v3 v3.3.1-0.20240201164551-bde0df5adfef h1:OF0aInyyWvt2Tf7gOh9+osMaWf24NbAztmJ8CVaiKRk=
github.com/cosmos/interchain-security/v3 v3.3.1-0.20240201164551-bde0df5adfef/go.mod h1:Q89a787cM5Ag+lw7diP/HCqfQnZMpnDKfWLdUNyuRFM=
github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo=
github.com/cosmos/keyring v1.2.0/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA=
github.com/cosmos/ledger-cosmos-go v0.12.4 h1:drvWt+GJP7Aiw550yeb3ON/zsrgW0jgh5saFCr7pDnw=
Expand Down
13 changes: 6 additions & 7 deletions tests/e2e/e2e_gov_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ func (s *IntegrationTestSuite) GovCommunityPoolSpend() {
submitGovFlags := []string{configFile(proposalCommunitySpendFilename)}
depositGovFlags := []string{strconv.Itoa(proposalCounter), depositAmount.String()}
voteGovFlags := []string{strconv.Itoa(proposalCounter), "yes"}
// TODO: replace proposal type by distrtypes.ProposalTypeCommunityPoolSpend equivalent in SDK v0.47
s.submitGovProposal(chainAAPIEndpoint, sender, proposalCounter, "CommunityPoolSpend", submitGovFlags, depositGovFlags, voteGovFlags, "vote", false)
s.submitGovProposal(chainAAPIEndpoint, sender, proposalCounter, "CommunityPoolSpend", submitGovFlags, depositGovFlags, voteGovFlags, "vote")

s.Require().Eventually(
func() bool {
Expand Down Expand Up @@ -160,13 +159,13 @@ func (s *IntegrationTestSuite) submitLegacyGovProposal(chainAAPIEndpoint, sender
s.submitGovCommand(chainAAPIEndpoint, sender, proposalID, voteCommand, voteFlags, govtypesv1beta1.StatusPassed)
}

func (s *IntegrationTestSuite) submitGovProposal(chainAAPIEndpoint, sender string, proposalID int, proposalType string, submitFlags []string, depositFlags []string, voteFlags []string, voteCommand string, withDeposit bool) {
// NOTE: in SDK >= v0.47 the submit-proposal does not have a --deposit flag
// Instead, the depoist is added to the "deposit" field of the proposal JSON (usually stored as a file)
// you can use `gaiad tx gov draft-proposal` to create a proposal file that you can use
// min initial deposit of 100uatom 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) {
s.T().Logf("Submitting Gov Proposal: %s", proposalType)
// min deposit of 1000uatom is required in e2e tests, otherwise the gov antehandler causes the proposal to be dropped
sflags := submitFlags
if withDeposit {
sflags = append(sflags, "--deposit=1000uatom")
}
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)
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/e2e_lsm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (s *IntegrationTestSuite) testLSM() {
// gov proposing LSM parameters (global liquid staking cap, validator liquid staking cap, validator bond factor)
s.T().Logf("Proposal number: %d", proposalCounter)
s.T().Logf("Submitting, deposit and vote legacy Gov Proposal: Set parameters (global liquid staking cap, validator liquid staking cap, validator bond factor)")
s.submitGovProposal(chainEndpoint, validatorAAddr.String(), proposalCounter, "stakingtypes.MsgUpdateProposal", submitGovFlags, depositGovFlags, voteGovFlags, "vote", false)
s.submitGovProposal(chainEndpoint, validatorAAddr.String(), proposalCounter, "stakingtypes.MsgUpdateProposal", submitGovFlags, depositGovFlags, voteGovFlags, "vote")

// query the proposal status and new fee
s.Require().Eventually(
Expand Down
42 changes: 22 additions & 20 deletions tests/e2e/e2e_setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import (
evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
)
Expand Down Expand Up @@ -874,25 +873,28 @@ func (s *IntegrationTestSuite) writeGovParamChangeProposalMaxTotalBypass(c *chai
}

func (s *IntegrationTestSuite) writeGovCommunitySpendProposal(c *chain, amount sdk.Coin, recipient string) {
msg := &distrtypes.MsgCommunityPoolSpend{
Authority: govModuleAddress,
Recipient: recipient,
Amount: sdk.Coins{amount},
template := `
{
"messages":[
{
"@type": "/cosmos.distribution.v1beta1.MsgCommunityPoolSpend",
"authority": "%s",
"recipient": "%s",
"amount": [{
"denom": "%s",
"amount": "%s"
}]
}
],
"deposit": "100uatom",
"proposer": "Proposing validator address",
"metadata": "Community Pool Spend",
"title": "Fund Team!",
"summary": "summary"
}

proposalCommSpend, err := govv1.NewMsgSubmitProposal(
[]sdk.Msg{msg},
sdk.Coins{sdk.NewCoin(uatomDenom, sdk.NewInt(100))},
"JohnGalt",
"Community Pool Spend",
"Fund Team!",
"summary",
)
s.Require().NoError(err)
res, err := cdc.MarshalInterfaceJSON(proposalCommSpend)
s.Require().NoError(err)

err = writeFile(filepath.Join(c.validators[0].configDir(), "config", proposalCommunitySpendFilename), res)
`
propMsgBody := fmt.Sprintf(template, govModuleAddress, recipient, amount.Denom, amount.Amount.String())
err := writeFile(filepath.Join(c.validators[0].configDir(), "config", proposalCommunitySpendFilename), []byte(propMsgBody))
s.Require().NoError(err)
}

Expand Down Expand Up @@ -931,7 +933,7 @@ func (s *IntegrationTestSuite) writeLiquidStakingParamsUpdateProposal(c *chain,
}
],
"metadata": "ipfs://CID",
"deposit": "0uatom",
"deposit": "100uatom",
"title": "Update LSM Params",
"summary": "e2e-test updating LSM staking params"
}`
Expand Down

0 comments on commit af052c7

Please sign in to comment.