Skip to content

Commit

Permalink
Fix evm chain params initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
skosito committed Feb 21, 2024
1 parent eb6f0be commit 3db710a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmd/zetaclientd/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func DebugCmd() *cobra.Command {
if err != nil {
return err
}
coreContext := corecontext.NewZetaCoreContext()
coreContext := corecontext.NewZetaCoreContext(cfg)
chainID, err := strconv.ParseInt(args[1], 10, 64)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion cmd/zetaclientd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func start(_ *cobra.Command, _ []string) error {
startLogger.Debug().Msgf("CreateAuthzSigner is ready")

// Initialize core parameters from zetacore
appContext := appcontext.NewAppContext(corecontext.NewZetaCoreContext(), cfg, masterLogger)
appContext := appcontext.NewAppContext(corecontext.NewZetaCoreContext(cfg), cfg, masterLogger)
err = zetaBridge.UpdateZetaCoreContext(appContext.ZetaCoreContext(), true)
if err != nil {
startLogger.Error().Err(err).Msg("Error getting core parameters")
Expand Down
9 changes: 7 additions & 2 deletions zetaclient/core_context/zeta_core_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/rs/zerolog"
"github.com/zeta-chain/zetacore/common"
observertypes "github.com/zeta-chain/zetacore/x/observer/types"
"github.com/zeta-chain/zetacore/zetaclient/config"
)

type ZetaCoreContext struct {
Expand All @@ -19,11 +20,15 @@ type ZetaCoreContext struct {
CurrentTssPubkey string
}

func NewZetaCoreContext() *ZetaCoreContext {
func NewZetaCoreContext(cfg *config.Config) *ZetaCoreContext {
evmChainParams := make(map[int64]*observertypes.ChainParams)
for _, e := range cfg.EVMChainConfigs {
evmChainParams[e.Chain.ChainId] = &observertypes.ChainParams{}
}
return &ZetaCoreContext{
coreContextLock: new(sync.RWMutex),
ChainsEnabled: []common.Chain{},
EVMChainParams: make(map[int64]*observertypes.ChainParams),
EVMChainParams: evmChainParams,
BitcoinChainParams: &observertypes.ChainParams{},
}
}
Expand Down

0 comments on commit 3db710a

Please sign in to comment.