Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/zeta-chain/node into ref…
Browse files Browse the repository at this point in the history
…actor-base-signer-observer
  • Loading branch information
ws4charlie committed Jun 6, 2024
2 parents d2d19f1 + 3f02526 commit 7b358d8
Show file tree
Hide file tree
Showing 52 changed files with 8,005 additions and 330 deletions.
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ func New(
app.MsgServiceRouter(),
app.AccountKeeper,
group.Config{
MaxExecutionPeriod: 2 * time.Hour, // Two hours.
MaxExecutionPeriod: 48 * time.Hour,
MaxMetadataLen: 255,
},
)
Expand Down
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
* [2291](https://github.com/zeta-chain/node/pull/2291) - initialize cctx gateway interface
* [2289](https://github.com/zeta-chain/node/pull/2289) - add an authorization list to keep track of all authorizations on the chain
* [2305](https://github.com/zeta-chain/node/pull/2305) - add new messages `MsgAddAuthorization` and `MsgRemoveAuthorization` that can be used to update the authorization list
* [2313](https://github.com/zeta-chain/node/pull/2313) - add `CheckAuthorization` function to replace the `IsAuthorized` function. The new function uses the authorization list to verify the signer's authorization.
* [2312](https://github.com/zeta-chain/node/pull/2312) - add queries `ShowAuthorization` and `ListAuthorizations`

### Refactor

Expand All @@ -40,6 +42,7 @@
* [2262](https://github.com/zeta-chain/node/pull/2262) - refactor MsgUpdateZRC20 into MsgPauseZrc20 and MsgUnPauseZRC20
* [2290](https://github.com/zeta-chain/node/pull/2290) - rename `MsgAddBlameVote` message to `MsgVoteBlame`
* [2269](https://github.com/zeta-chain/node/pull/2269) - refactor MsgUpdateCrosschainFlags into MsgEnableCCTX, MsgDisableCCTX and MsgUpdateGasPriceIncreaseFlags
* [2306](https://github.com/zeta-chain/node/pull/2306) - refactor zetaclient outbound transaction signing logic
* [2296](https://github.com/zeta-chain/node/pull/2296) - move `testdata` package to `testutil` to organize test-related utilities

### Tests
Expand All @@ -50,6 +53,7 @@
* [2199](https://github.com/zeta-chain/node/pull/2199) - custom priority mempool unit tests
* [2240](https://github.com/zeta-chain/node/pull/2240) - removed hard-coded Bitcoin regnet chainID in E2E withdraw tests
* [2266](https://github.com/zeta-chain/node/pull/2266) - try fixing E2E test `crosschain_swap` failure `btc transaction not signed`
* [2294](https://github.com/zeta-chain/node/pull/2294) - add and fix existing ethermint rpc unit test
* [2299](https://github.com/zeta-chain/node/pull/2299) - add `zetae2e` command to deploy test contracts

### Fixes
Expand Down
1 change: 0 additions & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ ignore:
- "cmd/**/*"
- "contrib/**/*"
- "docs/**/*"
- "rpc/**/*"
- "proto/**/*"
- "scripts/**/*"
- "server/**/*"
Expand Down
2 changes: 2 additions & 0 deletions docs/cli/zetacored/zetacored_query_authority.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ zetacored query authority [flags]
### SEE ALSO

* [zetacored query](zetacored_query.md) - Querying subcommands
* [zetacored query authority list-authorizations](zetacored_query_authority_list-authorizations.md) - lists all authorizations
* [zetacored query authority show-authorization](zetacored_query_authority_show-authorization.md) - shows the authorization for a given message URL
* [zetacored query authority show-chain-info](zetacored_query_authority_show-chain-info.md) - show the chain info
* [zetacored query authority show-policies](zetacored_query_authority_show-policies.md) - show the policies

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# query authority list-authorizations

lists all authorizations

```
zetacored query authority list-authorizations [flags]
```

### Options

```
--grpc-addr string the gRPC endpoint to use for this chain
--grpc-insecure allow gRPC over insecure channels, if not TLS the server must use TLS
--height int Use a specific height to query state at (this can error if the node is pruning state)
-h, --help help for list-authorizations
--node string [host]:[port] to Tendermint RPC interface for this chain
-o, --output string Output format (text|json)
```

### Options inherited from parent commands

```
--chain-id string The network chain ID
--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 query authority](zetacored_query_authority.md) - Querying commands for the authority module

34 changes: 34 additions & 0 deletions docs/cli/zetacored/zetacored_query_authority_show-authorization.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# query authority show-authorization

shows the authorization for a given message URL

```
zetacored query authority show-authorization [msg-url] [flags]
```

### Options

```
--grpc-addr string the gRPC endpoint to use for this chain
--grpc-insecure allow gRPC over insecure channels, if not TLS the server must use TLS
--height int Use a specific height to query state at (this can error if the node is pruning state)
-h, --help help for show-authorization
--node string [host]:[port] to Tendermint RPC interface for this chain
-o, --output string Output format (text|json)
```

### Options inherited from parent commands

```
--chain-id string The network chain ID
--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 query authority](zetacored_query_authority.md) - Querying commands for the authority module

70 changes: 70 additions & 0 deletions docs/openapi/openapi.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28254,6 +28254,39 @@ paths:
type: boolean
tags:
- Query
/zeta-chain/authority/authorization/{msg_url}:
get:
operationId: Query_Authorization
responses:
"200":
description: A successful response.
schema:
$ref: '#/definitions/authorityQueryAuthorizationResponse'
default:
description: An unexpected error response.
schema:
$ref: '#/definitions/googlerpcStatus'
parameters:
- name: msg_url
in: path
required: true
type: string
tags:
- Query
/zeta-chain/authority/authorizations:
get:
operationId: Query_AuthorizationList
responses:
"200":
description: A successful response.
schema:
$ref: '#/definitions/authorityQueryAuthorizationListResponse'
default:
description: An unexpected error response.
schema:
$ref: '#/definitions/googlerpcStatus'
tags:
- Query
/zeta-chain/authority/chainInfo:
get:
summary: Queries ChainInfo
Expand Down Expand Up @@ -56718,6 +56751,27 @@ definitions:
format: int64
balance:
type: string
authorityAuthorization:
type: object
properties:
msg_url:
type: string
title: The URL of the message that needs to be authorized
authorized_policy:
$ref: '#/definitions/authorityPolicyType'
title: The policy that is authorized to access the message
title: |-
Authorization defines the authorization required to access use a message
which needs special permissions
authorityAuthorizationList:
type: object
properties:
authorizations:
type: array
items:
type: object
$ref: '#/definitions/authorityAuthorization'
title: AuthorizationList holds the list of authorizations on zetachain
authorityChainInfo:
type: object
properties:
Expand Down Expand Up @@ -56778,6 +56832,22 @@ definitions:

Used for empty policy, no action is allowed
title: PolicyType defines the type of policy
authorityQueryAuthorizationListResponse:
type: object
properties:
authorization_list:
$ref: '#/definitions/authorityAuthorizationList'
title: |-
QueryAuthorizationListResponse is the response type for the
Query/AuthorizationList RPC
authorityQueryAuthorizationResponse:
type: object
properties:
authorization:
$ref: '#/definitions/authorityAuthorization'
description: |-
QueryAuthorizationResponse is the response type for the Query/Authorization
RPC method.
authorityQueryGetChainInfoResponse:
type: object
properties:
Expand Down
12 changes: 3 additions & 9 deletions e2e/e2etests/helper_bitcoin.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,7 @@ func withdrawBTCZRC20(r *runner.E2ERunner, to btcutil.Address, amount *big.Int)
}

// mine blocks if testing on regnet
var stop chan struct{}
isRegnet := chains.IsBitcoinRegnet(r.GetBitcoinChainID())
if isRegnet {
stop = r.MineBlocks()
}
stop := r.MineBlocksIfLocalBitcoin()

// withdraw 'amount' of BTC from ZRC20 to BTC address
tx, err = r.BTCZRC20.Withdraw(r.ZEVMAuth, []byte(to.EncodeAddress()), amount)
Expand All @@ -81,7 +77,7 @@ func withdrawBTCZRC20(r *runner.E2ERunner, to btcutil.Address, amount *big.Int)
}

// mine 10 blocks to confirm the withdraw tx
_, err = r.BtcRPCClient.GenerateToAddress(10, to, nil)
_, err = r.GenerateToAddressIfLocalBitcoin(10, to)
if err != nil {
panic(err)
}
Expand Down Expand Up @@ -118,9 +114,7 @@ func withdrawBTCZRC20(r *runner.E2ERunner, to btcutil.Address, amount *big.Int)
}

// stop mining
if isRegnet {
stop <- struct{}{}
}
stop()

return rawTx
}
11 changes: 2 additions & 9 deletions e2e/e2etests/test_bitcoin_withdraw_invalid_address.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (

"github.com/zeta-chain/zetacore/e2e/runner"
"github.com/zeta-chain/zetacore/e2e/utils"
"github.com/zeta-chain/zetacore/pkg/chains"
)

func TestBitcoinWithdrawToInvalidAddress(r *runner.E2ERunner, args []string) {
Expand Down Expand Up @@ -47,11 +46,7 @@ func withdrawToInvalidAddress(r *runner.E2ERunner, amount *big.Int) {
}

// mine blocks if testing on regnet
var stop chan struct{}
isRegnet := chains.IsBitcoinRegnet(r.GetBitcoinChainID())
if isRegnet {
stop = r.MineBlocks()
}
stop := r.MineBlocksIfLocalBitcoin()

// withdraw amount provided as test arg BTC from ZRC20 to BTC legacy address
// the address "1EYVvXLusCxtVuEwoYvWRyN5EZTXwPVvo3" is for mainnet, not regtest
Expand All @@ -65,7 +60,5 @@ func withdrawToInvalidAddress(r *runner.E2ERunner, amount *big.Int) {
}

// stop mining
if isRegnet {
stop <- struct{}{}
}
stop()
}
4 changes: 2 additions & 2 deletions e2e/e2etests/test_bitcoin_withdraw_multiple.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ package e2etests
// go func() {
// for {
// time.Sleep(3 * time.Second)
// _, err = r.BtcRPCClient.GenerateToAddress(1, r.BTCDeployerAddress, nil)
// _, err = r.GenerateToAddressIfLocalBitcoin(1, r.BTCDeployerAddress)
// if err != nil {
// panic(err)
// }
Expand All @@ -64,7 +64,7 @@ package e2etests
// if receipt.Status != 1 {
// panic(fmt.Errorf("withdraw receipt status is not 1"))
// }
// _, err = r.BtcRPCClient.GenerateToAddress(10, r.BTCDeployerAddress, nil)
// _, err = r.GenerateToAddressIfLocalBitcoin(10, r.BTCDeployerAddress)
// if err != nil {
// panic(err)
// }
Expand Down
35 changes: 7 additions & 28 deletions e2e/e2etests/test_crosschain_swap.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (

"github.com/zeta-chain/zetacore/e2e/runner"
"github.com/zeta-chain/zetacore/e2e/utils"
"github.com/zeta-chain/zetacore/pkg/chains"
"github.com/zeta-chain/zetacore/x/crosschain/types"
)

Expand Down Expand Up @@ -110,17 +109,13 @@ func TestCrosschainSwap(r *runner.E2ERunner, _ []string) {
}

// mine 10 blocks to confirm the outbound tx
_, err = r.BtcRPCClient.GenerateToAddress(10, r.BTCDeployerAddress, nil)
_, err = r.GenerateToAddressIfLocalBitcoin(10, r.BTCDeployerAddress)
if err != nil {
panic(err)
}

// mine blocks if testing on regnet
var stop chan struct{}
isRegnet := chains.IsBitcoinRegnet(r.GetBitcoinChainID())
if isRegnet {
stop = r.MineBlocks()
}
stop := r.MineBlocksIfLocalBitcoin()

// cctx1 index acts like the inboundHash for the second cctx (the one that withdraws BTC)
cctx2 := utils.WaitCctxMinedByInboundHash(r.Ctx, cctx1.Index, r.CctxClient, r.Logger, r.CctxTimeout)
Expand All @@ -137,8 +132,8 @@ func TestCrosschainSwap(r *runner.E2ERunner, _ []string) {
r.Logger.Info("cctx2 outbound tx hash %s", cctx2.GetCurrentOutboundParam().Hash)

r.Logger.Info("******* Second test: BTC -> ERC20ZRC20")
// list deployer utxos that have at least 1 BTC
utxos, err := r.ListDeployerUTXOs(1.0)
// list deployer utxos
utxos, err := r.ListDeployerUTXOs()
if err != nil {
panic(err)
}
Expand All @@ -151,14 +146,7 @@ func TestCrosschainSwap(r *runner.E2ERunner, _ []string) {
memo = append(r.ZEVMSwapAppAddr.Bytes(), memo...)
r.Logger.Info("memo length %d", len(memo))

txID, err := r.SendToTSSFromDeployerWithMemo(
r.BTCTSSAddress,
0.01,
utxos[0:1],
r.BtcRPCClient,
memo,
r.BTCDeployerAddress,
)
txID, err := r.SendToTSSFromDeployerWithMemo(0.01, utxos[0:1], memo)
if err != nil {
panic(err)
}
Expand Down Expand Up @@ -200,14 +188,7 @@ func TestCrosschainSwap(r *runner.E2ERunner, _ []string) {
r.Logger.Info("memo length %d", len(memo))

amount := 0.1
txid, err := r.SendToTSSFromDeployerWithMemo(
r.BTCTSSAddress,
amount,
utxos[1:2],
r.BtcRPCClient,
memo,
r.BTCDeployerAddress,
)
txid, err := r.SendToTSSFromDeployerWithMemo(amount, utxos[1:2], memo)
if err != nil {
panic(err)
}
Expand Down Expand Up @@ -239,7 +220,5 @@ func TestCrosschainSwap(r *runner.E2ERunner, _ []string) {
}

// stop mining
if isRegnet {
stop <- struct{}{}
}
stop()
}
Loading

0 comments on commit 7b358d8

Please sign in to comment.