Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/zeta-chain/node into fea…
Browse files Browse the repository at this point in the history
…t-observe-blob-transaction
  • Loading branch information
ws4charlie committed Mar 7, 2024
2 parents 6383662 + 09f99eb commit 01b4243
Show file tree
Hide file tree
Showing 20 changed files with 1,294 additions and 466 deletions.
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
* [1766](https://github.com/zeta-chain/node/pull/1766) - Refactors the `PostTxProcessing` EVM hook functionality to deal with invalid withdraw events
* [1630](https://github.com/zeta-chain/node/pull/1630) - added password prompts for hotkey and tss keyshare in zetaclient
* [1760](https://github.com/zeta-chain/node/pull/1760) - Make staking keeper private in crosschain module
* [1809](https://github.com/zeta-chain/node/pull/1809) - Refactored tryprocessout function in evm signer

### Fixes

Expand Down Expand Up @@ -98,6 +99,7 @@
* Added scripts for the new docker image that facilitate the start up automation.
* Adjusted the docker pipeline slightly to pull the version on PR from the app.go file.
* [1781](https://github.com/zeta-chain/node/pull/1781) - add codecov coverage report in CI
* fixed the download binary script to use relative pathing from binary_list file.

### Features

Expand Down
42 changes: 1 addition & 41 deletions contrib/docker-scripts/download_binaries.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import re
import requests
import os
import json
import logging
import sys
import shutil


# Logger class for easier logging setup
class Logger:
Expand All @@ -22,51 +19,14 @@ def __init__(self):
# Initialize logger instance
logger = Logger()

# Define the path where upgrades will be stored, using an environment variable for the base path
upgrade_path = f'{os.environ["DAEMON_HOME"]}/cosmovisor/upgrades/'


# Function to find the latest patch version of a binary based on major and optional minor version
def find_latest_patch_version(major_version, minor_version=None):
# Define a regex pattern to match version directories
pattern = re.compile(
f"v{major_version}\.{minor_version}\.(\d+)" if minor_version else f"v{major_version}\.0\.(\d+)")
# List directories that match the version pattern
versions = [folder for folder in os.listdir(upgrade_path) if pattern.match(folder)]
if versions:
try:
# Find the maximum version, assuming it's the latest patch
latest_patch_version = max(versions)
# Return the path to the binary of the latest patch version
return os.path.join(upgrade_path, latest_patch_version, "bin", "zetacored")
except ValueError as e:
logger.log.error(f"Error finding latest patch version: {e}")
return None
return None


# Function to replace an old binary with a new one
def replace_binary(source, target):
try:
# Log deletion of old binary
if os.path.exists(target):
logger.log.info(f"Deleted old binary: {target}")
os.remove(target)
# Copy the new binary to the target location
shutil.copy(source, target)
logger.log.info(f"Binary replaced: {target} -> {source}")
except Exception as e:
logger.log.error(f"Error replacing binary: {e}")


# Parse JSON from an environment variable to get binary download information
info = json.loads(os.environ["DOWNLOAD_BINARIES"])

try:
# Iterate over binaries to download
for binary in info["binaries"]:
download_link = binary["download_url"]
binary_location = binary["binary_location"]
binary_location = f'{os.environ["DAEMON_HOME"]}/{binary["binary_location"]}'
binary_directory = os.path.dirname(binary_location)
# Log download link
logger.log.info(f"DOWNLOAD LINK: {download_link}")
Expand Down
5 changes: 3 additions & 2 deletions zetaclient/bitcoin/bitcoin_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ import (
"github.com/zeta-chain/zetacore/common"
observertypes "github.com/zeta-chain/zetacore/x/observer/types"
"github.com/zeta-chain/zetacore/zetaclient/testutils"
"github.com/zeta-chain/zetacore/zetaclient/testutils/stub"
)

func MockBTCClientMainnet() *BTCChainClient {
return &BTCChainClient{
chain: common.BtcMainnetChain(),
zetaClient: testutils.MockCoreBridge(),
Tss: testutils.NewMockTSSMainnet(),
zetaClient: stub.NewZetaCoreBridge(),
Tss: stub.NewTSSMainnet(),
}
}

Expand Down
3 changes: 2 additions & 1 deletion zetaclient/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ type Config struct {

func NewConfig() *Config {
return &Config{
cfgLock: &sync.RWMutex{},
cfgLock: &sync.RWMutex{},
EVMChainConfigs: make(map[int64]*EVMConfig),
}
}

Expand Down
2 changes: 1 addition & 1 deletion zetaclient/evm/evm_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func (ob *ChainClient) WithEvmJSONRPC(client *ethrpc.EthRPC) {
ob.evmJSONRPC = client

Check warning on line 188 in zetaclient/evm/evm_client.go

View check run for this annotation

Codecov / codecov/patch

zetaclient/evm/evm_client.go#L185-L188

Added lines #L185 - L188 were not covered by tests
}

func (ob *ChainClient) WithZetaClient(bridge *zetabridge.ZetaCoreBridge) {
func (ob *ChainClient) WithZetaClient(bridge interfaces.ZetaCoreBridger) {
ob.Mu.Lock()
defer ob.Mu.Unlock()
ob.zetaClient = bridge
Expand Down
Loading

0 comments on commit 01b4243

Please sign in to comment.