Skip to content

Commit

Permalink
release: v12.0.0 (#1494)
Browse files Browse the repository at this point in the history
  • Loading branch information
0a1c committed Mar 24, 2023
1 parent 7d11ac4 commit 137cc00
Show file tree
Hide file tree
Showing 13 changed files with 19,260 additions and 50 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Upgrade Test Release
name: E2E Test Release
on:
pull_request:
branches:
Expand All @@ -8,7 +8,7 @@ on:
- release/**

jobs:
test-e2e-upgrade:
test-e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
Expand All @@ -23,7 +23,7 @@ jobs:
**/**.go
go.mod
go.sum
- name: Test E2E upgrade
- name: Test E2E
run: |
make test-upgrade
make test-e2e
if: env.GIT_DIFF
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Upgrade Test
name: E2E Test
on:
pull_request:
branches:
Expand All @@ -8,7 +8,7 @@ on:
- main

jobs:
test-e2e-upgrade:
test-e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
Expand All @@ -24,8 +24,8 @@ jobs:
go.mod
go.sum
tests/e2e/*
- name: Test E2E upgrade
- name: Test E2E
run: |
make test-upgrade
make test-e2e
if: env.GIT_DIFF

4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

# Changelog

## [v12.0.0-rc4] - 2023-03-16
## [v12.0.0] - 2023-03-23

### State Machine Breaking

Expand Down Expand Up @@ -82,6 +82,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
- (ante) [#1468](https://github.com/evmos/evmos/pull/1468) Add TxFeeChecker requirement
- (deps) [#1473](https://github.com/evmos/evmos/pull/1473) Bump Cosmos SDK version to [v0.46.10-alpha.ledger.2](https://github.com/evmos/cosmos-sdk/releases/tag/v0.46.10-alpha.ledger.2)
- (ante) [#1470](https://github.com/evmos/evmos/pull/1470) Improve error message on `DynamicFeeChecker` ante handler
- (test) [#1484](https://github.com/evmos/evmos/pull/1484) Update e2e test: refactor Makefile command and use latest changes for the tests

### Bug Fixes

Expand All @@ -92,6 +93,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
- (evm) [#1466](https://github.com/evmos/evmos/pull/1466) Add `gasUsed` field in Ethereum transaction receipt
- (cli) [#1467](https://github.com/evmos/evmos/pull/1467) Rollback fees `auto` flag logic
- (ci) [#1476](https://github.com/evmos/evmos/pull/1476) Fix go-releaser configuration to be consistent with previous version binaries naming
- (upgrade) [#1493](https://github.com/evmos/evmos/pull/1493) Add decay bug affected accounts

## [v11.0.2] - 2023-02-10

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ $(TEST_TARGETS): run-tests
test-unit-cover: ARGS=-timeout=15m -race -coverprofile=coverage.txt -covermode=atomic
test-unit-cover: TEST_PACKAGES=$(PACKAGES_UNIT)

test-upgrade:
test-e2e:
@if [ -z "$(TARGET_VERSION)" ]; then \
echo "Building docker image from local codebase"; \
make build-docker; \
Expand Down
19,168 changes: 19,165 additions & 3 deletions app/upgrades/v12/accounts.go

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions app/upgrades/v12/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ package v12

const (
// UpgradeName is the shared upgrade plan name for mainnet
UpgradeName = "v12.0.0-rc4"
UpgradeName = "v12.0.0"
// UpgradeInfo defines the binaries that will be used for the upgrade
UpgradeInfo = `'{"binaries":{"darwin/arm64":"https://github.com/evmos/evmos/releases/download/v12.0.0-rc4/evmos_12.0.0-rc4_Darwin_arm64.tar.gz","darwin/amd64":"https://github.com/evmos/evmos/releases/download/v12.0.0-rc4/evmos_12.0.0-rc4_Darwin_amd64.tar.gz","linux/arm64":"https://github.com/evmos/evmos/releases/download/v12.0.0-rc4/evmos_12.0.0-rc4_Linux_arm64.tar.gz","linux/amd64":"https://github.com/evmos/evmos/releases/download/v12.0.0-rc4/evmos_12.0.0-rc4_Linux_amd64.tar.gz","windows/x86_64":"https://github.com/evmos/evmos/releases/download/v12.0.0-rc4/evmos_12.0.0-rc4_Windows_x86_64.zip"}}'`
// TODO this is dummy data, update this with the real amount
UpgradeInfo = `'{"binaries":{"darwin/arm64":"https://github.com/evmos/evmos/releases/download/v12.0.0/evmos_12.0.0_Darwin_arm64.tar.gz","darwin/amd64":"https://github.com/evmos/evmos/releases/download/v12.0.0/evmos_12.0.0_Darwin_amd64.tar.gz","linux/arm64":"https://github.com/evmos/evmos/releases/download/v12.0.0/evmos_12.0.0_Linux_arm64.tar.gz","linux/amd64":"https://github.com/evmos/evmos/releases/download/v12.0.0/evmos_12.0.0_Linux_amd64.tar.gz","windows/x86_64":"https://github.com/evmos/evmos/releases/download/v12.0.0/evmos_12.0.0_Windows_x86_64.zip"}}'`
// MaxRecover is the maximum amount of coins to be redistributed in the upgrade
MaxRecover = "2000000000000000000"
MaxRecover = "169580456887205410791936"
)
3 changes: 1 addition & 2 deletions app/upgrades/v12/upgrades_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ func (suite *UpgradeTestSuite) TestReturnFundsFromCommunityPool() {
// store the addresses on a map to check if there're
// duplicated addresses
uniqueAddrs := make(map[string]bool)

// check balance of affected accounts
for i := range v12.Accounts {
addr := sdk.MustAccAddressFromBech32(v12.Accounts[i][0])
Expand All @@ -102,5 +101,5 @@ func (suite *UpgradeTestSuite) TestReturnFundsFromCommunityPool() {
}

balanceAfter := suite.app.DistrKeeper.GetFeePoolCommunityCoins(suite.ctx)
suite.Require().True(balanceAfter.IsZero())
suite.Require().True(balanceAfter.IsZero(), "Community pool balance should be zero after the distribution, but is %d", balanceAfter.AmountOf(utils.BaseDenom))
}
5 changes: 3 additions & 2 deletions tests/e2e/Dockerfile.repo
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
ARG INITIAL_VERSION
FROM golang:1.20.0-bullseye AS build-env

ARG BRANCH_NAME

WORKDIR /go/src/github.com/evmos/

RUN git clone "https://github.com/evmos/evmos.git"
Expand All @@ -9,7 +10,7 @@ WORKDIR /go/src/github.com/evmos/evmos

RUN apt-get update -y

RUN git checkout ${INITIAL_VERSION}
RUN git checkout ${BRANCH_NAME}

RUN make build

Expand Down
30 changes: 17 additions & 13 deletions tests/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,27 @@ for running end-to-end tests on Evmos.
It is used for testing chain upgrades,
as it allows for initializing multiple Evmos chains with different versions.

- [Quick Start](#quick-start)
- [Upgrade Process](#upgrade-process)
- [Test Suite Structure](#test-suite-structure)
- [`e2e` Package](#e2e-package)
- [`upgrade` Package](#upgrade-package)
- [Version retrieve](#version-retrieve)
- [Testing Results](#testing-results)
- [Running multiple upgrades](#running-multiple-upgrades)
- [End-to-End Testing Suite](#end-to-end-testing-suite)
- [Quick Start](#quick-start)
- [Upgrade Process](#upgrade-process)
- [Test Suite Structure](#test-suite-structure)
- [`e2e` Package](#e2e-package)
- [`upgrade` Package](#upgrade-package)
- [Version retrieve](#version-retrieve)
- [Testing Results](#testing-results)
- [Running multiple upgrades](#running-multiple-upgrades)

### Quick Start

To run a chain upgrade test, execute:
To run the e2e tests, execute:

```shell
make test-upgrade
make test-e2e
```

This command runs an upgrade test (upgrading a node from an old version to a newer one),
as well as query and transactions operations against a node with the latest changes.

This logic utilizes parameters that can be set manually(if necessary):

```shell
Expand Down Expand Up @@ -54,7 +58,7 @@ To test an upgrade to explicit target version
and continue to run the upgraded node, use:

```shell
make test-upgrade E2E_SKIP_CLEANUP=true INITIAL_VERSION=<tag> TARGET_VERSION=<tag>
make test-e2e E2E_SKIP_CLEANUP=true INITIAL_VERSION=<tag> TARGET_VERSION=<tag>
```

### Upgrade Process
Expand Down Expand Up @@ -135,7 +139,7 @@ from `evmos/app/upgrades`.

### Testing Results

The `make test-upgrade` script will output the test results
The `make test-e2e` script will output the test results
for each testing file.
In case of a successful upgrade,
the script will print the following output (example):
Expand Down Expand Up @@ -231,5 +235,5 @@ with a forward slash
and pass them as the `INITIAL_VERSION`.

```bash
make test-upgrade INITIAL_VERSION=v10.0.1/v11.0.0-rc1 TARGET_VERSION=v11.0.0-rc3
make test-e2e INITIAL_VERSION=v10.0.1/v11.0.0-rc1 TARGET_VERSION=v11.0.0-rc3
```
36 changes: 33 additions & 3 deletions tests/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ func (s *IntegrationTestSuite) SetupSuite() {

// runInitialNode builds a docker image capable of running an Evmos node with the given version.
// After a successful build, it runs the container and checks if the node can produce blocks.
func (s *IntegrationTestSuite) runInitialNode(version upgrade.VersionConfig, dockerFile string) {
func (s *IntegrationTestSuite) runInitialNode(version upgrade.VersionConfig) {
err := s.upgradeManager.BuildImage(
version.ImageName,
version.ImageTag,
dockerFile,
registryDockerFile,
".",
map[string]string{"INITIAL_VERSION": version.ImageTag},
)
s.Require().NoError(err, "can't build container with Evmos version: %s", version)
s.Require().NoError(err, "can't build container with Evmos version: %s", version.ImageTag)

node := upgrade.NewNode(version.ImageName, version.ImageTag)
node.SetEnvVars([]string{fmt.Sprintf("CHAIN_ID=%s", s.upgradeParams.ChainID)})
Expand All @@ -92,6 +92,36 @@ func (s *IntegrationTestSuite) runInitialNode(version upgrade.VersionConfig, doc
s.T().Logf("successfully started node with version: [%s]", version.ImageTag)
}

// runNodeWithCurrentChanges builds a docker image using the current branch of the Evmos repository.
// Before running the node, runs a script to modify some configurations for the tests
// (e.g.: gov proposal voting period, setup accounts, balances, etc..)
// After a successful build, runs the container.
func (s *IntegrationTestSuite) runNodeWithCurrentChanges() {
const (
name = "e2e-test/evmos"
version = "latest"
)
// get the current branch name
// to run the tests against the last changes
branch, err := getCurrentBranch()
s.Require().NoError(err)

err = s.upgradeManager.BuildImage(
name,
version,
repoDockerFile,
".",
map[string]string{"BRANCH_NAME": branch},
)
s.Require().NoError(err, "can't build container for e2e test")

node := upgrade.NewNode(name, version)
node.SetEnvVars([]string{fmt.Sprintf("CHAIN_ID=%s", s.upgradeParams.ChainID)})

err = s.upgradeManager.RunNode(node)
s.Require().NoError(err, "can't run node Evmos using branch %s", branch)
}

// proposeUpgrade submits an upgrade proposal to the chain that schedules an upgrade to
// the given target version.
func (s *IntegrationTestSuite) proposeUpgrade(name, target string) {
Expand Down
20 changes: 8 additions & 12 deletions tests/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package e2e
import (
"context"
"strings"

"github.com/evmos/evmos/v12/tests/e2e/upgrade"
)

// TestUpgrade tests if an Evmos node can be upgraded from one version to another.
Expand All @@ -16,7 +14,7 @@ func (s *IntegrationTestSuite) TestUpgrade() {
for idx, version := range s.upgradeParams.Versions {
if idx == 0 {
// start initial node
s.runInitialNode(version, registryDockerFile)
s.runInitialNode(version)
continue
}
s.T().Logf("(upgrade %d): UPGRADING TO %s WITH PROPOSAL NAME %s", idx, version.ImageTag, version.UpgradeName)
Expand All @@ -27,13 +25,11 @@ func (s *IntegrationTestSuite) TestUpgrade() {
s.T().Logf("SUCCESS")
}

// TestCLITxs executes different types of transactions against an Evmos node
// using the CLI client. The node used for the test has the latest changes introduced.
func (s *IntegrationTestSuite) TestCLITxs() {
mainBranch := upgrade.VersionConfig{
ImageTag: "main",
ImageName: "evmos",
}

s.runInitialNode(mainBranch, repoDockerFile)
// start a node
s.runNodeWithCurrentChanges()

testCases := []struct {
name string
Expand Down Expand Up @@ -68,7 +64,7 @@ func (s *IntegrationTestSuite) TestCLITxs() {
)
},
expPass: false,
expErrMsg: "out of gas",
expErrMsg: "gas prices too low",
},
{
name: "fail - submit upgrade proposal, insufficient fees",
Expand Down Expand Up @@ -148,8 +144,8 @@ func (s *IntegrationTestSuite) TestCLITxs() {
s.upgradeParams.ChainID,
1,
"--gas=auto",
"--gas-adjustment=1.4",
"--fees=500000aevmos",
"--gas-adjustment=1.5",
"--fees=10000000000000000aevmos",
)
},
expPass: true,
Expand Down
5 changes: 4 additions & 1 deletion tests/e2e/upgrade/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func NewManager(networkName string) (*Manager, error) {
// BuildImage builds a docker image to run in the provided context directory
// with <name>:<version> as the image target
func (m *Manager) BuildImage(name, version, dockerFile, contextDir string, args map[string]string) error {
buildArgs := make([]docker.BuildArg, len(args))
buildArgs := make([]docker.BuildArg, 0, len(args))
for k, v := range args {
bArg := docker.BuildArg{
Name: k,
Expand All @@ -83,6 +83,9 @@ func (m *Manager) BuildImage(name, version, dockerFile, contextDir string, args
// local Dockerfile path
Dockerfile: dockerFile,
BuildArgs: buildArgs,
// rebuild the image every time in case there were changes
// and the image is cached
NoCache: true,
// name with tag, e.g. evmos:v9.0.0
Name: fmt.Sprintf("%s:%s", name, version),
OutputStream: io.Discard,
Expand Down
14 changes: 14 additions & 0 deletions tests/e2e/utils.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package e2e

import (
"os/exec"
)

func getCurrentBranch() (string, error) {
cmd := exec.Command("git", "rev-parse", "--abbrev-ref", "HEAD")
out, err := cmd.Output()
if err != nil {
return "", err
}
return string(out), nil
}

0 comments on commit 137cc00

Please sign in to comment.