Skip to content

Commit

Permalink
Merge branch 'develop' into fix/chain-params-migration
Browse files Browse the repository at this point in the history
  • Loading branch information
lumtis authored Jan 12, 2024
2 parents 35835ac + c657669 commit 1f87a65
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 32 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
* [1528](https://github.com/zeta-chain/node/pull/1528) - fix panic caused on decoding malformed BTC addresses
* [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
* [1555](https://github.com/zeta-chain/node/pull/1555) - Reduce websocket message limit to 10MB
* [1567](https://github.com/zeta-chain/node/pull/1567) - add bitcoin chain id to fetch the tss address rpc endpoint

Expand Down
10 changes: 10 additions & 0 deletions testutil/network/genesis_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,18 @@ func AddObserverData(t *testing.T, n int, genesisState map[string]json.RawMessag
FinalizedZetaHeight: 1,
KeyGenZetaHeight: 1,
}
pendingNonces := make([]observertypes.PendingNonces, len(common.DefaultChainsList()))
for i, chain := range common.DefaultChainsList() {
pendingNonces[i] = observertypes.PendingNonces{
ChainId: chain.ChainId,
NonceLow: 0,
NonceHigh: 0,
Tss: tss.TssPubkey,
}
}
state.Tss = &tss
state.TssHistory = []observertypes.TSS{tss}
state.PendingNonces = pendingNonces

// set crosschain flags
crosschainFlags := &observertypes.CrosschainFlags{
Expand Down
2 changes: 1 addition & 1 deletion x/crosschain/client/integrationtests/cli_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func BuildSignedTssVote(t testing.TB, val *network.Validator, denom string, acco
cmd := cli.CmdCreateTSSVoter()
inboundVoterArgs := []string{
"tsspubkey",
strconv.FormatInt(common.GoerliLocalnetChain().ChainId, 10),
"1",
"0",
}
txArgs := []string{
Expand Down
20 changes: 7 additions & 13 deletions x/crosschain/client/integrationtests/inbound_voter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,20 +237,14 @@ func (s *IntegrationTestSuite) TestCCTXInboundVoter() {
_, err = clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, authcli.GetBroadcastCommand(), []string{signedTx.Name(), "--broadcast-mode", "sync"})
s.Require().NoError(err)
}
s.Require().NoError(s.network.WaitForNBlocks(2))

// Vote the tss
for _, val := range s.network.Validators {
out, err := clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, authcli.GetAccountCmd(), []string{val.Address.String(), "--output", "json"})
s.Require().NoError(err)

var account authtypes.AccountI
s.NoError(val.ClientCtx.Codec.UnmarshalInterfaceJSON(out.Bytes(), &account))
signedTx := BuildSignedTssVote(s.T(), val, s.cfg.BondDenom, account)
out, err = clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, authcli.GetBroadcastCommand(), []string{signedTx.Name(), "--broadcast-mode", "sync"})
s.Require().NoError(err)
}
s.Require().NoError(s.network.WaitForNBlocks(2))
out, err := clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, observercli.CmdListPendingNonces(), []string{"--output", "json"})
s.Require().NoError(err)
fmt.Println(out.String())
out, err = clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, observercli.CmdGetSupportedChains(), []string{"--output", "json"})
s.Require().NoError(err)
fmt.Println(out.String())

// Vote the inbound tx
for _, val := range s.network.Validators {
Expand All @@ -274,7 +268,7 @@ func (s *IntegrationTestSuite) TestCCTXInboundVoter() {

// Get the ballot
ballotIdentifier := GetBallotIdentifier(test.name, i)
out, err := clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, observercli.CmdBallotByIdentifier(), []string{ballotIdentifier, "--output", "json"})
out, err = clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, observercli.CmdBallotByIdentifier(), []string{ballotIdentifier, "--output", "json"})
s.Require().NoError(err)
ballot := observerTypes.QueryBallotByIdentifierResponse{}
s.NoError(broadcaster.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &ballot))
Expand Down
1 change: 0 additions & 1 deletion x/crosschain/keeper/msg_server_tss_voter.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ func (k msgServer) CreateTSSVoter(goCtx context.Context, msg *types.MsgCreateTSS
}
// Set TSS history only, current TSS is updated via admin transaction
// In Case this is the first TSS address update both current and history

tssList := k.zetaObserverKeeper.GetAllTSS(ctx)
if len(tssList) == 0 {
k.GetObserverKeeper().SetTssAndUpdateNonce(ctx, tss)
Expand Down
3 changes: 0 additions & 3 deletions x/fungible/client/cli/tx_update_update_system_contract.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package cli

import (
"fmt"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
Expand All @@ -20,7 +18,6 @@ func CmdUpdateSystemContract() *cobra.Command {
if err != nil {
return err
}
fmt.Printf("CLI address: %s\n", clientCtx.GetFromAddress().String())
msg := types.NewMsgUpdateSystemContract(clientCtx.GetFromAddress().String(), args[0])
if err := msg.ValidateBasic(); err != nil {
return err
Expand Down
31 changes: 18 additions & 13 deletions x/observer/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,21 +94,30 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState)
k.SetLastObserverCount(ctx, &types.LastObserverCount{LastChangeHeight: 0, Count: observerCount})
}

tss := types.TSS{}
if genState.Tss != nil {
tss := *genState.Tss
tss = *genState.Tss
k.SetTSS(ctx, tss)
}

// Set all the pending nonces
if genState.PendingNonces != nil {
for _, pendingNonce := range genState.PendingNonces {
k.SetPendingNonces(ctx, pendingNonce)
}
} else {
for _, chain := range common.DefaultChainsList() {
k.SetPendingNonces(ctx, types.PendingNonces{
NonceLow: 0,
NonceHigh: 0,
ChainId: chain.ChainId,
Tss: tss.TssPubkey,
})
if genState.Tss != nil {
k.SetPendingNonces(ctx, types.PendingNonces{
NonceLow: 0,
NonceHigh: 0,
ChainId: chain.ChainId,
Tss: tss.TssPubkey,
})
}
}
}

// Get all chain nonces

for _, elem := range genState.TssHistory {
k.SetTSSHistory(ctx, elem)
}
Expand All @@ -121,10 +130,6 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState)
k.SetBlame(ctx, elem)
}

// Set all the pending nonces
for _, pendingNonce := range genState.PendingNonces {
k.SetPendingNonces(ctx, pendingNonce)
}
for _, chainNonce := range genState.ChainNonces {
k.SetChainNonces(ctx, chainNonce)
}
Expand Down
1 change: 0 additions & 1 deletion x/observer/keeper/pending_nonces.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ func (k Keeper) SetTssAndUpdateNonce(ctx sdk.Context, tss types.TSS) {
FinalizedHeight: uint64(ctx.BlockHeight()),
}
k.SetChainNonces(ctx, chainNonce)

p := types.PendingNonces{
NonceLow: 0,
NonceHigh: 0,
Expand Down

0 comments on commit 1f87a65

Please sign in to comment.