Skip to content

Commit

Permalink
Merge branch 'refactor-inbound-vote' into refactor-outbound-vote
Browse files Browse the repository at this point in the history
  • Loading branch information
kingpinXD authored Mar 18, 2024
2 parents 1cfc5ae + f59f1a6 commit f9f658b
Show file tree
Hide file tree
Showing 107 changed files with 6,105 additions and 1,265 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ EXPOSE 8545
EXPOSE 8546
EXPOSE 9090
EXPOSE 26657
EXPOSE 9091
EXPOSE 9091
9 changes: 9 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
* [1783](https://github.com/zeta-chain/node/pull/1783) - refactor zetaclient metrics naming and structure
* [1774](https://github.com/zeta-chain/node/pull/1774) - split params and config in zetaclient
* [1831](https://github.com/zeta-chain/node/pull/1831) - removing unnecessary pointers in context structure
* [1864](https://github.com/zeta-chain/node/pull/1864) - prevent panic in param management
* [1848](https://github.com/zeta-chain/node/issues/1848) - create a method to observe deposits to tss address in one evm block
* [1885](https://github.com/zeta-chain/node/pull/1885) - change important metrics on port 8123 to be prometheus compatible
* [1863](https://github.com/zeta-chain/node/pull/1863) - remove duplicate ValidateChainParams function

### Features

Expand All @@ -37,10 +41,13 @@
* [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
* [1840](https://github.com/zeta-chain/node/pull/1840) - fix code coverage test failures ignored in CI
* [1870](https://github.com/zeta-chain/node/pull/1870) - enable emissions pool in local e2e testing
* [1868](https://github.com/zeta-chain/node/pull/1868) - run e2e btc tests locally
* [1851](https://github.com/zeta-chain/node/pull/1851) - rename usdt to erc20 in e2e tests
* [1872](https://github.com/zeta-chain/node/pull/1872) - remove usage of RPC in unit test
* [1805](https://github.com/zeta-chain/node/pull/1805) - add admin and performance test and fix upgrade test
* [1879](https://github.com/zeta-chain/node/pull/1879) - full coverage for messages in types packages
* [1899](https://github.com/zeta-chain/node/pull/1899) - add empty test files so packages are included in coverage

### Fixes

Expand All @@ -53,6 +60,8 @@
### CI

* [1867](https://github.com/zeta-chain/node/pull/1867) - default restore_type for full node docker-compose to snapshot instead of statesync for reliability.
* [1891](https://github.com/zeta-chain/node/pull/1891) - fix typo that was introduced to docker-compose and a typo in start.sh for the docker start script for full nodes.
* [1894](https://github.com/zeta-chain/node/pull/1894) - added download binaries and configs to the start sequence so it will download binaries that don't exist

## Version: v14

Expand Down
7 changes: 5 additions & 2 deletions cmd/zetaclientd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,15 @@ func start(_ *cobra.Command, _ []string) error {
}
}

metrics, err := metrics.NewMetrics()
m, err := metrics.NewMetrics()
if err != nil {
log.Error().Err(err).Msg("NewMetrics")
return err
}
metrics.Start()
m.Start()

metrics.Info.WithLabelValues(common.Version).Set(1)
metrics.LastStartTime.SetToCurrentTime()

var tssHistoricalList []observerTypes.TSS
tssHistoricalList, err = zetaBridge.GetTssHistory()
Expand Down
100 changes: 35 additions & 65 deletions cmd/zetae2e/local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,71 +44,19 @@ func NewLocalCmd() *cobra.Command {
Short: "Run Local E2E tests",
Run: localE2ETest,
}
cmd.Flags().Bool(
flagContractsDeployed,
false,
"set to to true if running tests again with existing state",
)
cmd.Flags().Int64(
flagWaitForHeight,
0,
"block height for tests to begin, ex. --wait-for 100",
)
cmd.Flags().String(
FlagConfigFile,
"",
"config file to use for the tests",
)
cmd.Flags().String(
flagConfigOut,
"",
"config file to write the deployed contracts from the setup",
)
cmd.Flags().Bool(
flagVerbose,
false,
"set to true to enable verbose logging",
)
cmd.Flags().Bool(
flagTestAdmin,
false,
"set to true to run admin tests",
)
cmd.Flags().Bool(
flagTestPerformance,
false,
"set to true to run performance tests",
)
cmd.Flags().Bool(
flagTestCustom,
false,
"set to true to run custom tests",
)
cmd.Flags().Bool(
flagSkipRegular,
false,
"set to true to skip regular tests",
)
cmd.Flags().Bool(
flagLight,
false,
"run the most basic regular tests, useful for quick checks",
)
cmd.Flags().Bool(
flagSetupOnly,
false,
"set to true to only setup the networks",
)
cmd.Flags().Bool(
flagSkipSetup,
false,
"set to true to skip setup",
)
cmd.Flags().Bool(
flagSkipBitcoinSetup,
false,
"set to true to skip bitcoin wallet setup",
)
cmd.Flags().Bool(flagContractsDeployed, false, "set to to true if running tests again with existing state")
cmd.Flags().Int64(flagWaitForHeight, 0, "block height for tests to begin, ex. --wait-for 100")
cmd.Flags().String(FlagConfigFile, "", "config file to use for the tests")
cmd.Flags().Bool(flagVerbose, false, "set to true to enable verbose logging")
cmd.Flags().Bool(flagTestAdmin, false, "set to true to run admin tests")
cmd.Flags().Bool(flagTestPerformance, false, "set to true to run performance tests")
cmd.Flags().Bool(flagTestCustom, false, "set to true to run custom tests")
cmd.Flags().Bool(flagSkipRegular, false, "set to true to skip regular tests")
cmd.Flags().Bool(flagLight, false, "run the most basic regular tests, useful for quick checks")
cmd.Flags().Bool(flagSetupOnly, false, "set to true to only setup the networks")
cmd.Flags().String(flagConfigOut, "", "config file to write the deployed contracts from the setup")
cmd.Flags().Bool(flagSkipSetup, false, "set to true to skip setup")
cmd.Flags().Bool(flagSkipBitcoinSetup, false, "set to true to skip bitcoin wallet setup")

return cmd
}
Expand Down Expand Up @@ -242,7 +190,16 @@ func localE2ETest(cmd *cobra.Command, _ []string) {
startTime := time.Now()
deployerRunner.SetupEVM(contractsDeployed)
deployerRunner.SetZEVMContracts()

// NOTE: this method return an error so we handle it and panic if it occurs unlike other method that panics directly
// TODO: all methods should return errors instead of panicking and this current function should also return an error
// https://github.com/zeta-chain/node/issues/1500
if err := deployerRunner.FundEmissionsPool(); err != nil {
panic(err)
}

deployerRunner.MintERC20OnEvm(10000)

logger.Print("✅ setup completed in %s", time.Since(startTime))
}

Expand Down Expand Up @@ -346,4 +303,17 @@ func localE2ETest(cmd *cobra.Command, _ []string) {
}

logger.Print("✅ e2e tests completed in %s", time.Since(testStartTime).String())

// print and validate report
networkReport, err := deployerRunner.GenerateNetworkReport()
if err != nil {
logger.Print("❌ failed to generate network report %v", err)
}
deployerRunner.PrintNetworkReport(networkReport)
if err := networkReport.Validate(); err != nil {
logger.Print("❌ network report validation failed %v", err)
os.Exit(1)
}

os.Exit(0)
}
2 changes: 2 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,6 @@ ignore:
- "scripts/"
- "server/"
- "testutil/"
- "testutils/"
- "errors/"
- "typescript/"
1 change: 1 addition & 0 deletions common/bitcoin/proof_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package bitcoin_test
1 change: 1 addition & 0 deletions common/cosmos/cosmos_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package cosmos_test
8 changes: 4 additions & 4 deletions contrib/athens3/zetacored/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
# build:
# context: ../../..
# dockerfile: Dockerfile
image: zetachain/zetacored:${DOCKER_TAG:-ubuntu-v14}
image: zetachain/zetacored:${DOCKER_TAG:-ubuntu-v14.0.1}
environment:
DAEMON_HOME: "/root/.zetacored"
NETWORK: athens3
Expand Down Expand Up @@ -35,8 +35,8 @@ services:
- "9090:9090"
- "9091:9091"
volumes:
- zetacored_data:/root/.zetacored/
entrypoint: bash /scripts/start-zetae2e.sh
- zetacored_data_athens3:/root/.zetacored/
entrypoint: bash /scripts/start.sh

volumes:
zetacored_data:
zetacored_data_athens3:
95 changes: 51 additions & 44 deletions contrib/docker-scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,49 @@ logt() {
echo "$(date '+%Y-%m-%d %H:%M:%S') $1"
}


function load_defaults {
#DEFAULT: Mainnet Statesync.
export DAEMON_HOME=${DAEMON_HOME:=/root/.zetacored}
export NETWORK=${NETWORK:=mainnet}
export RESTORE_TYPE=${RESTORE_TYPE:=statesync}
export SNAPSHOT_API=${SNAPSHOT_API:=https://snapshots.zetachain.com}
export TRUST_HEIGHT_DIFFERENCE_STATE_SYNC=${TRUST_HEIGHT_DIFFERENCE_STATE_SYNC:=40000}
export COSMOVISOR_VERSION=${COSMOVISOR_VERSION:=v1.5.0}
export CHAIN_ID=${CHAIN_ID:=zetachain_7000-1}
export COSMOVISOR_CHECKSUM=${COSMOVISOR_CHECKSUM:=626dfc58c266b85f84a7ed8e2fe0e2346c15be98cfb9f9b88576ba899ed78cdc}
export VISOR_NAME=${VISOR_NAME:=cosmovisor}
export DAEMON_NAME=${DAEMON_NAME:=zetacored}
export DAEMON_ALLOW_DOWNLOAD_BINARIES=${DAEMON_ALLOW_DOWNLOAD_BINARIES:=false}
export DAEMON_RESTART_AFTER_UPGRADE=${DAEMON_RESTART_AFTER_UPGRADE:=true}
export UNSAFE_SKIP_BACKUP=${UNSAFE_SKIP_BACKUP:=true}
export CLIENT_DAEMON_NAME=${CLIENT_DAEMON_NAME:=zetaclientd}
export CLIENT_DAEMON_ARGS=${CLIENT_DAEMON_ARGS:""}
export CLIENT_SKIP_UPGRADE=${CLIENT_SKIP_UPGRADE:=true}
export CLIENT_START_PROCESS=${CLIENT_START_PROCESS:=false}
export MONIKER=${MONIKER:=local-test}
export RE_DO_START_SEQUENCE=${RE_DO_START_SEQUENCE:=false}

#ATHENS3
export BINARY_LIST_ATHENS3=${BINARY_LIST_ATHENS3:=https://raw.githubusercontent.com/zeta-chain/network-config/main/athens3/binary_list.json}
export STATE_SYNC_RPC_NODE_FILE_ATHENS3=${STATE_SYNC_RPC_NODE_FILE_ATHENS3:=https://raw.githubusercontent.com/zeta-chain/network-config/main/athens3/state_sync_node}
export RPC_STATE_SYNC_RPC_LIST_FILE_ATHENS3=${RPC_STATE_SYNC_RPC_LIST_FILE_ATHENS3:=https://raw.githubusercontent.com/zeta-chain/network-config/main/athens3/rpc_state_sync_nodes}
export APP_TOML_FILE_ATHENS3=${APP_TOML_FILE_ATHENS3:=https://raw.githubusercontent.com/zeta-chain/network-config/main/athens3/app.toml}
export CONFIG_TOML_FILE_ATHENS3=${CONFIG_TOML_FILE_ATHENS3:=https://raw.githubusercontent.com/zeta-chain/network-config/main/athens3/config.toml}
export CLIENT_TOML_FILE_ATHENS3=${CLIENT_TOML_FILE_ATHENS3:=https://raw.githubusercontent.com/zeta-chain/network-config/main/athens3/client.toml}
export GENESIS_FILE_ATHENS3=${GENESIS_FILE_ATHENS3:=https://raw.githubusercontent.com/zeta-chain/network-config/main/athens3/genesis.json}

#MAINNET
export BINARY_LIST_MAINNET=${BINARY_LIST_MAINNET:=https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/binary_list.json}
export STATE_SYNC_RPC_NODE_FILE_MAINNET=${STATE_SYNC_RPC_NODE_FILE_MAINNET:=https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/state_sync_node}
export RPC_STATE_SYNC_RPC_LIST_FILE_MAINNET=${RPC_STATE_SYNC_RPC_LIST_FILE_MAINNET:=https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/rpc_state_sync_nodes}
export APP_TOML_FILE_MAINNET=${APP_TOML_FILE_MAINNET:=https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/app.toml}
export CONFIG_TOML_FILE_MAINNET=${CONFIG_TOML_FILE_MAINNET:=https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/config.toml}
export CLIENT_TOML_FILE_MAINNET=${CLIENT_TOML_FILE_MAINNET:=https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/client.toml}
export GENESIS_FILE_MAINNET=${GENESIS_FILE_MAINNET:=https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/genesis.json}

}

function init_chain {
if [ -d "${DAEMON_HOME}/config" ]; then
logt "${DAEMON_NAME} home directory already initialized."
Expand Down Expand Up @@ -193,61 +236,26 @@ function move_zetacored_binaries {
}

function start_network {
${VISOR_NAME} version
${VISOR_NAME} run start --home ${DAEMON_HOME} \
--log_level info \
--moniker ${MONIKER} \
--rpc.laddr tcp://0.0.0.0:26657 \
--minimum-gas-prices 1.0azeta "--grpc.enable=true"
}

function load_defaults {
#DEFAULT: Mainnet Statesync.
export DAEMON_HOME=${DAEMON_HOME:=/root/.zetacored}
export NETWORK=${NETWORK:=mainnet}
export RESTORE_TYPE=${RESTORE_TYPE:=statesync}
export SNAPSHOT_API=${SNAPSHOT_API:=https://snapshots.zetachain.com}
export TRUST_HEIGHT_DIFFERENCE_STATE_SYNC=${TRUST_HEIGHT_DIFFERENCE_STATE_SYNC:=40000}
export COSMOVISOR_VERSION=${COSMOVISOR_VERSION:=v1.5.0}
export CHAIN_ID=${CHAIN_ID:=zetachain_7000-1}
export COSMOVISOR_CHECKSUM=${COSMOVISOR_CHECKSUM:=626dfc58c266b85f84a7ed8e2fe0e2346c15be98cfb9f9b88576ba899ed78cdc}
export VISOR_NAME=${VISOR_NAME:=cosmovisor}
export DAEMON_NAME=${DAEMON_NAME:=zetacored}
export DAEMON_ALLOW_DOWNLOAD_BINARIES=${DAEMON_ALLOW_DOWNLOAD_BINARIES:=false}
export DAEMON_RESTART_AFTER_UPGRADE=${DAEMON_RESTART_AFTER_UPGRADE:=true}
export UNSAFE_SKIP_BACKUP=${UNSAFE_SKIP_BACKUP:=true}
export CLIENT_DAEMON_NAME=${CLIENT_DAEMON_NAME:=zetaclientd}
export CLIENT_DAEMON_ARGS=${CLIENT_DAEMON_ARGS:""}
export CLIENT_SKIP_UPGRADE=${CLIENT_SKIP_UPGRADE:=true}
export CLIENT_START_PROCESS=${CLIENT_START_PROCESS:=false}
export MONIKER=${MONIKER:=local-test}
export RE_DO_START_SEQUENCE=${RE_DO_START_SEQUENCE:=false}

#ATHENS3
export BINARY_LIST_ATHENS3=${BINARY_LIST_ATHENS3:=https://raw.githubusercontent.com/zeta-chain/network-config/main/athens3/binary_list.json}
export STATE_SYNC_RPC_NODE_FILE_ATHENS3=${STATE_SYNC_RPC_NODE_FILE_ATHENS3:=https://raw.githubusercontent.com/zeta-chain/network-config/main/athens3/state_sync_node}
export RPC_STATE_SYNC_RPC_LIST_FILE_ATHENS3=${RPC_STATE_SYNC_RPC_LIST_FILE_ATHENS3:=https://raw.githubusercontent.com/zeta-chain/network-config/main/athens3/rpc_state_sync_nodes}
export APP_TOML_FILE_ATHENS3=${APP_TOML_FILE_ATHENS3:=https://raw.githubusercontent.com/zeta-chain/network-config/main/athens3/app.toml}
export CONFIG_TOML_FILE_ATHENS3=${CONFIG_TOML_FILE_ATHENS3:=https://raw.githubusercontent.com/zeta-chain/network-config/main/athens3/config.toml}
export CLIENT_TOML_FILE_ATHENS3=${CLIENT_TOML_FILE_ATHENS3:=https://raw.githubusercontent.com/zeta-chain/network-config/main/athens3/client.toml}
export GENESIS_FILE_ATHENS3=${GENESIS_FILE_ATHENS3:=https://raw.githubusercontent.com/zeta-chain/network-config/main/athens3/genesis.json}

#MAINNET
export BINARY_LIST_MAINNET=${BINARY_LIST_ATHENS3:=https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/binary_list.json}
export STATE_SYNC_RPC_NODE_FILE_MAINNET=${STATE_SYNC_RPC_NODE_FILE_MAINNET:=https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/state_sync_node}
export RPC_STATE_SYNC_RPC_LIST_FILE_MAINNET=${RPC_STATE_SYNC_RPC_LIST_FILE_MAINNET:=https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/rpc_state_sync_nodes}
export APP_TOML_FILE_MAINNET=${APP_TOML_FILE_MAINNET:=https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/app.toml}
export CONFIG_TOML_FILE_MAINNET=${CONFIG_TOML_FILE_MAINNET:=https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/config.toml}
export CLIENT_TOML_FILE_MAINNET=${CLIENT_TOML_FILE_MAINNET:=https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/client.toml}
export GENESIS_FILE_MAINNET=${GENESIS_FILE_MAINNET:=https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/genesis.json}

}

logt "Load Default Values for ENV Vars if not set."
load_defaults

if [[ -f "${DAEMON_HOME}/start_sequence_status" ]] && grep -q "START_SEQUENCE_COMPLETE" "${DAEMON_HOME}/start_sequence_status" && [[ "$RE_DO_START_SEQUENCE" != "true" ]]; then
logt "The start sequence is complete and no redo is required."

logt "Download Configs"
download_configs

logt "Download Historical Binaries"
download_binary_version

if [ "${RESTORE_TYPE}" == "statesync" ]; then
logt "Setup Restore Type: ${RESTORE_TYPE}"
logt "During restarts, we re-do this to ensure to update the configs with valid values. When you call change config the stuff that gets set in this function for statesync needs to be set. Doesn't effect to re-set this."
Expand Down Expand Up @@ -296,5 +304,4 @@ else

logt "Start Network"
start_network
fi

fi
8 changes: 4 additions & 4 deletions contrib/mainnet/zetacored/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
# build:
# context: ../../..
# dockerfile: Dockerfile
image: zetachain/zetacored:${DOCKER_TAG:-ubuntu-v14}
image: zetachain/zetacored:${DOCKER_TAG:-ubuntu-v14.0.1}
container_name: zetachain_mainnet_rpc
environment:
DAEMON_HOME: "/root/.zetacored"
Expand Down Expand Up @@ -36,10 +36,10 @@ services:
- "9090:9090"
- "9091:9091"
volumes:
- zetacored_data:/root/.zetacored/
entrypoint: bash /scripts/start-zetae2e.sh
- zetacored_data_mainnet:/root/.zetacored/
entrypoint: bash /scripts/start.sh
#for debugging
#entrypoint: ["/bin/sh", "-c"]
#command: ["while true; do sleep 86400; done"]
volumes:
zetacored_data:
zetacored_data_mainnet:
Loading

0 comments on commit f9f658b

Please sign in to comment.