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 Bitcoin Testnet4 static chain info #2911

Merged
merged 7 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -12,6 +12,7 @@
* [2870](https://github.com/zeta-chain/node/pull/2870) - support for multiple Bitcoin chains in the zetaclient
* [2883](https://github.com/zeta-chain/node/pull/2883) - add chain static information for btc signet testnet
* [2907](https://github.com/zeta-chain/node/pull/2907) - derive Bitcoin tss address by chain id and added more Signet static info
* [2911](https://github.com/zeta-chain/node/pull/2911) - add chain static information for btc testnet4

### Refactor

Expand Down
1 change: 0 additions & 1 deletion docs/openapi/openapi.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56986,7 +56986,6 @@ definitions:
- solana_mainnet
- solana_devnet
- solana_localnet
- btc_signet_testnet
default: empty
title: |-
ws4charlie marked this conversation as resolved.
Show resolved Hide resolved
ChainName represents the name of the chain
Expand Down
15 changes: 14 additions & 1 deletion pkg/chains/chains.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ var (
Name: "btc_testnet",
}

// BitcoinSignetTestnet is Bitcoin Signet testnet
BitcoinSignetTestnet = Chain{
ChainName: ChainName_btc_signet_testnet,
ChainId: 18333,
Network: Network_btc,
NetworkType: NetworkType_testnet,
Expand All @@ -181,6 +181,18 @@ var (
Name: "btc_signet_testnet",
}

// BitcoinTestnet4 is Bitcoin testnet4
BitcoinTestnet4 = Chain{
ChainId: 18334,
Network: Network_btc,
NetworkType: NetworkType_testnet,
Vm: Vm_no_vm,
Consensus: Consensus_bitcoin,
IsExternal: true,
CctxGateway: CCTXGateway_observers,
Name: "btc_testnet4",
}

// Amoy is Polygon amoy testnet
Amoy = Chain{
ChainName: ChainName_amoy_testnet,
Expand Down Expand Up @@ -360,6 +372,7 @@ func DefaultChainsList() []Chain {
Ethereum,
BitcoinTestnet,
BitcoinSignetTestnet,
BitcoinTestnet4,
Mumbai,
Amoy,
BscTestnet,
Expand Down
189 changes: 93 additions & 96 deletions pkg/chains/chains.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion pkg/chains/chains_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import (
func TestChain_Name(t *testing.T) {
t.Run("new Name field is compatible with ChainName enum", func(t *testing.T) {
for _, chain := range chains.DefaultChainsList() {
require.EqualValues(t, chain.Name, chain.ChainName.String())
if chain.ChainName != chains.ChainName_empty {
require.EqualValues(t, chain.Name, chain.ChainName.String())
}
}
})
}
Expand Down Expand Up @@ -43,6 +45,7 @@ func TestChainListByNetworkType(t *testing.T) {
chains.ZetaChainTestnet,
chains.BitcoinTestnet,
chains.BitcoinSignetTestnet,
chains.BitcoinTestnet4,
chains.Mumbai,
chains.Amoy,
chains.BscTestnet,
Expand Down Expand Up @@ -95,6 +98,7 @@ func TestChainListByNetwork(t *testing.T) {
chains.BitcoinMainnet,
chains.BitcoinTestnet,
chains.BitcoinSignetTestnet,
chains.BitcoinTestnet4,
chains.BitcoinRegtest,
},
},
Expand Down Expand Up @@ -144,6 +148,7 @@ func TestDefaultChainList(t *testing.T) {
chains.Ethereum,
chains.BitcoinTestnet,
chains.BitcoinSignetTestnet,
chains.BitcoinTestnet4,
chains.Mumbai,
chains.Amoy,
chains.BscTestnet,
Expand Down Expand Up @@ -181,6 +186,7 @@ func TestChainListByGateway(t *testing.T) {
chains.Ethereum,
chains.BitcoinTestnet,
chains.BitcoinSignetTestnet,
chains.BitcoinTestnet4,
chains.Mumbai,
chains.Amoy,
chains.BscTestnet,
Expand Down Expand Up @@ -224,6 +230,7 @@ func TestExternalChainList(t *testing.T) {
chains.Ethereum,
chains.BitcoinTestnet,
chains.BitcoinSignetTestnet,
chains.BitcoinTestnet4,
chains.Mumbai,
chains.Amoy,
chains.BscTestnet,
Expand Down
2 changes: 0 additions & 2 deletions proto/zetachain/zetacore/pkg/chains/chains.proto
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ enum ChainName {
solana_mainnet = 21;
solana_devnet = 22;
solana_localnet = 23;

btc_signet_testnet = 24;
ws4charlie marked this conversation as resolved.
Show resolved Hide resolved
}

// Network represents the network of the chain
Expand Down
5 changes: 0 additions & 5 deletions typescript/zetachain/zetacore/pkg/chains/chains_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,6 @@ export declare enum ChainName {
* @generated from enum value: solana_localnet = 23;
*/
solana_localnet = 23,

/**
* @generated from enum value: btc_signet_testnet = 24;
*/
btc_signet_testnet = 24,
}

/**
Expand Down
2 changes: 1 addition & 1 deletion zetaclient/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type BTCConfig struct {
RPCUsername string `mask:"filled"`
RPCPassword string `mask:"filled"`
RPCHost string `mask:"filled"`
RPCParams string // "regtest", "mainnet", "testnet3" , "signet"
RPCParams string // "regtest", "mainnet", "testnet3" , "signet", "testnet4"
RPCAlertLatency int64
}

Expand Down
Loading