From a0e4f6269176f02a6f83ff49bf04a3cc6146e913 Mon Sep 17 00:00:00 2001 From: Charlie Chen <34498985+ws4charlie@users.noreply.github.com> Date: Tue, 16 Jan 2024 12:49:25 -0600 Subject: [PATCH 1/5] fix: skip unsupported chain parameters (#1581) Co-authored-by: Lucas Bertrand --- changelog.md | 1 + zetaclient/zetacore_bridge.go | 15 +++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/changelog.md b/changelog.md index 3c8acacc3c..56dd363d05 100644 --- a/changelog.md +++ b/changelog.md @@ -35,6 +35,7 @@ Getting the correct TSS address for Bitcoin now requires proviidng the Bitcoin c ### Fixes +* [1575](https://github.com/zeta-chain/node/issues/1575) - Skip unsupported chain parameters by IsSupported flag * [1554](https://github.com/zeta-chain/node/pull/1554) - Screen out unconfirmed UTXOs that are not created by TSS itself * [1560](https://github.com/zeta-chain/node/issues/1560) - Zetaclient post evm-chain outtx hashes only when receipt is available * [1516](https://github.com/zeta-chain/node/issues/1516) - Unprivileged outtx tracker removal diff --git a/zetaclient/zetacore_bridge.go b/zetaclient/zetacore_bridge.go index 0a2b3b08c4..bf4466565c 100644 --- a/zetaclient/zetacore_bridge.go +++ b/zetaclient/zetacore_bridge.go @@ -196,7 +196,8 @@ func (b *ZetaCoreBridge) UpdateConfigFromCore(cfg *config.Config, init bool) err return err } if plan != nil && bn == plan.Height-1 { // stop zetaclients; notify operator to upgrade and restart - b.logger.Warn().Msgf("Active upgrade plan detected and upgrade height reached: %s at height %d; ZetaClient is stopped; please kill this process, replace zetaclientd binary with upgraded version, and restart zetaclientd", plan.Name, plan.Height) + b.logger.Warn().Msgf("Active upgrade plan detected and upgrade height reached: %s at height %d; ZetaClient is stopped;"+ + "please kill this process, replace zetaclientd binary with upgraded version, and restart zetaclientd", plan.Name, plan.Height) b.pause <- struct{}{} // notify CoreObserver to stop ChainClients, Signers, and CoreObservder itself } @@ -212,14 +213,16 @@ func (b *ZetaCoreBridge) UpdateConfigFromCore(cfg *config.Config, init bool) err for _, chainParam := range chainParams { err := config.ValidateChainParams(chainParam) if err != nil { - b.logger.Debug().Err(err).Msgf( - "Invalid core params for chain %s", - common.GetChainFromChainID(chainParam.ChainId).ChainName, - ) + b.logger.Warn().Err(err).Msgf("Invalid chain params for chain %d", chainParam.ChainId) + continue + } + if !chainParam.GetIsSupported() { + b.logger.Info().Msgf("Chain %d is not supported yet", chainParam.ChainId) + continue } if common.IsBitcoinChain(chainParam.ChainId) { newBTCParams = chainParam - } else { + } else if common.IsEVMChain(chainParam.ChainId) { newEVMParams[chainParam.ChainId] = chainParam } } From 9a4608094448b8391a48226fcf14266c31a17709 Mon Sep 17 00:00:00 2001 From: Charlie Chen <34498985+ws4charlie@users.noreply.github.com> Date: Tue, 16 Jan 2024 21:35:19 -0600 Subject: [PATCH 2/5] fix: avoid voting on wrong ballots due to false blockNumber in EVM tx receipt (#1570) * avoid voting on wrong ballots due to false blockNumber in EVM tx receipt * update changelog --- changelog.md | 6 ++++++ zetaclient/evm_client.go | 39 +++++++++++++++++++++++++++------------ 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/changelog.md b/changelog.md index 56dd363d05..c943df84bf 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,12 @@ ## Unreleased +### Features + +### Fixes + +* [1535](https://github.com/zeta-chain/node/issues/1535) - Avoid voting on wrong ballots due to false blockNumber in EVM tx receipt + ## Version: v12.0.0 ### Breaking Changes diff --git a/zetaclient/evm_client.go b/zetaclient/evm_client.go index 8a68ac121e..d88ee980f9 100644 --- a/zetaclient/evm_client.go +++ b/zetaclient/evm_client.go @@ -59,7 +59,7 @@ type EVMLog struct { const ( DonationMessage = "I am rich!" TopicsZetaSent = 3 // [signature, zetaTxSenderAddress, destinationChainId] https://github.com/zeta-chain/protocol-contracts/blob/d65814debf17648a6c67d757ba03646415842790/contracts/evm/ZetaConnector.base.sol#L34 - TopicsZetaReceived = 4 // [signature, sourceChainId, destinationAddress] https://github.com/zeta-chain/protocol-contracts/blob/d65814debf17648a6c67d757ba03646415842790/contracts/evm/ZetaConnector.base.sol#L45 + TopicsZetaReceived = 4 // [signature, sourceChainId, destinationAddress, internalSendHash] https://github.com/zeta-chain/protocol-contracts/blob/d65814debf17648a6c67d757ba03646415842790/contracts/evm/ZetaConnector.base.sol#L45 TopicsZetaReverted = 3 // [signature, destinationChainId, internalSendHash] https://github.com/zeta-chain/protocol-contracts/blob/d65814debf17648a6c67d757ba03646415842790/contracts/evm/ZetaConnector.base.sol#L54 TopicsWithdrawn = 3 // [signature, recipient, asset] https://github.com/zeta-chain/protocol-contracts/blob/d65814debf17648a6c67d757ba03646415842790/contracts/evm/ERC20Custody.sol#L43 TopicsDeposited = 2 // [signature, asset] https://github.com/zeta-chain/protocol-contracts/blob/d65814debf17648a6c67d757ba03646415842790/contracts/evm/ERC20Custody.sol#L42 @@ -721,14 +721,29 @@ func (ob *EVMChainClient) checkConfirmedTx(txHash string, nonce uint64) (*ethtyp return nil, nil, false } - // check confirmations - confHeight := receipt.BlockNumber.Uint64() + ob.GetChainParams().ConfirmationCount - if confHeight >= math.MaxInt64 { - log.Error().Msgf("confirmTxByHash: confHeight is too large for txHash %s nonce %d", txHash, nonce) + // cross-check receipt against the block + block, err := ob.GetBlockByNumberCached(receipt.BlockNumber.Uint64()) + if err != nil { + log.Error().Err(err).Msgf("confirmTxByHash: GetBlockByNumberCached error, txHash %s nonce %d block %d", + txHash, nonce, receipt.BlockNumber) + return nil, nil, false + } + // #nosec G701 non negative value + if receipt.TransactionIndex >= uint(len(block.Transactions())) { + log.Error().Msgf("confirmTxByHash: transaction index %d out of range [0, %d), txHash %s nonce %d block %d", + receipt.TransactionIndex, len(block.Transactions()), txHash, nonce, receipt.BlockNumber) return nil, nil, false } - if confHeight > ob.GetLastBlockHeight() { - log.Info().Msgf("confirmTxByHash: txHash %s nonce %d included but not confirmed: receipt block %d, current block %d", + txAtIndex := block.Transactions()[receipt.TransactionIndex] + if txAtIndex.Hash() != transaction.Hash() { + log.Error().Msgf("confirmTxByHash: transaction at index %d has different hash %s, txHash %s nonce %d block %d", + receipt.TransactionIndex, txAtIndex.Hash().Hex(), txHash, nonce, receipt.BlockNumber) + return nil, nil, false + } + + // check confirmations + if !ob.HasEnoughConfirmations(receipt, ob.GetLastBlockHeight()) { + log.Debug().Msgf("confirmTxByHash: txHash %s nonce %d included but not confirmed: receipt block %d, current block %d", txHash, nonce, receipt.BlockNumber, ob.GetLastBlockHeight()) return nil, nil, false } @@ -848,11 +863,11 @@ func (ob *EVMChainClient) observeInTX(sampledLogger zerolog.Logger) error { } // get and update latest block height - header, err := ob.evmClient.HeaderByNumber(context.Background(), nil) + blockNumber, err := ob.evmClient.BlockNumber(context.Background()) if err != nil { return err } - ob.SetLastBlockHeight(header.Number.Uint64()) + ob.SetLastBlockHeight(blockNumber) // increment prom counter counter, err := ob.GetPromCounter("rpc_getBlockByNumber_count") @@ -862,10 +877,10 @@ func (ob *EVMChainClient) observeInTX(sampledLogger zerolog.Logger) error { counter.Inc() // skip if current height is too low - if header.Number.Uint64() < ob.GetChainParams().ConfirmationCount { - return fmt.Errorf("observeInTX: skipping observer, current block number %d is too low", header.Number.Uint64()) + if blockNumber < ob.GetChainParams().ConfirmationCount { + return fmt.Errorf("observeInTX: skipping observer, current block number %d is too low", blockNumber) } - confirmedBlockNum := header.Number.Uint64() - ob.GetChainParams().ConfirmationCount + confirmedBlockNum := blockNumber - ob.GetChainParams().ConfirmationCount // skip if no new block is confirmed lastScanned := ob.GetLastBlockHeightScanned() From b7867ec2bd74c484bfde2a6027d170a83c81618d Mon Sep 17 00:00:00 2001 From: brewmaster012 <88689859+brewmaster012@users.noreply.github.com> Date: Tue, 16 Jan 2024 20:19:46 -0800 Subject: [PATCH 3/5] fix: zetaclient crash due to out of bound int conversion (#1576) * fix crash due to out of bound * use GetLastBlockHeightScanned() instead * fixed ChainParams equality check and added changelog entry --------- Co-authored-by: Charlie Chen <34498985+ws4charlie@users.noreply.github.com> Co-authored-by: Charlie Chen --- changelog.md | 1 + zetaclient/bitcoin_client.go | 2 +- zetaclient/zetacore_observer.go | 7 ++++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/changelog.md b/changelog.md index c943df84bf..120b77cfd3 100644 --- a/changelog.md +++ b/changelog.md @@ -41,6 +41,7 @@ Getting the correct TSS address for Bitcoin now requires proviidng the Bitcoin c ### Fixes +* [1576](https://github.com/zeta-chain/node/pull/1576) - Fix zetaclient crash due to out of bound integer conversion and log prints. * [1575](https://github.com/zeta-chain/node/issues/1575) - Skip unsupported chain parameters by IsSupported flag * [1554](https://github.com/zeta-chain/node/pull/1554) - Screen out unconfirmed UTXOs that are not created by TSS itself * [1560](https://github.com/zeta-chain/node/issues/1560) - Zetaclient post evm-chain outtx hashes only when receipt is available diff --git a/zetaclient/bitcoin_client.go b/zetaclient/bitcoin_client.go index a316e3b4ac..a82e3a44cb 100644 --- a/zetaclient/bitcoin_client.go +++ b/zetaclient/bitcoin_client.go @@ -1326,7 +1326,7 @@ func (ob *BitcoinChainClient) LoadLastBlock() error { if ob.chain.ChainId == 18444 { // bitcoin regtest: start from block 100 ob.SetLastBlockHeightScanned(100) } - ob.logger.ChainLogger.Info().Msgf("%s: start scanning from block %d", ob.chain.String(), ob.lastBlock) + ob.logger.ChainLogger.Info().Msgf("%s: start scanning from block %d", ob.chain.String(), ob.GetLastBlockHeightScanned()) return nil } diff --git a/zetaclient/zetacore_observer.go b/zetaclient/zetacore_observer.go index 51078aefd2..aff055c74f 100644 --- a/zetaclient/zetacore_observer.go +++ b/zetaclient/zetacore_observer.go @@ -2,6 +2,7 @@ package zetaclient import ( "fmt" + "math" "strings" "time" @@ -158,7 +159,7 @@ func (co *CoreObserver) startCctxScheduler() { co.logger.ZetaChainWatcher.Error().Err(err).Msgf("couldn't get operator balance") } else { diff := co.lastOperatorBalance.Sub(balance) - if diff.GT(sdkmath.NewInt(0)) { + if diff.GT(sdkmath.NewInt(0)) && diff.LT(sdkmath.NewInt(math.MaxInt64)) { co.ts.AddFeeEntry(bn, diff.Int64()) co.lastOperatorBalance = balance } @@ -355,7 +356,7 @@ func (co *CoreObserver) getUpdatedChainOb(chainID int64) (ChainClient, error) { curParams := chainOb.GetChainParams() if common.IsEVMChain(chainID) { evmCfg, found := co.cfg.GetEVMConfig(chainID) - if found && curParams != evmCfg.ChainParams { + if found && curParams.String() != evmCfg.ChainParams.String() { chainOb.SetChainParams(evmCfg.ChainParams) co.logger.ZetaChainWatcher.Info().Msgf( "updated chain params for chainID %d, new params: %v", @@ -365,7 +366,7 @@ func (co *CoreObserver) getUpdatedChainOb(chainID int64) (ChainClient, error) { } } else if common.IsBitcoinChain(chainID) { _, btcCfg, found := co.cfg.GetBTCConfig() - if found && curParams != btcCfg.ChainParams { + if found && curParams.String() != btcCfg.ChainParams.String() { chainOb.SetChainParams(btcCfg.ChainParams) co.logger.ZetaChainWatcher.Info().Msgf( "updated chain params for Bitcoin, new params: %v", From 84502dcfca3c95efe0d1e978f868d04a5de7244f Mon Sep 17 00:00:00 2001 From: Charlie <31941002+CharlieMc0@users.noreply.github.com> Date: Tue, 16 Jan 2024 23:31:19 -0700 Subject: [PATCH 4/5] chore: update ledger dependencies(#1590) --- go.mod | 6 +++--- go.sum | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 942af7d565..aff1f815c3 100644 --- a/go.mod +++ b/go.mod @@ -147,7 +147,7 @@ require ( github.com/cosmos/gogoproto v1.4.7 github.com/cosmos/iavl v0.19.6 // indirect github.com/cosmos/ibc-go/v6 v6.1.0 - github.com/cosmos/ledger-cosmos-go v0.12.2 // indirect + github.com/cosmos/ledger-cosmos-go v0.12.4 // indirect github.com/creachadair/taskgroup v0.3.2 // indirect github.com/danieljoos/wincred v1.1.2 // indirect github.com/davecgh/go-spew v1.1.1 @@ -293,8 +293,8 @@ require ( github.com/tyler-smith/go-bip39 v1.1.0 // indirect github.com/ulikunitz/xz v0.5.10 // indirect github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 // indirect - github.com/zondax/hid v0.9.1 // indirect - github.com/zondax/ledger-go v0.14.1 // indirect + github.com/zondax/hid v0.9.2 // indirect + github.com/zondax/ledger-go v0.14.3 // indirect gitlab.com/thorchain/binance-sdk v1.2.3-0.20210117202539-d569b6b9ba5d // indirect go.opencensus.io v0.24.0 // indirect go.uber.org/atomic v1.11.0 // indirect diff --git a/go.sum b/go.sum index 6d1e76aba3..96ac6b81eb 100644 --- a/go.sum +++ b/go.sum @@ -1043,8 +1043,8 @@ github.com/cosmos/iavl v0.19.6/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONAp github.com/cosmos/ibc-go/v6 v6.1.0 h1:o7oXws2vKkKfOFzJI+oNylRn44PCNt5wzHd/zKQKbvQ= github.com/cosmos/ibc-go/v6 v6.1.0/go.mod h1:CY3zh2HLfetRiW8LY6kVHMATe90Wj/UOoY8T6cuB0is= github.com/cosmos/ledger-cosmos-go v0.11.1/go.mod h1:J8//BsAGTo3OC/vDLjMRFLW6q0WAaXvHnVc7ZmE8iUY= -github.com/cosmos/ledger-cosmos-go v0.12.2 h1:/XYaBlE2BJxtvpkHiBm97gFGSGmYGKunKyF3nNqAXZA= -github.com/cosmos/ledger-cosmos-go v0.12.2/go.mod h1:ZcqYgnfNJ6lAXe4HPtWgarNEY+B74i+2/8MhZw4ziiI= +github.com/cosmos/ledger-cosmos-go v0.12.4 h1:drvWt+GJP7Aiw550yeb3ON/zsrgW0jgh5saFCr7pDnw= +github.com/cosmos/ledger-cosmos-go v0.12.4/go.mod h1:fjfVWRf++Xkygt9wzCsjEBdjcf7wiiY35fv3ctT+k4M= github.com/cosmos/ledger-go v0.9.2/go.mod h1:oZJ2hHAZROdlHiwTg4t7kP+GKIIkBT+o6c9QWFanOyI= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= @@ -3037,11 +3037,11 @@ github.com/zeta-chain/keystone/keys v0.0.0-20231105174229-903bc9405da2/go.mod h1 github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20230816152528-db7d2bf9144b h1:aZRt5BtXdoDdyrUKwcv3B7mS30m/B854cjKjmnXBE5A= github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20230816152528-db7d2bf9144b/go.mod h1:v79f+eY6PMpmLv188FAubst4XV2Mm8mUmx1OgmdFG3c= github.com/zondax/hid v0.9.0/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= -github.com/zondax/hid v0.9.1 h1:gQe66rtmyZ8VeGFcOpbuH3r7erYtNEAezCAYu8LdkJo= -github.com/zondax/hid v0.9.1/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= +github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= +github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= github.com/zondax/ledger-go v0.12.1/go.mod h1:KatxXrVDzgWwbssUWsF5+cOJHXPvzQ09YSlzGNuhOEo= -github.com/zondax/ledger-go v0.14.1 h1:Pip65OOl4iJ84WTpA4BKChvOufMhhbxED3BaihoZN4c= -github.com/zondax/ledger-go v0.14.1/go.mod h1:fZ3Dqg6qcdXWSOJFKMG8GCTnD7slO/RL2feOQv8K320= +github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= +github.com/zondax/ledger-go v0.14.3/go.mod h1:IKKaoxupuB43g4NxeQmbLXv7T9AlQyie1UpHb342ycI= gitlab.com/bosi/decorder v0.2.3/go.mod h1:9K1RB5+VPNQYtXtTDAzd2OEftsZb1oV0IrJrzChSdGE= gitlab.com/thorchain/binance-sdk v1.2.3-0.20210117202539-d569b6b9ba5d h1:GGPSI9gU22zW75m1YO7ZEMFtVEI5NgyK4g17CIXFjqI= gitlab.com/thorchain/binance-sdk v1.2.3-0.20210117202539-d569b6b9ba5d/go.mod h1:SW01IZMpqlPNPdhHnn99qnJNvg8ll/agyyW7p85npwY= From bd413ec69b32ee565015a1c0facd38f2d8a7af2a Mon Sep 17 00:00:00 2001 From: Lucas Bertrand Date: Tue, 16 Jan 2024 22:54:18 -0800 Subject: [PATCH 5/5] fix(`zetaclient`): fix chain params comparison logic (#1588) * add chain params equal functions * fix param change check * goimport * changelog --- changelog.md | 1 + x/observer/types/chain_params.go | 18 ++++++++++++++++++ x/observer/types/chain_params_test.go | 6 ++++++ zetaclient/zetacore_observer.go | 6 ++++-- 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 120b77cfd3..f7049e9a7d 100644 --- a/changelog.md +++ b/changelog.md @@ -7,6 +7,7 @@ ### Fixes * [1535](https://github.com/zeta-chain/node/issues/1535) - Avoid voting on wrong ballots due to false blockNumber in EVM tx receipt +* [1588](https://github.com/zeta-chain/node/pull/1588) - fix chain params comparison logic ## Version: v12.0.0 diff --git a/x/observer/types/chain_params.go b/x/observer/types/chain_params.go index 78b66af17d..d76557584d 100644 --- a/x/observer/types/chain_params.go +++ b/x/observer/types/chain_params.go @@ -319,3 +319,21 @@ func GetDefaultZetaPrivnetChainParams() *ChainParams { IsSupported: false, } } + +// ChainParamsEqual returns true if two chain params are equal +func ChainParamsEqual(params1, params2 ChainParams) bool { + return params1.ChainId == params2.ChainId && + params1.ConfirmationCount == params2.ConfirmationCount && + params1.ZetaTokenContractAddress == params2.ZetaTokenContractAddress && + params1.ConnectorContractAddress == params2.ConnectorContractAddress && + params1.Erc20CustodyContractAddress == params2.Erc20CustodyContractAddress && + params1.InTxTicker == params2.InTxTicker && + params1.OutTxTicker == params2.OutTxTicker && + params1.WatchUtxoTicker == params2.WatchUtxoTicker && + params1.GasPriceTicker == params2.GasPriceTicker && + params1.OutboundTxScheduleInterval == params2.OutboundTxScheduleInterval && + params1.OutboundTxScheduleLookahead == params2.OutboundTxScheduleLookahead && + params1.BallotThreshold.Equal(params2.BallotThreshold) && + params1.MinObserverDelegation.Equal(params2.MinObserverDelegation) && + params1.IsSupported == params2.IsSupported +} diff --git a/x/observer/types/chain_params_test.go b/x/observer/types/chain_params_test.go index 5852f1f661..0bdc9d814d 100644 --- a/x/observer/types/chain_params_test.go +++ b/x/observer/types/chain_params_test.go @@ -44,6 +44,12 @@ func TestUpdateChainParamsSuiteSuite(t *testing.T) { suite.Run(t, new(UpdateChainParamsSuite)) } +func TestChainParamsEqual(t *testing.T) { + params := types.GetDefaultChainParams() + require.True(t, types.ChainParamsEqual(*params.ChainParams[0], *params.ChainParams[0])) + require.False(t, types.ChainParamsEqual(*params.ChainParams[0], *params.ChainParams[1])) +} + func (s *UpdateChainParamsSuite) SetupTest() { s.evmParams = &types.ChainParams{ ConfirmationCount: 1, diff --git a/zetaclient/zetacore_observer.go b/zetaclient/zetacore_observer.go index aff055c74f..8d8d426a39 100644 --- a/zetaclient/zetacore_observer.go +++ b/zetaclient/zetacore_observer.go @@ -6,6 +6,8 @@ import ( "strings" "time" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" + sdkmath "cosmossdk.io/math" "github.com/pkg/errors" @@ -356,7 +358,7 @@ func (co *CoreObserver) getUpdatedChainOb(chainID int64) (ChainClient, error) { curParams := chainOb.GetChainParams() if common.IsEVMChain(chainID) { evmCfg, found := co.cfg.GetEVMConfig(chainID) - if found && curParams.String() != evmCfg.ChainParams.String() { + if found && !observertypes.ChainParamsEqual(curParams, evmCfg.ChainParams) { chainOb.SetChainParams(evmCfg.ChainParams) co.logger.ZetaChainWatcher.Info().Msgf( "updated chain params for chainID %d, new params: %v", @@ -366,7 +368,7 @@ func (co *CoreObserver) getUpdatedChainOb(chainID int64) (ChainClient, error) { } } else if common.IsBitcoinChain(chainID) { _, btcCfg, found := co.cfg.GetBTCConfig() - if found && curParams.String() != btcCfg.ChainParams.String() { + if found && !observertypes.ChainParamsEqual(curParams, btcCfg.ChainParams) { chainOb.SetChainParams(btcCfg.ChainParams) co.logger.ZetaChainWatcher.Info().Msgf( "updated chain params for Bitcoin, new params: %v",