Skip to content

Commit

Permalink
Merge branch 'develop' into rpc-tests-todo
Browse files Browse the repository at this point in the history
  • Loading branch information
skosito authored Jun 19, 2024
2 parents 58e47b4 + c667168 commit 2c39d46
Show file tree
Hide file tree
Showing 66 changed files with 1,147 additions and 3,422 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
* @brewmaster012 @kingpinXD @lumtis @ws4charlie @skosito
* @brewmaster012 @kingpinXD @lumtis @ws4charlie @skosito @swift1337

.github/** @zeta-chain/devops
11 changes: 6 additions & 5 deletions .github/ISSUE_TEMPLATE/syncing.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Having difficulties setting up or syncing a node
description: Please fill out the following form to help us understand and resolve your issue with setting up or syncing a node. Provide as much detail as possible to ensure a quick and accurate resolution.
labels: ["infra"]
body:
- type: dropdown
attributes:
Expand All @@ -10,14 +11,14 @@ body:
- type: dropdown
attributes:
label: Does your machine match the technical requirements?
description: See https://www.zetachain.com/docs/validators/requirements/
description: See https://www.zetachain.com/docs/nodes/start-here/requirements/
options:
- "Yes"
- "No"
- type: dropdown
attributes:
label: Have you completed the setup?
description: See https://www.zetachain.com/docs/validators/setup/
description: See https://www.zetachain.com/docs/nodes/start-here/setup/
options:
- "Yes"
- "No"
Expand All @@ -30,10 +31,10 @@ body:
- KSYNC
- type: dropdown
attributes:
label: Did you build your binary from source or download it from the Releases[https://github.com/zeta-chain/node/releases] page?
description: We recommend using binaries from our releases page.
label: Did you build your binary from source or download it from the Releases page?
description: "We recommend using binaries from our Releases page: https://github.com/zeta-chain/node/releases"
options:
- "Downloaded from releases page"
- "Downloaded from Releases page"
- "Built locally"
- type: textarea
attributes:
Expand Down
2 changes: 0 additions & 2 deletions Dockerfile-localnet
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@ RUN mkdir -p /root/.zetacored/cosmovisor/genesis/bin && \
ENV PATH /root/.zetacored/cosmovisor/current/bin/:/root/.zetaclientd/upgrades/current/:${PATH}

COPY contrib/localnet/scripts /root
COPY contrib/localnet/preparams /root/preparams
COPY contrib/localnet/ssh_config /root/.ssh/config
COPY contrib/localnet/zetacored /root/zetacored
COPY contrib/localnet/tss /root/tss

RUN chmod 755 /root/*.sh

Expand Down
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
* [2269](https://github.com/zeta-chain/node/pull/2269) - refactor MsgUpdateCrosschainFlags into MsgEnableCCTX, MsgDisableCCTX and MsgUpdateGasPriceIncreaseFlags
* [2306](https://github.com/zeta-chain/node/pull/2306) - refactor zetaclient outbound transaction signing logic
* [2296](https://github.com/zeta-chain/node/pull/2296) - move `testdata` package to `testutil` to organize test-related utilities
* [2344](https://github.com/zeta-chain/node/pull/2344) - group common data of EVM/Bitcoin signer and observer using base structs

### Tests

Expand All @@ -67,6 +68,7 @@
* [2233](https://github.com/zeta-chain/node/pull/2233) - fix `IsSupported` flag not properly updated in zetaclient's context
* [2243](https://github.com/zeta-chain/node/pull/2243) - fix incorrect bitcoin outbound height in the CCTX outbound parameter
* [2256](https://github.com/zeta-chain/node/pull/2256) - fix rate limiter falsely included reverted non-withdraw cctxs
* [2327](https://github.com/zeta-chain/node/pull/2327) - partially cherry picked the fix to Bitcoin outbound dust amount

### CI

Expand Down
64 changes: 0 additions & 64 deletions cmd/zetaclientd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,15 @@ package main
import (
"math/rand"
"os"
"path/filepath"
"time"

ecdsakeygen "github.com/binance-chain/tss-lib/ecdsa/keygen"
"github.com/cosmos/cosmos-sdk/server"
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
"github.com/cosmos/cosmos-sdk/types"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"

"github.com/zeta-chain/zetacore/app"
"github.com/zeta-chain/zetacore/cmd"
clientcommon "github.com/zeta-chain/zetacore/zetaclient/common"
"github.com/zeta-chain/zetacore/zetaclient/config"
)

const (
ComplianceLogFile = "compliance.log"
)

var (
Expand Down Expand Up @@ -53,58 +44,3 @@ func SetupConfigForTest() {
rand.Seed(time.Now().UnixNano())

}

func InitLogger(cfg config.Config) (clientcommon.ClientLogger, error) {
// open compliance log file
file, err := OpenComplianceLogFile(cfg)
if err != nil {
return clientcommon.DefaultLoggers(), err
}

var logger zerolog.Logger
var loggerCompliance zerolog.Logger
switch cfg.LogFormat {
case "json":
logger = zerolog.New(os.Stdout).Level(zerolog.Level(cfg.LogLevel)).With().Timestamp().Logger()
loggerCompliance = zerolog.New(file).Level(zerolog.Level(cfg.LogLevel)).With().Timestamp().Logger()
case "text":
logger = zerolog.New(zerolog.ConsoleWriter{Out: os.Stdout, TimeFormat: time.RFC3339}).
Level(zerolog.Level(cfg.LogLevel)).
With().
Timestamp().
Logger()
loggerCompliance = zerolog.New(file).Level(zerolog.Level(cfg.LogLevel)).With().Timestamp().Logger()
default:
logger = zerolog.New(zerolog.ConsoleWriter{Out: os.Stdout, TimeFormat: time.RFC3339})
loggerCompliance = zerolog.New(file).With().Timestamp().Logger()
}

if cfg.LogSampler {
logger = logger.Sample(&zerolog.BasicSampler{N: 5})
}
log.Logger = logger // set global logger

return clientcommon.ClientLogger{
Std: log.Logger,
Compliance: loggerCompliance,
}, nil
}

func OpenComplianceLogFile(cfg config.Config) (*os.File, error) {
// use zetacore home as default
logPath := cfg.ZetaCoreHome
if cfg.ComplianceConfig.LogPath != "" {
logPath = cfg.ComplianceConfig.LogPath
}

// clean file name
name := filepath.Join(logPath, ComplianceLogFile)
name, err := filepath.Abs(name)
if err != nil {
return nil, err
}
name = filepath.Clean(name)

// open (or create) compliance log file
return os.OpenFile(name, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0600)
}
9 changes: 5 additions & 4 deletions cmd/zetaclientd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/zeta-chain/zetacore/pkg/authz"
"github.com/zeta-chain/zetacore/pkg/constant"
observerTypes "github.com/zeta-chain/zetacore/x/observer/types"
"github.com/zeta-chain/zetacore/zetaclient/chains/base"
"github.com/zeta-chain/zetacore/zetaclient/config"
"github.com/zeta-chain/zetacore/zetaclient/context"
"github.com/zeta-chain/zetacore/zetaclient/metrics"
Expand Down Expand Up @@ -61,7 +62,7 @@ func start(_ *cobra.Command, _ []string) error {
if err != nil {
return err
}
loggers, err := InitLogger(cfg)
logger, err := base.InitLogger(cfg)
if err != nil {
log.Error().Err(err).Msg("InitLogger failed")
return err
Expand All @@ -76,7 +77,7 @@ func start(_ *cobra.Command, _ []string) error {
}
}

masterLogger := loggers.Std
masterLogger := logger.Std
startLogger := masterLogger.With().Str("module", "startup").Logger()

// Wait until zetacore is up
Expand Down Expand Up @@ -267,7 +268,7 @@ func start(_ *cobra.Command, _ []string) error {
}

// CreateSignerMap: This creates a map of all signers for each chain . Each signer is responsible for signing transactions for a particular chain
signerMap, err := CreateSignerMap(appContext, tss, loggers, telemetryServer)
signerMap, err := CreateSignerMap(appContext, tss, logger, telemetryServer)
if err != nil {
log.Error().Err(err).Msg("CreateSignerMap")
return err
Expand All @@ -281,7 +282,7 @@ func start(_ *cobra.Command, _ []string) error {
dbpath := filepath.Join(userDir, ".zetaclient/chainobserver")

// Creates a map of all chain observers for each chain. Each chain observer is responsible for observing events on the chain and processing them.
observerMap, err := CreateChainObserverMap(appContext, zetacoreClient, tss, dbpath, loggers, telemetryServer)
observerMap, err := CreateChainObserverMap(appContext, zetacoreClient, tss, dbpath, logger, telemetryServer)
if err != nil {
startLogger.Err(err).Msg("CreateChainObserverMap")
return err
Expand Down
26 changes: 13 additions & 13 deletions cmd/zetaclientd/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import (
ethcommon "github.com/ethereum/go-ethereum/common"

"github.com/zeta-chain/zetacore/zetaclient/authz"
"github.com/zeta-chain/zetacore/zetaclient/chains/base"
btcobserver "github.com/zeta-chain/zetacore/zetaclient/chains/bitcoin/observer"
btcsigner "github.com/zeta-chain/zetacore/zetaclient/chains/bitcoin/signer"
evmobserver "github.com/zeta-chain/zetacore/zetaclient/chains/evm/observer"
evmsigner "github.com/zeta-chain/zetacore/zetaclient/chains/evm/signer"
"github.com/zeta-chain/zetacore/zetaclient/chains/interfaces"
clientcommon "github.com/zeta-chain/zetacore/zetaclient/common"
"github.com/zeta-chain/zetacore/zetaclient/config"
"github.com/zeta-chain/zetacore/zetaclient/context"
"github.com/zeta-chain/zetacore/zetaclient/keys"
Expand Down Expand Up @@ -57,7 +57,7 @@ func CreateZetacoreClient(
func CreateSignerMap(
appContext *context.AppContext,
tss interfaces.TSSSigner,
loggers clientcommon.ClientLogger,
logger base.Logger,
ts *metrics.TelemetryServer,
) (map[int64]interfaces.ChainSigner, error) {
coreContext := appContext.ZetacoreContext()
Expand All @@ -70,7 +70,7 @@ func CreateSignerMap(
}
evmChainParams, found := coreContext.GetEVMChainParams(evmConfig.Chain.ChainId)
if !found {
loggers.Std.Error().Msgf("ChainParam not found for chain %s", evmConfig.Chain.String())
logger.Std.Error().Msgf("ChainParam not found for chain %s", evmConfig.Chain.String())
continue
}
mpiAddress := ethcommon.HexToAddress(evmChainParams.ConnectorContractAddress)
Expand All @@ -84,20 +84,20 @@ func CreateSignerMap(
mpiAddress,
erc20CustodyAddress,
coreContext,
loggers,
logger,
ts)
if err != nil {
loggers.Std.Error().Err(err).Msgf("NewEVMSigner error for chain %s", evmConfig.Chain.String())
logger.Std.Error().Err(err).Msgf("NewEVMSigner error for chain %s", evmConfig.Chain.String())
continue
}
signerMap[evmConfig.Chain.ChainId] = signer
}
// BTC signer
btcChain, btcConfig, enabled := appContext.GetBTCChainAndConfig()
if enabled {
signer, err := btcsigner.NewSigner(btcConfig, tss, loggers, ts, coreContext)
signer, err := btcsigner.NewSigner(btcConfig, tss, logger, ts, coreContext)
if err != nil {
loggers.Std.Error().Err(err).Msgf("NewBTCSigner error for chain %s", btcChain.String())
logger.Std.Error().Err(err).Msgf("NewBTCSigner error for chain %s", btcChain.String())
} else {
signerMap[btcChain.ChainId] = signer
}
Expand All @@ -112,7 +112,7 @@ func CreateChainObserverMap(
zetacoreClient *zetacore.Client,
tss interfaces.TSSSigner,
dbpath string,
loggers clientcommon.ClientLogger,
logger base.Logger,
ts *metrics.TelemetryServer,
) (map[int64]interfaces.ChainObserver, error) {
observerMap := make(map[int64]interfaces.ChainObserver)
Expand All @@ -123,22 +123,22 @@ func CreateChainObserverMap(
}
_, found := appContext.ZetacoreContext().GetEVMChainParams(evmConfig.Chain.ChainId)
if !found {
loggers.Std.Error().Msgf("ChainParam not found for chain %s", evmConfig.Chain.String())
logger.Std.Error().Msgf("ChainParam not found for chain %s", evmConfig.Chain.String())
continue
}
co, err := evmobserver.NewObserver(appContext, zetacoreClient, tss, dbpath, loggers, evmConfig, ts)
co, err := evmobserver.NewObserver(appContext, zetacoreClient, tss, dbpath, logger, evmConfig, ts)
if err != nil {
loggers.Std.Error().Err(err).Msgf("NewObserver error for evm chain %s", evmConfig.Chain.String())
logger.Std.Error().Err(err).Msgf("NewObserver error for evm chain %s", evmConfig.Chain.String())
continue
}
observerMap[evmConfig.Chain.ChainId] = co
}
// BTC observer
btcChain, btcConfig, enabled := appContext.GetBTCChainAndConfig()
if enabled {
co, err := btcobserver.NewObserver(appContext, btcChain, zetacoreClient, tss, dbpath, loggers, btcConfig, ts)
co, err := btcobserver.NewObserver(appContext, btcChain, zetacoreClient, tss, dbpath, logger, btcConfig, ts)
if err != nil {
loggers.Std.Error().Err(err).Msgf("NewObserver error for bitcoin chain %s", btcChain.String())
logger.Std.Error().Err(err).Msgf("NewObserver error for bitcoin chain %s", btcChain.String())

} else {
observerMap[btcChain.ChainId] = co
Expand Down
1 change: 0 additions & 1 deletion contrib/localnet/preparams/PreParams_zetaclient0.json

This file was deleted.

Loading

0 comments on commit 2c39d46

Please sign in to comment.