Skip to content

Commit

Permalink
HACK: add testnet4 and signet to localnet
Browse files Browse the repository at this point in the history
adding it directly to genesis state is the quickest way to get thit
working but this should really be dynamic
  • Loading branch information
gartnera committed Nov 22, 2024
1 parent 495235e commit e6cb617
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 0 deletions.
5 changes: 5 additions & 0 deletions contrib/localnet/scripts/start-zetaclientd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,9 @@ if [[ -f /root/zetaclient-config-overlay.json ]]; then
mv /tmp/merged_config.json /root/.zetacored/config/zetaclient_config.json
fi

# signet
export CHAIN_18333_SCAN_FROM_BLOCK=latest
# testnet4
export CHAIN_18334_SCAN_FROM_BLOCK=latest

zetaclientd-supervisor start < /root/password.file
26 changes: 26 additions & 0 deletions contrib/localnet/scripts/zetaclient-config-overlay.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"BTCChainConfigs": {
"18444": {
"RPCUsername": "smoketest",
"RPCPassword": "123",
"RPCHost": "bitcoin:18443",
"RPCParams": "regtest",
"RPCAlertLatency": 60
},
"18333": {
"RPCUsername": "default",
"RPCPassword": "default",
"RPCHost": "172.17.0.1:38332",
"RPCParams": "testnet3",
"RPCAlertLatency": 60
},
"18334": {
"RPCUsername": "default",
"RPCPassword": "default",
"RPCHost": "172.17.0.1:48332",
"RPCParams": "testnet3",
"RPCAlertLatency": 60

}
}
}
20 changes: 20 additions & 0 deletions e2e/txserver/zeta_tx_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,26 @@ func (zts ZetaTxServer) DeployZRC20s(
coin.CoinType_Gas,
100000,
),
fungibletypes.NewMsgDeployFungibleCoinZRC20(
deployerAddr,
"",
chains.BitcoinSignetTestnet.ChainId,
8,
"BTC",
"tBTC",
coin.CoinType_Gas,
100000,
),
fungibletypes.NewMsgDeployFungibleCoinZRC20(
deployerAddr,
"",
chains.BitcoinTestnet4.ChainId,
8,
"BTC",
"tBTC",
coin.CoinType_Gas,
100000,
),
fungibletypes.NewMsgDeployFungibleCoinZRC20(
deployerAddr,
"",
Expand Down
6 changes: 6 additions & 0 deletions x/observer/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,19 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState)
// if no chain params are defined, set localnet chains for test purposes
btcChainParams := types.GetDefaultBtcRegtestChainParams()
btcChainParams.IsSupported = true
btcChainTestnet4Params := types.GetDefaultBtcTestnet4ChainParams()
btcChainTestnet4Params.IsSupported = true
btcChainSignetParams := types.GetDefaultBtcSignetChainParams()
btcChainSignetParams.IsSupported = true
goerliChainParams := types.GetDefaultGoerliLocalnetChainParams()
goerliChainParams.IsSupported = true
zetaPrivnetChainParams := types.GetDefaultZetaPrivnetChainParams()
zetaPrivnetChainParams.IsSupported = true
k.SetChainParamsList(ctx, types.ChainParamsList{
ChainParams: []*types.ChainParams{
btcChainParams,
btcChainTestnet4Params,
btcChainSignetParams,
goerliChainParams,
zetaPrivnetChainParams,
},
Expand Down
38 changes: 38 additions & 0 deletions x/observer/types/chain_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ func GetDefaultChainParams() ChainParamsList {
GetDefaultBscTestnetChainParams(),
GetDefaultMumbaiTestnetChainParams(),
GetDefaultBtcTestnetChainParams(),
GetDefaultBtcTestnet4ChainParams(),
GetDefaultBtcSignetChainParams(),
GetDefaultBtcRegtestChainParams(),
GetDefaultGoerliLocalnetChainParams(),
},
Expand Down Expand Up @@ -279,6 +281,42 @@ func GetDefaultBtcTestnetChainParams() *ChainParams {
IsSupported: false,
}
}
func GetDefaultBtcTestnet4ChainParams() *ChainParams {
return &ChainParams{
ChainId: chains.BitcoinTestnet4.ChainId,
ConfirmationCount: 2,
ZetaTokenContractAddress: constant.EVMZeroAddress,
ConnectorContractAddress: constant.EVMZeroAddress,
Erc20CustodyContractAddress: constant.EVMZeroAddress,
WatchUtxoTicker: 30,
InboundTicker: 120,
OutboundTicker: 12,
GasPriceTicker: 30,
OutboundScheduleInterval: 30,
OutboundScheduleLookahead: 100,
BallotThreshold: DefaultBallotThreshold,
MinObserverDelegation: DefaultMinObserverDelegation,
IsSupported: false,
}
}
func GetDefaultBtcSignetChainParams() *ChainParams {
return &ChainParams{
ChainId: chains.BitcoinSignetTestnet.ChainId,
ConfirmationCount: 2,
ZetaTokenContractAddress: constant.EVMZeroAddress,
ConnectorContractAddress: constant.EVMZeroAddress,
Erc20CustodyContractAddress: constant.EVMZeroAddress,
WatchUtxoTicker: 30,
InboundTicker: 120,
OutboundTicker: 12,
GasPriceTicker: 30,
OutboundScheduleInterval: 30,
OutboundScheduleLookahead: 100,
BallotThreshold: DefaultBallotThreshold,
MinObserverDelegation: DefaultMinObserverDelegation,
IsSupported: false,
}
}
func GetDefaultBtcRegtestChainParams() *ChainParams {
return &ChainParams{
ChainId: chains.BitcoinRegtest.ChainId,
Expand Down

0 comments on commit e6cb617

Please sign in to comment.