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

test: Stateful upgrade #1135

Merged
merged 50 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
d27e23c
fixed btc setup
kevinssgh Aug 29, 2023
040adba
fixed TestSetupZetaTokenAndConnectorAndZEVMContracts
kevinssgh Aug 29, 2023
be5629d
fixed TestDepositEtherIntoZRC20
kevinssgh Aug 29, 2023
b0afb6a
fixed Contract deployments
kevinssgh Sep 1, 2023
490e84f
fixed erc20 withdraw
kevinssgh Sep 1, 2023
cfc9b3a
added setup functions
kevinssgh Sep 2, 2023
b889622
fix swap tests
kevinssgh Sep 5, 2023
7132ff8
cleanup
kevinssgh Sep 5, 2023
07006e5
Merge branch 'develop' into stateful-smoketest
kevinssgh Sep 5, 2023
16e65d8
ran make generate
kevinssgh Sep 5, 2023
d0de765
removed line to trigger CI
kevinssgh Sep 5, 2023
f0a7baa
clean up some unused code
kevinssgh Sep 5, 2023
a182361
remove extra slashes
kevinssgh Sep 5, 2023
0df50a4
Merge branch 'develop' into stateful-smoketest
kevinssgh Sep 5, 2023
4f3e847
Merge branch 'develop' into stateful-smoketest
lumtis Sep 6, 2023
5de345a
initial commit
kevinssgh Sep 11, 2023
268e268
merge develop
kevinssgh Sep 11, 2023
1d5dd55
Merge branch 'develop' into stateful-upgrade
kevinssgh Sep 11, 2023
62e6190
incorporated zetavisor into smoketest
kevinssgh Sep 11, 2023
253cdba
enable gov proposal and votes
kevinssgh Sep 12, 2023
7136dde
fix auto upgrade script
kevinssgh Sep 13, 2023
878698e
move build process to dockerfile
kevinssgh Sep 13, 2023
a3acbb6
change smoketest build
kevinssgh Sep 13, 2023
59be3c1
temporarily add status to check height at smoketest completion
kevinssgh Sep 14, 2023
55bedc4
update smoketest
kevinssgh Sep 14, 2023
f3badb2
added flag for smoketest to start at particular block
kevinssgh Sep 14, 2023
ca6fecd
update smoketest
kevinssgh Sep 14, 2023
139c075
update log formatting
kevinssgh Sep 14, 2023
e655c7e
remove test code
kevinssgh Sep 14, 2023
905aa36
Merge branch 'develop' into stateful-upgrade
kevinssgh Sep 14, 2023
94dffa8
run zetaclient in background
kevinssgh Sep 18, 2023
fc06c34
added zetaclient restart script
kevinssgh Sep 19, 2023
6fe07bc
merge develop
kevinssgh Sep 20, 2023
a966abb
Merge branch 'develop' into stateful-upgrade
kevinssgh Sep 21, 2023
5e03c66
Merge branch 'develop' into stateful-upgrade
kevinssgh Sep 21, 2023
1d16733
Merge branch 'develop' into stateful-upgrade
kevinssgh Sep 22, 2023
4de9489
Merge branch 'develop' into stateful-upgrade
kevinssgh Sep 22, 2023
f5216fe
Merge branch 'develop' into stateful-upgrade
kevinssgh Sep 25, 2023
3411ef4
Merge branch 'develop' into stateful-upgrade
kevinssgh Sep 28, 2023
2492265
v10-rc2
Sep 25, 2023
496d0ba
fix build
Sep 25, 2023
a61cca9
fix restart zetaclient script
kevinssgh Sep 25, 2023
27cd99f
fix zetaclient restart and admin account
kevinssgh Sep 25, 2023
8472aa4
uncomment test
kevinssgh Sep 26, 2023
50ce185
add error log for block header query
kevinssgh Sep 26, 2023
01db71f
updates
kevinssgh Sep 26, 2023
fb0c01e
disable merkle proof test
kevinssgh Sep 26, 2023
5d95508
disable some other tests
kevinssgh Sep 26, 2023
b66d2ec
re-enable tests and fixed zetaclient restart.
kevinssgh Sep 28, 2023
0cf2be6
fix release version
kevinssgh Sep 28, 2023
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
Next Next commit
fixed btc setup
  • Loading branch information
kevinssgh committed Aug 29, 2023
commit d27e23c4b65eb1b2b26f47706abd0b250269b195
164 changes: 82 additions & 82 deletions contrib/localnet/orchestrator/smoketest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,91 +263,91 @@ func LocalSmokeTest(_ *cobra.Command, _ []string) {

// The following deployment must happen here and in this order, please do not change
// ==================== Deploying contracts ====================
startTime := time.Now()
//startTime := time.Now()
smokeTest.TestBitcoinSetup()
smokeTest.TestSetupZetaTokenAndConnectorAndZEVMContracts()
smokeTest.TestDepositEtherIntoZRC20()
smokeTest.TestSendZetaIn()

zevmSwapAppAddr, tx, _, err := zevmswap.DeployZEVMSwapApp(smokeTest.zevmAuth, smokeTest.zevmClient, smokeTest.UniswapV2RouterAddr, smokeTest.SystemContractAddr)
if err != nil {
panic(err)
}
receipt := MustWaitForTxReceipt(zevmClient, tx)
if receipt.Status != 1 {
panic("ZEVMSwapApp deployment failed")
}
zevmSwapApp, err := zevmswap.NewZEVMSwapApp(zevmSwapAppAddr, zevmClient)
fmt.Printf("ZEVMSwapApp contract address: %s, tx hash: %s\n", zevmSwapAppAddr.Hex(), tx.Hash().Hex())
smokeTest.ZEVMSwapAppAddr = zevmSwapAppAddr
smokeTest.ZEVMSwapApp = zevmSwapApp
//smokeTest.TestSetupZetaTokenAndConnectorAndZEVMContracts()
//smokeTest.TestDepositEtherIntoZRC20()
//smokeTest.TestSendZetaIn()
//
//zevmSwapAppAddr, tx, _, err := zevmswap.DeployZEVMSwapApp(smokeTest.zevmAuth, smokeTest.zevmClient, smokeTest.UniswapV2RouterAddr, smokeTest.SystemContractAddr)
//if err != nil {
// panic(err)
//}
//receipt := MustWaitForTxReceipt(zevmClient, tx)
//if receipt.Status != 1 {
// panic("ZEVMSwapApp deployment failed")
//}
//zevmSwapApp, err := zevmswap.NewZEVMSwapApp(zevmSwapAppAddr, zevmClient)
//fmt.Printf("ZEVMSwapApp contract address: %s, tx hash: %s\n", zevmSwapAppAddr.Hex(), tx.Hash().Hex())
//smokeTest.ZEVMSwapAppAddr = zevmSwapAppAddr
//smokeTest.ZEVMSwapApp = zevmSwapApp

// test system contract context upgrade
contextAppAddr, tx, _, err := contextapp.DeployContextApp(smokeTest.zevmAuth, smokeTest.zevmClient)
if err != nil {
panic(err)
}
receipt = MustWaitForTxReceipt(zevmClient, tx)
if receipt.Status != 1 {
panic("ContextApp deployment failed")
}
contextApp, err := contextapp.NewContextApp(contextAppAddr, zevmClient)
if err != nil {
panic(err)
}
fmt.Printf("ContextApp contract address: %s, tx hash: %s\n", contextAppAddr.Hex(), tx.Hash().Hex())
smokeTest.ContextAppAddr = contextAppAddr
smokeTest.ContextApp = contextApp

fmt.Printf("## Essential tests takes %s\n", time.Since(startTime))
fmt.Printf("## The DeployerAddress %s is funded on the following networks:\n", DeployerAddress.Hex())
fmt.Printf("## Ether on Ethereum private net\n")
fmt.Printf("## ZETA on ZetaChain EVM\n")
fmt.Printf("## ETH ZRC20 on ZetaChain\n")
// The following tests are optional tests; comment out the ones you don't want to run
// temporarily to reduce dev/test cycle turnaround time
smokeTest.CheckZRC20ReserveAndSupply()

smokeTest.TestContextUpgrade()

smokeTest.TestDepositAndCallRefund()
smokeTest.CheckZRC20ReserveAndSupply()

smokeTest.TestERC20Deposit()
smokeTest.CheckZRC20ReserveAndSupply()

smokeTest.TestERC20Withdraw()
//smokeTest.WithdrawBitcoinMultipleTimes(5)
smokeTest.CheckZRC20ReserveAndSupply()

smokeTest.TestSendZetaOut()
smokeTest.CheckZRC20ReserveAndSupply()

smokeTest.TestSendZetaOutBTCRevert()
smokeTest.CheckZRC20ReserveAndSupply()

smokeTest.TestMessagePassing()
smokeTest.CheckZRC20ReserveAndSupply()

smokeTest.TestZRC20Swap()
smokeTest.CheckZRC20ReserveAndSupply()

smokeTest.TestBitcoinWithdraw()
smokeTest.CheckZRC20ReserveAndSupply()

smokeTest.TestCrosschainSwap()
smokeTest.CheckZRC20ReserveAndSupply()

smokeTest.TestMessagePassingRevertFail()
smokeTest.CheckZRC20ReserveAndSupply()

smokeTest.TestMessagePassingRevertSuccess()
smokeTest.CheckZRC20ReserveAndSupply()

// add your dev test here
smokeTest.TestMyTest()

smokeTest.wg.Wait()
//contextAppAddr, tx, _, err := contextapp.DeployContextApp(smokeTest.zevmAuth, smokeTest.zevmClient)
//if err != nil {
// panic(err)
//}
//receipt = MustWaitForTxReceipt(zevmClient, tx)
//if receipt.Status != 1 {
// panic("ContextApp deployment failed")
//}
//contextApp, err := contextapp.NewContextApp(contextAppAddr, zevmClient)
//if err != nil {
// panic(err)
//}
//fmt.Printf("ContextApp contract address: %s, tx hash: %s\n", contextAppAddr.Hex(), tx.Hash().Hex())
//smokeTest.ContextAppAddr = contextAppAddr
//smokeTest.ContextApp = contextApp
//
//fmt.Printf("## Essential tests takes %s\n", time.Since(startTime))
//fmt.Printf("## The DeployerAddress %s is funded on the following networks:\n", DeployerAddress.Hex())
//fmt.Printf("## Ether on Ethereum private net\n")
//fmt.Printf("## ZETA on ZetaChain EVM\n")
//fmt.Printf("## ETH ZRC20 on ZetaChain\n")
//// The following tests are optional tests; comment out the ones you don't want to run
//// temporarily to reduce dev/test cycle turnaround time
//smokeTest.CheckZRC20ReserveAndSupply()
//
//smokeTest.TestContextUpgrade()
//
//smokeTest.TestDepositAndCallRefund()
//smokeTest.CheckZRC20ReserveAndSupply()
//
//smokeTest.TestERC20Deposit()
//smokeTest.CheckZRC20ReserveAndSupply()
//
//smokeTest.TestERC20Withdraw()
////smokeTest.WithdrawBitcoinMultipleTimes(5)
//smokeTest.CheckZRC20ReserveAndSupply()
//
//smokeTest.TestSendZetaOut()
//smokeTest.CheckZRC20ReserveAndSupply()
//
//smokeTest.TestSendZetaOutBTCRevert()
//smokeTest.CheckZRC20ReserveAndSupply()
//
//smokeTest.TestMessagePassing()
//smokeTest.CheckZRC20ReserveAndSupply()
//
//smokeTest.TestZRC20Swap()
//smokeTest.CheckZRC20ReserveAndSupply()
//
//smokeTest.TestBitcoinWithdraw()
//smokeTest.CheckZRC20ReserveAndSupply()
//
//smokeTest.TestCrosschainSwap()
//smokeTest.CheckZRC20ReserveAndSupply()
//
//smokeTest.TestMessagePassingRevertFail()
//smokeTest.CheckZRC20ReserveAndSupply()
//
//smokeTest.TestMessagePassingRevertSuccess()
//smokeTest.CheckZRC20ReserveAndSupply()
//
//// add your dev test here
//smokeTest.TestMyTest()
//
//smokeTest.wg.Wait()
}

func main() {
Expand Down
7 changes: 6 additions & 1 deletion contrib/localnet/orchestrator/smoketest/test_bitcoin.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"encoding/hex"
"fmt"
"math/big"
"strings"
"time"

"github.com/btcsuite/btcd/btcec"
Expand Down Expand Up @@ -39,8 +40,11 @@ func (sm *SmokeTest) TestBitcoinSetup() {
btc := sm.btcRPCClient
_, err := btc.CreateWallet("smoketest", rpcclient.WithCreateWalletBlank())
if err != nil {
panic(err)
if !strings.Contains(err.Error(), "Database already exists") {
panic(err)
}
}

skBytes, err := hex.DecodeString(DeployerPrivateKey)
if err != nil {
panic(err)
Expand Down Expand Up @@ -153,6 +157,7 @@ func (sm *SmokeTest) DepositBTC() {
}
diff := big.NewInt(0)
diff.Sub(balance, initialBalance)
fmt.Printf("BTC Difference in balance: %d", diff.Uint64())
if diff.Cmp(big.NewInt(1.15*btcutil.SatoshiPerBitcoin)) != 0 {
fmt.Printf("waiting for BTC balance to show up in ZRC contract... current bal %d\n", balance)
} else {
Expand Down
6 changes: 5 additions & 1 deletion contrib/localnet/orchestrator/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ curl -sS http://eth:8545 \
echo "running smoketest..."
smoketest "$SMOKETEST_CMD"
SMOKETEST_EXIT_CODE=$?

if [ $SMOKETEST_EXIT_CODE -ne 0 ]; then
echo "smoketest failed"
exit 1
fi
smoketest "$SMOKETEST_CMD"
if [ $SMOKETEST_EXIT_CODE -eq 0 ]; then
echo "smoketest passed"
exit 0
Expand Down