Unverified Commit 4fed7db0 authored by Adam Tucker's avatar Adam Tucker Committed by GitHub
Browse files

chore: v13 e2e and upgrade boilerplate (#2967)


* v13 handler and e2e updates

* v13 e2e changes w boilerplate

* add errors

* lint

* ran gofumpt

Co-authored-by: default avatarNicolas Lara <nicolaslara@gmail.com>
parent 7b5abef0
Showing with 46 additions and 25 deletions
+46 -25
......@@ -7,7 +7,7 @@ SDK_PACK := $(shell go list -m github.com/cosmos/cosmos-sdk | sed 's/ /\@/g')
GO_VERSION := $(shell cat go.mod | grep -E 'go [0-9].[0-9]+' | cut -d ' ' -f 2)
DOCKER := $(shell which docker)
BUILDDIR ?= $(CURDIR)/build
E2E_UPGRADE_VERSION := "v12"
E2E_UPGRADE_VERSION := "v13"
export GO111MODULE = on
......@@ -272,7 +272,7 @@ test-e2e-ci:
# test-e2e-debug runs a full e2e test suite but does
# not attempt to delete Docker resources at the end.
test-e2e-debug: e2e-setup
@VERSION=$(VERSION) OSMOSIS_E2E_DEBUG_LOG=True OSMOSIS_E2E_UPGRADE_VERSION=$(E2E_UPGRADE_VERSION) OSMOSIS_E2E_SKIP_CLEANUP=True go test -tags e2e -mod=readonly -timeout=25m -v $(PACKAGES_E2E) -count=1
@VERSION=$(VERSION) OSMOSIS_E2E_UPGRADE_VERSION=$(E2E_UPGRADE_VERSION) OSMOSIS_E2E_SKIP_CLEANUP=True go test -tags e2e -mod=readonly -timeout=25m -v $(PACKAGES_E2E) -count=1
# test-e2e-short runs the e2e test with only short tests.
# Does not delete any of the containers after running.
......
......@@ -44,6 +44,7 @@ import (
v10 "github.com/osmosis-labs/osmosis/v12/app/upgrades/v10"
v11 "github.com/osmosis-labs/osmosis/v12/app/upgrades/v11"
v12 "github.com/osmosis-labs/osmosis/v12/app/upgrades/v12"
v13 "github.com/osmosis-labs/osmosis/v12/app/upgrades/v13"
v3 "github.com/osmosis-labs/osmosis/v12/app/upgrades/v3"
v4 "github.com/osmosis-labs/osmosis/v12/app/upgrades/v4"
v5 "github.com/osmosis-labs/osmosis/v12/app/upgrades/v5"
......@@ -88,7 +89,7 @@ var (
// _ sdksimapp.App = (*OsmosisApp)(nil)
Upgrades = []upgrades.Upgrade{v4.Upgrade, v5.Upgrade, v7.Upgrade, v9.Upgrade, v11.Upgrade, v12.Upgrade}
Upgrades = []upgrades.Upgrade{v4.Upgrade, v5.Upgrade, v7.Upgrade, v9.Upgrade, v11.Upgrade, v12.Upgrade, v13.Upgrade}
Forks = []upgrades.Fork{v3.Fork, v6.Fork, v8.Fork, v10.Fork}
)
......
package v13
import (
"github.com/osmosis-labs/osmosis/v12/app/upgrades"
store "github.com/cosmos/cosmos-sdk/store/types"
)
// UpgradeName defines the on-chain upgrade name for the Osmosis v9 upgrade.
const UpgradeName = "v13"
var Upgrade = upgrades.Upgrade{
UpgradeName: UpgradeName,
CreateUpgradeHandler: CreateUpgradeHandler,
StoreUpgrades: store.StoreUpgrades{},
}
......@@ -5,10 +5,9 @@ import (
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
lockuptypes "github.com/osmosis-labs/osmosis/v12/x/lockup/types"
"github.com/osmosis-labs/osmosis/v12/app/keepers"
"github.com/osmosis-labs/osmosis/v12/app/upgrades"
lockuptypes "github.com/osmosis-labs/osmosis/v12/x/lockup/types"
)
func CreateUpgradeHandler(
......@@ -19,7 +18,6 @@ func CreateUpgradeHandler(
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
keepers.LockupKeeper.SetParams(ctx, lockuptypes.DefaultParams())
return mm.RunMigrations(ctx, configurator, fromVM)
}
}
......@@ -126,7 +126,8 @@ func (c *Config) WaitUntilHeight(height int64) {
func (c *Config) WaitForNumHeights(heightsToWait int64) {
node, err := c.GetDefaultNode()
require.NoError(c.t, err)
currentHeight := node.QueryCurrentHeight()
currentHeight, err := node.QueryCurrentHeight()
require.NoError(c.t, err)
c.WaitUntilHeight(currentHeight + heightsToWait)
}
......
......@@ -64,7 +64,10 @@ func (n *NodeConfig) Run() error {
n.t,
func() bool {
// This fails if unsuccessful.
n.QueryCurrentHeight()
_, err := n.QueryCurrentHeight()
if err != nil {
return false
}
n.t.Logf("started node container: %s", n.Name)
return true
},
......
......@@ -224,10 +224,12 @@ func (n *NodeConfig) QueryHashFromBlock(height int64) (string, error) {
}
// QueryCurrentHeight returns the current block height of the node or error.
func (n *NodeConfig) QueryCurrentHeight() int64 {
func (n *NodeConfig) QueryCurrentHeight() (int64, error) {
status, err := n.rpcClient.Status(context.Background())
require.NoError(n.t, err)
return status.SyncInfo.LatestBlockHeight
if err != nil {
return 0, err
}
return status.SyncInfo.LatestBlockHeight, nil
}
// QueryLatestBlockTime returns the latest block time.
......
......@@ -159,7 +159,10 @@ func (uc *UpgradeConfigurer) runProposalUpgrade() error {
for _, chainConfig := range uc.chainConfigs {
for validatorIdx, node := range chainConfig.NodeConfigs {
if validatorIdx == 0 {
currentHeight := node.QueryCurrentHeight()
currentHeight, err := node.QueryCurrentHeight()
if err != nil {
return err
}
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
......
......@@ -24,10 +24,10 @@ const (
// It should be uploaded to Docker Hub. OSMOSIS_E2E_SKIP_UPGRADE should be unset
// for this functionality to be used.
previousVersionOsmoRepository = "osmolabs/osmosis"
previousVersionOsmoTag = "11"
previousVersionOsmoTag = "12.1"
// Pre-upgrade repo/tag for osmosis initialization (this should be one version below upgradeVersion)
previousVersionInitRepository = "osmolabs/osmosis-e2e-init-chain"
previousVersionInitTag = "v11.0.0-e2e-v1"
previousVersionInitTag = "v12.1.0-e2e-v1"
// Hermes repo/version for relayer
relayerRepository = "osmolabs/hermes"
relayerTag = "0.13.0"
......
......@@ -236,8 +236,7 @@ func (m *Manager) RunNodeResource(chainId string, containerName, valCondifDir st
// must deal with removing the resource.
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)
expeditedVotingPeriodDuration := time.Duration(chainExpeditedVotingPeriod * 1000000000)
initResource, err := m.pool.RunWithOptions(
&dockertest.RunOptions{
......@@ -250,8 +249,7 @@ func (m *Manager) RunChainInitResource(chainId string, chainVotingPeriod, chainE
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("--expedited-voting-period=%v", expeditedVotingPeriodDuration),
fmt.Sprintf("--fork-height=%v", forkHeight),
},
User: "root:root",
......
......@@ -342,7 +342,8 @@ func (s *IntegrationTestSuite) TestStateSync() {
stateSyncRPCServers := []string{stateSyncHostPort, stateSyncHostPort}
// get trust height and trust hash.
trustHeight := runningNode.QueryCurrentHeight()
trustHeight, err := runningNode.QueryCurrentHeight()
s.Require().NoError(err)
trustHash, err := runningNode.QueryHashFromBlock(trustHeight)
s.Require().NoError(err)
......@@ -404,8 +405,10 @@ func (s *IntegrationTestSuite) TestStateSync() {
// ensure that the state synching node cathes up to the running node.
s.Require().Eventually(func() bool {
stateSyncNodeHeight := stateSynchingNode.QueryCurrentHeight()
runningNodeHeight := runningNode.QueryCurrentHeight()
stateSyncNodeHeight, err := stateSynchingNode.QueryCurrentHeight()
s.Require().NoError(err)
runningNodeHeight, err := runningNode.QueryCurrentHeight()
s.Require().NoError(err)
return stateSyncNodeHeight == runningNodeHeight
},
3*time.Minute,
......@@ -418,10 +421,6 @@ func (s *IntegrationTestSuite) TestStateSync() {
}
func (s *IntegrationTestSuite) TestExpeditedProposals() {
if !s.skipUpgrade {
s.T().Skip("this can be re-enabled post v12")
}
chainA := s.configurer.GetChainConfig(0)
chainANode, err := chainA.GetDefaultNode()
s.NoError(err)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment