Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Optimism and Base in static chain data and rename chain objects #2258

Merged
merged 23 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* [2152](https://github.com/zeta-chain/node/pull/2152) - custom priority nonce mempool
* [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

### Refactor

Expand Down
2 changes: 1 addition & 1 deletion cmd/zetaclientd/keygen_tss.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func GenerateTss(
// Bitcoin chain ID is currently used for using the correct signature format
// TODO: remove this once we have a better way to determine the signature format
// https://github.com/zeta-chain/node/issues/1397
bitcoinChainID := chains.BtcRegtestChain.ChainId
bitcoinChainID := chains.BitcoinRegtest.ChainId
btcChain, _, btcEnabled := appContext.GetBTCChainAndConfig()
if btcEnabled {
bitcoinChainID = btcChain.ChainId
Expand Down
4 changes: 2 additions & 2 deletions cmd/zetae2e/local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ func localE2ETest(cmd *cobra.Command, _ []string) {

if !skipHeaderProof {
if err := deployerRunner.EnableHeaderVerification([]int64{
chains.GoerliLocalnetChain.ChainId,
chains.BtcRegtestChain.ChainId}); err != nil {
chains.GoerliLocalnet.ChainId,
chains.BitcoinRegtest.ChainId}); err != nil {
panic(err)
}
}
Expand Down
43 changes: 35 additions & 8 deletions docs/openapi/openapi.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56747,21 +56747,31 @@ definitions:
chainsChain:
type: object
properties:
chain_name:
$ref: '#/definitions/chainsChainName'
chain_id:
type: string
format: int64
title: ChainId is the unique identifier of the chain
chain_name:
$ref: '#/definitions/chainsChainName'
title: ChainName is the name of the chain
network:
$ref: '#/definitions/chainsNetwork'
title: Network is the network of the chain
network_type:
$ref: '#/definitions/chainsNetworkType'
description: 'NetworkType is the network type of the chain: mainnet, testnet, etc..'
vm:
$ref: '#/definitions/chainsVm'
title: Vm is the virtual machine used in the chain
consensus:
$ref: '#/definitions/chainsConsensus'
title: Consensus is the underlying consensus algorithm used by the chain
is_external:
type: boolean
title: IsExternal describe if the chain is ZetaChain or external
title: |-
Chain represents static data about a blockchain network
it is identified by a unique chain ID
chainsChainName:
type: string
enum:
Expand All @@ -56773,15 +56783,17 @@ definitions:
- bsc_mainnet
- goerli_testnet
- mumbai_testnet
- ganache_testnet
- baobab_testnet
- bsc_testnet
- zeta_testnet
- btc_testnet
- sepolia_testnet
- goerli_localnet
- btc_regtest
- amoy_testnet
- optimism_mainnet
- optimism_sepolia
- base_mainnet
- base_sepolia
default: empty
title: ChainName represents the name of the chain
chainsConsensus:
Expand All @@ -56790,8 +56802,12 @@ definitions:
- ethereum
- tendermint
- bitcoin
- op_stack
default: ethereum
title: Consensus represents the consensus algorithm used by the chain
title: |-
Consensus represents the consensus algorithm used by the chain
this can represent the consensus of a L1
this can also represent the solution of a L2
chainsNetwork:
type: string
enum:
Expand All @@ -56800,8 +56816,13 @@ definitions:
- btc
- polygon
- bsc
- optimism
- base
default: eth
title: Network represents the network type of the chain
title: |-
Network represents the network of the chain
there is a single instance of the network on mainnet
then the network can have eventual testnets or devnets
chainsNetworkType:
type: string
enum:
Expand All @@ -56810,15 +56831,21 @@ definitions:
- privnet
- devnet
default: mainnet
title: NetworkType represents the network type of the chain
title: |-
NetworkType represents the network type of the chain
Mainnet, Testnet, Privnet, Devnet
chainsReceiveStatus:
type: string
enum:
- created
- success
- failed
default: created
title: '- created: some observer sees inbound tx'
description: '- created: Created is used for inbounds'
title: |-
ReceiveStatus represents the status of an outbound
TODO: Rename and move
https://github.com/zeta-chain/node/issues/2257
chainsVm:
type: string
enum:
Expand Down
2 changes: 1 addition & 1 deletion e2e/e2etests/test_bitcoin_withdraw_restricted_address.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func withdrawBitcoinRestricted(r *runner.E2ERunner, amount *big.Int) {
// use restricted BTC P2WPKH address
addressRestricted, err := chains.DecodeBtcAddress(
testutils.RestrictedBtcAddressTest,
chains.BtcRegtestChain.ChainId,
chains.BitcoinRegtest.ChainId,
)
if err != nil {
panic(err)
Expand Down
4 changes: 2 additions & 2 deletions e2e/e2etests/test_migrate_chain_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const EVM2RPCURL = "http://eth2:8545"

// EVM2ChainID is the chain ID for the additional EVM localnet
// We set Sepolia testnet although the value is not important, only used to differentiate
var EVM2ChainID = chains.SepoliaChain.ChainId
var EVM2ChainID = chains.Sepolia.ChainId
lumtis marked this conversation as resolved.
Show resolved Hide resolved

func TestMigrateChainSupport(r *runner.E2ERunner, _ []string) {
// deposit most of the ZETA supply on ZetaChain
Expand Down Expand Up @@ -187,7 +187,7 @@ func TestMigrateChainSupport(r *runner.E2ERunner, _ []string) {
res, err := newRunner.ZetaTxServer.BroadcastTx(utils.FungibleAdminName, crosschaintypes.NewMsgWhitelistERC20(
adminAddr,
newRunner.ERC20Addr.Hex(),
chains.SepoliaChain.ChainId,
chains.Sepolia.ChainId,
"USDT",
"USDT",
18,
Expand Down
2 changes: 1 addition & 1 deletion e2e/e2etests/test_zeta_withdraw_bitcoin_revert.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func TestZetaWithdrawBTCRevert(r *runner.E2ERunner, args []string) {

lessThanAmount := amount.Div(amount, big.NewInt(10)) // 1/10 of amount
tx, err = r.ConnectorZEVM.Send(r.ZEVMAuth, connectorzevm.ZetaInterfacesSendInput{
DestinationChainId: big.NewInt(chains.BtcRegtestChain.ChainId),
DestinationChainId: big.NewInt(chains.BitcoinRegtest.ChainId),
DestinationAddress: r.DeployerAddress.Bytes(),
DestinationGasLimit: big.NewInt(400_000),
Message: nil,
Expand Down
2 changes: 1 addition & 1 deletion e2e/runner/bitcoin.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ func (runner *E2ERunner) ProveBTCTransaction(txHash *chainhash.Hash) {

// verify merkle proof through RPC
res, err := runner.LightclientClient.Prove(runner.Ctx, &lightclienttypes.QueryProveRequest{
ChainId: chains.BtcRegtestChain.ChainId,
ChainId: chains.BitcoinRegtest.ChainId,
TxHash: txHash.String(),
BlockHash: blockHash.String(),
Proof: proofs.NewBitcoinProof(txBytes, path, index),
Expand Down
2 changes: 1 addition & 1 deletion e2e/runner/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ func (runner *E2ERunner) ProveEthTransaction(receipt *ethtypes.Receipt) {
TxIndex: int64(txIndex),
TxHash: txHash.Hex(),
Proof: proofs.NewEthereumProof(txProof),
ChainId: chains.GoerliLocalnetChain.ChainId,
ChainId: chains.GoerliLocalnet.ChainId,
})
if err != nil {
panic(err)
Expand Down
4 changes: 2 additions & 2 deletions e2e/runner/setup_zeta.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func (runner *E2ERunner) SetZEVMContracts() {
func (runner *E2ERunner) SetupETHZRC20() {
ethZRC20Addr, err := runner.SystemContract.GasCoinZRC20ByChainId(
&bind.CallOpts{},
big.NewInt(chains.GoerliLocalnetChain.ChainId),
big.NewInt(chains.GoerliLocalnet.ChainId),
)
if err != nil {
panic(err)
Expand All @@ -224,7 +224,7 @@ func (runner *E2ERunner) SetupETHZRC20() {
func (runner *E2ERunner) SetupBTCZRC20() {
BTCZRC20Addr, err := runner.SystemContract.GasCoinZRC20ByChainId(
&bind.CallOpts{},
big.NewInt(chains.BtcRegtestChain.ChainId),
big.NewInt(chains.BitcoinRegtest.ChainId),
)
if err != nil {
panic(err)
Expand Down
6 changes: 3 additions & 3 deletions e2e/txserver/zeta_tx_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ func (zts ZetaTxServer) DeploySystemContractsAndZRC20(
_, err = zts.BroadcastTx(account, fungibletypes.NewMsgDeployFungibleCoinZRC20(
addr.String(),
"",
chains.GoerliLocalnetChain.ChainId,
chains.GoerliLocalnet.ChainId,
18,
"ETH",
"gETH",
Expand All @@ -356,7 +356,7 @@ func (zts ZetaTxServer) DeploySystemContractsAndZRC20(
_, err = zts.BroadcastTx(account, fungibletypes.NewMsgDeployFungibleCoinZRC20(
addr.String(),
"",
chains.BtcRegtestChain.ChainId,
chains.BitcoinRegtest.ChainId,
8,
"BTC",
"tBTC",
Expand All @@ -371,7 +371,7 @@ func (zts ZetaTxServer) DeploySystemContractsAndZRC20(
res, err = zts.BroadcastTx(account, fungibletypes.NewMsgDeployFungibleCoinZRC20(
addr.String(),
erc20Addr,
chains.GoerliLocalnetChain.ChainId,
chains.GoerliLocalnet.ChainId,
6,
"USDT",
"USDT",
Expand Down
Loading
Loading