diff --git a/Makefile b/Makefile index 56a27362075..5ccde424a43 100644 --- a/Makefile +++ b/Makefile @@ -243,7 +243,7 @@ test-sim-app: test-sim-determinism: @VERSION=$(VERSION) go test -mod=readonly -run ^TestAppStateDeterminism -v $(PACKAGES_SIM) -test-sim-benchmark: +test-sim-bench: @VERSION=$(VERSION) go test -benchmem -run ^BenchmarkFullAppSimulation -bench ^BenchmarkFullAppSimulation -cpuprofile cpu.out $(PACKAGES_SIM) test-e2e: diff --git a/go.mod b/go.mod index 9daa2a8ba19..131cbf49e15 100644 --- a/go.mod +++ b/go.mod @@ -287,8 +287,8 @@ require ( replace ( // branch: v0.27.0.rc3-osmo, current tag: v0.27.0.rc3-osmo github.com/CosmWasm/wasmd => github.com/osmosis-labs/wasmd v0.27.0-rc2.0.20220517191021-59051aa18d58 - // Our cosmos-sdk branch is: https://github.com/osmosis-labs/cosmos-sdk, current tag: 0.45.0x-osmo-v11-alpha.5 current branch: osmosis-main - github.com/cosmos/cosmos-sdk => github.com/osmosis-labs/cosmos-sdk v0.45.1-0.20220727221653-51bfa90799ee + // Our cosmos-sdk branch is: https://github.com/osmosis-labs/cosmos-sdk, current tag: 0.45.0x-osmo-v12-alpha.1 current branch: osmosis-main + github.com/cosmos/cosmos-sdk => github.com/osmosis-labs/cosmos-sdk v0.45.1-0.20220808173601-02273b880e44 // Use Osmosis fast iavl github.com/cosmos/iavl => github.com/osmosis-labs/iavl v0.17.3-osmo-v7 // use cosmos-compatible protobufs diff --git a/go.sum b/go.sum index 42db544bd2d..2f8cf6823ac 100644 --- a/go.sum +++ b/go.sum @@ -1104,8 +1104,8 @@ github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4 github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= github.com/ory/dockertest/v3 v3.9.1 h1:v4dkG+dlu76goxMiTT2j8zV7s4oPPEppKT8K8p2f1kY= github.com/ory/dockertest/v3 v3.9.1/go.mod h1:42Ir9hmvaAPm0Mgibk6mBPi7SFvTXxEcnztDYOJ//uM= -github.com/osmosis-labs/cosmos-sdk v0.45.1-0.20220727221653-51bfa90799ee h1:JUWaacaNfxC0IxxkpC/MsJozi1eKQztZX+Wa9OU6+cw= -github.com/osmosis-labs/cosmos-sdk v0.45.1-0.20220727221653-51bfa90799ee/go.mod h1:uUkGXyCWol+CHoaMxZA0nKglvlN5uHBCMbMSsZoGSAs= +github.com/osmosis-labs/cosmos-sdk v0.45.1-0.20220808173601-02273b880e44 h1:mjsR4jDM16FYVkh5ZQv6IRcPheU3yG60t1KetG8FEPU= +github.com/osmosis-labs/cosmos-sdk v0.45.1-0.20220808173601-02273b880e44/go.mod h1:uUkGXyCWol+CHoaMxZA0nKglvlN5uHBCMbMSsZoGSAs= github.com/osmosis-labs/go-mutesting v0.0.0-20220811235203-65a53b4ea8e3 h1:/imbKy8s1I+z7wx4FbRHOXK2v82xesUCz2EPUqfBDIg= github.com/osmosis-labs/go-mutesting v0.0.0-20220811235203-65a53b4ea8e3/go.mod h1:lV6KnqXYD/ayTe7310MHtM3I2q8Z6bBfMAi+bhwPYtI= github.com/osmosis-labs/iavl v0.17.3-osmo-v7 h1:6KcADC/WhL7yDmNQxUIJt2XmzNt4FfRmq9gRke45w74= diff --git a/tests/e2e/configurer/chain/chain.go b/tests/e2e/configurer/chain/chain.go index 069bda55ad9..6ae9ed57c2d 100644 --- a/tests/e2e/configurer/chain/chain.go +++ b/tests/e2e/configurer/chain/chain.go @@ -9,6 +9,8 @@ import ( "github.com/stretchr/testify/require" coretypes "github.com/tendermint/tendermint/rpc/core/types" + "github.com/osmosis-labs/osmosis/v11/tests/e2e/configurer/config" + "github.com/osmosis-labs/osmosis/v11/tests/e2e/containers" "github.com/osmosis-labs/osmosis/v11/tests/e2e/initialization" ) @@ -18,7 +20,8 @@ type Config struct { ValidatorInitConfigs []*initialization.NodeConfig // voting period is number of blocks it takes to deposit, 1.2 seconds per validator to vote on the prop, and a buffer. - VotingPeriod float32 + VotingPeriod float32 + ExpeditedVotingPeriod float32 // upgrade proposal height for chain. UpgradePropHeight int64 LatestProposalNumber int @@ -40,13 +43,16 @@ const ( ) func New(t *testing.T, containerManager *containers.Manager, id string, initValidatorConfigs []*initialization.NodeConfig) *Config { + numVal := float32(len(initValidatorConfigs)) return &Config{ ChainMeta: initialization.ChainMeta{ Id: id, }, - ValidatorInitConfigs: initValidatorConfigs, - t: t, - containerManager: containerManager, + ValidatorInitConfigs: initValidatorConfigs, + VotingPeriod: config.PropDepositBlocks + numVal*config.PropVoteBlocks + config.PropBufferBlocks, + ExpeditedVotingPeriod: config.PropDepositBlocks + numVal*config.PropVoteBlocks + config.PropBufferBlocks - 1, + t: t, + containerManager: containerManager, } } diff --git a/tests/e2e/configurer/chain/commands.go b/tests/e2e/configurer/chain/commands.go index cefcfbb7173..58db7c53dfb 100644 --- a/tests/e2e/configurer/chain/commands.go +++ b/tests/e2e/configurer/chain/commands.go @@ -5,6 +5,7 @@ import ( "regexp" "strconv" "strings" + "time" appparams "github.com/osmosis-labs/osmosis/v11/app/params" "github.com/osmosis-labs/osmosis/v11/tests/e2e/configurer/config" @@ -37,17 +38,24 @@ func (n *NodeConfig) SubmitSuperfluidProposal(asset string, initialDeposit sdk.C n.LogActionF("successfully submitted superfluid proposal for asset %s", asset) } -func (n *NodeConfig) SubmitTextProposal(text string, initialDeposit sdk.Coin) { +func (n *NodeConfig) SubmitTextProposal(text string, initialDeposit sdk.Coin, isExpedited bool) { n.LogActionF("submitting text gov proposal") cmd := []string{"osmosisd", "tx", "gov", "submit-proposal", "--type=text", fmt.Sprintf("--title=\"%s\"", text), "--description=\"test text proposal\"", "--from=val", fmt.Sprintf("--deposit=%s", initialDeposit)} + if isExpedited { + cmd = append(cmd, "--is-expedited=true") + } _, _, err := n.containerManager.ExecTxCmd(n.t, n.chainId, n.Name, cmd) require.NoError(n.t, err) n.LogActionF("successfully submitted text gov proposal") } -func (n *NodeConfig) DepositProposal(proposalNumber int) { +func (n *NodeConfig) DepositProposal(proposalNumber int, isExpedited bool) { n.LogActionF("depositing on proposal: %d", proposalNumber) - cmd := []string{"osmosisd", "tx", "gov", "deposit", fmt.Sprintf("%d", proposalNumber), sdk.NewCoin(appparams.BaseCoinUnit, sdk.NewInt(config.MinDepositValue)).String(), "--from=val"} + deposit := sdk.NewCoin(appparams.BaseCoinUnit, sdk.NewInt(config.MinDepositValue)).String() + if isExpedited { + deposit = sdk.NewCoin(appparams.BaseCoinUnit, sdk.NewInt(config.MinExpeditedDepositValue)).String() + } + cmd := []string{"osmosisd", "tx", "gov", "deposit", fmt.Sprintf("%d", proposalNumber), deposit, "--from=val"} _, _, err := n.containerManager.ExecTxCmd(n.t, n.chainId, n.Name, cmd) require.NoError(n.t, err) n.LogActionF("successfully deposited on proposal %d", proposalNumber) @@ -105,3 +113,23 @@ func (n *NodeConfig) CreateWallet(walletName string) string { n.LogActionF("created wallet %s, waller address - %s", walletName, walletAddr) return walletAddr } + +func (n *NodeConfig) QueryPropStatusTimed(proposalNumber int, desiredStatus string, totalTime chan time.Duration) { + start := time.Now() + require.Eventually( + n.t, + func() bool { + status, err := n.QueryPropStatus(proposalNumber) + if err != nil { + return false + } + + return status == desiredStatus + }, + 1*time.Minute, + 10*time.Millisecond, + "Osmosis node failed to retrieve prop tally", + ) + elapsed := time.Since(start) + totalTime <- elapsed +} diff --git a/tests/e2e/configurer/chain/queries.go b/tests/e2e/configurer/chain/queries.go index c6a899229a3..fad12937c86 100644 --- a/tests/e2e/configurer/chain/queries.go +++ b/tests/e2e/configurer/chain/queries.go @@ -77,6 +77,20 @@ func (n *NodeConfig) QueryPropTally(proposalNumber int) (sdk.Int, sdk.Int, sdk.I return noTotal, yesTotal, noWithVetoTotal, abstainTotal, nil } +func (n *NodeConfig) QueryPropStatus(proposalNumber int) (string, error) { + path := fmt.Sprintf("cosmos/gov/v1beta1/proposals/%d", proposalNumber) + bz, err := n.QueryGRPCGateway(path) + require.NoError(n.t, err) + + var propResp govtypes.QueryProposalResponse + if err := util.Cdc.UnmarshalJSON(bz, &propResp); err != nil { + return "", err + } + proposalStatus := propResp.Proposal.Status + + return proposalStatus.String(), nil +} + func (n *NodeConfig) QueryIntermediaryAccount(denom string, valAddr string) (int, error) { intAccount := superfluidtypes.GetSuperfluidIntermediaryAccountAddr(denom, valAddr) path := fmt.Sprintf( diff --git a/tests/e2e/configurer/config/constants.go b/tests/e2e/configurer/config/constants.go index 64321c5c4fb..c9138fae8a4 100644 --- a/tests/e2e/configurer/config/constants.go +++ b/tests/e2e/configurer/config/constants.go @@ -20,6 +20,10 @@ const ( var ( // Minimum deposit value for a proposal to enter a voting period. MinDepositValue = govtypes.DefaultMinDepositTokens.Int64() + // Minimum expedited deposit value for a proposal to enter a voting period. + MinExpeditedDepositValue = govtypes.DefaultMinExpeditedDepositTokens.Int64() // Minimum deposit value for proposal to be submitted. InitialMinDeposit = MinDepositValue / 4 + // Minimum expedited deposit value for proposal to be submitted. + InitialMinExpeditedDeposit = MinExpeditedDepositValue / 4 ) diff --git a/tests/e2e/configurer/current.go b/tests/e2e/configurer/current.go index b67dc5fe0a9..00db1a53736 100644 --- a/tests/e2e/configurer/current.go +++ b/tests/e2e/configurer/current.go @@ -44,7 +44,8 @@ func (cb *CurrentBranchConfigurer) ConfigureChain(chainConfig *chain.Config) err return err } cb.t.Logf("temp directory for chain-id %v: %v", chainConfig.Id, tmpDir) - initializedChain, err := initialization.InitChain(chainConfig.Id, tmpDir, chainConfig.ValidatorInitConfigs, time.Duration(chainConfig.VotingPeriod), 0) + + initializedChain, err := initialization.InitChain(chainConfig.Id, tmpDir, chainConfig.ValidatorInitConfigs, time.Duration(chainConfig.VotingPeriod*1000000000), time.Duration(chainConfig.ExpeditedVotingPeriod*1000000000), 0) if err != nil { return err } diff --git a/tests/e2e/configurer/upgrade.go b/tests/e2e/configurer/upgrade.go index 5ee6885db40..ad61502b7f6 100644 --- a/tests/e2e/configurer/upgrade.go +++ b/tests/e2e/configurer/upgrade.go @@ -60,9 +60,6 @@ func (uc *UpgradeConfigurer) ConfigureChain(chainConfig *chain.Config) error { return err } - numVal := float32(len(chainConfig.ValidatorInitConfigs)) - chainConfig.VotingPeriod = config.PropDepositBlocks + numVal*config.PropVoteBlocks + config.PropBufferBlocks - validatorConfigBytes, err := json.Marshal(chainConfig.ValidatorInitConfigs) if err != nil { return err @@ -73,7 +70,7 @@ func (uc *UpgradeConfigurer) ConfigureChain(chainConfig *chain.Config) error { forkHeight = forkHeight - config.ForkHeightPreUpgradeOffset } - chainInitResource, err := uc.containerManager.RunChainInitResource(chainConfig.Id, int(chainConfig.VotingPeriod), validatorConfigBytes, tmpDir, int(forkHeight)) + chainInitResource, err := uc.containerManager.RunChainInitResource(chainConfig.Id, int(chainConfig.VotingPeriod), int(chainConfig.ExpeditedVotingPeriod), validatorConfigBytes, tmpDir, int(forkHeight)) if err != nil { return err } @@ -154,7 +151,7 @@ func (uc *UpgradeConfigurer) runProposalUpgrade() error { chainConfig.UpgradePropHeight = currentHeight + int64(chainConfig.VotingPeriod) + int64(config.PropSubmitBlocks) + int64(config.PropBufferBlocks) node.SubmitUpgradeProposal(uc.upgradeVersion, chainConfig.UpgradePropHeight, sdk.NewCoin(appparams.BaseCoinUnit, sdk.NewInt(config.InitialMinDeposit))) chainConfig.LatestProposalNumber += 1 - node.DepositProposal(chainConfig.LatestProposalNumber) + node.DepositProposal(chainConfig.LatestProposalNumber, false) } node.VoteYesProposal(initialization.ValidatorWalletName, chainConfig.LatestProposalNumber) } diff --git a/tests/e2e/containers/containers.go b/tests/e2e/containers/containers.go index deae5a28899..1ac09b882f7 100644 --- a/tests/e2e/containers/containers.go +++ b/tests/e2e/containers/containers.go @@ -229,8 +229,10 @@ func (m *Manager) RunNodeResource(chainId string, containerName, valCondifDir st // The genesis and configs are to be mounted on the init container as volume on mountDir path. // Returns the container resource and error if any. This method does not Purge the container. The caller // must deal with removing the resource. -func (m *Manager) RunChainInitResource(chainId string, chainVotingPeriod int, validatorConfigBytes []byte, mountDir string, forkHeight int) (*dockertest.Resource, error) { +func (m *Manager) RunChainInitResource(chainId string, chainVotingPeriod, chainExpeditedVotingPeriod int, validatorConfigBytes []byte, mountDir string, forkHeight int) (*dockertest.Resource, error) { votingPeriodDuration := time.Duration(chainVotingPeriod * 1000000000) + // TODO: Uncomment this after v12 release + //expeditedVotingPeriodDuration := time.Duration(chainExpeditedVotingPeriod * 1000000000) initResource, err := m.pool.RunWithOptions( &dockertest.RunOptions{ @@ -243,6 +245,8 @@ func (m *Manager) RunChainInitResource(chainId string, chainVotingPeriod int, va fmt.Sprintf("--chain-id=%s", chainId), fmt.Sprintf("--config=%s", validatorConfigBytes), fmt.Sprintf("--voting-period=%v", votingPeriodDuration), + // TODO: Uncomment this after v12 release + //fmt.Sprintf("--expedited-voting-period=%v", expeditedVotingPeriodDuration), fmt.Sprintf("--fork-height=%v", forkHeight), }, User: "root:root", diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go index 809e006330b..4fab2c21113 100644 --- a/tests/e2e/e2e_test.go +++ b/tests/e2e/e2e_test.go @@ -58,7 +58,7 @@ func (s *IntegrationTestSuite) TestSuperfluidVoting() { // enable superfluid via proposal. node.SubmitSuperfluidProposal("gamm/pool/1", sdk.NewCoin(appparams.BaseCoinUnit, sdk.NewInt(config.InitialMinDeposit))) chain.LatestProposalNumber += 1 - node.DepositProposal(chain.LatestProposalNumber) + node.DepositProposal(chain.LatestProposalNumber, false) for _, node := range chain.NodeConfigs { node.VoteYesProposal(initialization.ValidatorWalletName, chain.LatestProposalNumber) } @@ -73,9 +73,9 @@ func (s *IntegrationTestSuite) TestSuperfluidVoting() { node.SuperfluidDelegate(chain.LatestLockNumber, chain.NodeConfigs[1].OperatorAddress, walletName) // create a text prop, deposit and vote yes - node.SubmitTextProposal("superfluid vote overwrite test", sdk.NewCoin(appparams.BaseCoinUnit, sdk.NewInt(config.InitialMinDeposit))) + node.SubmitTextProposal("superfluid vote overwrite test", sdk.NewCoin(appparams.BaseCoinUnit, sdk.NewInt(config.InitialMinDeposit)), false) chain.LatestProposalNumber += 1 - node.DepositProposal(chain.LatestProposalNumber) + node.DepositProposal(chain.LatestProposalNumber, false) for _, node := range chain.NodeConfigs { node.VoteYesProposal(initialization.ValidatorWalletName, chain.LatestProposalNumber) } @@ -161,6 +161,7 @@ func (s *IntegrationTestSuite) TestStateSync() { filepath.Join(runningNode.ConfigDir, "config", "genesis.json"), stateSynchingNodeConfig, time.Duration(chain.VotingPeriod), + //time.Duration(chain.ExpeditedVotingPeriod), trustHeight, trustHash, stateSyncRPCServers, @@ -214,3 +215,39 @@ func (s *IntegrationTestSuite) TestStateSync() { err = chain.RemoveNode(stateSynchingNode.Name) s.NoError(err) } + +func (s *IntegrationTestSuite) TestExpeditedProposals() { + if !s.skipUpgrade { + s.T().Skip("this can be re-enabled post v12") + } + + chain := s.configurer.GetChainConfig(0) + node, err := chain.GetDefaultNode() + s.NoError(err) + + node.SubmitTextProposal("expedited text proposal", sdk.NewCoin(appparams.BaseCoinUnit, sdk.NewInt(config.InitialMinExpeditedDeposit)), true) + chain.LatestProposalNumber += 1 + node.DepositProposal(chain.LatestProposalNumber, true) + totalTimeChan := make(chan time.Duration, 1) + go node.QueryPropStatusTimed(chain.LatestProposalNumber, "PROPOSAL_STATUS_PASSED", totalTimeChan) + for _, node := range chain.NodeConfigs { + node.VoteYesProposal(initialization.ValidatorWalletName, chain.LatestProposalNumber) + } + // if querying proposal takes longer than timeoutPeriod, stop the goroutine and error + var elapsed time.Duration + timeoutPeriod := time.Duration(2 * time.Minute) + select { + case elapsed = <-totalTimeChan: + case <-time.After(timeoutPeriod): + err := fmt.Errorf("go routine took longer than %s", timeoutPeriod) + s.Require().NoError(err) + } + + // compare the time it took to reach pass status to expected expedited voting period + expeditedVotingPeriodDuration := time.Duration(chain.ExpeditedVotingPeriod * 1000000000) + timeDelta := elapsed - expeditedVotingPeriodDuration + // ensure delta is within one second of expected time + s.Require().Less(timeDelta, time.Second) + s.T().Logf("expeditedVotingPeriodDuration within one second of expected time: %v", timeDelta) + close(totalTimeChan) +} diff --git a/tests/e2e/initialization/chain/main.go b/tests/e2e/initialization/chain/main.go index dfcc725bcf4..c5c417ac286 100644 --- a/tests/e2e/initialization/chain/main.go +++ b/tests/e2e/initialization/chain/main.go @@ -12,18 +12,20 @@ import ( func main() { var ( - valConfig []*initialization.NodeConfig - dataDir string - chainId string - config string - votingPeriod time.Duration - forkHeight int + valConfig []*initialization.NodeConfig + dataDir string + chainId string + config string + votingPeriod time.Duration + expeditedVotingPeriod time.Duration + forkHeight int ) flag.StringVar(&dataDir, "data-dir", "", "chain data directory") flag.StringVar(&chainId, "chain-id", "", "chain ID") flag.StringVar(&config, "config", "", "serialized config") flag.DurationVar(&votingPeriod, "voting-period", 30000000000, "voting period") + flag.DurationVar(&expeditedVotingPeriod, "expedited-voting-period", 20000000000, "expedited voting period") flag.IntVar(&forkHeight, "fork-height", 0, "fork height") flag.Parse() @@ -41,7 +43,7 @@ func main() { panic(err) } - createdChain, err := initialization.InitChain(chainId, dataDir, valConfig, votingPeriod, forkHeight) + createdChain, err := initialization.InitChain(chainId, dataDir, valConfig, votingPeriod, expeditedVotingPeriod, forkHeight) if err != nil { panic(err) } diff --git a/tests/e2e/initialization/config.go b/tests/e2e/initialization/config.go index 30dbf4a423f..7be50eef47e 100644 --- a/tests/e2e/initialization/config.go +++ b/tests/e2e/initialization/config.go @@ -74,6 +74,7 @@ var ( OsmoToken = sdk.NewInt64Coin(OsmoDenom, IbcSendAmount) // 3,300uosmo StakeToken = sdk.NewInt64Coin(StakeDenom, IbcSendAmount) // 3,300ustake tenOsmo = sdk.Coins{sdk.NewInt64Coin(OsmoDenom, 10_000_000)} + fiftyOsmo = sdk.Coins{sdk.NewInt64Coin(OsmoDenom, 50_000_000)} ) func addAccount(path, moniker, amountStr string, accAddr sdk.AccAddress, forkHeight int) error { @@ -166,7 +167,7 @@ func updateModuleGenesis[V proto.Message](appGenState map[string]json.RawMessage return nil } -func initGenesis(chain *internalChain, votingPeriod time.Duration, forkHeight int) error { +func initGenesis(chain *internalChain, votingPeriod, expeditedVotingPeriod time.Duration, forkHeight int) error { // initialize a genesis file configDir := chain.nodes[0].configDir() for _, val := range chain.nodes { @@ -249,7 +250,7 @@ func initGenesis(chain *internalChain, votingPeriod time.Duration, forkHeight in return err } - err = updateModuleGenesis(appGenState, govtypes.ModuleName, &govtypes.GenesisState{}, updateGovGenesis(votingPeriod)) + err = updateModuleGenesis(appGenState, govtypes.ModuleName, &govtypes.GenesisState{}, updateGovGenesis(votingPeriod, expeditedVotingPeriod)) if err != nil { return err } @@ -358,12 +359,12 @@ func updateCrisisGenesis(crisisGenState *crisistypes.GenesisState) { crisisGenState.ConstantFee.Denom = OsmoDenom } -func updateGovGenesis(votingPeriod time.Duration) func(*govtypes.GenesisState) { +func updateGovGenesis(votingPeriod, expeditedVotingPeriod time.Duration) func(*govtypes.GenesisState) { return func(govGenState *govtypes.GenesisState) { - govGenState.VotingParams = govtypes.VotingParams{ - VotingPeriod: votingPeriod, - } + govGenState.VotingParams.VotingPeriod = votingPeriod + govGenState.VotingParams.ExpeditedVotingPeriod = expeditedVotingPeriod govGenState.DepositParams.MinDeposit = tenOsmo + govGenState.DepositParams.MinExpeditedDeposit = fiftyOsmo } } diff --git a/tests/e2e/initialization/init.go b/tests/e2e/initialization/init.go index fabdd9de1cf..44b8164c90b 100644 --- a/tests/e2e/initialization/init.go +++ b/tests/e2e/initialization/init.go @@ -9,7 +9,7 @@ import ( "github.com/osmosis-labs/osmosis/v11/tests/e2e/util" ) -func InitChain(id, dataDir string, nodeConfigs []*NodeConfig, votingPeriod time.Duration, forkHeight int) (*Chain, error) { +func InitChain(id, dataDir string, nodeConfigs []*NodeConfig, votingPeriod, expeditedVotingPeriod time.Duration, forkHeight int) (*Chain, error) { chain, err := new(id, dataDir) if err != nil { return nil, err @@ -23,7 +23,7 @@ func InitChain(id, dataDir string, nodeConfigs []*NodeConfig, votingPeriod time. chain.nodes = append(chain.nodes, newNode) } - if err := initGenesis(chain, votingPeriod, forkHeight); err != nil { + if err := initGenesis(chain, votingPeriod, expeditedVotingPeriod, forkHeight); err != nil { return nil, err } diff --git a/tests/e2e/initialization/init_test.go b/tests/e2e/initialization/init_test.go index e4e64ccc48c..4771ff9d1a9 100644 --- a/tests/e2e/initialization/init_test.go +++ b/tests/e2e/initialization/init_test.go @@ -51,7 +51,7 @@ func TestChainInit(t *testing.T) { dataDir, err = os.MkdirTemp("", "osmosis-e2e-testnet-test") ) - chain, err := initialization.InitChain(id, dataDir, nodeConfigs, time.Second*3, forkHeight) + chain, err := initialization.InitChain(id, dataDir, nodeConfigs, time.Second*3, time.Second, forkHeight) require.NoError(t, err) require.Equal(t, chain.ChainMeta.DataDir, dataDir) @@ -109,7 +109,7 @@ func TestSingleNodeInit(t *testing.T) { ) // Setup - existingChain, err := initialization.InitChain(id, dataDir, existingChainNodeConfigs, time.Second*3, forkHeight) + existingChain, err := initialization.InitChain(id, dataDir, existingChainNodeConfigs, time.Second*3, time.Second, forkHeight) require.NoError(t, err) actualNode, err := initialization.InitSingleNode(existingChain.ChainMeta.Id, dataDir, filepath.Join(existingChain.Nodes[0].ConfigDir, "config", "genesis.json"), expectedConfig, time.Second*3, 3, "testHash", []string{"some server"}, []string{"some server"}) diff --git a/x/mint/keeper/keeper_test.go b/x/mint/keeper/keeper_test.go index 4fd75e814f6..b2f1a9e621a 100644 --- a/x/mint/keeper/keeper_test.go +++ b/x/mint/keeper/keeper_test.go @@ -336,6 +336,11 @@ func (suite *KeeperTestSuite) TestSetInitialSupplyOffsetDuringMigration() { bankKeeper := suite.App.BankKeeper mintKeeper := suite.App.MintKeeper + // in order to ensure the offset is correctly calculated, we need to mint the supply + 1 + // this is because a negative supply offset will always return zero + // by setting this to the supply + 1, we ensure we are correctly calculating the offset by keeping it delta positive + mintKeeper.MintCoins(ctx, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(keeper.DeveloperVestingAmount+1)))) + supplyWithOffsetBefore := bankKeeper.GetSupplyWithOffset(ctx, sdk.DefaultBondDenom) supplyOffsetBefore := bankKeeper.GetSupplyOffset(ctx, sdk.DefaultBondDenom)