Skip to content

Commit

Permalink
Merge branch 'develop' into try-fix-E2E-crosschain-swap
Browse files Browse the repository at this point in the history
  • Loading branch information
ws4charlie authored May 29, 2024
2 parents db85efc + 85861be commit 9c7d374
Show file tree
Hide file tree
Showing 62 changed files with 4,876 additions and 1,747 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* [2113](https://github.com/zeta-chain/node/pull/2113) - add zetaclientd-supervisor process
* [2154](https://github.com/zeta-chain/node/pull/2154) - add `ibccrosschain` module
* [2258](https://github.com/zeta-chain/node/pull/2258) - add Optimism and Base in static chain information
* [2279](https://github.com/zeta-chain/node/pull/2279) - add a CCTXGateway field to chain static data
* [2275](https://github.com/zeta-chain/node/pull/2275) - add ChainInfo singleton state variable in authority

### Refactor

Expand All @@ -31,6 +33,8 @@
* [2205](https://github.com/zeta-chain/node/pull/2205) - remove deprecated variables pre-v17
* [2226](https://github.com/zeta-chain/node/pull/2226) - improve Go formatting with imports standardization and max line length to 120
* [2262](https://github.com/zeta-chain/node/pull/2262) - refactor MsgUpdateZRC20 into MsgPauseZrc20 and MsgUnPauseZRC20
* [2269](https://github.com/zeta-chain/node/pull/2269) - refactor MsgUpdateCrosschainFlags into MsgEnableCCTX, MsgDisableCCTX and MsgUpdateGasPriceIncreaseFlags


### Tests

Expand Down
8 changes: 4 additions & 4 deletions contrib/localnet/orchestrator/start-zetae2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ if [ "$OPTION" == "upgrade" ]; then
# When the upgrade height is greater than 100 for upgrade test, the Bitcoin tests have been run once, therefore the Bitcoin wallet is already set up
# Use light flag to skip advanced tests
if [ "$UPGRADE_HEIGHT" -lt 100 ]; then
zetae2e "$ZETAE2E_CMD" --skip-setup --config deployed.yml --light --skip-header-proof
zetae2e $ZETAE2E_CMD --skip-setup --config deployed.yml --light --skip-header-proof
else
zetae2e "$ZETAE2E_CMD" --skip-setup --config deployed.yml --skip-bitcoin-setup --light --skip-header-proof
zetae2e $ZETAE2E_CMD --skip-setup --config deployed.yml --skip-bitcoin-setup --light --skip-header-proof
fi

ZETAE2E_EXIT_CODE=$?
Expand All @@ -156,7 +156,7 @@ else
echo "running e2e setup..."

if [[ ! -f deployed.yml ]]; then
zetae2e "$ZETAE2E_CMD" --setup-only --config-out deployed.yml
zetae2e $ZETAE2E_CMD --setup-only --config-out deployed.yml
if [ $? -ne 0 ]; then
echo "e2e setup failed"
exit 1
Expand All @@ -167,7 +167,7 @@ else

echo "running e2e tests..."

zetae2e "$ZETAE2E_CMD" --skip-setup --config deployed.yml
zetae2e $ZETAE2E_CMD --skip-setup --config deployed.yml
ZETAE2E_EXIT_CODE=$?

# if e2e passed, exit with 0, otherwise exit with 1
Expand Down
4 changes: 3 additions & 1 deletion docs/cli/zetacored/zetacored_tx_observer.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ zetacored tx observer [flags]
* [zetacored tx](zetacored_tx.md) - Transactions subcommands
* [zetacored tx observer add-blame-vote](zetacored_tx_observer_add-blame-vote.md) - Broadcast message add-blame-vote
* [zetacored tx observer add-observer](zetacored_tx_observer_add-observer.md) - Broadcast message add-observer
* [zetacored tx observer disable-cctx](zetacored_tx_observer_disable-cctx.md) - Disable inbound and outbound for CCTX
* [zetacored tx observer enable-cctx](zetacored_tx_observer_enable-cctx.md) - Enable inbound and outbound for CCTX
* [zetacored tx observer encode](zetacored_tx_observer_encode.md) - Encode a json string into hex
* [zetacored tx observer remove-chain-params](zetacored_tx_observer_remove-chain-params.md) - Broadcast message to remove chain params
* [zetacored tx observer reset-chain-nonces](zetacored_tx_observer_reset-chain-nonces.md) - Broadcast message to reset chain nonces
* [zetacored tx observer update-chain-params](zetacored_tx_observer_update-chain-params.md) - Broadcast message updateChainParams
* [zetacored tx observer update-crosschain-flags](zetacored_tx_observer_update-crosschain-flags.md) - Update crosschain flags
* [zetacored tx observer update-gas-price-increase-flags](zetacored_tx_observer_update-gas-price-increase-flags.md) - Update the gas price increase 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# tx observer update-crosschain-flags
# tx observer disable-cctx

Update crosschain flags
Disable inbound and outbound for CCTX

```
zetacored tx observer update-crosschain-flags [is-inbound-enabled] [is-outbound-enabled] [flags]
zetacored tx observer disable-cctx [disable-inbound] [disable-outbound] [flags]
```

### Options
Expand All @@ -22,7 +22,7 @@ zetacored tx observer update-crosschain-flags [is-inbound-enabled] [is-outbound-
--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 update-crosschain-flags
-h, --help help for disable-cctx
--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 Down
53 changes: 53 additions & 0 deletions docs/cli/zetacored/zetacored_tx_observer_enable-cctx.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# tx observer enable-cctx

Enable inbound and outbound for CCTX

```
zetacored tx observer enable-cctx [enable-inbound] [enable-outbound] [flags]
```

### Options

```
-a, --account-number uint The account number of the signing account (offline mode only)
--aux Generate aux signer data instead of sending a tx
-b, --broadcast-mode string Transaction broadcasting mode (sync|async)
--chain-id string The network chain ID
--dry-run ignore the --gas flag and perform a simulation of a transaction, but don't broadcast it (when enabled, the local Keybase is not accessible)
--fee-granter string Fee granter grants fees for the transaction
--fee-payer string Fee payer pays fees for the transaction instead of deducting from the signer
--fees string Fees to pay along with transaction; eg: 10uatom
--from string Name or address of private key with which to sign
--gas string gas limit to set per-transaction; set to "auto" to calculate sufficient gas automatically. Note: "auto" option doesn't always report accurate results. Set a valid coin value to adjust the result. Can be used instead of "fees". (default 200000)
--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 enable-cctx
--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
--node string [host]:[port] to tendermint rpc interface for this chain
--note string Note to add a description to the transaction (previously --memo)
--offline Offline mode (does not allow any online functionality)
-o, --output string Output format (text|json)
-s, --sequence uint The sequence number of the signing account (offline mode only)
--sign-mode string Choose sign mode (direct|amino-json|direct-aux), this is an advanced feature
--timeout-height uint Set a block timeout height to prevent the tx from being committed past a certain height
--tip string Tip is the amount that is going to be transferred to the fee payer on the target chain. This flag is only valid when used with --aux, and is ignored if the target chain didn't enable the TipDecorator
-y, --yes Skip tx broadcasting prompt confirmation
```

### Options inherited from parent commands

```
--home string directory for config and data
--log_format string The logging format (json|plain)
--log_level string The logging level (trace|debug|info|warn|error|fatal|panic)
--log_no_color Disable colored logs
--trace print out full stack trace on errors
```

### SEE ALSO

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# tx observer update-gas-price-increase-flags

Update the gas price increase flags

```
zetacored tx observer update-gas-price-increase-flags [epochLength] [retryInterval] [gasPriceIncreasePercent] [gasPriceIncreaseMax] [maxPendingCctxs] [flags]
```

### Options

```
-a, --account-number uint The account number of the signing account (offline mode only)
--aux Generate aux signer data instead of sending a tx
-b, --broadcast-mode string Transaction broadcasting mode (sync|async)
--chain-id string The network chain ID
--dry-run ignore the --gas flag and perform a simulation of a transaction, but don't broadcast it (when enabled, the local Keybase is not accessible)
--fee-granter string Fee granter grants fees for the transaction
--fee-payer string Fee payer pays fees for the transaction instead of deducting from the signer
--fees string Fees to pay along with transaction; eg: 10uatom
--from string Name or address of private key with which to sign
--gas string gas limit to set per-transaction; set to "auto" to calculate sufficient gas automatically. Note: "auto" option doesn't always report accurate results. Set a valid coin value to adjust the result. Can be used instead of "fees". (default 200000)
--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 update-gas-price-increase-flags
--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
--node string [host]:[port] to tendermint rpc interface for this chain
--note string Note to add a description to the transaction (previously --memo)
--offline Offline mode (does not allow any online functionality)
-o, --output string Output format (text|json)
-s, --sequence uint The sequence number of the signing account (offline mode only)
--sign-mode string Choose sign mode (direct|amino-json|direct-aux), this is an advanced feature
--timeout-height uint Set a block timeout height to prevent the tx from being committed past a certain height
--tip string Tip is the amount that is going to be transferred to the fee payer on the target chain. This flag is only valid when used with --aux, and is ignored if the target chain didn't enable the TipDecorator
-y, --yes Skip tx broadcasting prompt confirmation
```

### Options inherited from parent commands

```
--home string directory for config and data
--log_format string The logging format (json|plain)
--log_level string The logging level (trace|debug|info|warn|error|fatal|panic)
--log_no_color Disable colored logs
--trace print out full stack trace on errors
```

### SEE ALSO

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

21 changes: 20 additions & 1 deletion docs/openapi/openapi.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56744,6 +56744,18 @@ definitions:
description: |-
QueryGetPoliciesResponse is the response type for the Query/Policies RPC
method.
chainsCCTXGateway:
type: string
enum:
- zevm
- observers
default: zevm
description: |-
- zevm: zevm is the internal CCTX gateway to process outbound on the ZEVM and read
inbound events from the ZEVM only used for ZetaChain chains
- observers: observers is the CCTX gateway for chains relying on the observer set to
observe inbounds and TSS for outbounds
title: CCTXGateway describes for the chain the gateway used to handle CCTX outbounds
chainsChain:
type: object
properties:
Expand All @@ -56769,6 +56781,9 @@ definitions:
is_external:
type: boolean
title: IsExternal describe if the chain is ZetaChain or external
cctx_gateway:
$ref: '#/definitions/chainsCCTXGateway'
title: CCTXGateway is the gateway used to handle CCTX outbounds
title: |-
Chain represents static data about a blockchain network
it is identified by a unique chain ID
Expand Down Expand Up @@ -57735,13 +57750,17 @@ definitions:
type: object
observerMsgAddObserverResponse:
type: object
observerMsgDisableCCTXResponse:
type: object
observerMsgEnableCCTXResponse:
type: object
observerMsgRemoveChainParamsResponse:
type: object
observerMsgResetChainNoncesResponse:
type: object
observerMsgUpdateChainParamsResponse:
type: object
observerMsgUpdateCrosschainFlagsResponse:
observerMsgUpdateGasPriceIncreaseFlagsResponse:
type: object
observerMsgUpdateKeygenResponse:
type: object
Expand Down
7 changes: 7 additions & 0 deletions docs/releases/v17_breaking_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
* `MsgEnableHeaderVerification` message enables block header verification for a list of chains and can be triggered via `PolicyType_groupOperational`
* `MsgDisableHeaderVerification` message disables block header verification for a list of chains and can be triggered via `PolicyType_emergency`

### Crosschain Flags update

* `MsgUpdateCrosschainFlags` has been removed,and replaced with `MsgEnableCCTX`, `MsgDisableCCTX` and `MsgUpdateGasPriceIncreaseFlags` messages.
* `MsgEnableCCTX` message enables either the IsInboundEnabled flag,or the IsOutboundEnabled flag or both `PolicyType_groupOperational`
* `MsgDisableCCTX` message disables either the IsInboundEnabled flag,or the IsOutboundEnabled flag or both `PolicyType_emergency`
* `MsgUpdateGasPriceIncreaseFlags` message updates the gas price increase flags and can be triggered via `PolicyType_groupOperational`

### `BallotMaturityBlocks` moved to `emissions` module

* Observer param `ballot_maturity_blocks` is part of `emissions` module now. Observer `params` are deprecated and removed from `observer` module.
Expand Down
54 changes: 38 additions & 16 deletions docs/spec/observer/messages.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,6 @@ message MsgAddBlameVote {
}
```

## MsgUpdateCrosschainFlags

UpdateCrosschainFlags updates the crosschain related flags.

Aurthorized: admin policy group 1 (except enabling/disabled
inbounds/outbounds and gas price increase), admin policy group 2 (all).

```proto
message MsgUpdateCrosschainFlags {
string creator = 1;
bool isInboundEnabled = 3;
bool isOutboundEnabled = 4;
GasPriceIncreaseFlags gasPriceIncreaseFlags = 5;
}
```

## MsgUpdateKeygen

UpdateKeygen updates the block height of the keygen and sets the status to
Expand Down Expand Up @@ -142,3 +126,41 @@ message MsgVoteTSS {
}
```

## MsgEnableCCTX

EnableCCTX enables the IsInboundEnabled and IsOutboundEnabled flags.These flags control the creation of inbounds and outbounds.
The flags are enabled by the policy account with the groupOperational policy type.

```proto
message MsgEnableCCTX {
string creator = 1;
bool enableInbound = 2;
bool enableOutbound = 3;
}
```

## MsgDisableCCTX

DisableCCTX disables the IsInboundEnabled and IsOutboundEnabled flags. These flags control the creation of inbounds and outbounds.
The flags are disabled by the policy account with the groupEmergency policy type.

```proto
message MsgDisableCCTX {
string creator = 1;
bool disableInbound = 2;
bool disableOutbound = 3;
}
```

## MsgUpdateGasPriceIncreaseFlags

UpdateGasPriceIncreaseFlags updates the GasPriceIncreaseFlags. These flags control the increase of gas prices.
The flags are updated by the policy account with the groupOperational policy type.

```proto
message MsgUpdateGasPriceIncreaseFlags {
string creator = 1;
GasPriceIncreaseFlags gasPriceIncreaseFlags = 2;
}
```

33 changes: 33 additions & 0 deletions pkg/chains/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,47 @@ type SigninAlgo string
// Chains represent a slice of Chain
type Chains []Chain

// Validate checks whether the chain is valid
// The function check the chain ID is positive and all enum fields have a defined value
func (chain Chain) Validate() error {
if chain.ChainId <= 0 {
return fmt.Errorf("chain ID must be positive")
}

if _, ok := ChainName_name[int32(chain.ChainName)]; !ok {
return fmt.Errorf("invalid chain name %d", int32(chain.ChainName))
}

if _, ok := Network_name[int32(chain.Network)]; !ok {
return fmt.Errorf("invalid network %d", int32(chain.Network))
}

if _, ok := NetworkType_name[int32(chain.NetworkType)]; !ok {
return fmt.Errorf("invalid network type %d", int32(chain.NetworkType))
}

if _, ok := Vm_name[int32(chain.Vm)]; !ok {
return fmt.Errorf("invalid vm %d", int32(chain.Vm))
}

if _, ok := Consensus_name[int32(chain.Consensus)]; !ok {
return fmt.Errorf("invalid consensus %d", int32(chain.Consensus))
}

return nil
}

// IsEqual compare two chain to see whether they represent the same chain
func (chain Chain) IsEqual(c Chain) bool {
return chain.ChainId == c.ChainId
}

// IsZetaChain returns true if the chain is a ZetaChain chain
func (chain Chain) IsZetaChain() bool {
return chain.Network == Network_zeta
}

// IsExternalChain returns true if the chain is an ExternalChain chain, not ZetaChain
func (chain Chain) IsExternalChain() bool {
return chain.IsExternal
}
Expand Down
Loading

0 comments on commit 9c7d374

Please sign in to comment.