Skip to content

Commit

Permalink
Merge branch 'develop' into ci-add-docker-build-and-push
Browse files Browse the repository at this point in the history
  • Loading branch information
lumtis authored Feb 13, 2024
2 parents b73b74a + 68f8ed9 commit 84d417b
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 1 deletion.
7 changes: 6 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,24 @@

* `zetaclientd start` : 2 inputs required from stdin

### Docs

* [1731](https://github.com/zeta-chain/node/pull/1731) added doc for hotkey and tss key-share password prompts.

### Refactor

* [1630](https://github.com/zeta-chain/node/pull/1630) added password prompts for hotkey and tss keyshare in zetaclient
Starting zetaclient now requires two passwords to be input; one for the hotkey and another for the tss key-share.

### Fixes

* [1678](https://github.com/zeta-chain/node/issues/1678) - clean cached stale block to fix evm outtx hash mismatch
* [1690](https://github.com/zeta-chain/node/issues/1690) - double watched gas prices and fix btc scheduler
* [1687](https://github.com/zeta-chain/node/pull/1687) - only use EVM supported chains for gas stability pool
* [1692](https://github.com/zeta-chain/node/pull/1692) - fix get params query for emissions module
* [1707](https://github.com/zeta-chain/node/issues/1707) - fix bitcoin fee rate estimation
* [1712](https://github.com/zeta-chain/node/issues/1712) - increase EVM outtx inclusion timeout to 20 minutes
* [1733](https://github.com/zeta-chain/node/pull/1733)) - remove the unnecessary 2x multiplier in the convertGasToZeta RPC
* [1733](https://github.com/zeta-chain/node/pull/1733) - remove the unnecessary 2x multiplier in the convertGasToZeta RPC
* [1721](https://github.com/zeta-chain/node/issues/1721) - zetaclient should provide bitcoin_chain_id when querying TSS address
* [1744](https://github.com/zeta-chain/node/pull/1744) - added cmd to encrypt tss keyshare file, allowing empty tss password for backward compatibility.

Expand Down
34 changes: 34 additions & 0 deletions docs/zetaclient/migration_v12.2->v12.3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## Hot Key and TSS key-share Passwords

### Zetaclient
Previously there were two environment variables being used to store passwords encrypting the tss key file and local operator keyring file:

* HOTKEY_PASSWORD
* TSS_FRAGMENT_SEED

With this new change, these variables will no longer be valid.
Instead, a series of prompts will appear asking for passwords using STDIN during the startup process.

* Hot Key password
* TSS Key share password

If your key files are already encrypted, you can use the same passwords you provided in the environment variables.

**It's extremely important to take note of these passwords or commit them to memory.**

### Hot Key

#### File backend

* The hot key will use the existing keyring that holds your operator key. The file will be encrypted with your existing password,
make sure to use this same password when starting the client.

#### Test backend

* You will still be prompted for a password, but you need to leave it blank which indicates the test backend is being used.

### TSS Key-Share

During key-gen, the password you enter will be used to encrypt the generated key-share file. The key data will be stored in
memory once the process is running. If the client needs to be restarted, this key-share file needs to be present on your
machine and will be decrypted using the password you've entered.
8 changes: 8 additions & 0 deletions zetaclient/evm/evm_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,7 @@ func (ob *ChainClient) checkTxInclusion(tx *ethtypes.Transaction, blockNumber ui
}
txAtIndex := block.Transactions()[txIndex]
if txAtIndex.Hash() != tx.Hash() {
ob.RemoveCachedBlock(blockNumber) // clean stale block from cache
return fmt.Errorf("transaction at index %d has different hash %s, txHash %s nonce %d block %d",
txIndex, txAtIndex.Hash().Hex(), tx.Hash(), tx.Nonce(), blockNumber)
}
Expand All @@ -810,6 +811,7 @@ func (ob *ChainClient) checkTxInclusion(tx *ethtypes.Transaction, blockNumber ui
}
txAtIndex := blockRPC.Transactions[txIndex]
if ethcommon.HexToHash(txAtIndex.Hash) != tx.Hash() {
ob.RemoveCachedBlock(blockNumber) // clean stale block from cache
return fmt.Errorf("transaction at index %d has different hash %s, txHash %s nonce %d block %d",
txIndex, txAtIndex.Hash, tx.Hash(), tx.Nonce(), blockNumber)
}
Expand Down Expand Up @@ -1520,3 +1522,9 @@ func (ob *ChainClient) GetBlockByNumberCached(blockNumber uint64) (*ethtypes.Blo
ob.blockCache.Add(blockNumber, block)
return block, nil, false, false, nil
}

// RemoveCachedBlock remove block from cache
func (ob *ChainClient) RemoveCachedBlock(blockNumber uint64) {
ob.blockCache.Remove(blockNumber)
ob.blockCacheV3.Remove(blockNumber)
}
37 changes: 37 additions & 0 deletions zetaclient/evm/evm_client_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package evm

import (
"math/big"
"testing"

ethtypes "github.com/ethereum/go-ethereum/core/types"
lru "github.com/hashicorp/golang-lru"
"github.com/stretchr/testify/require"
)

func TestEVMBlockCache(t *testing.T) {
// create client
blockCache, err := lru.New(1000)
require.NoError(t, err)
blockCacheV3, err := lru.New(1000)
require.NoError(t, err)
ob := ChainClient{
blockCache: blockCache,
blockCacheV3: blockCacheV3,
}

// delete non-existing block should not panic
blockNumber := int64(10388180)
// #nosec G701 possible nummber
ob.RemoveCachedBlock(uint64(blockNumber))

// add a block
header := &ethtypes.Header{
Number: big.NewInt(blockNumber),
}
block := ethtypes.NewBlock(header, nil, nil, nil, nil)
ob.blockCache.Add(blockNumber, block)

// delete the block should not panic
ob.RemoveCachedBlock(uint64(blockNumber))
}

0 comments on commit 84d417b

Please sign in to comment.