Skip to content

Commit

Permalink
Merge branch 'develop' into withdraw-emissions
Browse files Browse the repository at this point in the history
  • Loading branch information
kingpinXD authored Mar 5, 2024
2 parents e0560ee + 422e00e commit 4960fea
Show file tree
Hide file tree
Showing 188 changed files with 7,467 additions and 1,045 deletions.
4 changes: 2 additions & 2 deletions Dockerfile-upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ WORKDIR /go/delivery/zeta-node
RUN mkdir -p $GOPATH/bin/old
RUN mkdir -p $GOPATH/bin/new

ARG OLD_VERSION=v12.2.1
ENV NEW_VERSION=v13
ARG OLD_VERSION=v13.0.0
ENV NEW_VERSION=v14

# Build new release from the current source
COPY go.mod /go/delivery/zeta-node/
Expand Down
17 changes: 17 additions & 0 deletions LOCAL_TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,23 @@ cast balance 0xE5C5367B8224807Ac2207d350E60e1b6F27a7ecC --rpc-url http://0.0.0.0
cast send 0x9fd96203f7b22bCF72d9DCb40ff98302376cE09c --value 42 --rpc-url http://0.0.0.0:8545 --private-key "d87baf7bf6dc560a252596678c12e41f7d1682837f05b29d411bc3f78ae2c263"
```

### Interaction using `zetae2e`

`zetae2e` CLI can also be used to interact with the localnet and test specific functionalities with the `run` command. The [local config](cmd/zetae2e/config/local.yml) can be used to interact with the network.

The balances on the localnet can be checked with the following command:

```bash
zetae2e balances cmd/zetae2e/config/local.yml --skip-btc
```
Note: Bitcoin network is currently not supported for the command.

Example of `run` command:

```dockerfile
zetae2e run zeta_deposit:2000000000000000000 eth_deposit:2000000000000000000 erc20_deposit:200000 --config cmd/zetae2e/config/local.yml
```

## Useful data

- TSS Address (on ETH): 0xF421292cb0d3c97b90EEEADfcD660B893592c6A2
Expand Down
160 changes: 98 additions & 62 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ import (
"github.com/gorilla/mux"
"github.com/rakyll/statik/fs"
"github.com/spf13/cast"
emissionsModule "github.com/zeta-chain/zetacore/x/emissions"
emissionsModuleKeeper "github.com/zeta-chain/zetacore/x/emissions/keeper"
emissionsModuleTypes "github.com/zeta-chain/zetacore/x/emissions/types"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
Expand Down Expand Up @@ -97,13 +94,21 @@ import (
"github.com/zeta-chain/zetacore/docs/openapi"
srvflags "github.com/zeta-chain/zetacore/server/flags"

authoritymodule "github.com/zeta-chain/zetacore/x/authority"
authoritykeeper "github.com/zeta-chain/zetacore/x/authority/keeper"
authoritytypes "github.com/zeta-chain/zetacore/x/authority/types"

crosschainmodule "github.com/zeta-chain/zetacore/x/crosschain"
crosschainkeeper "github.com/zeta-chain/zetacore/x/crosschain/keeper"
crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types"

fungibleModule "github.com/zeta-chain/zetacore/x/fungible"
fungibleModuleKeeper "github.com/zeta-chain/zetacore/x/fungible/keeper"
fungibleModuleTypes "github.com/zeta-chain/zetacore/x/fungible/types"
emissionsmodule "github.com/zeta-chain/zetacore/x/emissions"
emissionskeeper "github.com/zeta-chain/zetacore/x/emissions/keeper"
emissionstypes "github.com/zeta-chain/zetacore/x/emissions/types"

fungiblemodule "github.com/zeta-chain/zetacore/x/fungible"
fungiblekeeper "github.com/zeta-chain/zetacore/x/fungible/keeper"
fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types"

observermodule "github.com/zeta-chain/zetacore/x/observer"
observerkeeper "github.com/zeta-chain/zetacore/x/observer/keeper"
Expand Down Expand Up @@ -175,27 +180,28 @@ var (
vesting.AppModuleBasic{},
evm.AppModuleBasic{},
feemarket.AppModuleBasic{},
authoritymodule.AppModuleBasic{},
crosschainmodule.AppModuleBasic{},
observermodule.AppModuleBasic{},
fungibleModule.AppModuleBasic{},
emissionsModule.AppModuleBasic{},
fungiblemodule.AppModuleBasic{},
emissionsmodule.AppModuleBasic{},
groupmodule.AppModuleBasic{},
authzmodule.AppModuleBasic{},
)

// module account permissions
maccPerms = map[string][]string{
authtypes.FeeCollectorName: nil,
distrtypes.ModuleName: nil,
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
govtypes.ModuleName: {authtypes.Burner},
crosschaintypes.ModuleName: {authtypes.Minter, authtypes.Burner},
evmtypes.ModuleName: {authtypes.Minter, authtypes.Burner},
fungibleModuleTypes.ModuleName: {authtypes.Minter, authtypes.Burner},
emissionsModuleTypes.ModuleName: nil,
emissionsModuleTypes.UndistributedObserverRewardsPool: nil,
emissionsModuleTypes.UndistributedTssRewardsPool: nil,
authtypes.FeeCollectorName: nil,
distrtypes.ModuleName: nil,
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
govtypes.ModuleName: {authtypes.Burner},
crosschaintypes.ModuleName: {authtypes.Minter, authtypes.Burner},
evmtypes.ModuleName: {authtypes.Minter, authtypes.Burner},
fungibletypes.ModuleName: {authtypes.Minter, authtypes.Burner},
emissionstypes.ModuleName: nil,
emissionstypes.UndistributedObserverRewardsPool: nil,
emissionstypes.UndistributedTssRewardsPool: nil,
}

// module accounts that are NOT allowed to receive tokens
Expand Down Expand Up @@ -226,28 +232,34 @@ type App struct {
tkeys map[string]*storetypes.TransientStoreKey
memKeys map[string]*storetypes.MemoryStoreKey

// keepers
AccountKeeper authkeeper.AccountKeeper
BankKeeper bankkeeper.Keeper
StakingKeeper stakingkeeper.Keeper
SlashingKeeper slashingkeeper.Keeper
DistrKeeper distrkeeper.Keeper
GovKeeper govkeeper.Keeper
CrisisKeeper crisiskeeper.Keeper
UpgradeKeeper upgradekeeper.Keeper
ParamsKeeper paramskeeper.Keeper
EvidenceKeeper evidencekeeper.Keeper
mm *module.Manager
sm *module.SimulationManager
configurator module.Configurator

// sdk keepers
AccountKeeper authkeeper.AccountKeeper
BankKeeper bankkeeper.Keeper
StakingKeeper stakingkeeper.Keeper
SlashingKeeper slashingkeeper.Keeper
DistrKeeper distrkeeper.Keeper
GovKeeper govkeeper.Keeper
CrisisKeeper crisiskeeper.Keeper
UpgradeKeeper upgradekeeper.Keeper
ParamsKeeper paramskeeper.Keeper
EvidenceKeeper evidencekeeper.Keeper
GroupKeeper groupkeeper.Keeper
AuthzKeeper authzkeeper.Keeper

// evm keepers
EvmKeeper *evmkeeper.Keeper
FeeMarketKeeper feemarketkeeper.Keeper

// zetachain keepers
AuthorityKeeper authoritykeeper.Keeper
CrosschainKeeper crosschainkeeper.Keeper
ObserverKeeper *observerkeeper.Keeper
mm *module.Manager
sm *module.SimulationManager
configurator module.Configurator
EvmKeeper *evmkeeper.Keeper
FeeMarketKeeper feemarketkeeper.Keeper
FungibleKeeper fungibleModuleKeeper.Keeper
EmissionsKeeper emissionsModuleKeeper.Keeper
GroupKeeper groupkeeper.Keeper
AuthzKeeper authzkeeper.Keeper
FungibleKeeper fungiblekeeper.Keeper
EmissionsKeeper emissionskeeper.Keeper
}

// New returns a reference to an initialized ZetaApp.
Expand Down Expand Up @@ -279,12 +291,14 @@ func New(
group.StoreKey,
upgradetypes.StoreKey,
evidencetypes.StoreKey,
authzkeeper.StoreKey,
evmtypes.StoreKey,
feemarkettypes.StoreKey,
authoritytypes.StoreKey,
crosschaintypes.StoreKey,
observertypes.StoreKey,
evmtypes.StoreKey, feemarkettypes.StoreKey,
fungibleModuleTypes.StoreKey,
emissionsModuleTypes.StoreKey,
authzkeeper.StoreKey,
fungibletypes.StoreKey,
emissionstypes.StoreKey,
)
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey, evmtypes.TransientKey, feemarkettypes.TransientKey)
memKeys := sdk.NewMemoryStoreKeys()
Expand Down Expand Up @@ -316,10 +330,13 @@ func New(
maccPerms,
sdk.GetConfig().GetBech32AccountAddrPrefix(),
)

logger.Info("bank keeper blocklist addresses", "addresses", app.BlockedAddrs())

app.BankKeeper = bankkeeper.NewBaseKeeper(
appCodec, keys[banktypes.StoreKey], app.AccountKeeper, app.GetSubspace(banktypes.ModuleName), app.BlockedAddrs(),
)

stakingKeeper := stakingkeeper.NewKeeper(
appCodec, keys[stakingtypes.StoreKey], app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName),
)
Expand All @@ -328,22 +345,33 @@ func New(
appCodec, keys[distrtypes.StoreKey], app.GetSubspace(distrtypes.ModuleName), app.AccountKeeper, app.BankKeeper,
&stakingKeeper, authtypes.FeeCollectorName,
)

app.SlashingKeeper = slashingkeeper.NewKeeper(
appCodec, keys[slashingtypes.StoreKey], &stakingKeeper, app.GetSubspace(slashingtypes.ModuleName),
)

app.CrisisKeeper = crisiskeeper.NewKeeper(
app.GetSubspace(crisistypes.ModuleName), invCheckPeriod, app.BankKeeper, authtypes.FeeCollectorName,
)

app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath, app.BaseApp,
authtypes.NewModuleAddress(govtypes.ModuleName).String())

app.AuthorityKeeper = authoritykeeper.NewKeeper(
appCodec,
keys[authoritytypes.StoreKey],
keys[authoritytypes.MemStoreKey],
authtypes.NewModuleAddress(govtypes.ModuleName),
)

app.ObserverKeeper = observerkeeper.NewKeeper(
appCodec,
keys[observertypes.StoreKey],
keys[observertypes.MemStoreKey],
app.GetSubspace(observertypes.ModuleName),
&stakingKeeper,
app.SlashingKeeper,
app.AuthorityKeeper,
)

// register the staking hooks
Expand All @@ -356,19 +384,21 @@ func New(
keys[authzkeeper.StoreKey],
appCodec,
app.MsgServiceRouter(),
app.AccountKeeper)
app.AccountKeeper,
)

app.EmissionsKeeper = *emissionsModuleKeeper.NewKeeper(
app.EmissionsKeeper = *emissionskeeper.NewKeeper(
appCodec,
keys[emissionsModuleTypes.StoreKey],
keys[emissionsModuleTypes.MemStoreKey],
app.GetSubspace(emissionsModuleTypes.ModuleName),
keys[emissionstypes.StoreKey],
keys[emissionstypes.MemStoreKey],
app.GetSubspace(emissionstypes.ModuleName),
authtypes.FeeCollectorName,
app.BankKeeper,
app.StakingKeeper,
app.ObserverKeeper,
app.AccountKeeper,
)

// Create Ethermint keepers
tracer := cast.ToString(appOpts.Get(srvflags.EVMTracer))
feeSs := app.GetSubspace(feemarkettypes.ModuleName)
Expand All @@ -385,15 +415,16 @@ func New(
tracer, evmSs,
)

app.FungibleKeeper = *fungibleModuleKeeper.NewKeeper(
app.FungibleKeeper = *fungiblekeeper.NewKeeper(
appCodec,
keys[fungibleModuleTypes.StoreKey],
keys[fungibleModuleTypes.MemStoreKey],
app.GetSubspace(fungibleModuleTypes.ModuleName),
keys[fungibletypes.StoreKey],
keys[fungibletypes.MemStoreKey],
app.GetSubspace(fungibletypes.ModuleName),
app.AccountKeeper,
app.EvmKeeper,
app.BankKeeper,
app.ObserverKeeper,
app.AuthorityKeeper,
)

app.CrosschainKeeper = *crosschainkeeper.NewKeeper(
Expand All @@ -406,6 +437,7 @@ func New(
app.BankKeeper,
app.ObserverKeeper,
&app.FungibleKeeper,
app.AuthorityKeeper,
)
app.GroupKeeper = groupkeeper.NewKeeper(keys[group.StoreKey], appCodec, app.MsgServiceRouter(), app.AccountKeeper, group.Config{
MaxExecutionPeriod: 2 * time.Hour, // Two hours.
Expand Down Expand Up @@ -476,10 +508,11 @@ func New(
groupmodule.NewAppModule(appCodec, app.GroupKeeper, app.AccountKeeper, app.BankKeeper, interfaceRegistry),
evm.NewAppModule(app.EvmKeeper, app.AccountKeeper, evmSs),
feemarket.NewAppModule(app.FeeMarketKeeper, feeSs),
authoritymodule.NewAppModule(appCodec, app.AuthorityKeeper),
crosschainmodule.NewAppModule(appCodec, app.CrosschainKeeper),
observermodule.NewAppModule(appCodec, *app.ObserverKeeper),
fungibleModule.NewAppModule(appCodec, app.FungibleKeeper),
emissionsModule.NewAppModule(appCodec, app.EmissionsKeeper),
fungiblemodule.NewAppModule(appCodec, app.FungibleKeeper),
emissionsmodule.NewAppModule(appCodec, app.EmissionsKeeper),
authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
)

Expand All @@ -506,9 +539,10 @@ func New(
feemarkettypes.ModuleName,
crosschaintypes.ModuleName,
observertypes.ModuleName,
fungibleModuleTypes.ModuleName,
emissionsModuleTypes.ModuleName,
fungibletypes.ModuleName,
emissionstypes.ModuleName,
authz.ModuleName,
authoritytypes.ModuleName,
)
app.mm.SetOrderEndBlockers(
banktypes.ModuleName,
Expand All @@ -528,9 +562,10 @@ func New(
feemarkettypes.ModuleName,
crosschaintypes.ModuleName,
observertypes.ModuleName,
fungibleModuleTypes.ModuleName,
emissionsModuleTypes.ModuleName,
fungibletypes.ModuleName,
emissionstypes.ModuleName,
authz.ModuleName,
authoritytypes.ModuleName,
)

// NOTE: The genutils module must occur after staking so that pools are
Expand All @@ -557,9 +592,10 @@ func New(
vestingtypes.ModuleName,
observertypes.ModuleName,
crosschaintypes.ModuleName,
fungibleModuleTypes.ModuleName,
emissionsModuleTypes.ModuleName,
fungibletypes.ModuleName,
emissionstypes.ModuleName,
authz.ModuleName,
authoritytypes.ModuleName,
)

app.mm.RegisterInvariants(&app.CrisisKeeper)
Expand Down Expand Up @@ -769,8 +805,8 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(group.ModuleName)
paramsKeeper.Subspace(crosschaintypes.ModuleName)
paramsKeeper.Subspace(observertypes.ModuleName)
paramsKeeper.Subspace(fungibleModuleTypes.ModuleName)
paramsKeeper.Subspace(emissionsModuleTypes.ModuleName)
paramsKeeper.Subspace(fungibletypes.ModuleName)
paramsKeeper.Subspace(emissionstypes.ModuleName)
return paramsKeeper
}

Expand Down
2 changes: 1 addition & 1 deletion app/setup_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types"
)

const releaseVersion = "v13"
const releaseVersion = "v14"

func SetupHandlers(app *App) {
app.UpgradeKeeper.SetUpgradeHandler(releaseVersion, func(ctx sdk.Context, plan types.Plan, vm module.VersionMap) (module.VersionMap, error) {
Expand Down
14 changes: 14 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
# CHANGELOG
## Version: v14

### Fixes
- [1817](https://github.com/zeta-chain/node/pull/1817) - Add migration script to fix pending and chain nonces on testnet

## Unreleased

### Breaking Changes

* Admin policies have been moved from `observer` to a new module `authority`.
* Updating admin policies now requires to send a governance proposal executing the `UpdatePolicies` message in the `authority` module.
* The `Policies` query of the `authority` module must be used to get the current admin policies.
* `PolicyType_group1` has been renamed into `PolicyType_groupEmergency` and `PolicyType_group2` has been renamed into `PolicyType_groupAdmin`.

### Refactor

* [1511](https://github.com/zeta-chain/node/pull/1511) - move ballot voting logic from `crosschain` to `observer`
Expand All @@ -11,11 +22,14 @@
### Features

* [1789](https://github.com/zeta-chain/node/issues/1789) - block cross-chain transactions that involve restricted addresses
* [1815](https://github.com/zeta-chain/node/pull/1815) - add authority module for authorized actions

### Tests

* [1767](https://github.com/zeta-chain/node/pull/1767) - add unit tests for emissions module begin blocker
* [1816](https://github.com/zeta-chain/node/pull/1816) - add args to e2e tests
* [1791](https://github.com/zeta-chain/node/pull/1791) - add e2e tests for feature of restricted address
* [1787](https://github.com/zeta-chain/node/pull/1787) - add unit tests for cross-chain evm hooks and e2e test failed withdraw to BTC legacy address

### Chores

Expand Down
Loading

0 comments on commit 4960fea

Please sign in to comment.