Skip to content

Commit

Permalink
Merge branch 'develop' into fix-crosschain-flags-and-outtx-timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
ws4charlie authored Apr 3, 2024
2 parents c5dfb42 + 64b898c commit f017197
Show file tree
Hide file tree
Showing 119 changed files with 4,954 additions and 2,970 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
* @brewmaster012 @kingpinXD @kevinssgh @fadeev @lumtis @ws4charlie @skosito
* @brewmaster012 @kingpinXD @kevinssgh @lumtis @ws4charlie @skosito

.github/** @zeta-chain/devops
2 changes: 1 addition & 1 deletion .github/workflows/change-log-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Changelog Check

on:
pull_request:
types: [opened, synchronize, reopened]
types: [opened, synchronize, reopened, labeled, unlabeled]

jobs:
check-changelog:
Expand Down
2 changes: 1 addition & 1 deletion app/ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func IsSystemTx(tx sdk.Tx, isAuthorizedSigner func(string) bool) bool {
*cctxtypes.MsgVoteOnObservedInboundTx,
*cctxtypes.MsgVoteOnObservedOutboundTx,
*cctxtypes.MsgAddToOutTxTracker,
*cctxtypes.MsgCreateTSSVoter,
*observertypes.MsgVoteTSS,
*observertypes.MsgAddBlockHeader,
*observertypes.MsgAddBlameVote:
signers := innerMsg.GetSigners()
Expand Down
22 changes: 11 additions & 11 deletions app/ante/ante_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func TestIsSystemTx(t *testing.T) {
// *cctxtypes.MsgVoteOnObservedInboundTx,
// *cctxtypes.MsgVoteOnObservedOutboundTx,
// *cctxtypes.MsgAddToOutTxTracker,
// *cctxtypes.MsgCreateTSSVoter,
// *observertypes.MsgVoteTSS,
// *observertypes.MsgAddBlockHeader,
// *observertypes.MsgAddBlameVote:
buildTxFromMsg := func(msg sdk.Msg) sdk.Tx {
Expand Down Expand Up @@ -64,26 +64,26 @@ func TestIsSystemTx(t *testing.T) {
wantIs bool
}{
{
"MsgCreateTSSVoter",
buildTxFromMsg(&crosschaintypes.MsgCreateTSSVoter{
"MsgVoteTSS",
buildTxFromMsg(&observertypes.MsgVoteTSS{
Creator: sample.AccAddress(),
TssPubkey: "pubkey1234",
}),
isAuthorizedFalse,
false,
},
{
"MsgCreateTSSVoter",
buildTxFromMsg(&crosschaintypes.MsgCreateTSSVoter{
"MsgVoteTSS",
buildTxFromMsg(&observertypes.MsgVoteTSS{
Creator: sample.AccAddress(),
TssPubkey: "pubkey1234",
}),
isAuthorized,
true,
},
{
"MsgExec{MsgCreateTSSVoter}",
buildAuthzTxFromMsg(&crosschaintypes.MsgCreateTSSVoter{
"MsgExec{MsgVoteTSS}",
buildAuthzTxFromMsg(&observertypes.MsgVoteTSS{
Creator: sample.AccAddress(),
TssPubkey: "pubkey1234",
}),
Expand Down Expand Up @@ -169,17 +169,17 @@ func TestIsSystemTx(t *testing.T) {
true,
},
{
"MsgCreateTSSVoter",
buildTxFromMsg(&crosschaintypes.MsgCreateTSSVoter{
"MsgVoteTSS",
buildTxFromMsg(&observertypes.MsgVoteTSS{
Creator: sample.AccAddress(),
}),
isAuthorized,

true,
},
{
"MsgExec{MsgCreateTSSVoter}",
buildAuthzTxFromMsg(&crosschaintypes.MsgCreateTSSVoter{
"MsgExec{MsgVoteTSS}",
buildAuthzTxFromMsg(&observertypes.MsgVoteTSS{
Creator: sample.AccAddress(),
}),
isAuthorized,
Expand Down
7 changes: 6 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# CHANGELOG

## Unreleased

### Breaking Changes

* Admin policies have been moved from `observer` to a new module `authority`.
* Updating admin policies now requires to send a governance proposal executing the `UpdatePolicies` message in the `authority` module.
* The `Policies` query of the `authority` module must be used to get the current admin policies.
* `PolicyType_group1` has been renamed into `PolicyType_groupEmergency` and `PolicyType_group2` has been renamed into `PolicyType_groupAdmin`.

* `MsgCreateTSSVoter` message in the `crosschain` module has been moved to the `observer` module and renamed to `MsgVoteTSS`.
* The structure of the message remains the same.

### Refactor

* [1511](https://github.com/zeta-chain/node/pull/1511) - move ballot voting logic from `crosschain` to `observer`
Expand All @@ -22,6 +24,8 @@
* [1914](https://github.com/zeta-chain/node/pull/1914) - move crosschain flags to core context in zetaclient
* [1948](https://github.com/zeta-chain/node/pull/1948) - remove deprecated GetTSSAddress query in crosschain module
* [1936](https://github.com/zeta-chain/node/pull/1936) - refactor common package into subpackages and rename to pkg
* [1966](https://github.com/zeta-chain/node/pull/1966) - move TSS vote message from crosschain to observer
* [1853](https://github.com/zeta-chain/node/pull/1853) - refactor vote inbound tx and vote outbound tx

### Features

Expand All @@ -47,6 +51,7 @@
* [1879](https://github.com/zeta-chain/node/pull/1879) - full coverage for messages in types packages
* [1899](https://github.com/zeta-chain/node/pull/1899) - add empty test files so packages are included in coverage
* [1903](https://github.com/zeta-chain/node/pull/1903) - common package tests
* [1955](https://github.com/zeta-chain/node/pull/1955) - improve emissions module coverage

### Fixes

Expand Down
17 changes: 8 additions & 9 deletions cmd/zetaclientd/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,24 @@ import (
"strings"
"sync"

"github.com/btcsuite/btcd/rpcclient"
sdk "github.com/cosmos/cosmos-sdk/types"
ethcommon "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/onrik/ethrpc"
"github.com/rs/zerolog"
"github.com/spf13/cobra"
"github.com/zeta-chain/zetacore/pkg/chains"
"github.com/zeta-chain/zetacore/pkg/coin"
"github.com/zeta-chain/zetacore/testutil/sample"
observertypes "github.com/zeta-chain/zetacore/x/observer/types"
"github.com/zeta-chain/zetacore/zetaclient/bitcoin"
"github.com/zeta-chain/zetacore/zetaclient/config"
corecontext "github.com/zeta-chain/zetacore/zetaclient/core_context"
"github.com/zeta-chain/zetacore/zetaclient/evm"
"github.com/zeta-chain/zetacore/zetaclient/keys"
"github.com/zeta-chain/zetacore/zetaclient/metrics"
"github.com/zeta-chain/zetacore/zetaclient/zetabridge"

"github.com/btcsuite/btcd/rpcclient"
sdk "github.com/cosmos/cosmos-sdk/types"
ethcommon "github.com/ethereum/go-ethereum/common"
"github.com/rs/zerolog"
"github.com/spf13/cobra"
"github.com/zeta-chain/zetacore/testutil/sample"
observertypes "github.com/zeta-chain/zetacore/x/observer/types"
"github.com/zeta-chain/zetacore/zetaclient/config"
)

var debugArgs = debugArguments{}
Expand Down
30 changes: 15 additions & 15 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ flags:
- "common/"

ignore:
- "x/**/client/"
- "x/**/client/**/*"
- "x/**/keeper/keeper.go"
- "x/**/keeper/msg_server.go"
- "x/**/keeper/grpc_query_params.go"
Expand All @@ -50,24 +50,24 @@ ignore:
- "x/**/types/expected_keepers.go"
- "x/**/module.go"
- "x/**/module_simulation.go"
- "x/**/simulation/"
- "x/**/simulation/**/*"
- "**/*.proto"
- "**/*.md"
- "**/*.yml"
- "**/*.yaml"
- "**/*.pb.go"
- "**/*.pb.gw.go"
- "**/*.json"
- ".github/"
- "app/"
- "cmd/"
- "contrib/"
- "docs/"
- "rpc/"
- "proto/"
- "scripts/"
- "server/"
- "testutil/"
- "testutils/"
- "errors/"
- "typescript/"
- ".github/**/*"
- "app/**/*"
- "cmd/**/*"
- "contrib/**/*"
- "docs/**/*"
- "rpc/**/*"
- "proto/**/*"
- "scripts/**/*"
- "server/**/*"
- "testutil/**/*"
- "testutils/**/*"
- "errors/**/*"
- "typescript/**/*"
1 change: 0 additions & 1 deletion docs/cli/zetacored/zetacored_tx_crosschain.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ zetacored tx crosschain [flags]
* [zetacored tx crosschain add-to-in-tx-tracker](zetacored_tx_crosschain_add-to-in-tx-tracker.md) - Add a in-tx-tracker
Use 0:Zeta,1:Gas,2:ERC20
* [zetacored tx crosschain add-to-out-tx-tracker](zetacored_tx_crosschain_add-to-out-tx-tracker.md) - Add a out-tx-tracker
* [zetacored tx crosschain create-tss-voter](zetacored_tx_crosschain_create-tss-voter.md) - Create a new TSSVoter
* [zetacored tx crosschain gas-price-voter](zetacored_tx_crosschain_gas-price-voter.md) - Broadcast message gasPriceVoter
* [zetacored tx crosschain inbound-voter](zetacored_tx_crosschain_inbound-voter.md) - Broadcast message sendVoter
* [zetacored tx crosschain migrate-tss-funds](zetacored_tx_crosschain_migrate-tss-funds.md) - Migrate TSS funds to the latest TSS address
Expand Down
1 change: 1 addition & 0 deletions docs/cli/zetacored/zetacored_tx_observer.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ zetacored tx observer [flags]
* [zetacored tx observer update-crosschain-flags](zetacored_tx_observer_update-crosschain-flags.md) - Update crosschain flags
* [zetacored tx observer update-keygen](zetacored_tx_observer_update-keygen.md) - command to update the keygen block via a group proposal
* [zetacored tx observer update-observer](zetacored_tx_observer_update-observer.md) - Broadcast message add-observer
* [zetacored tx observer vote-tss](zetacored_tx_observer_vote-tss.md) - Vote for a new TSS creation

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# tx crosschain create-tss-voter
# tx observer vote-tss

Create a new TSSVoter
Vote for a new TSS creation

```
zetacored tx crosschain create-tss-voter [pubkey] [keygenBlock] [status] [flags]
zetacored tx observer vote-tss [pubkey] [keygen-block] [status] [flags]
```

### Options
Expand All @@ -21,7 +21,7 @@ zetacored tx crosschain create-tss-voter [pubkey] [keygenBlock] [status] [flags]
--gas-adjustment float adjustment factor to be multiplied against the estimate returned by the tx simulation; if the gas limit is set manually this flag is ignored (default 1)
--gas-prices string Gas prices in decimal format to determine the transaction fee (e.g. 0.1uatom)
--generate-only Build an unsigned transaction and write it to STDOUT (when enabled, the local Keybase only accessed when providing a key name)
-h, --help help for create-tss-voter
-h, --help help for vote-tss
--keyring-backend string Select keyring's backend (os|file|kwallet|pass|test|memory)
--keyring-dir string The client Keyring directory; if omitted, the default 'home' directory will be used
--ledger Use a connected Ledger device
Expand All @@ -48,5 +48,5 @@ zetacored tx crosschain create-tss-voter [pubkey] [keygenBlock] [status] [flags]

### SEE ALSO

* [zetacored tx crosschain](zetacored_tx_crosschain.md) - crosschain transactions subcommands
* [zetacored tx observer](zetacored_tx_observer.md) - observer transactions subcommands

11 changes: 9 additions & 2 deletions docs/openapi/openapi.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53701,8 +53701,6 @@ definitions:
is_removed:
type: boolean
title: if the tx was removed from the tracker due to no pending cctx
crosschainMsgCreateTSSVoterResponse:
type: object
crosschainMsgGasPriceVoterResponse:
type: object
crosschainMsgMigrateTssFundsResponse:
Expand Down Expand Up @@ -54324,6 +54322,15 @@ definitions:
type: object
observerMsgUpdateObserverResponse:
type: object
observerMsgVoteTSSResponse:
type: object
properties:
ballot_created:
type: boolean
vote_finalized:
type: boolean
keygen_success:
type: boolean
observerNode:
type: object
properties:
Expand Down
22 changes: 0 additions & 22 deletions docs/spec/crosschain/messages.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,28 +236,6 @@ message MsgMigrateTssFunds {
}
```

## MsgCreateTSSVoter

CreateTSSVoter votes on creating a TSS key and recording the information about it (public
key, participant and operator addresses, finalized and keygen heights).

If the vote passes, the information about the TSS key is recorded on chain
and the status of the keygen is set to "success".

Fails if the keygen does not exist, the keygen has been already
completed, or the keygen has failed.

Only node accounts are authorized to broadcast this message.

```proto
message MsgCreateTSSVoter {
string creator = 1;
string tss_pubkey = 2;
int64 keyGenZetaHeight = 3;
chains.ReceiveStatus status = 4;
}
```

## MsgAbortStuckCCTX

AbortStuckCCTX aborts a stuck CCTX
Expand Down
4 changes: 2 additions & 2 deletions docs/spec/crosschain/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ status is changed to final.
## Permissions

| Message | Admin policy account | Observer validator |
| --------------------------- | -------------------- | ------------------ |
| MsgCreateTSSVoter | ||
|-----------------------------| -------------------- | ------------------ |
| MsgVoteTSS | ||
| MsgGasPriceVoter | ||
| MsgVoteOnObservedOutboundTx | ||
| MsgVoteOnObservedInboundTx | ||
Expand Down
22 changes: 22 additions & 0 deletions docs/spec/observer/messages.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,25 @@ message MsgResetChainNonces {
}
```

## MsgVoteTSS

VoteTSS votes on creating a TSS key and recording the information about it (public
key, participant and operator addresses, finalized and keygen heights).

If the vote passes, the information about the TSS key is recorded on chain
and the status of the keygen is set to "success".

Fails if the keygen does not exist, the keygen has been already
completed, or the keygen has failed.

Only node accounts are authorized to broadcast this message.

```proto
message MsgVoteTSS {
string creator = 1;
string tss_pubkey = 2;
int64 keygen_zeta_height = 3;
chains.ReceiveStatus status = 4;
}
```

18 changes: 18 additions & 0 deletions pkg/chains/status.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package chains

import "errors"

// ReceiveStatusFromString returns a ReceiveStatus from a string using in CLI
// 0 for success, 1 for failed
// TODO: remove "receive" naming ans use outbound
// https://github.com/zeta-chain/node/issues/1797
func ReceiveStatusFromString(str string) (ReceiveStatus, error) {
switch str {
case "0":
return ReceiveStatus_Success, nil
case "1":
return ReceiveStatus_Failed, nil
default:
return ReceiveStatus(0), errors.New("wrong status, must be 0 for success or 1 for failed")
}
}
Loading

0 comments on commit f017197

Please sign in to comment.