From cf7a4aa75b877d51cad9538654709b35902ad7fc Mon Sep 17 00:00:00 2001 From: kevinssgh Date: Thu, 14 Mar 2024 15:23:36 -0400 Subject: [PATCH] added targets and docs --- Makefile | 12 +++- cmd/zetatool/filterdeposit/evm.go | 2 +- cmd/zetatool/filterdeposit/filterdeposit.go | 1 + docs/cli/zetatool/filterdeposit.md | 24 +++++++ docs/cli/zetatool/readme.md | 63 +++++++++++++++++++ .../InboundTxFilter_config.json | 11 ++++ .../filter_missed_btc.sh | 3 + .../filter_missed_eth.sh | 3 + 8 files changed, 117 insertions(+), 2 deletions(-) create mode 100644 docs/cli/zetatool/filterdeposit.md create mode 100644 docs/cli/zetatool/readme.md create mode 100644 tool/filter_missed_deposits/InboundTxFilter_config.json create mode 100755 tool/filter_missed_deposits/filter_missed_btc.sh create mode 100755 tool/filter_missed_deposits/filter_missed_eth.sh diff --git a/Makefile b/Makefile index f0913e5ca7..529738bedb 100644 --- a/Makefile +++ b/Makefile @@ -290,4 +290,14 @@ mainnet-bitcoind-node: cd contrib/mainnet/bitcoind && DOCKER_TAG=$(DOCKER_TAG) docker-compose up athens3-zetarpc-node: - cd contrib/athens3/zetacored && DOCKER_TAG=$(DOCKER_TAG) docker-compose up \ No newline at end of file + cd contrib/athens3/zetacored && DOCKER_TAG=$(DOCKER_TAG) docker-compose up + +############################################################################### +### Debug Tools ### +############################################################################### + +filter-missed-btc: install-zetatool + ./tool/filter_missed_deposits/filter_missed_btc.sh + +filter-missed-eth: install-zetatool + ./tool/filter_missed_deposits/filter_missed_eth.sh \ No newline at end of file diff --git a/cmd/zetatool/filterdeposit/evm.go b/cmd/zetatool/filterdeposit/evm.go index a16482186d..ee43946400 100644 --- a/cmd/zetatool/filterdeposit/evm.go +++ b/cmd/zetatool/filterdeposit/evm.go @@ -25,7 +25,7 @@ const ( ) var evmCmd = &cobra.Command{ - Use: "evm", + Use: "eth", Short: "Filter inbound eth deposits", Run: FilterEVMTransactions, } diff --git a/cmd/zetatool/filterdeposit/filterdeposit.go b/cmd/zetatool/filterdeposit/filterdeposit.go index e7e2091fd5..98fda63943 100644 --- a/cmd/zetatool/filterdeposit/filterdeposit.go +++ b/cmd/zetatool/filterdeposit/filterdeposit.go @@ -72,6 +72,7 @@ func CheckForCCTX(list []Deposit, cfg *config.Config) []Deposit { } } + fmt.Printf("Found %d missed transactions.\n", len(missedList)) for _, entry := range missedList { fmt.Printf("%s, amount: %d\n", entry.TxID, entry.Amount) } diff --git a/docs/cli/zetatool/filterdeposit.md b/docs/cli/zetatool/filterdeposit.md new file mode 100644 index 0000000000..475ca1b540 --- /dev/null +++ b/docs/cli/zetatool/filterdeposit.md @@ -0,0 +1,24 @@ +# filterdeposit + +Filter missing inbound deposits + +### Synopsis + +Filters relevant inbound transactions for a given network and attempts to find an associated cctx from the core. If a +cctx is not found, the associated transaction hash and amount is added to a list and displayed. + +``` +zetatool filterdeposit [command] +``` +### Options + +``` +Available Commands: +btc Filter inbound btc deposits +eth Filter inbound eth deposits +``` + +### Options inherited from parent commands +``` +--config string custom config file: --config filename.json +``` \ No newline at end of file diff --git a/docs/cli/zetatool/readme.md b/docs/cli/zetatool/readme.md new file mode 100644 index 0000000000..e83352bb15 --- /dev/null +++ b/docs/cli/zetatool/readme.md @@ -0,0 +1,63 @@ +# Zeta Tool + +Currently, has only one subcommand which finds inbound transactions or deposits that weren't observed on a particular +network. `filterdeposit` + +## Configuring + +#### RPC endpoints +Configuring the tool for specific networks will require different reliable endpoints. For example, if you wanted to +configure an ethereum rpc endpoint, then you will have to find an evm rpc endpoint for eth mainnet and set the field: +`EthRPC` + +#### Zeta URL +You will need to find an enpoint for zetachain and set the field: `ZetaURL` + +#### TSS Addresses +Depending on which network you are using, you will have to populate the tss addresses for both EVM and BTC using these +fields: `TssAddressBTC`, `TssAddressEVM` + +#### Contract Addresses +Depending on the network, connector and custody contract addresses must be set using these fields: `ConnectorAddress`, +`CustodyAddress` + +#### EVM Block Ranges +When filtering evm transactions, a range of blocks is required and to reduce runtime of the command, a suitable range +must be selected and set in these fields: `EvmStartBlock`, `EvmMaxRange` + +If a configuration file is not provided, a default config will be generated under the name +`InboundTxFilter_config.json`. Below is an example of a configuration file used for mainnet: + +```json +{ + "ZetaURL": "http://46.4.15.110:1317", + "TssAddressBTC": "bc1qm24wp577nk8aacckv8np465z3dvmu7ry45el6y", + "TssAddressEVM": "0x70e967acfcc17c3941e87562161406d41676fd83", + "BtcExplorer": "https://blockstream.info/api/address/bc1qm24wp577nk8aacckv8np465z3dvmu7ry45el6y/txs", + "EthRPC": "https://ethereum-rpc.publicnode.com", + "ConnectorAddress": "0x000007Cf399229b2f5A4D043F20E90C9C98B7C6a", + "CustodyAddress": "0x0000030Ec64DF25301d8414eE5a29588C4B0dE10", + "EvmStartBlock": 19200110, + "EvmMaxRange": 1000 +} +``` + +## Running Tool + +There are two targets available: + +``` +filter-missed-btc: install-zetatool + ./tool/filter_missed_deposits/filter_missed_btc.sh + +filter-missed-eth: install-zetatool + ./tool/filter_missed_deposits/filter_missed_eth.sh +``` + +Running the commands can be simply done through the makefile in the node repo: + +``` +make filter-missed-btc +or ... +make filter-missed-eth +``` \ No newline at end of file diff --git a/tool/filter_missed_deposits/InboundTxFilter_config.json b/tool/filter_missed_deposits/InboundTxFilter_config.json new file mode 100644 index 0000000000..5ccc92f6d2 --- /dev/null +++ b/tool/filter_missed_deposits/InboundTxFilter_config.json @@ -0,0 +1,11 @@ +{ + "ZetaURL": "http://46.4.15.110:1317", + "TssAddressBTC": "bc1qm24wp577nk8aacckv8np465z3dvmu7ry45el6y", + "TssAddressEVM": "0x70e967acfcc17c3941e87562161406d41676fd83", + "BtcExplorer": "https://blockstream.info/api/address/bc1qm24wp577nk8aacckv8np465z3dvmu7ry45el6y/txs", + "EthRPC": "https://ethereum-rpc.publicnode.com", + "ConnectorAddress": "0x000007Cf399229b2f5A4D043F20E90C9C98B7C6a", + "CustodyAddress": "0x0000030Ec64DF25301d8414eE5a29588C4B0dE10", + "EvmStartBlock": 19200110, + "EvmMaxRange": 1000 +} \ No newline at end of file diff --git a/tool/filter_missed_deposits/filter_missed_btc.sh b/tool/filter_missed_deposits/filter_missed_btc.sh new file mode 100755 index 0000000000..f654f9c32e --- /dev/null +++ b/tool/filter_missed_deposits/filter_missed_btc.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +zetatool filterdeposit btc --config ./tool/filter_missed_deposits/InboundTxFilter_config.json \ No newline at end of file diff --git a/tool/filter_missed_deposits/filter_missed_eth.sh b/tool/filter_missed_deposits/filter_missed_eth.sh new file mode 100755 index 0000000000..f8151bc81c --- /dev/null +++ b/tool/filter_missed_deposits/filter_missed_eth.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +zetatool filterdeposit eth --config ./tool/filter_missed_deposits/InboundTxFilter_config.json \ No newline at end of file