Skip to content

Commit

Permalink
Merge branch 'develop' into evmtx-fail-bug
Browse files Browse the repository at this point in the history
  • Loading branch information
lumtis committed Nov 3, 2023
2 parents 0b2f828 + 5403c8e commit 37e5087
Show file tree
Hide file tree
Showing 17 changed files with 110 additions and 36 deletions.
6 changes: 3 additions & 3 deletions cmd/zetaclientd/keygen_tss.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import (
"github.com/rs/zerolog"
"github.com/tendermint/crypto/sha3"
"github.com/tendermint/tendermint/crypto/secp256k1"
tsscommon "github.com/zeta-chain/go-tss/common"
"github.com/zeta-chain/go-tss/keygen"
"github.com/zeta-chain/go-tss/p2p"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/crosschain/types"
observerTypes "github.com/zeta-chain/zetacore/x/observer/types"
mc "github.com/zeta-chain/zetacore/zetaclient"
"github.com/zeta-chain/zetacore/zetaclient/config"
"github.com/zeta-chain/zetacore/zetaclient/metrics"
tsscommon "gitlab.com/thorchain/tss/go-tss/common"
"gitlab.com/thorchain/tss/go-tss/keygen"
"gitlab.com/thorchain/tss/go-tss/p2p"
)

func GenerateTss(logger zerolog.Logger, cfg *config.Config, zetaBridge *mc.ZetaCoreBridge, peers p2p.AddrList, priKey secp256k1.PrivKey, ts *mc.TelemetryServer, tssHistoricalList []types.TSS, metrics *metrics.Metrics) (*mc.TSS, error) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/zetaclientd/main.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package main

import (
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/rs/zerolog"
ecdsakeygen "github.com/zeta-chain/tss-lib/ecdsa/keygen"
"github.com/zeta-chain/zetacore/zetaclient/config"

"github.com/zeta-chain/zetacore/cmd"
Expand Down
2 changes: 1 addition & 1 deletion cmd/zetaclientd/p2p_diagnostics.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import (
maddr "github.com/multiformats/go-multiaddr"
"github.com/rs/zerolog"
"github.com/tendermint/tendermint/crypto/secp256k1"
"github.com/zeta-chain/go-tss/p2p"
"github.com/zeta-chain/zetacore/common/cosmos"
mc "github.com/zeta-chain/zetacore/zetaclient"
"github.com/zeta-chain/zetacore/zetaclient/config"
"gitlab.com/thorchain/tss/go-tss/p2p"
)

func RunDiagnostics(startLogger zerolog.Logger, peers p2p.AddrList, bridgePk cryptotypes.PrivKey, cfg *config.Config) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/zetaclientd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ import (
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/tendermint/tendermint/crypto/secp256k1"
"github.com/zeta-chain/go-tss/p2p"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/crosschain/types"
observerTypes "github.com/zeta-chain/zetacore/x/observer/types"
mc "github.com/zeta-chain/zetacore/zetaclient"
"github.com/zeta-chain/zetacore/zetaclient/config"
metrics2 "github.com/zeta-chain/zetacore/zetaclient/metrics"
"gitlab.com/thorchain/tss/go-tss/p2p"
)

type Multiaddr = core.Multiaddr
Expand Down
3 changes: 3 additions & 0 deletions common/address_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//go:build TESTNET
// +build TESTNET

package common

import (
Expand Down
5 changes: 4 additions & 1 deletion common/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,13 @@ func (chain Chain) EncodeAddress(b []byte) (string, error) {
if err != nil {
return "", err
}
_, err = btcutil.DecodeAddress(addrStr, chainParams)
addr, err := btcutil.DecodeAddress(addrStr, chainParams)
if err != nil {
return "", err
}
if !addr.IsForNet(chainParams) {
return "", fmt.Errorf("address is not for network %s", chainParams.Name)
}
return addrStr, nil
}
return "", fmt.Errorf("chain (%d) not supported", chain.ChainId)
Expand Down
55 changes: 55 additions & 0 deletions common/chain_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package common

import (
"testing"

"github.com/stretchr/testify/require"
)

func TestChain_EncodeAddress(t *testing.T) {
type fields struct {
ChainName ChainName
ChainId int32
}

tests := []struct {
name string
chain Chain
b []byte
want string
wantErr bool
}{
{
name: "should error if b is not a valid address on the network",
chain: Chain{
ChainName: ChainName_btc_testnet,
ChainId: 18332,
},
b: []byte("bc1qk0cc73p8m7hswn8y2q080xa4e5pxapnqgp7h9c"),
want: "",
wantErr: true,
},
{
name: "should pass if b is a valid address on the network",
chain: Chain{
ChainName: ChainName_btc_mainnet,
ChainId: 8332,
},
b: []byte("bc1qk0cc73p8m7hswn8y2q080xa4e5pxapnqgp7h9c"),
want: "bc1qk0cc73p8m7hswn8y2q080xa4e5pxapnqgp7h9c",
wantErr: false,
},
}

for _, tc := range tests {
tc := tc
t.Run(tc.name, func(t *testing.T) {
s, err := tc.chain.EncodeAddress(tc.b)
if tc.wantErr {
require.Error(t, err)
return
}
require.Equal(t, tc.want, s)
})
}
}
4 changes: 2 additions & 2 deletions contrib/localnet/orchestrator/smoketest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func LocalSmokeTest(_ *cobra.Command, _ []string) {
observerClient := observertypes.NewQueryClient(grpcConn)

//Wait for Genesis
time.Sleep(20 * time.Second)
time.Sleep(30 * time.Second)

// initialize client to send messages to ZetaChain
zetaTxServer, err := NewZetaTxServer(
Expand All @@ -175,7 +175,7 @@ func LocalSmokeTest(_ *cobra.Command, _ []string) {
fmt.Printf("cctxClient.LastZetaHeight error: %s", err)
continue
}
if response.Height >= 30 {
if response.Height >= 60 {
break
}
fmt.Printf("Last ZetaHeight: %d\n", response.Height)
Expand Down
2 changes: 1 addition & 1 deletion contrib/localnet/scripts/genesis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ then

# 2. Add the observers, authorizations, required params and accounts to the genesis.json
zetacored collect-observer-info
zetacored add-observer-list
zetacored add-observer-list --keygen-block 55
cat $HOME/.zetacored/config/genesis.json | jq '.app_state["staking"]["params"]["bond_denom"]="azeta"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json
cat $HOME/.zetacored/config/genesis.json | jq '.app_state["crisis"]["constant_fee"]["denom"]="azeta"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json
cat $HOME/.zetacored/config/genesis.json | jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="azeta"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json
Expand Down
6 changes: 5 additions & 1 deletion contrib/localnet/scripts/start-zetaclientd-genesis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ else
num=$(echo $HOSTNAME | tr -dc '0-9')
node="zetacore$num"
MYIP=$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1)
SEED=$(curl --retry 10 --retry-delay 5 --retry-connrefused -s zetaclient0:8123/p2p)
SEED=""
while [ -z "$SEED" ]
do
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
zetaclientd start
Expand Down
11 changes: 6 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ require (
cosmossdk.io/errors v1.0.0-beta.7
cosmossdk.io/math v1.0.0-rc.0
github.com/99designs/keyring v1.2.1
github.com/binance-chain/tss-lib v1.3.2
github.com/btcsuite/btcd v0.23.4
github.com/btcsuite/btcd/btcec/v2 v2.3.2
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1
Expand All @@ -41,8 +40,9 @@ require (
github.com/pkg/errors v0.9.1
github.com/rakyll/statik v0.1.7
github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15
github.com/zeta-chain/go-tss v0.1.0
github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20230816152528-db7d2bf9144b
gitlab.com/thorchain/tss/go-tss v0.0.0-00010101000000-000000000000
github.com/zeta-chain/tss-lib v0.1.7
google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc
gopkg.in/yaml.v2 v2.4.0
)
Expand All @@ -57,6 +57,8 @@ require (

require (
github.com/DataDog/zstd v1.5.2 // indirect
github.com/agl/ed25519 v0.0.0-20200225211852-fd4d107ace12 // indirect
github.com/bnb-chain/tss-lib v1.5.0 // indirect
github.com/btcsuite/btcd/btcutil v1.1.3 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cockroachdb/errors v1.9.1 // indirect
Expand All @@ -65,6 +67,7 @@ require (
github.com/cockroachdb/redact v1.1.3 // indirect
github.com/cometbft/cometbft-db v0.7.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/decred/dcrd/dcrec/edwards/v2 v2.0.0 // indirect
github.com/dgraph-io/badger/v2 v2.2007.4 // indirect
github.com/dgraph-io/ristretto v0.1.0 // indirect
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
Expand Down Expand Up @@ -315,7 +318,7 @@ require (
)

replace (
github.com/binance-chain/tss-lib => gitlab.com/thorchain/tss/tss-lib v0.0.0-20201118045712-70b2cb4bf916
github.com/agl/ed25519 => github.com/binance-chain/edwards25519 v0.0.0-20200305024217-f36fc4b53d43
github.com/btcsuite/btcd => github.com/btcsuite/btcd v0.22.3
github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0

Expand All @@ -326,8 +329,6 @@ replace (
// use cometbft
github.com/tendermint/tendermint => github.com/cometbft/cometbft v0.34.28
github.com/tendermint/tm-db => github.com/BlockPILabs/cosmos-db v0.0.3
gitlab.com/thorchain/tss/go-tss => github.com/brewmaster012/go-tss v0.0.0-20230724230849-ce080275bbad

)

replace github.com/cometbft/cometbft-db => github.com/notional-labs/cometbft-db v0.0.0-20230321185329-6dc7c0ca6345
Loading

0 comments on commit 37e5087

Please sign in to comment.