Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: hotfix release v12.0.3 #1617

Closed
wants to merge 10 commits into from
13 changes: 7 additions & 6 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

## Unreleased

### Features

* [1591](https://github.com/zeta-chain/node/pull/1591) - support lower gas limit for voting on inbound and outbound transactions
* [1592](https://github.com/zeta-chain/node/issues/1592) - check inbound tracker tx hash against Tss address and some refactor on inTx observation

### Fixes
* [1625](https://github.com/zeta-chain/node/pull/1625) - temporarily skip keygen check in zetaclient
## Version: v12.0.0

### Breaking Changes
Expand All @@ -24,8 +31,6 @@ Getting the correct TSS address for Bitcoin now requires proviidng the Bitcoin c
* `GetTssAddress` : Changed from `/zeta-chain/observer/get_tss_address/` to `/zeta-chain/observer/getTssAddress/{bitcoin_chain_id}` . Optional bitcoin chain id can now be passed as a parameter to fetch the correct tss for required BTC chain. This parameter only affects the BTC tss address in the response.

### Features

* [1549](https://github.com/zeta-chain/node/pull/1549) - add monitoring for vote tx results in ZetaClient
* [1498](https://github.com/zeta-chain/node/pull/1498) - Add monitoring(grafana, prometheus, ethbalance) for localnet testing
* [1395](https://github.com/zeta-chain/node/pull/1395) - Add state variable to track aborted zeta amount
* [1410](https://github.com/zeta-chain/node/pull/1410) - `snapshots` commands
Expand Down Expand Up @@ -53,7 +58,6 @@ Getting the correct TSS address for Bitcoin now requires proviidng the Bitcoin c
* [1525](https://github.com/zeta-chain/node/pull/1525) - relax EVM chain block header length check 1024->4096
* [1522](https://github.com/zeta-chain/node/pull/1522/files) - block `distribution` module account from receiving zeta
* [1528](https://github.com/zeta-chain/node/pull/1528) - fix panic caused on decoding malformed BTC addresses
* [1557](https://github.com/zeta-chain/node/pull/1557) - remove decreaseAllowance and increaseAllowance checks
* [1536](https://github.com/zeta-chain/node/pull/1536) - add index to check previously finalized inbounds
* [1556](https://github.com/zeta-chain/node/pull/1556) - add emptiness check for topic array in event parsing
* [1546](https://github.com/zeta-chain/node/pull/1546) - fix reset of pending nonces on genesis import
Expand All @@ -80,7 +84,6 @@ Getting the correct TSS address for Bitcoin now requires proviidng the Bitcoin c
* Update --ledger flag hint

### Chores

* [1446](https://github.com/zeta-chain/node/pull/1446) - renamed file `zetaclientd/aux.go` to `zetaclientd/utils.go` to avoid complaints from go package resolver.
* [1499](https://github.com/zeta-chain/node/pull/1499) - Add scripts to localnet to help test gov proposals
* [1442](https://github.com/zeta-chain/node/pull/1442) - remove build types in `.goreleaser.yaml`
Expand All @@ -92,9 +95,7 @@ Getting the correct TSS address for Bitcoin now requires proviidng the Bitcoin c
* [1538](https://github.com/zeta-chain/node/pull/1538) - improve stateful e2e testing

### CI

* Removed private runners and unused GitHub Action
* Adding typescript publishing pipeline.

## Version: v11.0.0

Expand Down
4 changes: 4 additions & 0 deletions cmd/zetaclientd/keygen_tss.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"errors"
"fmt"
"math"
"time"

"github.com/rs/zerolog"
Expand Down Expand Up @@ -79,6 +80,9 @@ func GenerateTss(logger zerolog.Logger,
}
// Try generating TSS at keygen block , only when status is pending keygen and generation has not been tried at the block
if keyGen.Status == observertypes.KeygenStatus_PendingKeygen {
if keyGen.BlockNumber == math.MaxInt64 {
return tss, nil
}
// Return error if RPC is not working
currentBlock, err := zetaBridge.GetZetaBlockHeight()
if err != nil {
Expand Down
18 changes: 9 additions & 9 deletions cmd/zetaclientd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"path/filepath"
"strings"
"syscall"
"time"

"github.com/libp2p/go-libp2p/core"
maddr "github.com/multiformats/go-multiaddr"
Expand Down Expand Up @@ -173,14 +172,15 @@ func start(_ *cobra.Command, _ []string) error {

// Wait for TSS keygen to be successful before proceeding, This is a blocking thread only for a new keygen.
// For existing keygen, this should directly proceed to the next step
ticker := time.NewTicker(time.Second * 1)
for range ticker.C {
if cfg.Keygen.Status != observerTypes.KeygenStatus_KeyGenSuccess {
startLogger.Info().Msgf("Waiting for TSS Keygen to be a success, current status %s", cfg.Keygen.Status)
continue
}
break
}
// Temporarily allow zeta-client to proceed even if the keygen is set to pending
//ticker := time.NewTicker(time.Second * 1)
//for range ticker.C {
// if cfg.Keygen.Status != observerTypes.KeygenStatus_KeyGenSuccess {
// startLogger.Info().Msgf("Waiting for TSS Keygen to be a success, current status %s", cfg.Keygen.Status)
// continue
// }
// break
//}

// Update Current TSS value from zetacore, if TSS keygen is successful, the TSS address is set on zeta-core
// Returns err if the RPC call fails as zeta client needs the current TSS address to be set
Expand Down
2 changes: 1 addition & 1 deletion contrib/localnet/scripts/start-zetaclientd-genesis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ else
SEED=$(curl --retry 10 --retry-delay 5 --retry-connrefused -s zetaclient0:8123/p2p)
done
rm ~/.tss/*
zetaclientd init --peer /ip4/172.20.0.21/tcp/6668/p2p/"$SEED" --zetacore-url "$node" --chain-id athens_101-1 --operator "$operatorAddress" --log-format=text --public-ip "$MYIP" --log-level 0 --keyring-backend "$BACKEND"
zetaclientd init --peer /ip4/172.20.0.21/tcp/6668/p2p/"$SEED" --zetacore-url "$node" --chain-id athens_101-1 --operator "$operatorAddress" --log-format=text --public-ip "$MYIP" --log-level 1 --keyring-backend "$BACKEND"
zetaclientd start
fi
2 changes: 1 addition & 1 deletion contrib/localnet/scripts/start-zetaclientd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ else
zetaclientd init \
--peer /ip4/172.20.0.21/tcp/6668/p2p/$SEED \
--pre-params ~/preParams.json --zetacore-url $node \
--chain-id athens_101-1 --operator zeta1lz2fqwzjnk6qy48fgj753h48444fxtt7hekp52 --log-level 0 --hotkey=val_grantee_observer
--chain-id athens_101-1 --operator zeta1lz2fqwzjnk6qy48fgj753h48444fxtt7hekp52 --log-level 1 --hotkey=val_grantee_observer
zetaclientd start
fi
57 changes: 53 additions & 4 deletions zetaclient/bitcoin_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"strconv"
"sync"
"sync/atomic"
"time"

cosmosmath "cosmossdk.io/math"
"github.com/btcsuite/btcd/btcjson"
Expand Down Expand Up @@ -199,6 +200,54 @@ func (ob *BitcoinChainClient) Start() {
go ob.WatchUTXOS()
go ob.WatchGasPrice()
go ob.ExternalChainWatcherForNewInboundTrackerSuggestions()
go ob.RPCStatus()
}

func (ob *BitcoinChainClient) RPCStatus() {
ob.logger.ChainLogger.Info().Msgf("RPCStatus is starting")
ticker := time.NewTicker(60 * time.Second)

for {
select {
case <-ticker.C:
//ob.logger.ChainLogger.Info().Msgf("RPCStatus is running")
bn, err := ob.rpcClient.GetBlockCount()
if err != nil {
ob.logger.ChainLogger.Error().Err(err).Msg("RPC status check: RPC down? ")
continue
}
hash, err := ob.rpcClient.GetBlockHash(bn)
if err != nil {
ob.logger.ChainLogger.Error().Err(err).Msg("RPC status check: RPC down? ")
continue
}
header, err := ob.rpcClient.GetBlockHeader(hash)
if err != nil {
ob.logger.ChainLogger.Error().Err(err).Msg("RPC status check: RPC down? ")
continue
}
blockTime := header.Timestamp
elapsedSeconds := time.Since(blockTime).Seconds()
if elapsedSeconds > 1200 {
ob.logger.ChainLogger.Error().Err(err).Msg("RPC status check: RPC down? ")
continue
}
tssAddr := ob.Tss.BTCAddressWitnessPubkeyHash()
res, err := ob.rpcClient.ListUnspentMinMaxAddresses(0, 1000000, []btcutil.Address{tssAddr})
if err != nil {
ob.logger.ChainLogger.Error().Err(err).Msg("RPC status check: can't list utxos of TSS address; wallet or loaded? TSS address is not imported? ")
continue
}
if len(res) == 0 {
ob.logger.ChainLogger.Error().Err(err).Msg("RPC status check: TSS address has no utxos; TSS address is not importede? ")
continue
}
ob.logger.ChainLogger.Info().Msgf("[OK] RPC status check: latest block number %d, timestamp %s (%.fs ago), tss addr %s, #utxos: %d", bn, blockTime, elapsedSeconds, tssAddr, len(res))

case <-ob.stop:
return
}
}
}

func (ob *BitcoinChainClient) Stop() {
Expand Down Expand Up @@ -385,12 +434,12 @@ func (ob *BitcoinChainClient) observeInTx() error {
// post inbound vote message to zetacore
for _, inTx := range inTxs {
msg := ob.GetInboundVoteMessageFromBtcEvent(inTx)
zetaHash, ballot, err := ob.zetaClient.PostSend(PostSendEVMGasLimit, msg)
zetaHash, ballot, err := ob.zetaClient.PostVoteInbound(PostVoteInboundGasLimit, PostVoteInboundExecutionGasLimit, msg)
if err != nil {
ob.logger.WatchInTx.Error().Err(err).Msgf("observeInTxBTC: error posting to zeta core for tx %s", inTx.TxHash)
return err // we have to re-scan this block next time
} else if zetaHash != "" {
ob.logger.WatchInTx.Info().Msgf("observeInTxBTC: BTC deposit detected and reported: PostSend zeta tx: %s ballot %s", zetaHash, ballot)
ob.logger.WatchInTx.Info().Msgf("observeInTxBTC: BTC deposit detected and reported: PostVoteInbound zeta tx: %s ballot %s", zetaHash, ballot)
}
}

Expand Down Expand Up @@ -470,7 +519,7 @@ func (ob *BitcoinChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64
}

logger.Debug().Msgf("Bitcoin outTx confirmed: txid %s, amount %s\n", res.TxID, amountInSat.String())
zetaHash, ballot, err := ob.zetaClient.PostReceiveConfirmation(
zetaHash, ballot, err := ob.zetaClient.PostVoteOutbound(
sendHash,
res.TxID,
// #nosec G701 always positive
Expand Down Expand Up @@ -1326,7 +1375,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
}
Expand Down
8 changes: 3 additions & 5 deletions zetaclient/broadcast.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ func (b *ZetaCoreBridge) Broadcast(gaslimit uint64, authzWrappedMsg sdktypes.Msg
b.seqNumber[authzSigner.KeyType] = seqNumber
}
}
//b.logger.Info().Uint64("account_number", b.accountNumber).Uint64("sequence_number", b.seqNumber).Msg("account info")

flags := flag.NewFlagSet("zetacore", 0)

Expand All @@ -69,12 +68,13 @@ func (b *ZetaCoreBridge) Broadcast(gaslimit uint64, authzWrappedMsg sdktypes.Msg
if err != nil {
return "", err
}

builder.SetGasLimit(gaslimit)

// #nosec G701 always in range
fee := sdktypes.NewCoins(sdktypes.NewCoin(config.BaseDenom,
cosmos.NewInt(int64(gaslimit)).Mul(cosmos.NewInt(baseGasPrice))))
builder.SetFeeAmount(fee)
//fmt.Printf("signing from name: %s\n", ctx.GetFromName())
err = b.SignTx(factory, ctx.GetFromName(), builder, true, ctx.TxConfig)
if err != nil {
return "", err
Expand All @@ -90,6 +90,7 @@ func (b *ZetaCoreBridge) Broadcast(gaslimit uint64, authzWrappedMsg sdktypes.Msg
b.logger.Error().Err(err).Msgf("fail to broadcast tx %s", err.Error())
return "", err
}

// Code will be the tendermint ABICode , it start at 1 , so if it is an error , code will not be zero
if commit.Code > 0 {
if commit.Code == 32 {
Expand All @@ -114,11 +115,8 @@ func (b *ZetaCoreBridge) Broadcast(gaslimit uint64, authzWrappedMsg sdktypes.Msg
}
return commit.TxHash, fmt.Errorf("fail to broadcast to zetachain,code:%d, log:%s", commit.Code, commit.RawLog)
}
//b.logger.Debug().Msgf("Received a TxHash of %v from the metachain, Code %d, log %s", commit.TxHash, commit.Code, commit.Logs)

// increment seqNum
//seq := b.seqNumber[authzSigner.KeyType]
//atomic.AddUint64(&seq, 1)
b.seqNumber[authzSigner.KeyType] = b.seqNumber[authzSigner.KeyType] + 1

return commit.TxHash, nil
Expand Down
4 changes: 2 additions & 2 deletions zetaclient/btc_signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ func (signer *BTCSigner) SignWithdrawTx(
signer.logger.Info().Msgf("sizeLimit %d is less than txSize %d for nonce %d", sizeLimit, txSize, nonce)
}
if txSize < outTxBytesMin { // outbound shouldn't be blocked a low sizeLimit
signer.logger.Warn().Msgf("sizeLimit %d is less than outTxBytesMin %d; use outTxBytesMin", sizeLimit, outTxBytesMin)
signer.logger.Warn().Msgf("txSize %d is less than outTxBytesMin %d; use outTxBytesMin", txSize, outTxBytesMin)
txSize = outTxBytesMin
}
if txSize > outTxBytesMax { // in case of accident
signer.logger.Warn().Msgf("sizeLimit %d is greater than outTxBytesMax %d; use outTxBytesMax", sizeLimit, outTxBytesMax)
signer.logger.Warn().Msgf("txSize %d is greater than outTxBytesMax %d; use outTxBytesMax", txSize, outTxBytesMax)
txSize = outTxBytesMax
}

Expand Down
Loading
Loading