Skip to content

Commit

Permalink
Merge branch 'develop' into cctx-validate-inbound
Browse files Browse the repository at this point in the history
  • Loading branch information
skosito authored Jun 20, 2024
2 parents ae38f3b + 5e3c3ba commit 7f3bf86
Show file tree
Hide file tree
Showing 21 changed files with 484 additions and 327 deletions.
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,13 @@ start-upgrade-test-light: zetanode-upgrade
@echo "--> Starting light upgrade test (no ZetaChain state populating before upgrade)"
cd contrib/localnet/ && $(DOCKER) compose -f docker-compose.yml -f docker-compose-upgrade.yml -f docker-compose-upgrade-light.yml up -d

start-localnet: zetanode
start-localnet: zetanode start-localnet-skip-build

start-localnet-skip-build:
@echo "--> Starting localnet"
cd contrib/localnet/ && $(DOCKER) compose -f docker-compose.yml -f docker-compose-setup-only.yml up -d

stop-test:
stop-localnet:
cd contrib/localnet/ && $(DOCKER) compose down --remove-orphans

###############################################################################
Expand Down
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
* [2329](https://github.com/zeta-chain/node/pull/2329) - fix TODOs in rpc unit tests
* [2342](https://github.com/zeta-chain/node/pull/2342) - extend rpc unit tests with testing extension to include synthetic ethereum txs
* [2299](https://github.com/zeta-chain/node/pull/2299) - add `zetae2e` command to deploy test contracts
* [2349](https://github.com/zeta-chain/node/pull/2349) - add TestBitcoinDepositRefund and WithdrawBitcoinMultipleTimes E2E tests

### Fixes

Expand Down
3 changes: 3 additions & 0 deletions cmd/zetae2e/local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@ func localE2ETest(cmd *cobra.Command, _ []string) {
e2etests.TestMessagePassingEVMtoZEVMRevertFailName,
}
bitcoinTests := []string{
e2etests.TestBitcoinDepositName,
e2etests.TestBitcoinDepositRefundName,
e2etests.TestBitcoinWithdrawSegWitName,
e2etests.TestBitcoinWithdrawInvalidAddressName,
e2etests.TestZetaWithdrawBTCRevertName,
Expand All @@ -297,6 +299,7 @@ func localE2ETest(cmd *cobra.Command, _ []string) {
bitcoinAdvancedTests := []string{
e2etests.TestBitcoinWithdrawTaprootName,
e2etests.TestBitcoinWithdrawLegacyName,
e2etests.TestBitcoinWithdrawMultipleName,
e2etests.TestBitcoinWithdrawP2SHName,
e2etests.TestBitcoinWithdrawP2WSHName,
e2etests.TestBitcoinWithdrawRestrictedName,
Expand Down
23 changes: 19 additions & 4 deletions cmd/zetae2e/stress.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"math/big"
"os"
"sort"
"sync"
"time"

sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -223,11 +224,25 @@ func StressTest(cmd *cobra.Command, _ []string) {
fmt.Println(" 1. Periodically Withdraw ETH from ZEVM to EVM")
fmt.Println(" 2. Display Network metrics to monitor performance [Num Pending outbound tx], [Num Trackers]")

e2eTest.WG.Add(2)
go WithdrawCCtx(e2eTest) // Withdraw from ZEVM to EVM
go EchoNetworkMetrics(e2eTest) // Display Network metrics periodically to monitor performance
var wg sync.WaitGroup

e2eTest.WG.Wait()
wg.Add(2)

go func() {
defer wg.Done()

// Withdraw from ZEVM to EVM
WithdrawCCtx(e2eTest)
}()

go func() {
defer wg.Done()

// Display Network metrics periodically to monitor performance
EchoNetworkMetrics(e2eTest)
}()

wg.Wait()
}

// WithdrawCCtx withdraw ETHZRC20 from ZEVM to EVM
Expand Down
2 changes: 1 addition & 1 deletion docs/development/LOCAL_TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ $ docker logs -f orchestrator

To stop the tests,
```bash
make stop-test
make stop-localnet
```

### Run monitoring setup
Expand Down
20 changes: 20 additions & 0 deletions e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,23 @@ zeta_chain_id: "zetachain-1"
```
NOTE: config is in progress, contracts on the zEVM must be added
## Debugging
It's possible to debug a single test using Delve debugger.
1. Make sure delve is installed. `go install github.com/go-delve/delve/cmd/dlv@latest`
2. Configure your IDE to use Delve as the debugger. For Goland, you can do the following:
- Go to "Run" > "Edit Run Configurations"
- Hit "+" > "Go Remote". Keep port as default (`2345`). Toggle "On Disconnect" > "Stop Delve process"
3. Make sure that localnet is running. For a quick start, you can use `make start-localnet-skip-build`.
Networks need some time to generate blocks.
4. Run test as following: `./e2e/scripts/debug.sh my_test_name arg1 arg2 arg_n`.
Example: `./e2e/scripts/debug.sh bitcoin_withdraw_restricted 0.001`
5. Place a breakpoint in the code.
6. Go to the editor's debug panel and hit "Debug" button.

You can also run an alias of `zetae2e run` like so:
```shell
`./e2e/scripts/run.sh bitcoin_withdraw_restricted 0.001`
```
18 changes: 18 additions & 0 deletions e2e/e2etests/e2etests.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ const (
Test transfer of Bitcoin asset across chains
*/
TestBitcoinDepositName = "bitcoin_deposit"
TestBitcoinDepositRefundName = "bitcoin_deposit_refund"
TestBitcoinWithdrawSegWitName = "bitcoin_withdraw_segwit"
TestBitcoinWithdrawTaprootName = "bitcoin_withdraw_taproot"
TestBitcoinWithdrawMultipleName = "bitcoin_withdraw_multiple"
TestBitcoinWithdrawLegacyName = "bitcoin_withdraw_legacy"
TestBitcoinWithdrawP2WSHName = "bitcoin_withdraw_p2wsh"
TestBitcoinWithdrawP2SHName = "bitcoin_withdraw_p2sh"
Expand Down Expand Up @@ -332,6 +334,13 @@ var AllE2ETests = []runner.E2ETest{
},
TestBitcoinDeposit,
),
runner.NewE2ETest(
TestBitcoinDepositRefundName,
"deposit Bitcoin into ZEVM; expect refund", []runner.ArgDefinition{
{Description: "amount in btc", DefaultValue: "0.1"},
},
TestBitcoinDepositRefund,
),
runner.NewE2ETest(
TestBitcoinWithdrawSegWitName,
"withdraw BTC from ZEVM to a SegWit address",
Expand Down Expand Up @@ -359,6 +368,15 @@ var AllE2ETests = []runner.E2ETest{
},
TestBitcoinWithdrawLegacy,
),
runner.NewE2ETest(
TestBitcoinWithdrawMultipleName,
"withdraw BTC from ZEVM multiple times",
[]runner.ArgDefinition{
{Description: "amount", DefaultValue: "0.01"},
{Description: "times", DefaultValue: "2"},
},
WithdrawBitcoinMultipleTimes,
),
runner.NewE2ETest(
TestBitcoinWithdrawP2WSHName,
"withdraw BTC from ZEVM to a P2WSH address",
Expand Down
120 changes: 0 additions & 120 deletions e2e/e2etests/helper_bitcoin.go

This file was deleted.

32 changes: 0 additions & 32 deletions e2e/e2etests/helper_erc20.go

This file was deleted.

Loading

0 comments on commit 7f3bf86

Please sign in to comment.