Skip to content

Commit

Permalink
Merge branch 'develop' into feat/ton-localnet
Browse files Browse the repository at this point in the history
  • Loading branch information
swift1337 authored Sep 12, 2024
2 parents a4827b3 + 1929ff6 commit e40a523
Show file tree
Hide file tree
Showing 129 changed files with 9,267 additions and 1,953 deletions.
61 changes: 26 additions & 35 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,40 @@ on:
type: boolean
required: false
default: false
description: 'Use this to skip: check-changelog and check-upgrade-handler-updated go straight to approval step.'
description: 'Skip pre-release checks and skip straight to the actual release'
skip_release:
type: boolean
required: false
default: false
description: 'If this is true it will simply execute all the steps for a release prior to actually cutting the release, then stop'
description: 'Only run pre-release checks'

concurrency:
group: publish-release
cancel-in-progress: false

jobs:
log:
runs-on: ubuntu-22.04
steps:
- name: "Log inputs"
env:
INPUTS: ${{ toJson(inputs) }}
run: echo "${INPUTS}" | jq -r
- name: "Log event"
env:
EVENT: ${{ toJson(github.event) }}
run: echo "${EVENT}" | jq -r

check-branch:
if: ${{ (startsWith(github.ref, 'refs/heads/release/v') || startsWith(github.ref, 'refs/heads/hotfix/v')) }}
if: (startsWith(github.ref, 'refs/heads/release/v') || startsWith(github.ref, 'refs/heads/hotfix/v'))
runs-on: ubuntu-22.04
steps:
- name: Branch
run: |
echo "${{ github.ref }}"
check-goreleaser:
if: ${{ github.event.inputs.skip_checks != 'true' }}
if: inputs.skip_checks != true
runs-on: ${{ vars.RELEASE_RUNNER }}
steps:
- uses: actions/checkout@v4
Expand All @@ -47,13 +59,13 @@ jobs:
steps:

- name: Checkout code
if: ${{ github.event.inputs.skip_checks != 'true' }}
if: inputs.skip_checks != true
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get latest commit SHA of Develop & Current Branch
if: ${{ github.event.inputs.skip_checks != 'true' }}
if: inputs.skip_checks != true
id: get-develop-sha
run: |
SHA=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
Expand All @@ -62,7 +74,7 @@ jobs:
echo "CURRENT_BRANCH_SHA=${{ github.sha }}" >> ${GITHUB_ENV}
- name: Check for CHANGELOG.md changes
if: ${{ github.event.inputs.skip_checks != 'true' }}
if: inputs.skip_checks != true
run: |
echo "Check the changelog has actually been updated from whats in develop"
echo "DEVELOP BRANCH SHA: ${DEVELOP_SHA}"
Expand All @@ -77,7 +89,7 @@ jobs:
fi
- name: Mark Job Complete Skipped
if: ${{ github.event.inputs.skip_checks == 'true' }}
if: inputs.skip_checks == true
shell: bash
run: |
echo "continue"
Expand All @@ -90,15 +102,15 @@ jobs:
steps:

- uses: actions/checkout@v4
if: ${{ github.event.inputs.skip_checks != 'true' }}
if: inputs.skip_checks != true
with:
fetch-depth: 0

- name: Major Version in Upgrade Handler Must Match Tag
if: ${{ github.event.inputs.skip_checks != 'true' }}
if: inputs.skip_checks != true
run: |
UPGRADE_HANDLER_MAJOR_VERSION=$(cat app/setup_handlers.go | grep "const releaseVersion" | cut -d ' ' -f4 | tr -d '"' | cut -d '.' -f 1 | tr -d '\n')
USER_INPUT_VERSION=$(echo "${{ github.event.inputs.version }}" | cut -d '.' -f 1 | tr -d '\n')
USER_INPUT_VERSION=$(echo "${{ inputs.version }}" | cut -d '.' -f 1 | tr -d '\n')
echo "Upgrade Handler Major Version: ${UPGRADE_HANDLER_MAJOR_VERSION}"
echo "User Inputted Release Version: ${USER_INPUT_VERSION}"
if [ ${USER_INPUT_VERSION} != $UPGRADE_HANDLER_MAJOR_VERSION ]; then
Expand All @@ -109,7 +121,7 @@ jobs:
echo "The major version found in 'releaseVersion' in app/setup_handlers.go matches this tagged release - Moving Forward!"
- name: Mark Job Complete Skipped
if: ${{ github.event.inputs.skip_checks == 'true' }}
if: inputs.skip_checks == true
shell: bash
run: |
echo "continue"
Expand All @@ -119,7 +131,7 @@ jobs:
id-token: write
contents: write
attestations: write
if: ${{ github.event.inputs.skip_release == 'false' }}
if: inputs.skip_release != true
needs:
- check-changelog
- check-upgrade-handler-updated
Expand All @@ -131,15 +143,6 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install Pipeline Dependencies
uses: ./.github/actions/install-dependencies
timeout-minutes: 8
with:
cpu_architecture: ${{ env.CPU_ARCH }}
skip_python: "true"
skip_aws_cli: "true"
skip_docker_compose: "true"

- name: Change Log Release Notes.
id: release_notes
run: |
Expand All @@ -148,19 +151,7 @@ jobs:
- name: Set Version
run: |
echo "GITHUB_TAG_MAJOR_VERSION=${{ github.event.inputs.version }}" >> ${GITHUB_ENV}
- name: Set CPU Architecture
shell: bash
run: |
if [ "$(uname -m)" == "aarch64" ]; then
echo "CPU_ARCH=arm64" >> $GITHUB_ENV
elif [ "$(uname -m)" == "x86_64" ]; then
echo "CPU_ARCH=amd64" >> $GITHUB_ENV
else
echo "Unsupported architecture" >&2
exit 1
fi
echo "GITHUB_TAG_MAJOR_VERSION=${{ inputs.version }}" >> ${GITHUB_ENV}
- name: Create Release Tag
shell: bash
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -298,12 +298,12 @@ start-v2-test: zetanode
ifdef UPGRADE_TEST_FROM_SOURCE
zetanode-upgrade: zetanode
@echo "Building zetanode-upgrade from source"
$(DOCKER) build -t zetanode:old -f Dockerfile-localnet --target old-runtime-source --build-arg OLD_VERSION='release/v18' .
$(DOCKER) build -t zetanode:old -f Dockerfile-localnet --target old-runtime-source --build-arg OLD_VERSION='release/v19' .
.PHONY: zetanode-upgrade
else
zetanode-upgrade: zetanode
@echo "Building zetanode-upgrade from binaries"
$(DOCKER) build -t zetanode:old -f Dockerfile-localnet --target old-runtime --build-arg OLD_VERSION='https://github.com/zeta-chain/node/releases/download/v18.0.0' .
$(DOCKER) build -t zetanode:old -f Dockerfile-localnet --target old-runtime --build-arg OLD_VERSION='https://github.com/zeta-chain/node/releases/download/v19.1.1' .
.PHONY: zetanode-upgrade
endif

Expand Down
7 changes: 6 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,12 @@ func New(
&app.FeeMarketKeeper,
tracer,
evmSs,
precompiles.StatefulContracts(&app.FungibleKeeper, appCodec, storetypes.TransientGasConfig()),
precompiles.StatefulContracts(
&app.FungibleKeeper,
app.StakingKeeper,
appCodec,
storetypes.TransientGasConfig(),
),
app.ConsensusParamsKeeper,
aggregateAllKeys(keys, tKeys, memKeys),
)
Expand Down
44 changes: 39 additions & 5 deletions app/encoding.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,51 @@
package app

import (
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/authz"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
evmenc "github.com/zeta-chain/ethermint/encoding"
ethermint "github.com/zeta-chain/ethermint/types"
evmtypes "github.com/zeta-chain/ethermint/x/evm/types"

authoritytypes "github.com/zeta-chain/node/x/authority/types"
crosschaintypes "github.com/zeta-chain/node/x/crosschain/types"
emissionstypes "github.com/zeta-chain/node/x/emissions/types"
fungibletypes "github.com/zeta-chain/node/x/fungible/types"
lightclienttypes "github.com/zeta-chain/node/x/lightclient/types"
observertypes "github.com/zeta-chain/node/x/observer/types"
)

// MakeEncodingConfig creates an EncodingConfig for testing
func MakeEncodingConfig() ethermint.EncodingConfig {
//encodingConfig := params.MakeEncodingConfig()
encodingConfig := evmenc.MakeConfig(ModuleBasics)
//std.RegisterLegacyAminoCodec(encodingConfig.Amino)
//std.RegisterInterfaces(encodingConfig.InterfaceRegistry)
//ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino)
//ModuleBasics.RegisterInterfaces(encodingConfig.InterfaceRegistry)
registry := encodingConfig.InterfaceRegistry

cryptocodec.RegisterInterfaces(registry)
authtypes.RegisterInterfaces(registry)
authz.RegisterInterfaces(registry)
banktypes.RegisterInterfaces(registry)
stakingtypes.RegisterInterfaces(registry)
slashingtypes.RegisterInterfaces(registry)
upgradetypes.RegisterInterfaces(registry)
distrtypes.RegisterInterfaces(registry)
evidencetypes.RegisterInterfaces(registry)
crisistypes.RegisterInterfaces(registry)
evmtypes.RegisterInterfaces(registry)
ethermint.RegisterInterfaces(registry)
authoritytypes.RegisterInterfaces(registry)
crosschaintypes.RegisterInterfaces(registry)
emissionstypes.RegisterInterfaces(registry)
fungibletypes.RegisterInterfaces(registry)
observertypes.RegisterInterfaces(registry)
lightclienttypes.RegisterInterfaces(registry)

return encodingConfig
}
88 changes: 2 additions & 86 deletions app/setup_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,106 +3,22 @@ package app
import (
"os"

"github.com/cosmos/cosmos-sdk/baseapp"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
consensustypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/cosmos/cosmos-sdk/x/upgrade/types"
"golang.org/x/exp/slices"

"github.com/zeta-chain/node/pkg/constant"
authoritytypes "github.com/zeta-chain/node/x/authority/types"
emissionstypes "github.com/zeta-chain/node/x/emissions/types"
observertypes "github.com/zeta-chain/node/x/observer/types"
)

func SetupHandlers(app *App) {
// Set param key table for params module migration
for _, subspace := range app.ParamsKeeper.GetSubspaces() {
var keyTable paramstypes.KeyTable
switch subspace.Name() {
case authtypes.ModuleName:
keyTable = authtypes.ParamKeyTable() //nolint:staticcheck
case banktypes.ModuleName:
keyTable = banktypes.ParamKeyTable() //nolint:staticcheck
case stakingtypes.ModuleName:
keyTable = stakingtypes.ParamKeyTable()
case distrtypes.ModuleName:
keyTable = distrtypes.ParamKeyTable() //nolint:staticcheck
case slashingtypes.ModuleName:
keyTable = slashingtypes.ParamKeyTable() //nolint:staticcheck
case govtypes.ModuleName:
keyTable = govv1.ParamKeyTable() //nolint:staticcheck
case crisistypes.ModuleName:
keyTable = crisistypes.ParamKeyTable() //nolint:staticcheck
case emissionstypes.ModuleName:
keyTable = emissionstypes.ParamKeyTable()
default:
continue
}
if !subspace.HasKeyTable() {
subspace.WithKeyTable(keyTable)
}
}
baseAppLegacySS := app.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramstypes.ConsensusParamsKeyTable())
needsForcedMigration := []string{
authtypes.ModuleName,
banktypes.ModuleName,
stakingtypes.ModuleName,
distrtypes.ModuleName,
slashingtypes.ModuleName,
govtypes.ModuleName,
crisistypes.ModuleName,
emissionstypes.ModuleName,
authoritytypes.ModuleName,
observertypes.ModuleName,
}
allUpgrades := upgradeTracker{
upgrades: []upgradeTrackerItem{
{
index: 1714664193,
storeUpgrade: &storetypes.StoreUpgrades{
Added: []string{consensustypes.ModuleName, crisistypes.ModuleName},
},
upgradeHandler: func(ctx sdk.Context, vm module.VersionMap) (module.VersionMap, error) {
// Migrate Tendermint consensus parameters from x/params module to a dedicated x/consensus module
// https://docs.cosmos.network/main/build/migrations/upgrading#xconsensus
baseapp.MigrateParams(ctx, baseAppLegacySS, &app.ConsensusParamsKeeper)

// empty version map happens when upgrading from old versions which did not correctly call
// app.UpgradeKeeper.SetModuleVersionMap(ctx, app.mm.GetVersionMap()) in InitChainer.
// we must populate the version map if we detect this scenario
//
// this will only happen on the first upgrade. mainnet and testnet will not require this condition.
if len(vm) == 0 {
for m, mb := range app.mm.Modules {
if module, ok := mb.(module.HasConsensusVersion); ok {
if slices.Contains(needsForcedMigration, m) {
vm[m] = module.ConsensusVersion() - 1
} else {
vm[m] = module.ConsensusVersion()
}
}
}
}
return vm, nil
},
},
// TODO: enable back IBC
// these commented lines allow for the IBC modules to be added to the upgrade tracker
// https://github.com/zeta-chain/node/issues/2573
//{
// index: 1715624665,
// index: <CURRENT TIMESTAMP>,
// storeUpgrade: &storetypes.StoreUpgrades{
// Added: []string{
// capabilitytypes.ModuleName,
Expand All @@ -112,7 +28,7 @@ func SetupHandlers(app *App) {
// },
//},
//{
// index: 1715707436,
// index: <CURRENT TIMESTAMP>,
// storeUpgrade: &storetypes.StoreUpgrades{
// Added: []string{ibccrosschaintypes.ModuleName},
// },
Expand Down
12 changes: 11 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,38 @@
* [2681](https://github.com/zeta-chain/node/pull/2681) - implement `MsgUpdateERC20CustodyPauseStatus` to pause or unpause ERC20 Custody contract (to be used for the migration process for smart contract V2)
* [2644](https://github.com/zeta-chain/node/pull/2644) - add created_timestamp to cctx status
* [2673](https://github.com/zeta-chain/node/pull/2673) - add relayer key importer, encryption and decryption
* [2633](https://github.com/zeta-chain/node/pull/2633) - support for stateful precompiled contracts.
* [2633](https://github.com/zeta-chain/node/pull/2633) - support for stateful precompiled contracts
* [2788](https://github.com/zeta-chain/node/pull/2788) - add common importable zetacored rpc package
* [2784](https://github.com/zeta-chain/node/pull/2784) - staking precompiled contract
* [2795](https://github.com/zeta-chain/node/pull/2795) - support restricted address in Solana
* [2861](https://github.com/zeta-chain/node/pull/2861) - emit events from staking precompile

### Refactor

* [2615](https://github.com/zeta-chain/node/pull/2615) - Refactor cleanup of outbound trackers
* [2749](https://github.com/zeta-chain/node/pull/2749) - fix all lint errors from govet
* [2725](https://github.com/zeta-chain/node/pull/2725) - refactor SetCctxAndNonceToCctxAndInboundHashToCctx to receive tsspubkey as an argument
* [2802](https://github.com/zeta-chain/node/pull/2802) - set default liquidity cap for new ZRC20s
* [2826](https://github.com/zeta-chain/node/pull/2826) - remove unused code from emissions module and add new parameter for fixed block reward amount

### Tests

* [2661](https://github.com/zeta-chain/node/pull/2661) - update connector and erc20Custody addresses in tss migration e2e tests
* [2726](https://github.com/zeta-chain/node/pull/2726) - add e2e tests for deposit and call, deposit and revert
* [2703](https://github.com/zeta-chain/node/pull/2703) - add e2e tests for stateful precompiled contracts
* [2763](https://github.com/zeta-chain/node/pull/2763) - add V2 contracts migration test
* [2830](https://github.com/zeta-chain/node/pull/2830) - extend staking precompile tests
* [2867](https://github.com/zeta-chain/node/pull/2867) - skip precompiles test for tss migration

### Fixes

* [2654](https://github.com/zeta-chain/node/pull/2654) - add validation for authorization list in when validating genesis state for authorization module
* [2674](https://github.com/zeta-chain/node/pull/2674) - allow operators to vote on ballots associated with discarded keygen without affecting the status of the current keygen.
* [2672](https://github.com/zeta-chain/node/pull/2672) - check observer set for duplicates when adding a new observer or updating an existing one
* [2735](https://github.com/zeta-chain/node/pull/2735) - fix the outbound tracker blocking confirmation and outbound processing on EVM chains by locally index outbound txs in zetaclient
* [2787](https://github.com/zeta-chain/node/pull/2787) - ask for 3 accounts (signer, pda, system_program) on solana gateway deposit
* [2842](https://github.com/zeta-chain/node/pull/2842) - fix: move interval assignment out of cctx loop in EVM outbound tx scheduler
* [2853](https://github.com/zeta-chain/node/pull/2853) - calling precompile through sc with sc state update

## v19.0.0

Expand Down
Loading

0 comments on commit e40a523

Please sign in to comment.