diff --git a/changelog.md b/changelog.md index cf21cc81ba..b0f89948f6 100644 --- a/changelog.md +++ b/changelog.md @@ -64,6 +64,9 @@ * [1667](https://github.com/zeta-chain/node/issues/1667) - estimate SegWit tx size in uinit of vByte * [1675](https://github.com/zeta-chain/node/issues/1675) - use chain param ConfirmationCount for bitcoin confirmation +## Chores +* [1694](https://github.com/zeta-chain/node/pull/1694) - remove standalone network, use require testing package for the entire node folder + ## Version: v12.1.0 ### Tests @@ -90,6 +93,7 @@ * [1585](https://github.com/zeta-chain/node/pull/1585) - Updated release instructions * [1615](https://github.com/zeta-chain/node/pull/1615) - Add upgrade handler for version v12.1.0 + ### Features * [1591](https://github.com/zeta-chain/node/pull/1591) - support lower gas limit for voting on inbound and outbound transactions diff --git a/cmd/zetacored/parsers_test.go b/cmd/zetacored/parsers_test.go index f3310717ef..06f0346903 100644 --- a/cmd/zetacored/parsers_test.go +++ b/cmd/zetacored/parsers_test.go @@ -6,7 +6,7 @@ import ( "os" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/tendermint/tendermint/crypto" "github.com/zeta-chain/zetacore/app" @@ -18,14 +18,14 @@ func TestParsefileToObserverMapper(t *testing.T) { file := "tmp.json" defer func(t *testing.T, fp string) { err := os.RemoveAll(fp) - assert.NoError(t, err) + require.NoError(t, err) }(t, file) app.SetConfig() createObserverList(file) obsListReadFromFile, err := ParsefileToObserverDetails(file) - assert.NoError(t, err) + require.NoError(t, err) for _, obs := range obsListReadFromFile { - assert.Equal(t, obs.ZetaClientGranteeAddress, sdk.AccAddress(crypto.AddressHash([]byte("ObserverGranteeAddress"))).String()) + require.Equal(t, obs.ZetaClientGranteeAddress, sdk.AccAddress(crypto.AddressHash([]byte("ObserverGranteeAddress"))).String()) } } diff --git a/common/coin_test.go b/common/coin_test.go index 4dd03fa2db..4adfbc2d8d 100644 --- a/common/coin_test.go +++ b/common/coin_test.go @@ -4,7 +4,7 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/common" ) @@ -12,43 +12,43 @@ func Test_GetAzetaDecFromAmountInZeta(t *testing.T) { tt := []struct { name string zetaAmount string - err assert.ErrorAssertionFunc + err require.ErrorAssertionFunc azetaAmount sdk.Dec }{ { name: "valid zeta amount", zetaAmount: "210000000", - err: assert.NoError, + err: require.NoError, azetaAmount: sdk.MustNewDecFromStr("210000000000000000000000000"), }, { name: "very high zeta amount", zetaAmount: "21000000000000000000", - err: assert.NoError, + err: require.NoError, azetaAmount: sdk.MustNewDecFromStr("21000000000000000000000000000000000000"), }, { name: "very low zeta amount", zetaAmount: "1", - err: assert.NoError, + err: require.NoError, azetaAmount: sdk.MustNewDecFromStr("1000000000000000000"), }, { name: "zero zeta amount", zetaAmount: "0", - err: assert.NoError, + err: require.NoError, azetaAmount: sdk.MustNewDecFromStr("0"), }, { name: "decimal zeta amount", zetaAmount: "0.1", - err: assert.NoError, + err: require.NoError, azetaAmount: sdk.MustNewDecFromStr("100000000000000000"), }, { name: "invalid zeta amount", zetaAmount: "%%%%%$#", - err: assert.Error, + err: require.Error, azetaAmount: sdk.MustNewDecFromStr("0"), }, } @@ -57,7 +57,7 @@ func Test_GetAzetaDecFromAmountInZeta(t *testing.T) { azeta, err := common.GetAzetaDecFromAmountInZeta(tc.zetaAmount) tc.err(t, err) if err == nil { - assert.Equal(t, tc.azetaAmount, azeta) + require.Equal(t, tc.azetaAmount, azeta) } }) } diff --git a/standalone-network/add-emissions.sh b/standalone-network/add-emissions.sh deleted file mode 100644 index 610e10e257..0000000000 --- a/standalone-network/add-emissions.sh +++ /dev/null @@ -1,23 +0,0 @@ -zetacored tx bank send zeta1syavy2npfyt9tcncdtsdzf7kny9lh777heefxk zeta1w43fn2ze2wyhu5hfmegr6vp52c3dgn0srdgymy 100000000000azeta --keyring-backend=test --chain-id=localnet_101-1 --fees=200000azeta --yes - -#total left in reserves -zetacored q bank balances zeta1w43fn2ze2wyhu5hfmegr6vp52c3dgn0srdgymy -#observer undistributed -zetacored q bank balances zeta1pyks89mqljlpgzenwa0g8zch0hptk6usd9vcuh -#tss undistributed -zetacored q bank balances zeta1v8v7zkyt7j3dc526k4alsu8vspvqqg342t27vu - - -#Zeta rewards self Delegation -zetacored q distribution rewards zeta1syavy2npfyt9tcncdtsdzf7kny9lh777heefxk zetavaloper1syavy2npfyt9tcncdtsdzf7kny9lh777nep4tq - - -#Mario delegate -zetacored tx staking delegate zetavaloper1syavy2npfyt9tcncdtsdzf7kny9lh777nep4tq 1000000000000000000000000azeta --from=mario --keyring-backend=test --chain-id=localnet_101-1 --fees=200000azeta -zetacored q distribution rewards zeta1l7hypmqk2yc334vc6vmdwzp5sdefygj2w5yj50 zetavaloper1syavy2npfyt9tcncdtsdzf7kny9lh777nep4tq - -#Zeta outstanding rewards (Total) -zetacored q distribution validator-outstanding-rewards zetavaloper1syavy2npfyt9tcncdtsdzf7kny9lh777nep4tq - -#Zeta commission rewards -zetacored q distribution commission zetavaloper1syavy2npfyt9tcncdtsdzf7kny9lh777nep4tq diff --git a/standalone-network/add-observer.sh b/standalone-network/add-observer.sh deleted file mode 100644 index 38d4953435..0000000000 --- a/standalone-network/add-observer.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash -zetacored tx observer add-observer 5 InBoundTx --from zeta --fees=40azeta --chain-id=localnet_101-1 --keyring-backend=test -y --broadcast-mode=block -zetacored tx observer add-observer 5 OutBoundTx --from zeta --fees=40azeta --chain-id=localnet_101-1 --keyring-backend=test -y --broadcast-mode=block -zetacored q observer list-observer - -zetacored tx staking unbond zetavaloper1syavy2npfyt9tcncdtsdzf7kny9lh777nep4tq 99999900000000000000azeta --from zeta --gas=auto --gas-prices=0.0001azeta --gas-adjustment=1.5 --chain-id=localnet_101-1 --keyring-backend=test -y --broadcast-mode=block - - -#Add via genesis -#zetacored add-observer-list sample-observer-list.json -#zetacored add-observer Eth InBoundTx $(zetacored keys show zeta -a --keyring-backend=test) -#zetacored add-observer Eth OutBoundTx $(zetacored keys show zeta -a --keyring-backend=test) -#zetacored add-genesis-account $(zetacored keys show zetaeth -a --keyring-backend=test) 50000000000000000000000000000000azeta,500000000000000000000000000000000stake --keyring-backend=test - diff --git a/standalone-network/authz/commands.sh b/standalone-network/authz/commands.sh deleted file mode 100644 index f3083eb8e4..0000000000 --- a/standalone-network/authz/commands.sh +++ /dev/null @@ -1,10 +0,0 @@ -zetacored tx authz grant zeta1l7hypmqk2yc334vc6vmdwzp5sdefygj2w5yj50 delegate --allowed-validators zetavaloper1syavy2npfyt9tcncdtsdzf7kny9lh777nep4tq --from zeta --fees=40azeta --chain-id=localnet_101-1 --keyring-backend=test -y --broadcast-mode=block --spend-limit=100000000000azeta - -zetacored q authz grants zeta1syavy2npfyt9tcncdtsdzf7kny9lh777heefxk zeta1l7hypmqk2yc334vc6vmdwzp5sdefygj2w5yj50 -zetacored tx authz exec tx.json --from mario --gas=auto --gas-prices=0.1azeta --gas-adjustment=20 --chain-id=localnet_101-1 --keyring-backend=test -y --broadcast-mode=block -zetacored q staking delegations-to zetavaloper1syavy2npfyt9tcncdtsdzf7kny9lh777nep4tq - - - -zetacored tx authz grant zeta1l7hypmqk2yc334vc6vmdwzp5sdefygj2w5yj50 generic --from zeta --fees=40azeta --chain-id=localnet_101-1 --keyring-backend=test -y --broadcast-mode=block --msg-type=/zetachain.zetacore.crosschain.MsgGasPriceVoter - diff --git a/standalone-network/authz/tx.json b/standalone-network/authz/tx.json deleted file mode 100644 index 8e24e6c5bc..0000000000 --- a/standalone-network/authz/tx.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "body": { - "messages": [ - { - "@type": "/cosmos.staking.v1beta1.MsgDelegate", - "delegator_address": "zeta1syavy2npfyt9tcncdtsdzf7kny9lh777heefxk", - "validator_address": "zetavaloper1syavy2npfyt9tcncdtsdzf7kny9lh777nep4tq", - "amount": { - "denom": "azeta", - "amount": "100000000000" - } - } - ], - "memo": "", - "timeout_height": "0", - "extension_options": [], - "non_critical_extension_options": [] - }, - "auth_info": { - "signer_infos": [], - "fee": { - "amount": [ - { - "denom": "azeta", - "amount": "40" - } - ], - "gas_limit": "200000", - "payer": "", - "granter": "" - }, - "tip": null - }, - "signatures": [] -} diff --git a/standalone-network/cctx/cctx-creator-gas.sh b/standalone-network/cctx/cctx-creator-gas.sh deleted file mode 100755 index e17a327f7e..0000000000 --- a/standalone-network/cctx/cctx-creator-gas.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash -set -x - -zetacored tx observer add-observer 5 InBoundTx --from zeta --fees=40azeta --chain-id=localnet_101-1 --keyring-backend=test -y --broadcast-mode=block -#zetacored tx observer add-observer 5 OutBoundTx --from zeta --fees=40azeta --chain-id=localnet_101-1 --keyring-backend=test -y --broadcast-mode=block -zetacored tx observer add-observer 2374 InBoundTx --from zeta --fees=40azeta --chain-id=localnet_101-1 --keyring-backend=test -y --broadcast-mode=block -zetacored tx observer add-observer 2374 OutBoundTx --from zeta --fees=40azeta --chain-id=localnet_101-1 --keyring-backend=test -y --broadcast-mode=block -zetacored tx crosschain gas-price-voter 2374 10000000000 100 100 --from=zeta --keyring-backend=test --yes --chain-id=localnet_101-1 --broadcast-mode=block --gas=auto --gas-adjustment=2 --gas-prices=0.1azeta -zetacored tx crosschain nonce-voter Goerli 2374 --from=zeta --keyring-backend=test --yes --chain-id=localnet_101-1 --broadcast-mode=block --gas=auto --gas-adjustment=2 --gas-prices=0.1azeta --broadcast-mode=block - -zetacored tx crosschain inbound-voter 0x96B05C238b99768F349135de0653b687f9c13fEE 5 0x3b9Fe88DE29efD13240829A0c18E9EC7A44C3CA7 2374 10000000000000000000 0 "" "0x19398991572a825894b34b904ac1e3692720895351466b5c9e6bb7ae1e21d680" 100 Gas --from=zeta --keyring-backend=test --yes --chain-id=localnet_101-1 --broadcast-mode=block --gas=auto --gas-adjustment=2 --gas-prices=0.1azeta -zetacored q crosschain list-cctx -exit 0 -zetacored tx crosschain outbound-voter 0x752139735699b0ffa87571bf519867ab2aaf355733316842f9941e0efe5d05c9 hashout 1 7997428181981842964 0 2374 1 1 --from=zeta --keyring-backend=test --yes --chain-id=localnet_101-1 --broadcast-mode=block --gas=auto --gas-adjustment=2 --gas-prices=0.1azeta - -#zetacored tx crosschain zeta-conversion-rate-voter Goerli 1 1 --from=zeta --keyring-backend=test --yes --chain-id=localnet_101-1 --broadcast-mode=block --gas=auto --gas-adjustment=2 --gas-prices=0.1azeta diff --git a/standalone-network/cctx/cctx-creator-goerili.sh b/standalone-network/cctx/cctx-creator-goerili.sh deleted file mode 100755 index 71f0660d97..0000000000 --- a/standalone-network/cctx/cctx-creator-goerili.sh +++ /dev/null @@ -1,65 +0,0 @@ -set -x - - -zetacored tx crosschain gas-price-voter 1337 10000000000 100 100 --from=zeta --keyring-backend=test --yes --chain-id=localnet_101-1 --broadcast-mode=block --gas=auto --gas-adjustment=2 --gas-prices=0.1azeta -zetacored tx crosschain create-tss-voter tsspubkey 5 0 --from=zeta --keyring-backend=test --yes --chain-id=localnet_101-1 --broadcast-mode=block --gas=auto --gas-adjustment=2 --gas-prices=0.1azeta -zetacored tx crosschain gas-price-voter 1337 10000000000 100 100 --from=mario --keyring-backend=test --yes --chain-id=localnet_101-1 --broadcast-mode=block --gas=auto --gas-adjustment=2 --gas-prices=0.1azeta -zetacored tx crosschain create-tss-voter tsspubkey 5 0 --from=mario --keyring-backend=test --yes --chain-id=localnet_101-1 --broadcast-mode=block --gas=auto --gas-adjustment=2 --gas-prices=0.1azeta - -exit 0 -zetacored tx crosschain inbound-voter \ -0x96B05C238b99768F349135de0653b687f9c13fEE \ -1337 \ -0x3b9Fe88DE29efD13240829A0c18E9EC7A44C3CA7 \ -0x96B05C238b99768F349135de0653b687f9c13fEE \ -1337 \ -10000000000000000000 \ -"" \ -"0x19398991572a825894b34b904ac1e3692720895351466b5c9e6bb7ae1e21d680" \ -100 \ -Gas \ -"" \ ---from=zeta --keyring-backend=test --yes --chain-id=localnet_101-1 --broadcast-mode=block --gas=auto --gas-adjustment=2 --gas-prices=0.1azeta - - -zetacored tx crosschain inbound-voter \ -0x96B05C238b99768F349135de0653b687f9c13fEE \ -1337 \ -0x3b9Fe88DE29efD13240829A0c18E9EC7A44C3CA7 \ -0x96B05C238b99768F349135de0653b687f9c13fEE \ -1337 \ -10000000000000000000 \ -"" \ -"0x19398991572a825894b34b904ac1e3692720895351466b5c9e6bb7ae1e21d680" \ -100 \ -Gas \ -"" \ ---from=mario --keyring-backend=test --yes --chain-id=localnet_101-1 --broadcast-mode=block --gas=auto --gas-adjustment=2 --gas-prices=0.1azeta --output=json - -zetacored q crosschain list-cctx - -zetacored tx crosschain outbound-voter \ -0xead687de84b3969b4c18480f197d2812e0acb83f851acc2830f70e94c85cef55 \ -hashout \ -1 \ -7994721005120625032 \ -0 \ -1337 \ -1 \ -Gas \ ---from=zeta --keyring-backend=test --yes --chain-id=localnet_101-1 --broadcast-mode=block --gas=auto --gas-adjustment=2 --gas-prices=0.1azeta - -zetacored tx crosschain outbound-voter \ -0xead687de84b3969b4c18480f197d2812e0acb83f851acc2830f70e94c85cef55 \ -hashout \ -1 \ -7994721005120625032 \ -0 \ -1337 \ -1 \ -Gas \ ---from=mario --keyring-backend=test --yes --chain-id=localnet_101-1 --broadcast-mode=block --gas=auto --gas-adjustment=2 --gas-prices=0.1azeta - - - - diff --git a/standalone-network/cctx/cctx-creator-zeta.sh b/standalone-network/cctx/cctx-creator-zeta.sh deleted file mode 100755 index 1184991bea..0000000000 --- a/standalone-network/cctx/cctx-creator-zeta.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash -set -x - -#zetacored tx observer add-observer 5 InBoundTx --from zeta --fees=40azeta --chain-id=localnet_101-1 --keyring-backend=test -y --broadcast-mode=block -#zetacored tx observer add-observer 5 OutBoundTx --from zeta --fees=40azeta --chain-id=localnet_101-1 --keyring-backend=test -y --broadcast-mode=block -zetacored tx observer add-observer 2374 InBoundTx --from zeta --fees=40azeta --chain-id=localnet_101-1 --keyring-backend=test -y --broadcast-mode=block -zetacored tx observer add-observer 2374 OutBoundTx --from zeta --fees=40azeta --chain-id=localnet_101-1 --keyring-backend=test -y --broadcast-mode=block -zetacored tx crosschain gas-price-voter 1 10000000000 100 100 --from=zeta --keyring-backend=test --yes --chain-id=localnet_101-1 --broadcast-mode=block --gas=auto --gas-adjustment=2 --gas-prices=0.1azeta -zetacored tx crosschain nonce-voter Goerli 2374 --from=zeta --keyring-backend=test --yes --chain-id=localnet_101-1 --broadcast-mode=block --gas=auto --gas-adjustment=2 --gas-prices=0.1azeta --broadcast-mode=block - -zetacored tx crosschain inbound-voter 0x96B05C238b99768F349135de0653b687f9c13fEE 5 0x3b9Fe88DE29efD13240829A0c18E9EC7A44C3CA7 2374 10000000000000000000 0 "" "0x19398991572a825894b34b904ac1e3692720895351466b5c9e6bb7ae1e21d680" 100 Zeta --from=zeta --keyring-backend=test --yes --chain-id=localnet_101-1 --broadcast-mode=block --gas=auto --gas-adjustment=2 --gas-prices=0.1azeta -zetacored q crosschain list-cctx -exit 0 -zetacored tx crosschain outbound-voter 0x752139735699b0ffa87571bf519867ab2aaf355733316842f9941e0efe5d05c9 hashout 1 7997428181981842964 0 2374 1 1 --from=zeta --keyring-backend=test --yes --chain-id=localnet_101-1 --broadcast-mode=block --gas=auto --gas-adjustment=2 --gas-prices=0.1azeta - -#zetacored tx crosschain zeta-conversion-rate-voter Goerli 1 1 --from=zeta --keyring-backend=test --yes --chain-id=localnet_101-1 --broadcast-mode=block --gas=auto --gas-adjustment=2 --gas-prices=0.1azeta diff --git a/standalone-network/cctx_authz/commands.sh b/standalone-network/cctx_authz/commands.sh deleted file mode 100644 index c7d12d9753..0000000000 --- a/standalone-network/cctx_authz/commands.sh +++ /dev/null @@ -1,31 +0,0 @@ - -#Grant executer authorization to execute the GAS PRICE VOTER, NONCE VOTER for validator `zeta` -zetacored tx authz grant zeta19wzjdtah4kl2vh77jks68cyy5gpjyurqltys99 generic --from zeta --fees=40azeta --chain-id=localnet_101-1 --keyring-backend=test -y --broadcast-mode=block --msg-type=/zetachain.zetacore.crosschain.MsgGasPriceVoter -zetacored tx authz grant zeta19wzjdtah4kl2vh77jks68cyy5gpjyurqltys99 generic --from zeta --fees=40azeta --chain-id=localnet_101-1 --keyring-backend=test -y --broadcast-mode=block --msg-type=/zetachain.zetacore.crosschain.MsgNonceVoter - -#Grant executer authorization to execute the Inbound and Outbound VOTER for observers `zeta` and `mario` -#These are essentially the list of transactions that the zetaclient does to process a CCTX end to end -zetacored tx authz grant zeta19wzjdtah4kl2vh77jks68cyy5gpjyurqltys99 generic --from zeta --fees=40azeta --chain-id=localnet_101-1 --keyring-backend=test -y --broadcast-mode=block --msg-type=/zetachain.zetacore.crosschain.MsgVoteOnObservedInboundTx -zetacored tx authz grant zeta19wzjdtah4kl2vh77jks68cyy5gpjyurqltys99 generic --from mario --fees=40azeta --chain-id=localnet_101-1 --keyring-backend=test -y --broadcast-mode=block --msg-type=/zetachain.zetacore.crosschain.MsgVoteOnObservedInboundTx - -zetacored tx authz grant zeta19wzjdtah4kl2vh77jks68cyy5gpjyurqltys99 generic --from zeta --fees=40azeta --chain-id=localnet_101-1 --keyring-backend=test -y --broadcast-mode=block --msg-type=/zetachain.zetacore.crosschain.MsgVoteOnObservedOutboundTx -zetacored tx authz grant zeta19wzjdtah4kl2vh77jks68cyy5gpjyurqltys99 generic --from mario --fees=40azeta --chain-id=localnet_101-1 --keyring-backend=test -y --broadcast-mode=block --msg-type=/zetachain.zetacore.crosschain.MsgVoteOnObservedOutboundTx - - -# Check all the grants -zetacored q authz grants zeta1syavy2npfyt9tcncdtsdzf7kny9lh777heefxk zeta19wzjdtah4kl2vh77jks68cyy5gpjyurqltys99 -zetacored q authz grants zeta1l7hypmqk2yc334vc6vmdwzp5sdefygj2w5yj50 zeta19wzjdtah4kl2vh77jks68cyy5gpjyurqltys99 - - -# Execute all messages from executer . At this time zeta and mario keys can be offline -zetacored tx authz exec gas_price_voter_zeta.json --from executer --gas=auto --gas-prices=0.1azeta --gas-adjustment=10 --chain-id=localnet_101-1 --keyring-backend=test -y --broadcast-mode=block -zetacored tx authz exec nonce_voter_zeta.json --from executer --gas=auto --gas-prices=0.1azeta --gas-adjustment=10 --chain-id=localnet_101-1 --keyring-backend=test -y --broadcast-mode=block -zetacored tx authz exec mario_inbound_vote.json --from executer --gas=auto --gas-prices=0.1azeta --gas-adjustment=10 --chain-id=localnet_101-1 --keyring-backend=test -y --broadcast-mode=block -zetacored tx authz exec zeta_inbound_vote.json --from executer --gas=auto --gas-prices=0.1azeta --gas-adjustment=10 --chain-id=localnet_101-1 --keyring-backend=test -y --broadcast-mode=block -zetacored tx authz exec zeta_outbound_vote.json --from executer --gas=auto --gas-prices=0.1azeta --gas-adjustment=10 --chain-id=localnet_101-1 --keyring-backend=test -y --broadcast-mode=block -zetacored tx authz exec mario_outbound_vote.json --from executer --gas=auto --gas-prices=0.1azeta --gas-adjustment=10 --chain-id=localnet_101-1 --keyring-backend=test -y --broadcast-mode=block - - - - - diff --git a/standalone-network/cctx_authz/gas_price_voter_zeta.json b/standalone-network/cctx_authz/gas_price_voter_zeta.json deleted file mode 100644 index 6f92a9fb89..0000000000 --- a/standalone-network/cctx_authz/gas_price_voter_zeta.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "body": { - "messages": [ - { - "@type": "/zetachain.zetacore.crosschain.MsgGasPriceVoter", - "creator": "zeta1syavy2npfyt9tcncdtsdzf7kny9lh777heefxk", - "chain_id": "1337", - "price": "10000000000", - "block_number": "100", - "supply": "100" - } - ], - "memo": "", - "timeout_height": "0", - "extension_options": [], - "non_critical_extension_options": [] - }, - "auth_info": { - "signer_infos": [], - "fee": { - "amount": [ - { - "denom": "azeta", - "amount": "5183" - } - ], - "gas_limit": "51828", - "payer": "", - "granter": "" - }, - "tip": null - }, - "signatures": [] -} diff --git a/standalone-network/cctx_authz/mario_inbound_vote.json b/standalone-network/cctx_authz/mario_inbound_vote.json deleted file mode 100644 index a54198cf19..0000000000 --- a/standalone-network/cctx_authz/mario_inbound_vote.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "body": { - "messages": [ - { - "@type": "/zetachain.zetacore.crosschain.MsgVoteOnObservedInboundTx", - "creator": "zeta1l7hypmqk2yc334vc6vmdwzp5sdefygj2w5yj50", - "sender": "0x96B05C238b99768F349135de0653b687f9c13fEE", - "sender_chain_id": "1337", - "receiver": "0x96B05C238b99768F349135de0653b687f9c13fEE", - "receiver_chain": "1337", - "amount": "10000000000000000000", - "message": "", - "in_tx_hash": "0x19398991572a825894b34b904ac1e3692720895351466b5c9e6bb7ae1e21d680", - "in_block_height": "100", - "gas_limit": "250000", - "coin_type": "Gas", - "tx_origin": "0x3b9Fe88DE29efD13240829A0c18E9EC7A44C3CA7", - "asset": "" - } - ], - "memo": "", - "timeout_height": "0", - "extension_options": [], - "non_critical_extension_options": [] - }, - "auth_info": { - "signer_infos": [], - "fee": { - "amount": [ - { - "denom": "azeta", - "amount": "16968" - } - ], - "gas_limit": "169672", - "payer": "", - "granter": "" - }, - "tip": null - }, - "signatures": [] -} diff --git a/standalone-network/cctx_authz/mario_outbound_vote.json b/standalone-network/cctx_authz/mario_outbound_vote.json deleted file mode 100644 index d2ff9a6696..0000000000 --- a/standalone-network/cctx_authz/mario_outbound_vote.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "body": { - "messages": [ - { - "@type": "/zetachain.zetacore.crosschain.MsgVoteOnObservedOutboundTx", - "creator": "zeta1l7hypmqk2yc334vc6vmdwzp5sdefygj2w5yj50", - "cctx_hash": "0xead687de84b3969b4c18480f197d2812e0acb83f851acc2830f70e94c85cef55", - "observed_outTx_hash": "hashout", - "observed_outTx_blockHeight": "1", - "zeta_minted": "7997428181981842964", - "status": "Success", - "outTx_chain": "1337", - "outTx_tss_nonce": "1", - "coin_type": "Gas" - } - ], - "memo": "", - "timeout_height": "0", - "extension_options": [], - "non_critical_extension_options": [] - }, - "auth_info": { - "signer_infos": [], - "fee": { - "amount": [ - { - "denom": "azeta", - "amount": "22450" - } - ], - "gas_limit": "224498", - "payer": "", - "granter": "" - }, - "tip": null - }, - "signatures": [] -} diff --git a/standalone-network/cctx_authz/nonce_voter_zeta.json b/standalone-network/cctx_authz/nonce_voter_zeta.json deleted file mode 100644 index ebf7884740..0000000000 --- a/standalone-network/cctx_authz/nonce_voter_zeta.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "body": { - "messages": [ - { - "@type": "/zetachain.zetacore.crosschain.MsgNonceVoter", - "creator": "zeta1syavy2npfyt9tcncdtsdzf7kny9lh777heefxk", - "chain_id": "1337", - "nonce": "1" - } - ], - "memo": "", - "timeout_height": "0", - "extension_options": [], - "non_critical_extension_options": [] - }, - "auth_info": { - "signer_infos": [], - "fee": { - "amount": [ - { - "denom": "azeta", - "amount": "13236" - } - ], - "gas_limit": "132360", - "payer": "", - "granter": "" - }, - "tip": null - }, - "signatures": [] -} diff --git a/standalone-network/cctx_authz/zeta_inbound_vote.json b/standalone-network/cctx_authz/zeta_inbound_vote.json deleted file mode 100644 index 69fb355b28..0000000000 --- a/standalone-network/cctx_authz/zeta_inbound_vote.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "body": { - "messages": [ - { - "@type": "/zetachain.zetacore.crosschain.MsgVoteOnObservedInboundTx", - "creator": "zeta1syavy2npfyt9tcncdtsdzf7kny9lh777heefxk", - "sender": "0x96B05C238b99768F349135de0653b687f9c13fEE", - "sender_chain_id": "1337", - "receiver": "0x96B05C238b99768F349135de0653b687f9c13fEE", - "receiver_chain": "1337", - "amount": "10000000000000000000", - "message": "", - "in_tx_hash": "0x19398991572a825894b34b904ac1e3692720895351466b5c9e6bb7ae1e21d680", - "in_block_height": "100", - "gas_limit": "250000", - "coin_type": "Gas", - "tx_origin": "0x3b9Fe88DE29efD13240829A0c18E9EC7A44C3CA7", - "asset": "" - } - ], - "memo": "", - "timeout_height": "0", - "extension_options": [], - "non_critical_extension_options": [] - }, - "auth_info": { - "signer_infos": [], - "fee": { - "amount": [ - { - "denom": "azeta", - "amount": "16948" - } - ], - "gas_limit": "169480", - "payer": "", - "granter": "" - }, - "tip": null - }, - "signatures": [] -} diff --git a/standalone-network/cctx_authz/zeta_outbound_vote.json b/standalone-network/cctx_authz/zeta_outbound_vote.json deleted file mode 100644 index d595d7506f..0000000000 --- a/standalone-network/cctx_authz/zeta_outbound_vote.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "body": { - "messages": [ - { - "@type": "/zetachain.zetacore.crosschain.MsgVoteOnObservedOutboundTx", - "creator": "zeta1syavy2npfyt9tcncdtsdzf7kny9lh777heefxk", - "cctx_hash": "0xead687de84b3969b4c18480f197d2812e0acb83f851acc2830f70e94c85cef55", - "observed_outTx_hash": "hashout", - "observed_outTx_blockHeight": "1", - "zeta_minted": "7997428181981842964", - "status": "Success", - "outTx_chain": "1337", - "outTx_tss_nonce": "1", - "coin_type": "Gas" - } - ], - "memo": "", - "timeout_height": "0", - "extension_options": [], - "non_critical_extension_options": [] - }, - "auth_info": { - "signer_infos": [], - "fee": { - "amount": [ - { - "denom": "azeta", - "amount": "22431" - } - ], - "gas_limit": "224306", - "payer": "", - "granter": "" - }, - "tip": null - }, - "signatures": [] -} diff --git a/standalone-network/change-observer-params.sh b/standalone-network/change-observer-params.sh deleted file mode 100644 index 4df238642f..0000000000 --- a/standalone-network/change-observer-params.sh +++ /dev/null @@ -1,2 +0,0 @@ -zetacored tx gov submit-proposal proposal_feemarket.json --from zeta --keyring-backend=test -b block --chain-id=localnet_101-1 --gas=auto --gas-prices=0.1azeta --gas-adjustment=1.5 --yes -zetacored tx gov vote 1 yes --from zeta --keyring-backend test --chain-id localnet_101-1 --yes --gas=auto --gas-prices=0.1azeta --gas-adjustment=1.5 \ No newline at end of file diff --git a/standalone-network/evm-init b/standalone-network/evm-init deleted file mode 100644 index 69980fbc09..0000000000 --- a/standalone-network/evm-init +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/bash - -set -x - -KEY1="alice" -KEY2="bob" -CHAINID="athens_8888-2" -MONIKER="localtestnet" -KEYRING="test" -KEYALGO="eth_secp256k1" -LOGLEVEL="info" -# to trace evm -TRACE="--trace" -#TRACE="" - -# validate dependencies are installed -command -v jq > /dev/null 2>&1 || { echo >&2 "jq not installed. More info: https://stedolan.github.io/jq/download/"; exit 1; } - -# remove existing daemon and client -rm -rf ~/.zetacored* - -make install - -zetacored config keyring-backend $KEYRING --home ~/.zetacored -zetacored config chain-id $CHAINID --home ~/.zetacored - -# if $KEY exists it should be deleted -#zetacored keys add $KEY1 --keyring-backend $KEYRING --algo $KEYALGO -echo "Generating deterministic account - alice" -echo "race draft rival universe maid cheese steel logic crowd fork comic easy truth drift tomorrow eye buddy head time cash swing swift midnight borrow" | zetacored keys add alice --recover --keyring-backend $KEYRING --algo=secp256k1 --home ~/.zetacored - -echo "Generating deterministic account - bob" -echo "hand inmate canvas head lunar naive increase recycle dog ecology inhale december wide bubble hockey dice worth gravity ketchup feed balance parent secret orchard" | zetacored keys add bob --recover --keyring-backend $KEYRING --home ~/.zetacored - - -# Set moniker and chain-id for Ethermint (Moniker can be anything, chain-id must be an integer) -zetacored init $MONIKER --chain-id $CHAINID --home ~/.zetacored - -# Change parameter token denominations to aphoton -cat $HOME/.zetacored/config/genesis.json | jq '.app_state["staking"]["params"]["bond_denom"]="azeta"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json -cat $HOME/.zetacored/config/genesis.json | jq '.app_state["crisis"]["constant_fee"]["denom"]="azeta"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json -cat $HOME/.zetacored/config/genesis.json | jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="azeta"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json -cat $HOME/.zetacored/config/genesis.json | jq '.app_state["mint"]["params"]["mint_denom"]="azeta"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json -cat $HOME/.zetacored/config/genesis.json | jq '.app_state["evm"]["params"]["evm_denom"]="azeta"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json - - -# Set gas limit in genesis -cat $HOME/.zetacored/config/genesis.json | jq '.consensus_params["block"]["max_gas"]="100000000"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json - -# disable produce empty block -if [[ "$OSTYPE" == "darwin"* ]]; then - sed -i '' 's/create_empty_blocks = true/create_empty_blocks = false/g' $HOME/.zetacored/config/config.toml - else - sed -i 's/create_empty_blocks = true/create_empty_blocks = false/g' $HOME/.zetacored/config/config.toml -fi - -if [[ $1 == "pending" ]]; then - if [[ "$OSTYPE" == "darwin"* ]]; then - sed -i '' 's/create_empty_blocks_interval = "0s"/create_empty_blocks_interval = "30s"/g' $HOME/.zetacored/config/config.toml - sed -i '' 's/timeout_propose = "3s"/timeout_propose = "30s"/g' $HOME/.zetacored/config/config.toml - sed -i '' 's/timeout_propose_delta = "500ms"/timeout_propose_delta = "5s"/g' $HOME/.zetacored/config/config.toml - sed -i '' 's/timeout_prevote = "1s"/timeout_prevote = "10s"/g' $HOME/.zetacored/config/config.toml - sed -i '' 's/timeout_prevote_delta = "500ms"/timeout_prevote_delta = "5s"/g' $HOME/.zetacored/config/config.toml - sed -i '' 's/timeout_precommit = "1s"/timeout_precommit = "10s"/g' $HOME/.zetacored/config/config.toml - sed -i '' 's/timeout_precommit_delta = "500ms"/timeout_precommit_delta = "5s"/g' $HOME/.zetacored/config/config.toml - sed -i '' 's/timeout_commit = "5s"/timeout_commit = "150s"/g' $HOME/.zetacored/config/config.toml - sed -i '' 's/timeout_broadcast_tx_commit = "10s"/timeout_broadcast_tx_commit = "150s"/g' $HOME/.zetacored/config/config.toml - sed -i '/\[api\]/,+3 s/enable = false/enable = true/' ~/.zetacored/config/app.toml - - else - sed -i 's/create_empty_blocks_interval = "0s"/create_empty_blocks_interval = "30s"/g' $HOME/.zetacored/config/config.toml - sed -i 's/timeout_propose = "3s"/timeout_propose = "30s"/g' $HOME/.zetacored/config/config.toml - sed -i 's/timeout_propose_delta = "500ms"/timeout_propose_delta = "5s"/g' $HOME/.zetacored/config/config.toml - sed -i 's/timeout_prevote = "1s"/timeout_prevote = "10s"/g' $HOME/.zetacored/config/config.toml - sed -i 's/timeout_prevote_delta = "500ms"/timeout_prevote_delta = "5s"/g' $HOME/.zetacored/config/config.toml - sed -i 's/timeout_precommit = "1s"/timeout_precommit = "10s"/g' $HOME/.zetacored/config/config.toml - sed -i 's/timeout_precommit_delta = "500ms"/timeout_precommit_delta = "5s"/g' $HOME/.zetacored/config/config.toml - sed -i 's/timeout_commit = "5s"/timeout_commit = "150s"/g' $HOME/.zetacored/config/config.toml - sed -i 's/timeout_broadcast_tx_commit = "10s"/timeout_broadcast_tx_commit = "150s"/g' $HOME/.zetacored/config/config.toml - sed -i '/\[api\]/,+3 s/enable = false/enable = true/' ~/.zetacored/config/app.toml - - fi -fi - -# Allocate genesis accounts (cosmos formatted addresses) -zetacored add-genesis-account $KEY1 100000000000000000000000000azeta --keyring-backend $KEYRING --home ~/.zetacored -zetacored add-genesis-account $KEY2 1000000000000000000000azeta --keyring-backend $KEYRING --home ~/.zetacored - - -# Sign genesis transaction -zetacored gentx $KEY1 1000000000000000000000azeta --keyring-backend $KEYRING --chain-id $CHAINID --home ~/.zetacored - -# Collect genesis tx -zetacored collect-gentxs --home ~/.zetacored - -# Run this to ensure everything worked and that the genesis file is setup correctly -zetacored validate-genesis --home ~/.zetacored - -if [[ $1 == "pending" ]]; then - echo "pending mode is on, please wait for the first block committed." -fi - -# Start the node (remove the --pruning=nothing flag if historical queries are not needed) -zetacored start --pruning=nothing $TRACE --log_level $LOGLEVEL --minimum-gas-prices=0.0001azeta --json-rpc.api eth,txpool,personal,net,debug,web3,miner --api.enable --home ~/.zetacored diff --git a/standalone-network/gov/gov.sh b/standalone-network/gov/gov.sh deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/standalone-network/gov/gov_observer_params_supported_chains.json b/standalone-network/gov/gov_observer_params_supported_chains.json deleted file mode 100644 index 6fc8ca324b..0000000000 --- a/standalone-network/gov/gov_observer_params_supported_chains.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "title": "Observer Param Change", - "description": "Update observer params", - "changes": [ - { - "subspace": "observer", - "key": "ObserverParams", - "value": [ - { - "chain": { - "chain_name": 6, - "chain_id": 5 - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": "true" - }, - { - "chain": { - "chain_name": 11, - "chain_id": 7001 - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": "true" - }, - { - "chain": { - "chain_name": 10, - "chain_id": 97 - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": "true" - }, - { - "chain": { - "chain_name": 12, - "chain_id": 18332 - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": "true" - }, - { - "chain": { - "chain_name": 7, - "chain_id": 80001 - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": "true" - } - ] - } - ], - "deposit": "10000000azeta" -} \ No newline at end of file diff --git a/standalone-network/group/add-observer.json b/standalone-network/group/add-observer.json deleted file mode 100644 index d3a0988d0c..0000000000 --- a/standalone-network/group/add-observer.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "body": { - "messages": [ - { - "@type": "/zetachain.zetacore.observer.MsgAddObserver", - "creator": "zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax", - "observer_address": "zeta1cv5nqpay7p5r2y9apkl97zute45d5je3f06e4j", - "zetaclient_grantee_pubkey": "zetapub1addwnpepq0ss57s6hdheyfgyymyvllcd6rfyqn6jayyvkuff8mrlvrluuktrwvcjfve", - "add_node_account_only": true - } - ], - "memo": "", - "timeout_height": "0", - "extension_options": [], - "non_critical_extension_options": [] - }, - "auth_info": { - "signer_infos": [], - "fee": { - "amount": [], - "gas_limit": "200000", - "payer": "", - "granter": "" - }, - "tip": null - }, - "signatures": [] -} diff --git a/standalone-network/group/group.sh b/standalone-network/group/group.sh deleted file mode 100644 index 1e678f167e..0000000000 --- a/standalone-network/group/group.sh +++ /dev/null @@ -1,11 +0,0 @@ -zetacored tx group create-group-with-policy zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax group-metadata group-policy-metadata members.json policy.json --from zeta --fees=40azeta --chain-id=localnet_101-1 --keyring-backend=test -y --broadcast-mode=block -zetacored tx group submit-proposal proposal_keygen.json --from zeta --fees=40azeta --chain-id=localnet_101-1 --keyring-backend=test -y --broadcast-mode=block --exec=1 -zetacored tx group vote 2 zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax VOTE_OPTION_YES metadata --from zeta --fees=40azeta --chain-id=localnet_101-1 --keyring-backend=test -y --broadcast-mode=block -zetacored tx group vote 2 zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2 VOTE_OPTION_YES metadata --from mario --fees=40azeta --chain-id=localnet_101-1 --keyring-backend=test -y --broadcast-mode=block -zetacored q group proposal 2 -zetacored tx group exec 2 --from zeta --fees=40azeta --chain-id=localnet_101-1 --keyring-backend=test -y --broadcast-mode=block -zetacored q group group-policies-by-admin zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax - - -#zetacored q group group-policy-info zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73 -#zetacored q group group-policies-by-group 1 \ No newline at end of file diff --git a/standalone-network/group/members-updated.json b/standalone-network/group/members-updated.json deleted file mode 100644 index 93473242f1..0000000000 --- a/standalone-network/group/members-updated.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "members": [ - { - "address": "zeta1syavy2npfyt9tcncdtsdzf7kny9lh777heefxk", - "weight": "1", - "metadata": "zetadmin" - }, - { - "address": "zeta1l7hypmqk2yc334vc6vmdwzp5sdefygj2w5yj50", - "weight": "0", - "metadata": "marioadmin" - } - ] -} diff --git a/standalone-network/group/members.json b/standalone-network/group/members.json deleted file mode 100644 index f536aaa959..0000000000 --- a/standalone-network/group/members.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "members": [ - { - "address": "zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax", - "weight": "1", - "metadata": "zetadmin" - }, - { - "address": "zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2", - "weight": "1", - "metadata": "marioadmin" - } - ] -} diff --git a/standalone-network/group/msg.json b/standalone-network/group/msg.json deleted file mode 100644 index 1e1856a1c7..0000000000 --- a/standalone-network/group/msg.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "body": { - "messages": [ - { - "@type": "/zetachain.zetacore.crosschain.MsgUpdatePermissionFlags", - "creator": "zeta1syavy2npfyt9tcncdtsdzf7kny9lh777heefxk", - "isInboundEnabled": false - }, - ], - "memo": "", - "timeout_height": "0", - "extension_options": [], - "non_critical_extension_options": [] - }, - "auth_info": { - "signer_infos": [], - "fee": { - "amount": [ - { - "denom": "azeta", - "amount": "40" - } - ], - "gas_limit": "200000", - "payer": "", - "granter": "" - }, - "tip": null - }, - "signatures": [] -} diff --git a/standalone-network/group/msg_fungible.json b/standalone-network/group/msg_fungible.json deleted file mode 100644 index 43b84eec2c..0000000000 --- a/standalone-network/group/msg_fungible.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "body": { - "messages": [ - { - "@type": "/zetachain.zetacore.fungible.MsgDeployFungibleCoinZRC20", - "creator": "zeta1syavy2npfyt9tcncdtsdzf7kny9lh777heefxk", - "ERC20": "test", - "foreignChain": "test", - "decimals": 2, - "name": "test", - "symbol": "test", - "coinType": "Gas", - "gasLimit": "0" - } - ], - "memo": "", - "timeout_height": "0", - "extension_options": [], - "non_critical_extension_options": [] - }, - "auth_info": { - "signer_infos": [], - "fee": { - "amount": [ - { - "denom": "azeta", - "amount": "40" - } - ], - "gas_limit": "200000", - "payer": "", - "granter": "" - }, - "tip": null - }, - "signatures": [] -} diff --git a/standalone-network/group/policy.json b/standalone-network/group/policy.json deleted file mode 100644 index 7f21a03e09..0000000000 --- a/standalone-network/group/policy.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "@type": "/cosmos.group.v1.ThresholdDecisionPolicy", - "threshold": "1", - "windows": { - "voting_period": "20000s", - "min_execution_period": "0s" - } -} diff --git a/standalone-network/group/proposal.json b/standalone-network/group/proposal.json deleted file mode 100644 index e9b66b624e..0000000000 --- a/standalone-network/group/proposal.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "title": "Observer Param Change", - "description": "Change observer params", - "changes": [ - { - "subspace": "observer", - "key": "ObserverParams", - "value": [ - { - "chain": { - "chain_name": 12, - "chain_id": "18332" - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": true - }, - { - "chain": { - "chain_name": 3, - "chain_id": "8332" - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": true - }, - { - "chain": { - "chain_name": 4, - "chain_id": "137" - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": true - }, - { - "chain": { - "chain_name": 7, - "chain_id": "80001" - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": true - }, - { - "chain": { - "chain_name": 9, - "chain_id": "1001" - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": true - }, - { - "chain": { - "chain_name": 10, - "chain_id": "97" - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": true - }, - { - "chain": { - "chain_name": 5, - "chain_id": "56" - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": true - }, - { - "chain": { - "chain_name": 1, - "chain_id": "1" - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": true - }, - { - "chain": { - "chain_name": 6, - "chain_id": "5" - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": true - }, - { - "chain": { - "chain_name": 14, - "chain_id": "1337" - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": false - }, - { - "chain": { - "chain_name": 2, - "chain_id": "101" - }, - "ballot_threshold": "0.660000000000000000", - "min_observer_delegation": "10000000000.000000000000000000", - "is_supported": false - } - ] - } - ], - "deposit": "10000zeta" -} \ No newline at end of file diff --git a/standalone-network/group/proposal_add-observer.json b/standalone-network/group/proposal_add-observer.json deleted file mode 100644 index 996e168c2f..0000000000 --- a/standalone-network/group/proposal_add-observer.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "group_policy_address": "zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73", - "messages": [ - { - "@type": "/zetachain.zetacore.observer.MsgAddObserver", - "creator": "zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73", - "observer_address": "zeta1cv5nqpay7p5r2y9apkl97zute45d5je3f06e4j", - "zetaclient_grantee_pubkey": "zetapub1addwnpepq0ss57s6hdheyfgyymyvllcd6rfyqn6jayyvkuff8mrlvrluuktrwvcjfve", - "add_node_account_only": true - } - ], - "metadata": "", - "proposers": ["zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax"] -} diff --git a/standalone-network/group/proposal_group.json b/standalone-network/group/proposal_group.json deleted file mode 100644 index 495f15cf0a..0000000000 --- a/standalone-network/group/proposal_group.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "group_policy_address": "zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73", - "messages": [ - { - "@type": "/zetachain.zetacore.crosschain.MsgUpdateKeygen", - "creator": "zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73", - "block": 100 - } - ], - "metadata": "", - "proposers": ["zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax"] -} diff --git a/standalone-network/group/proposal_group_examples.json b/standalone-network/group/proposal_group_examples.json deleted file mode 100644 index a45bb3a9a2..0000000000 --- a/standalone-network/group/proposal_group_examples.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "group_policy_address": "zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73", - "messages": [ - { - "@type": "/zetachain.zetacore.crosschain.MsgUpdatePermissionFlags", - "creator": "zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73", - "isInboundEnabled": false - }, - { - "@type": "/zetachain.zetacore.fungible.MsgDeployFungibleCoinZRC20", - "creator": "zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73", - "ERC20": "test", - "foreignChain": "test", - "decimals": 2, - "name": "test", - "symbol": "test", - "coinType": "Gas", - "gasLimit": "0" - } - ], - "metadata": "", - "proposers": ["zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax"] -} diff --git a/standalone-network/group/proposal_keygen.json b/standalone-network/group/proposal_keygen.json deleted file mode 100644 index a155bec515..0000000000 --- a/standalone-network/group/proposal_keygen.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "group_policy_address": "zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73", - "messages": [ - { - "@type": "/zetachain.zetacore.observer.MsgUpdateKeygen", - "creator": "zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73", - "block": 400 - } - ], - "metadata": "", - "proposers": ["zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax"] -} diff --git a/standalone-network/init-multinode.sh b/standalone-network/init-multinode.sh deleted file mode 100755 index 0d66bc3dcf..0000000000 --- a/standalone-network/init-multinode.sh +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/env bash - -### chain init script for development purposes only ### -rm -rf ~/.zetacored -kill -9 $(lsof -ti:26657) - -NODES="node0 node1 node2 node3" - -genesis_addresses=() -for NODE in $NODES; do - mkdir -p $HOME/.zetacored/$NODE - zetacored init test --chain-id=localnet_101-1 -o --home=$HOME/.zetacored/$NODE - zetacored keys add zeta --algo secp256k1 --keyring-backend=test --home=$HOME/.zetacored/$NODE - zetacored keys add mario --algo secp256k1 --keyring-backend=test --home=$HOME/.zetacored/$NODE - genesis_addresses+=$(zetacored keys show zeta -a --keyring-backend=test --home=$HOME/.zetacored/$NODE) - genesis_addresses+=" " - genesis_addresses+=$(zetacored keys show mario -a --keyring-backend=test --home=$HOME/.zetacored/$NODE) - genesis_addresses+=" " -done - -for address in $genesis_addresses; do - zetacored add-genesis-account $address 500000000000000000000000000000000azeta --keyring-backend=test --home=$HOME/.zetacored/node0 -done - -zetacored gentx zeta 10000000000000000azeta --chain-id=localnet_101-1 --keyring-backend=test --home=$HOME/.zetacored/node0 -for NODE in $NODES; do - if [ $NODE != "node0" ] - then - rm -rf $HOME/.zetacored/$NODE/config/genesis.json - cp $HOME/.zetacored/node0/config/genesis.json $HOME/.zetacored/$NODE/config/ - zetacored gentx zeta 10000000000000000azeta --chain-id=localnet_101-1 --keyring-backend=test --home=$HOME/.zetacored/$NODE - cp $HOME/.zetacored/$NODE/config/gentx/*.json $HOME/.zetacored/node0/config/gentx/ - fi -done - - -cat $HOME/.zetacored/node0/config/genesis.json | jq '.app_state["staking"]["params"]["bond_denom"]="azeta"' > $HOME/.zetacored/node0/config/tmp_genesis.json && mv $HOME/.zetacored/node0/config/tmp_genesis.json $HOME/.zetacored/node0/config/genesis.json -cat $HOME/.zetacored/node0/config/genesis.json | jq '.app_state["crisis"]["constant_fee"]["denom"]="azeta"' > $HOME/.zetacored/node0/config/tmp_genesis.json && mv $HOME/.zetacored/node0/config/tmp_genesis.json $HOME/.zetacored/node0/config/genesis.json -cat $HOME/.zetacored/node0/config/genesis.json | jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="azeta"' > $HOME/.zetacored/node0/config/tmp_genesis.json && mv $HOME/.zetacored/node0/config/tmp_genesis.json $HOME/.zetacored/node0/config/genesis.json -cat $HOME/.zetacored/node0/config/genesis.json | jq '.app_state["mint"]["params"]["mint_denom"]="azeta"' > $HOME/.zetacored/node0/config/tmp_genesis.json && mv $HOME/.zetacored/node0/config/tmp_genesis.json $HOME/.zetacored/node0/config/genesis.json -cat $HOME/.zetacored/node0/config/genesis.json | jq '.app_state["evm"]["params"]["evm_denom"]="azeta"' > $HOME/.zetacored/node0/config/tmp_genesis.json && mv $HOME/.zetacored/node0/config/tmp_genesis.json $HOME/.zetacored/node0/config/genesis.json -cat $HOME/.zetacored/node0/config/genesis.json | jq '.consensus_params["block"]["max_gas"]="10000000"' > $HOME/.zetacored/node0/config/tmp_genesis.json && mv $HOME/.zetacored/node0/config/tmp_genesis.json $HOME/.zetacored/node0/config/genesis.json - -zetacored collect-gentxs --home=$HOME/.zetacored/node0 -zetacored validate-genesis --home=$HOME/.zetacored/node0 -for NODE in $NODES; do - if [ $NODE != "node0" ] - then - rm -rf $HOME/.zetacored/$NODE/config/genesis.json - cp $HOME/.zetacored/node0/config/genesis.json $HOME/.zetacored/$NODE/config/ - fi -done - -killall zetacored - - -p2p=27655 -grpc=9085 -grpcweb=9093 -tcp=27659 -rpcladdr=2665 -jsonrpc=8545 -ws=9545 - -for NODE in $NODES; do - echo "Starting $NODE" - zetacored start \ - --minimum-gas-prices=0.0001azeta \ - --home $HOME/.zetacored/$NODE \ - --p2p.laddr 0.0.0.0:$p2p \ - --grpc.address 0.0.0.0:$grpc \ - --grpc-web.address 0.0.0.0:$grpcweb \ - --address tcp://0.0.0.0:$tcp \ - --json-rpc.address 0.0.0.0:$jsonrpc \ - --json-rpc.ws-address 0.0.0.0:$ws \ - --rpc.laddr tcp://127.0.0.1:$rpcladdr >> $HOME/.zetacored/$NODE/abci.log 2>&1 & - ((p2p=p2p+1)) - ((grpc=grpc+1)) - ((grpcweb=grpcweb+1)) - ((tcp=tcp+1)) - ((rpcladdr=rpcladdr+1)) - ((jsonrpc=jsonrpc+1)) - ((ws=ws+1)) -done - -# TODO ADD peers to config \ No newline at end of file diff --git a/standalone-network/init.sh b/standalone-network/init.sh deleted file mode 100755 index ca932c2a21..0000000000 --- a/standalone-network/init.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env bash - -CHAINID="localnet_101-1" -KEYRING="test" -export DAEMON_HOME=$HOME/.zetacored -export DAEMON_NAME=zetacored - -### chain init script for development purposes only ### -rm -rf ~/.zetacored -kill -9 $(lsof -ti:26657) -zetacored config keyring-backend $KEYRING --home ~/.zetacored -zetacored config chain-id $CHAINID --home ~/.zetacored -echo "race draft rival universe maid cheese steel logic crowd fork comic easy truth drift tomorrow eye buddy head time cash swing swift midnight borrow" | zetacored keys add zeta --algo=secp256k1 --recover --keyring-backend=$KEYRING -echo "hand inmate canvas head lunar naive increase recycle dog ecology inhale december wide bubble hockey dice worth gravity ketchup feed balance parent secret orchard" | zetacored keys add mario --algo secp256k1 --recover --keyring-backend=$KEYRING -echo "lounge supply patch festival retire duck foster decline theme horror decline poverty behind clever harsh layer primary syrup depart fantasy session fossil dismiss east" | zetacored keys add executer_zeta --recover --keyring-backend=$KEYRING --algo secp256k1 -echo "debris dumb among crew celery derive judge spoon road oyster dad panic adult song attack net pole merge mystery pig actual penalty neither peasant"| zetacored keys add executer_mario --algo=secp256k1 --recover --keyring-backend=$KEYRING - -zetacored init Zetanode-Localnet --chain-id=$CHAINID - -#Set config to use azeta -cat $HOME/.zetacored/config/genesis.json | jq '.app_state["staking"]["params"]["bond_denom"]="azeta"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json -cat $HOME/.zetacored/config/genesis.json | jq '.app_state["crisis"]["constant_fee"]["denom"]="azeta"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json -cat $HOME/.zetacored/config/genesis.json | jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="azeta"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json -cat $HOME/.zetacored/config/genesis.json | jq '.app_state["mint"]["params"]["mint_denom"]="azeta"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json -cat $HOME/.zetacored/config/genesis.json | jq '.app_state["evm"]["params"]["evm_denom"]="azeta"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json -cat $HOME/.zetacored/config/genesis.json | jq '.consensus_params["block"]["max_gas"]="10000000"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json -contents="$(jq '.app_state.gov.voting_params.voting_period = "10s"' $DAEMON_HOME/config/genesis.json)" && \ -echo "${contents}" > $DAEMON_HOME/config/genesis.json -sed -i '/\[api\]/,+3 s/enable = false/enable = true/' ~/.zetacored/config/app.toml - - -zetacored add-observer-list standalone-network/observers.json --keygen-block=5 -zetacored gentx zeta 1000000000000000000000azeta --chain-id=$CHAINID --keyring-backend=$KEYRING - - - -echo "Collecting genesis txs..." -zetacored collect-gentxs - -echo "Validating genesis file..." -zetacored validate-genesis - diff --git a/standalone-network/observers-complete.json b/standalone-network/observers-complete.json deleted file mode 100644 index b94d885193..0000000000 --- a/standalone-network/observers-complete.json +++ /dev/null @@ -1,40 +0,0 @@ -[ - { - "ObserverAddress": "zeta1syavy2npfyt9tcncdtsdzf7kny9lh777heefxk", - "ZetaClientGranteeAddress": "zeta19wzjdtah4kl2vh77jks68cyy5gpjyurqltys99", - "StakingGranteeAddress": "zeta19wzjdtah4kl2vh77jks68cyy5gpjyurqltys99", - "StakingMaxTokens": "100000000", - "StakingValidatorAllowList": [ - "zetavaloper1syavy2npfyt9tcncdtsdzf7kny9lh777nep4tq" - ], - "SpendGranteeAddress": "zeta19wzjdtah4kl2vh77jks68cyy5gpjyurqltys99", - "SpendMaxTokens": "100000000", - "GovGranteeAddress": "zeta19wzjdtah4kl2vh77jks68cyy5gpjyurqltys99", - "NodeAccount": { - "creator": "zeta1syavy2npfyt9tcncdtsdzf7kny9lh777heefxk", - "tssSignerAddress": "zeta19wzjdtah4kl2vh77jks68cyy5gpjyurqltys99", - "pubkeySet": { - "secp256k1": "zetapub1addwnpepqggtjvkmj6apcqr6ynyc5edxf2mpf5fxp2d3kwupemxtfwvg6gm7qv79fw0" - } - } - }, - { - "ObserverAddress": "zeta1l7hypmqk2yc334vc6vmdwzp5sdefygj2w5yj50", - "ZetaClientGranteeAddress": "zeta19wzjdtah4kl2vh77jks68cyy5gpjyurqltys99", - "StakingGranteeAddress": "zeta19wzjdtah4kl2vh77jks68cyy5gpjyurqltys99", - "StakingMaxTokens": "100000000", - "StakingValidatorAllowList": [ - "zetavaloper1syavy2npfyt9tcncdtsdzf7kny9lh777nep4tq" - ], - "SpendGranteeAddress": "zeta19wzjdtah4kl2vh77jks68cyy5gpjyurqltys99", - "SpendMaxTokens": "100000000", - "GovGranteeAddress": "zeta19wzjdtah4kl2vh77jks68cyy5gpjyurqltys99", - "NodeAccount": { - "creator": "zeta1l7hypmqk2yc334vc6vmdwzp5sdefygj2w5yj50", - "tssSignerAddress": "zeta19wzjdtah4kl2vh77jks68cyy5gpjyurqltys99", - "pubkeySet": { - "secp256k1": "zetapub1addwnpepqggtjvkmj6apcqr6ynyc5edxf2mpf5fxp2d3kwupemxtfwvg6gm7qv79fw0" - } - } - } -] \ No newline at end of file diff --git a/standalone-network/observers.json b/standalone-network/observers.json deleted file mode 100644 index f39019ea02..0000000000 --- a/standalone-network/observers.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "IsObserver": "y", - "ObserverAddress": "zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax", - "ZetaClientGranteeAddress": "zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n", - "ZetaClientGranteePubKey": "zetapub1addwnpepqtlu7fykuh875xjckz4mn4x0mzc25rrqk5qne7mrwxqmatgllv3nx6lrkdp" - }, - { - "IsObserver": "y", - "ObserverAddress": "zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2", - "ZetaClientGranteeAddress": "zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx", - "ZetaClientGranteePubKey": "zetapub1addwnpepqwy5pmg39regpq0gkggxehmfm8hwmxxw94sch7qzh4smava0szs07kk5045" - } -] \ No newline at end of file diff --git a/standalone-network/os_info/os1.json b/standalone-network/os_info/os1.json deleted file mode 100644 index c613e61cc7..0000000000 --- a/standalone-network/os_info/os1.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "ObserverAddress": "zeta1n48d8es90mezvc33srhgedjjuk3t69zzp7v6d4", - "ZetaClientGranteeAddress": "zeta1cjrr268h72a8fpc3870r437r5e5e8aumlwvhe0", - "ZetaClientGranteePubKey": "zetapub1addwnpepqg2l4m4n5ywn470c4qwkj3fy632rdug0hmnygy97ha5t8pcgnq78zk9fke7" -} \ No newline at end of file diff --git a/standalone-network/os_info/os2.json b/standalone-network/os_info/os2.json deleted file mode 100644 index c613e61cc7..0000000000 --- a/standalone-network/os_info/os2.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "ObserverAddress": "zeta1n48d8es90mezvc33srhgedjjuk3t69zzp7v6d4", - "ZetaClientGranteeAddress": "zeta1cjrr268h72a8fpc3870r437r5e5e8aumlwvhe0", - "ZetaClientGranteePubKey": "zetapub1addwnpepqg2l4m4n5ywn470c4qwkj3fy632rdug0hmnygy97ha5t8pcgnq78zk9fke7" -} \ No newline at end of file diff --git a/standalone-network/proposal.json b/standalone-network/proposal.json deleted file mode 100644 index da505d13cb..0000000000 --- a/standalone-network/proposal.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "title": "Observer Param Change", - "description": "Update policy address", - "changes": [ - { - "subspace": "observer", - "key": "AdminParams", - "value": [ - { - "policy_type": 0, - "address": "zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73" - }, - { - "policy_type": 1, - "address": "zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73" - }, - { - "policy_type": 2, - "address": "zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73" - }, - { - "policy_type": 3, - "address": "zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73" - } - ] - } - ], - "deposit": "10000000azeta" -} \ No newline at end of file diff --git a/standalone-network/proposal_feemarket.json b/standalone-network/proposal_feemarket.json deleted file mode 100644 index 1ec114d19a..0000000000 --- a/standalone-network/proposal_feemarket.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "messages": [ - { - "@type": "/ethermint.feemarket.v1.MsgUpdateParams", - "authority": "zeta10d07y265gmmuvt4z0w9aw880jnsr700jvxasvr", - "params": { - "base_fee": "7", - "min_gas_price" : "100000000000000", - "base_fee_change_denominator": "8" - } - } - ], - "metadata" : "some metadata", - "deposit": "10000000azeta" -} \ No newline at end of file diff --git a/standalone-network/run-zetaclient.sh b/standalone-network/run-zetaclient.sh deleted file mode 100644 index 5ad3375ea9..0000000000 --- a/standalone-network/run-zetaclient.sh +++ /dev/null @@ -1,2 +0,0 @@ -zetaclientd init --chain-id localnet_101-1 --operator zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax --hotkey=zeta --public-ip=0.0.0.0 -zetaclientd start \ No newline at end of file diff --git a/standalone-network/run.sh b/standalone-network/run.sh deleted file mode 100755 index 42b76cfce0..0000000000 --- a/standalone-network/run.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env bash - -CHAINID="localnet_101-1" -KEYRING="test" -HOSTNAME=$(hostname) -signer="zeta" - - -killall zetacored -zetacored start --trace \ ---minimum-gas-prices=0.0001azeta \ ---json-rpc.api eth,txpool,personal,net,debug,web3,miner \ ---api.enable >> ~/.zetacored/zetacored.log 2>&1 & \ -#>> "$HOME"/.zetacored/zetanode.log 2>&1 & \ - -#--home ~/.zetacored \ -#--p2p.laddr 0.0.0.0:27655 \ -#--grpc.address 0.0.0.0:9096 \ -#--grpc-web.address 0.0.0.0:9093 \ -#--address tcp://0.0.0.0:27659 \ -#--rpc.laddr tcp://127.0.0.1:26657 \ -#--pruning custom \ -#--pruning-keep-recent 54000 \ -#--pruning-interval 10 \ -#--min-retain-blocks 54000 \ -#--state-sync.snapshot-interval 14400 \ -#--state-sync.snapshot-keep-recent 3 - -#echo "--> Submitting proposal to update admin policies " -#sleep 7 -#zetacored tx gov submit-legacy-proposal param-change standalone-network/proposal.json --from $signer --gas=auto --gas-adjustment=1.5 --gas-prices=0.001azeta --chain-id=$CHAINID --keyring-backend=$KEYRING -y --broadcast-mode=block -#echo "--> Submitting vote for proposal" -#sleep 7 -#zetacored tx gov vote 1 yes --from $signer --keyring-backend $KEYRING --chain-id $CHAINID --yes --fees=40azeta --broadcast-mode=block -tail -f ~/.zetacored/zetacored.log - diff --git a/standalone-network/update_core_params/new_params.json b/standalone-network/update_core_params/new_params.json deleted file mode 100644 index 2acc3a571e..0000000000 --- a/standalone-network/update_core_params/new_params.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "confirmation_count" : 10, - "gas_price_ticker" : 10, - "in_tx_ticker": 10, - "out_tx_ticker": 10, - "watch_utxo_ticker": 10, - "chain_id" : 101, - "zeta_token_contract_address" : "", - "connector_contract_address" : "", - "erc20_custody_contract_address" : "" -} \ No newline at end of file diff --git a/standalone-network/update_core_params/update-params.sh b/standalone-network/update_core_params/update-params.sh deleted file mode 100755 index 3cca5583aa..0000000000 --- a/standalone-network/update_core_params/update-params.sh +++ /dev/null @@ -1,2 +0,0 @@ -zetacored tx observer update-client-params 101 new_params.json --from zeta --fees=40azeta --chain-id=localnet_101-1 --keyring-backend=test -y --broadcast-mode=block -#zetacored tx observer update-client-params 101 new_params.json --from val_grantee_observer --fees=40azeta --chain-id=athens_101-1 --keyring-backend=test -y --broadcast-mode=block \ No newline at end of file diff --git a/standalone-network/update_voting_period/proposal.json b/standalone-network/update_voting_period/proposal.json deleted file mode 100644 index 34d1c709b6..0000000000 --- a/standalone-network/update_voting_period/proposal.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "title": "Gov Param Change", - "description": "Update voting period", - "changes": [ - { - "subspace": "gov", - "key": "votingparams", - "value": { - "voting_period": "86400" - } - }, - { - "subspace": "gov", - "key": "depositparams", - "value": { - "min_deposit": [ - { - "denom": "azeta", - "amount": "1000000" - } - ], - "max_deposit_period": "86400" - } - } - ], - "deposit": "1000000zeta" -} \ No newline at end of file diff --git a/standalone-network/update_voting_period/update_voting_period.sh b/standalone-network/update_voting_period/update_voting_period.sh deleted file mode 100644 index 417b0d3737..0000000000 --- a/standalone-network/update_voting_period/update_voting_period.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -CHAINID="atheens_7001-1" -KEYRING="test" -HOSTNAME=$(hostname) -signer="operator" -proposal_count=10 - -#PID=1 - -signerAddress=$(zetacored keys show $signer -a --keyring-backend=test) -echo "signerAddress: $signerAddress" -for (( i = 0; i < proposal_count; i++ )); do - zetacored tx gov submit-legacy-proposal param-change proposal.json --from $signer --gas=auto --gas-adjustment=1.5 --gas-prices=0.001azeta --chain-id=$CHAINID --keyring-backend=$KEYRING -y --broadcast-mode=block -done - - -#zetacored tx gov vote "$PID" yes --from $signer --keyring-backend $KEYRING --chain-id $CHAINID --yes --fees=40azeta --broadcast-mode=block \ No newline at end of file diff --git a/standalone-network/upgrade-integration-client.sh b/standalone-network/upgrade-integration-client.sh deleted file mode 100755 index e3bd6f73c0..0000000000 --- a/standalone-network/upgrade-integration-client.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/usr/bin/env bash - - -clibuilder() -{ - echo "" - echo "Usage: $0 -u UpgradeName -c CurrentBinary -n NewBinary" - echo -e "\t-u Name of the upgrade [Must match a handler defined in setup-handlers.go in NewBinary]" - echo -e "\t-c Branch name for old binary (Upgrade From)" - echo -e "\t-n Branch name for new binary (Upgrade To)" - exit 1 # Exit script after printing help -} - -while getopts "u:c:n:" opt -do - case "$opt" in - u ) UpgradeName="$OPTARG" ;; - c ) CurrentBinary="$OPTARG" ;; - n ) NewBinary="$OPTARG" ;; - ? ) clibuilder ;; # Print cliBuilder in case parameter is non-existent - esac -done - -if [ -z "$UpgradeName" ] || [ -z "$CurrentBinary" ] || [ -z "$NewBinary" ] -then - echo "Some or all of the parameters are empty"; - clibuilder -fi - - -export DAEMON_HOME=$HOME/.zetacore -export DAEMON_NAME=zetacored -export DAEMON_ALLOW_DOWNLOAD_BINARIES=true -export DAEMON_RESTART_AFTER_UPGRADE=true -export CLIENT_DAEMON_NAME=zetaclientd -export CLIENT_DAEMON_ARGS="-enable-chains,GOERLI,-val,zeta" - -make clean -rm -rf ~/.zetacore -rm -rf zetacore.log -rm -rf ZetaClient.log - -rm -rf $GOPATH/bin/zetacored -rm -rf $GOPATH/bin/old/zetacored -rm -rf $GOPATH/bin/new/zetacored - -# Setup old binary and start chain -mkdir -p $GOPATH/bin/old -mkdir -p $GOPATH/bin/new - -git checkout $CurrentBinary -make install -cp $GOPATH/bin/zetacored $GOPATH/bin/old/ -cp $GOPATH/bin/zetaclientd $GOPATH/bin/old/ -zetacored init test --chain-id=localnet -o - -echo "Generating deterministic account - zeta" -echo "race draft rival universe maid cheese steel logic crowd fork comic easy truth drift tomorrow eye buddy head time cash swing swift midnight borrow" | zetacored keys add zeta --recover --keyring-backend=test - -echo "Generating deterministic account - mario" -echo "hand inmate canvas head lunar naive increase recycle dog ecology inhale december wide bubble hockey dice worth gravity ketchup feed balance parent secret orchard" | zetacored keys add mario --recover --keyring-backend=test - - -zetacored add-genesis-account $(zetacored keys show zeta -a --keyring-backend=test) 500000000000000000000000000000000stake --keyring-backend=test -zetacored add-genesis-account $(zetacored keys show mario -a --keyring-backend=test) 500000000000000000000000000000000stake --keyring-backend=test - -zetacored gentx zeta 1000000000000000000000000stake --chain-id=localnet --keyring-backend=test - -echo "Collecting genesis txs..." -zetacored collect-gentxs - -echo "Validating genesis file..." -zetacored validate-genesis - - -mkdir -p $DAEMON_HOME/cosmovisor/genesis/bin -mkdir -p $DAEMON_HOME/cosmovisor/upgrades/$UpgradeName/bin - - -# Setup new binary -git checkout $NewBinary -rm -rf $GOPATH/bin/zetacored -rm -rf $GOPATH/bin/zetaclientd - -make install -cp $GOPATH/bin/zetacored $GOPATH/bin/new/ -cp $GOPATH/bin/zetaclientd $GOPATH/bin/new/ - - -# Setup cosmovisor -cp $GOPATH/bin/old/zetacored $DAEMON_HOME/cosmovisor/genesis/bin/ -cp $GOPATH/bin/new/zetacored $DAEMON_HOME/cosmovisor/upgrades/$UpgradeName/bin/ -cp $GOPATH/bin/old/zetaclientd $DAEMON_HOME/cosmovisor/genesis/bin/ -cp $GOPATH/bin/new/zetaclientd $DAEMON_HOME/cosmovisor/upgrades/$UpgradeName/bin/ - -chmod +x $DAEMON_HOME/cosmovisor/genesis/bin/zetacored -chmod +x $DAEMON_HOME/cosmovisor/genesis/bin/zetaclientd -chmod +x $DAEMON_HOME/cosmovisor/upgrades/$UpgradeName/bin/zetacored -chmod +x $DAEMON_HOME/cosmovisor/upgrades/$UpgradeName/bin/zetaclientd - -contents="$(jq '.app_state.gov.voting_params.voting_period = "10s"' $DAEMON_HOME/config/genesis.json)" && \ -echo "${contents}" > $DAEMON_HOME/config/genesis.json - -# Add state data here if required - -cosmovisor start --home ~/.zetacore/ --p2p.laddr 0.0.0.0:27655 --grpc.address 0.0.0.0:9096 --grpc-web.address 0.0.0.0:9093 --address tcp://0.0.0.0:27659 --rpc.laddr tcp://127.0.0.1:26657 >> zetanode.log 2>&1 & - -sleep 7 -zetacored tx gov submit-proposal software-upgrade $UpgradeName --from zeta --deposit 100000000stake --upgrade-height 10 --title $UpgradeName --description $UpgradeName --keyring-backend test --chain-id localnet --yes -sleep 7 -zetacored tx gov vote 1 yes --from zeta --keyring-backend test --chain-id localnet --yes -clear -sleep 7 -zetacored query gov proposal 1 - -tail -f zetanode.log - diff --git a/standalone-network/upgrade-integration-download.sh b/standalone-network/upgrade-integration-download.sh deleted file mode 100755 index bea2fb717e..0000000000 --- a/standalone-network/upgrade-integration-download.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env bash - -kill -9 $(lsof -ti:26657) -export DAEMON_HOME=$HOME/.zetacore -export DAEMON_NAME=zetacored -export DAEMON_ALLOW_DOWNLOAD_BINARIES=true -export DAEMON_RESTART_AFTER_UPGRADE=true -export CLIENT_DAEMON_NAME=zetaclientd -export CLIENT_DAEMON_ARGS="-enable-chains,GOERLI,-val,zeta" -export DAEMON_DATA_BACKUP_DIR=$DAEMON_HOME -export CLIENT_SKIP_UPGRADE=true -export CLIENT_START_PROCESS=true -export UNSAFE_SKIP_BACKUP=true - -rm -rf ~/.zetacore -rm -rf zetacore.log -rm -rf zetanode.log -rm -rf zetacore-debug.log -rm -rf GOERLI_debug.log -rm -rf ZetaClient.log - -make install -# Genesis -mkdir -p $DAEMON_HOME/cosmovisor/genesis/bin -#mkdir -p $DAEMON_HOME/cosmovisor/upgrades/0.2.1/bin -cp $GOPATH/bin/zetacored $DAEMON_HOME/cosmovisor/genesis/bin -cp $GOPATH/bin/zetaclientd $DAEMON_HOME/cosmovisor/genesis/bin - - -chmod +x $DAEMON_HOME/cosmovisor/genesis/bin/zetacored -chmod +x $DAEMON_HOME/cosmovisor/genesis/bin/zetaclientd - -zetacored init test --chain-id=localnet -o -echo "race draft rival universe maid cheese steel logic crowd fork comic easy truth drift tomorrow eye buddy head time cash swing swift midnight borrow" | zetacored keys add zeta --recover --keyring-backend=test -echo "hand inmate canvas head lunar naive increase recycle dog ecology inhale december wide bubble hockey dice worth gravity ketchup feed balance parent secret orchard" | zetacored keys add mario --recover --keyring-backend=test -zetacored add-genesis-account $(zetacored keys show zeta -a --keyring-backend=test) 500000000000000000000000000000000stake --keyring-backend=test -zetacored add-genesis-account $(zetacored keys show mario -a --keyring-backend=test) 500000000000000000000000000000000stake --keyring-backend=test -zetacored gentx zeta 1000000000000000000000000stake --chain-id=localnet --keyring-backend=test -zetacored collect-gentxs -zetacored validate-genesis - - -contents="$(jq '.app_state.gov.voting_params.voting_period = "10s"' $DAEMON_HOME/config/genesis.json)" && \ -echo "${contents}" > $DAEMON_HOME/config/genesis.json - - -cosmovisor start --home ~/.zetacore/ --p2p.laddr 0.0.0.0:27655 --grpc.address 0.0.0.0:9096 --grpc-web.address 0.0.0.0:9093 --address tcp://0.0.0.0:27659 --rpc.laddr tcp://127.0.0.1:26657 >> zetanode.log 2>&1 & - -sleep 7 -printf "Raising the governance proposal:\n" -zetacored tx gov submit-proposal software-upgrade 0.2.1 \ - --from zeta \ - --deposit 10000000000000000000stake \ - --upgrade-height 6 \ - --upgrade-info '{"binaries":{"zetaclientd-darwin/arm64":"https://filebin.net/4awhitgraq8eenpd/zetaclientd","zetacored-darwin/arm64":"https://filebin.net/4awhitgraq8eenpd/zetacored"}}' \ - --description "test-upgrade" \ - --title "test-upgrade" \ - --from zeta \ - --keyring-backend test \ - --chain-id localnet \ - --yes -sleep 7 -zetacored tx gov vote 1 yes --from zeta --keyring-backend test --chain-id localnet --yes -clear -sleep 10 -zetacored query gov proposal 1 -tail -f zetanode.log \ No newline at end of file diff --git a/standalone-network/upgrade-integration.sh b/standalone-network/upgrade-integration.sh deleted file mode 100755 index 9d421eeaec..0000000000 --- a/standalone-network/upgrade-integration.sh +++ /dev/null @@ -1,119 +0,0 @@ -clibuilder() -{ - echo "" - echo "Usage: $0 -u UpgradeName -c CurrentBinary -n NewBinary" - echo -e "\t-u Name of the upgrade [Must match a handler defined in setup-handlers.go in NewBinary]" - echo -e "\t-c Branch name for old binary (Upgrade From)" - echo -e "\t-n Branch name for new binary (Upgrade To)" - exit 1 # Exit script after printing help -} - -while getopts "u:c:n:" opt -do - case "$opt" in - u ) UpgradeName="$OPTARG" ;; - c ) CurrentBinary="$OPTARG" ;; - n ) NewBinary="$OPTARG" ;; - ? ) clibuilder ;; # Print cliBuilder in case parameter is non-existent - esac -done - -if [ -z "$UpgradeName" ] || [ -z "$CurrentBinary" ] || [ -z "$NewBinary" ] -then - echo "Some or all of the parameters are empty"; - clibuilder -fi - -KEYRING=test -CHAINID="localnet_101-1" -export DAEMON_HOME=$HOME/.zetacored -export DAEMON_NAME=zetacored -export DAEMON_ALLOW_DOWNLOAD_BINARIES=true -export DAEMON_RESTART_AFTER_UPGRADE=true -export CLIENT_DAEMON_NAME=zetaclientd -export CLIENT_DAEMON_ARGS="-enable-chains,GOERLI,-val,zeta" -export DAEMON_DATA_BACKUP_DIR=$DAEMON_HOME -export CLIENT_SKIP_UPGRADE=true -export CLIENT_START_PROCESS=false -export UNSAFE_SKIP_BACKUP=true - -make clean -rm -rf ~/.zetacore -rm -rf zetacore.log - -rm -rf $GOPATH/bin/zetacored -rm -rf $GOPATH/bin/old/zetacored -rm -rf $GOPATH/bin/new/zetacored - -# Setup old binary and start chain -mkdir -p $GOPATH/bin/old -mkdir -p $GOPATH/bin/new - -git checkout $CurrentBinary -git pull -make install-zetacore -cp $GOPATH/bin/zetacored $GOPATH/bin/old/ -zetacored init test --chain-id=localnet_101-1 -o -cat $HOME/.zetacored/config/genesis.json | jq '.app_state["staking"]["params"]["bond_denom"]="azeta"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json -cat $HOME/.zetacored/config/genesis.json | jq '.app_state["crisis"]["constant_fee"]["denom"]="azeta"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json -cat $HOME/.zetacored/config/genesis.json | jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="azeta"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json -cat $HOME/.zetacored/config/genesis.json | jq '.app_state["mint"]["params"]["mint_denom"]="azeta"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json -cat $HOME/.zetacored/config/genesis.json | jq '.app_state["evm"]["params"]["evm_denom"]="azeta"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json -cat $HOME/.zetacored/config/genesis.json | jq '.consensus_params["block"]["max_gas"]="10000000"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json -echo "Generating deterministic account - zeta" -echo "race draft rival universe maid cheese steel logic crowd fork comic easy truth drift tomorrow eye buddy head time cash swing swift midnight borrow" | zetacored keys add zeta --algo secp256k1 --recover --keyring-backend=test -echo "Generating deterministic account - mario" -echo "hand inmate canvas head lunar naive increase recycle dog ecology inhale december wide bubble hockey dice worth gravity ketchup feed balance parent secret orchard" | zetacored keys add mario --algo secp256k1 --recover --keyring-backend=test - - - -zetacored add-observer-list standalone-network/observers.json --keygen-block=0 --tss-pubkey="tsspubkey" -zetacored gentx zeta 1000000000000000000000azeta --chain-id=$CHAINID --keyring-backend=$KEYRING - -echo "Collecting genesis txs..." -zetacored collect-gentxs - -echo "Validating genesis file..." -zetacored validate-genesis - - -mkdir -p $DAEMON_HOME/cosmovisor/genesis/bin -mkdir -p $DAEMON_HOME/cosmovisor/upgrades/$UpgradeName/bin - - -# Setup new binary -git checkout $NewBinary -git pull -rm -rf $GOPATH/bin/zetacored -make install -cp $GOPATH/bin/zetacored $GOPATH/bin/new/ - - -# Setup cosmovisor -# Genesis -cp $GOPATH/bin/old/zetacored $DAEMON_HOME/cosmovisor/genesis/bin -cp $GOPATH/bin/zetaclientd $DAEMON_HOME/cosmovisor/genesis/bin - -#Upgrades -cp $GOPATH/bin/new/zetacored $DAEMON_HOME/cosmovisor/upgrades/$UpgradeName/bin/ - -#Permissions -chmod +x $DAEMON_HOME/cosmovisor/genesis/bin/zetacored -chmod +x $DAEMON_HOME/cosmovisor/genesis/bin/zetaclientd -chmod +x $DAEMON_HOME/cosmovisor/upgrades/$UpgradeName/bin/zetacored - -contents="$(jq '.app_state.gov.voting_params.voting_period = "10s"' $DAEMON_HOME/config/genesis.json)" && \ -echo "${contents}" > $DAEMON_HOME/config/genesis.json - -# Add state data here if required - -cosmovisor start --home ~/.zetacored/ --p2p.laddr 0.0.0.0:27655 --grpc.address 0.0.0.0:9096 --grpc-web.address 0.0.0.0:9093 --address tcp://0.0.0.0:27659 --rpc.laddr tcp://127.0.0.1:26657 >> zetanode.log 2>&1 & -sleep 8 -zetacored tx gov submit-legacy-proposal software-upgrade $UpgradeName --from zeta --deposit 100000000azeta --upgrade-height 6 --title $UpgradeName --description $UpgradeName --keyring-backend test --chain-id localnet_101-1 --yes --no-validate --fees=200azeta --broadcast-mode block -sleep 8 -zetacored tx gov vote 1 yes --from zeta --keyring-backend test --chain-id localnet_101-1 --yes --fees=200azeta --broadcast-mode block -clear -sleep 7 -zetacored query gov proposal 1 - -tail -f zetanode.log diff --git a/testutil/keeper/fungible.go b/testutil/keeper/fungible.go index b4caebbc88..0ef4e981f4 100644 --- a/testutil/keeper/fungible.go +++ b/testutil/keeper/fungible.go @@ -8,7 +8,6 @@ import ( storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" tmdb "github.com/tendermint/tm-db" fungiblemocks "github.com/zeta-chain/zetacore/testutil/keeper/mocks/fungible" @@ -149,24 +148,24 @@ func FungibleKeeper(t testing.TB) (*keeper.Keeper, sdk.Context, SDKKeepers, Zeta func GetFungibleAccountMock(t testing.TB, keeper *keeper.Keeper) *fungiblemocks.FungibleAccountKeeper { fak, ok := keeper.GetAuthKeeper().(*fungiblemocks.FungibleAccountKeeper) - assert.True(t, ok) + require.True(t, ok) return fak } func GetFungibleBankMock(t testing.TB, keeper *keeper.Keeper) *fungiblemocks.FungibleBankKeeper { fbk, ok := keeper.GetBankKeeper().(*fungiblemocks.FungibleBankKeeper) - assert.True(t, ok) + require.True(t, ok) return fbk } func GetFungibleObserverMock(t testing.TB, keeper *keeper.Keeper) *fungiblemocks.FungibleObserverKeeper { fok, ok := keeper.GetObserverKeeper().(*fungiblemocks.FungibleObserverKeeper) - assert.True(t, ok) + require.True(t, ok) return fok } func GetFungibleEVMMock(t testing.TB, keeper *keeper.Keeper) *fungiblemocks.FungibleEVMKeeper { fek, ok := keeper.GetEVMKeeper().(*fungiblemocks.FungibleEVMKeeper) - assert.True(t, ok) + require.True(t, ok) return fek } diff --git a/testutil/network/genesis_state.go b/testutil/network/genesis_state.go index d74b5c4c8f..12ae9f9d50 100644 --- a/testutil/network/genesis_state.go +++ b/testutil/network/genesis_state.go @@ -10,7 +10,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" evmtypes "github.com/evmos/ethermint/x/evm/types" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" cmdcfg "github.com/zeta-chain/zetacore/cmd/zetacored/config" "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/testutil/nullify" @@ -22,7 +22,7 @@ func SetupZetaGenesisState(t *testing.T, genesisState map[string]json.RawMessage // Cross-chain genesis state var crossChainGenesis types.GenesisState - assert.NoError(t, codec.UnmarshalJSON(genesisState[types.ModuleName], &crossChainGenesis)) + require.NoError(t, codec.UnmarshalJSON(genesisState[types.ModuleName], &crossChainGenesis)) nodeAccountList := make([]*observertypes.NodeAccount, len(observerList)) for i, operator := range observerList { nodeAccountList[i] = &observertypes.NodeAccount{ @@ -32,28 +32,28 @@ func SetupZetaGenesisState(t *testing.T, genesisState map[string]json.RawMessage } crossChainGenesis.Params.Enabled = true - assert.NoError(t, crossChainGenesis.Validate()) + require.NoError(t, crossChainGenesis.Validate()) crossChainGenesisBz, err := codec.MarshalJSON(&crossChainGenesis) - assert.NoError(t, err) + require.NoError(t, err) // EVM genesis state var evmGenesisState evmtypes.GenesisState - assert.NoError(t, codec.UnmarshalJSON(genesisState[evmtypes.ModuleName], &evmGenesisState)) + require.NoError(t, codec.UnmarshalJSON(genesisState[evmtypes.ModuleName], &evmGenesisState)) evmGenesisState.Params.EvmDenom = cmdcfg.BaseDenom - assert.NoError(t, evmGenesisState.Validate()) + require.NoError(t, evmGenesisState.Validate()) evmGenesisBz, err := codec.MarshalJSON(&evmGenesisState) - assert.NoError(t, err) + require.NoError(t, err) // Staking genesis state var stakingGenesisState stakingtypes.GenesisState - assert.NoError(t, codec.UnmarshalJSON(genesisState[stakingtypes.ModuleName], &stakingGenesisState)) + require.NoError(t, codec.UnmarshalJSON(genesisState[stakingtypes.ModuleName], &stakingGenesisState)) stakingGenesisState.Params.BondDenom = cmdcfg.BaseDenom stakingGenesisStateBz, err := codec.MarshalJSON(&stakingGenesisState) - assert.NoError(t, err) + require.NoError(t, err) // Observer genesis state var observerGenesis observertypes.GenesisState - assert.NoError(t, codec.UnmarshalJSON(genesisState[observertypes.ModuleName], &observerGenesis)) + require.NoError(t, codec.UnmarshalJSON(genesisState[observertypes.ModuleName], &observerGenesis)) observerSet := observertypes.ObserverSet{ ObserverList: observerList, } @@ -92,9 +92,9 @@ func SetupZetaGenesisState(t *testing.T, genesisState map[string]json.RawMessage IsInboundEnabled: true, IsOutboundEnabled: true, } - assert.NoError(t, observerGenesis.Validate()) + require.NoError(t, observerGenesis.Validate()) observerGenesisBz, err := codec.MarshalJSON(&observerGenesis) - assert.NoError(t, err) + require.NoError(t, err) genesisState[types.ModuleName] = crossChainGenesisBz genesisState[stakingtypes.ModuleName] = stakingGenesisStateBz @@ -104,7 +104,7 @@ func SetupZetaGenesisState(t *testing.T, genesisState map[string]json.RawMessage func AddObserverData(t *testing.T, n int, genesisState map[string]json.RawMessage, codec codec.Codec, ballots []*observertypes.Ballot) *observertypes.GenesisState { state := observertypes.GenesisState{} - assert.NoError(t, codec.UnmarshalJSON(genesisState[observertypes.ModuleName], &state)) + require.NoError(t, codec.UnmarshalJSON(genesisState[observertypes.ModuleName], &state)) // set chain params with chains all enabled state.ChainParamsList = observertypes.GetDefaultChainParams() @@ -155,17 +155,17 @@ func AddObserverData(t *testing.T, n int, genesisState map[string]json.RawMessag } // check genesis state validity - assert.NoError(t, state.Validate()) + require.NoError(t, state.Validate()) // marshal genesis state buf, err := codec.MarshalJSON(&state) - assert.NoError(t, err) + require.NoError(t, err) genesisState[observertypes.ModuleName] = buf return &state } func AddCrosschainData(t *testing.T, n int, genesisState map[string]json.RawMessage, codec codec.Codec) *types.GenesisState { state := types.GenesisState{} - assert.NoError(t, codec.UnmarshalJSON(genesisState[types.ModuleName], &state)) + require.NoError(t, codec.UnmarshalJSON(genesisState[types.ModuleName], &state)) // TODO : Fix add EVM balance to deploy contracts for i := 0; i < n; i++ { state.CrossChainTxs = append(state.CrossChainTxs, &types.CrossChainTx{ @@ -216,10 +216,10 @@ func AddCrosschainData(t *testing.T, n int, genesisState map[string]json.RawMess state.OutTxTrackerList = append(state.OutTxTrackerList, outTxTracker) } - assert.NoError(t, state.Validate()) + require.NoError(t, state.Validate()) buf, err := codec.MarshalJSON(&state) - assert.NoError(t, err) + require.NoError(t, err) genesisState[types.ModuleName] = buf return &state } diff --git a/x/crosschain/keeper/cctx_test.go b/x/crosschain/keeper/cctx_test.go index 13218eca13..6732ed6795 100644 --- a/x/crosschain/keeper/cctx_test.go +++ b/x/crosschain/keeper/cctx_test.go @@ -15,8 +15,6 @@ import ( "google.golang.org/grpc/status" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/assert" - "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/x/crosschain/types" ) @@ -125,14 +123,14 @@ func TestSends(t *testing.T) { sends = append(sends, createNCctxWithStatus(keeper, ctx, tt.Aborted, types.CctxStatus_Aborted)...) sends = append(sends, createNCctxWithStatus(keeper, ctx, tt.OutboundMined, types.CctxStatus_OutboundMined)...) sends = append(sends, createNCctxWithStatus(keeper, ctx, tt.Reverted, types.CctxStatus_Reverted)...) - //assert.Equal(t, tt.PendingOutbound, len(keeper.GetAllCctxByStatuses(ctx, []types.CctxStatus{types.CctxStatus_PendingOutbound}))) - //assert.Equal(t, tt.PendingInbound, len(keeper.GetAllCctxByStatuses(ctx, []types.CctxStatus{types.CctxStatus_PendingInbound}))) - //assert.Equal(t, tt.PendingOutbound+tt.PendingRevert, len(keeper.GetAllCctxByStatuses(ctx, []types.CctxStatus{types.CctxStatus_PendingOutbound, types.CctxStatus_PendingRevert}))) - assert.Equal(t, len(sends), len(keeper.GetAllCrossChainTx(ctx))) + //require.Equal(t, tt.PendingOutbound, len(keeper.GetAllCctxByStatuses(ctx, []types.CctxStatus{types.CctxStatus_PendingOutbound}))) + //require.Equal(t, tt.PendingInbound, len(keeper.GetAllCctxByStatuses(ctx, []types.CctxStatus{types.CctxStatus_PendingInbound}))) + //require.Equal(t, tt.PendingOutbound+tt.PendingRevert, len(keeper.GetAllCctxByStatuses(ctx, []types.CctxStatus{types.CctxStatus_PendingOutbound, types.CctxStatus_PendingRevert}))) + require.Equal(t, len(sends), len(keeper.GetAllCrossChainTx(ctx))) for _, s := range sends { send, found := keeper.GetCrossChainTx(ctx, s.Index) - assert.True(t, found) - assert.Equal(t, s, send) + require.True(t, found) + require.Equal(t, s, send) } }) @@ -148,7 +146,7 @@ func TestSendGetAll(t *testing.T) { for i, val := range cctx { c[i] = val } - assert.Equal(t, items, c) + require.Equal(t, items, c) } // Querier Tests @@ -218,7 +216,7 @@ func TestSendQueryPaginated(t *testing.T) { resp, err := keeper.CctxAll(wctx, request(nil, uint64(i), uint64(step), false)) require.NoError(t, err) for j := i; j < len(msgs) && j < i+step; j++ { - assert.Equal(t, &msgs[j], resp.CrossChainTx[j-i]) + require.Equal(t, &msgs[j], resp.CrossChainTx[j-i]) } } }) @@ -229,7 +227,7 @@ func TestSendQueryPaginated(t *testing.T) { resp, err := keeper.CctxAll(wctx, request(next, 0, uint64(step), false)) require.NoError(t, err) for j := i; j < len(msgs) && j < i+step; j++ { - assert.Equal(t, &msgs[j], resp.CrossChainTx[j-i]) + require.Equal(t, &msgs[j], resp.CrossChainTx[j-i]) } next = resp.Pagination.NextKey } diff --git a/x/crosschain/keeper/gas_price_test.go b/x/crosschain/keeper/gas_price_test.go index 9a269832c2..67aeb95cd6 100644 --- a/x/crosschain/keeper/gas_price_test.go +++ b/x/crosschain/keeper/gas_price_test.go @@ -5,7 +5,7 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/x/crosschain/types" ) @@ -26,8 +26,8 @@ func TestGasPriceGet(t *testing.T) { items := createNGasPrice(keeper, ctx, 10) for _, item := range items { rst, found := keeper.GetGasPrice(ctx, item.ChainId) - assert.True(t, found) - assert.Equal(t, item, rst) + require.True(t, found) + require.Equal(t, item, rst) } } func TestGasPriceRemove(t *testing.T) { @@ -36,12 +36,12 @@ func TestGasPriceRemove(t *testing.T) { for _, item := range items { keeper.RemoveGasPrice(ctx, item.Index) _, found := keeper.GetGasPrice(ctx, item.ChainId) - assert.False(t, found) + require.False(t, found) } } func TestGasPriceGetAll(t *testing.T) { keeper, ctx := setupKeeper(t) items := createNGasPrice(keeper, ctx, 10) - assert.Equal(t, items, keeper.GetAllGasPrice(ctx)) + require.Equal(t, items, keeper.GetAllGasPrice(ctx)) } diff --git a/x/crosschain/keeper/grpc_query_gas_price_test.go b/x/crosschain/keeper/grpc_query_gas_price_test.go index 5c2d12cadd..cc48e2f3b0 100644 --- a/x/crosschain/keeper/grpc_query_gas_price_test.go +++ b/x/crosschain/keeper/grpc_query_gas_price_test.go @@ -5,7 +5,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/x/crosschain/types" "google.golang.org/grpc/codes" @@ -75,7 +74,7 @@ func TestGasPriceQueryPaginated(t *testing.T) { resp, err := keeper.GasPriceAll(wctx, request(nil, uint64(i), uint64(step), false)) require.NoError(t, err) for j := i; j < len(msgs) && j < i+step; j++ { - assert.Equal(t, &msgs[j], resp.GasPrice[j-i]) + require.Equal(t, &msgs[j], resp.GasPrice[j-i]) } } }) @@ -86,7 +85,7 @@ func TestGasPriceQueryPaginated(t *testing.T) { resp, err := keeper.GasPriceAll(wctx, request(next, 0, uint64(step), false)) require.NoError(t, err) for j := i; j < len(msgs) && j < i+step; j++ { - assert.Equal(t, &msgs[j], resp.GasPrice[j-i]) + require.Equal(t, &msgs[j], resp.GasPrice[j-i]) } next = resp.Pagination.NextKey } diff --git a/x/crosschain/keeper/grpc_query_last_block_height_test.go b/x/crosschain/keeper/grpc_query_last_block_height_test.go index b2fd0463cf..f2747bf7c9 100644 --- a/x/crosschain/keeper/grpc_query_last_block_height_test.go +++ b/x/crosschain/keeper/grpc_query_last_block_height_test.go @@ -5,7 +5,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/x/crosschain/types" "google.golang.org/grpc/codes" @@ -75,7 +74,7 @@ func TestLastBlockHeightQueryPaginated(t *testing.T) { resp, err := keeper.LastBlockHeightAll(wctx, request(nil, uint64(i), uint64(step), false)) require.NoError(t, err) for j := i; j < len(msgs) && j < i+step; j++ { - assert.Equal(t, &msgs[j], resp.LastBlockHeight[j-i]) + require.Equal(t, &msgs[j], resp.LastBlockHeight[j-i]) } } }) @@ -86,7 +85,7 @@ func TestLastBlockHeightQueryPaginated(t *testing.T) { resp, err := keeper.LastBlockHeightAll(wctx, request(next, 0, uint64(step), false)) require.NoError(t, err) for j := i; j < len(msgs) && j < i+step; j++ { - assert.Equal(t, &msgs[j], resp.LastBlockHeight[j-i]) + require.Equal(t, &msgs[j], resp.LastBlockHeight[j-i]) } next = resp.Pagination.NextKey } diff --git a/x/crosschain/keeper/last_block_height_test.go b/x/crosschain/keeper/last_block_height_test.go index 94eb087e01..8a284f6f97 100644 --- a/x/crosschain/keeper/last_block_height_test.go +++ b/x/crosschain/keeper/last_block_height_test.go @@ -5,7 +5,7 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/x/crosschain/types" ) @@ -24,8 +24,8 @@ func TestLastBlockHeightGet(t *testing.T) { items := createNLastBlockHeight(keeper, ctx, 10) for _, item := range items { rst, found := keeper.GetLastBlockHeight(ctx, item.Index) - assert.True(t, found) - assert.Equal(t, item, rst) + require.True(t, found) + require.Equal(t, item, rst) } } func TestLastBlockHeightRemove(t *testing.T) { @@ -34,12 +34,12 @@ func TestLastBlockHeightRemove(t *testing.T) { for _, item := range items { keeper.RemoveLastBlockHeight(ctx, item.Index) _, found := keeper.GetLastBlockHeight(ctx, item.Index) - assert.False(t, found) + require.False(t, found) } } func TestLastBlockHeightGetAll(t *testing.T) { keeper, ctx := setupKeeper(t) items := createNLastBlockHeight(keeper, ctx, 10) - assert.Equal(t, items, keeper.GetAllLastBlockHeight(ctx)) + require.Equal(t, items, keeper.GetAllLastBlockHeight(ctx)) } diff --git a/x/crosschain/keeper/msg_server_add_to_outtx_tracker_test.go b/x/crosschain/keeper/msg_server_add_to_outtx_tracker_test.go index c2ad9d6e7a..a6dfe317eb 100644 --- a/x/crosschain/keeper/msg_server_add_to_outtx_tracker_test.go +++ b/x/crosschain/keeper/msg_server_add_to_outtx_tracker_test.go @@ -4,7 +4,6 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/common/ethereum" @@ -12,7 +11,6 @@ import ( "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/crosschain/keeper" "github.com/zeta-chain/zetacore/x/crosschain/types" - observerTypes "github.com/zeta-chain/zetacore/x/observer/types" observertypes "github.com/zeta-chain/zetacore/x/observer/types" ) @@ -254,7 +252,7 @@ func TestMsgServer_AddToOutTxTracker(t *testing.T) { }, }) tracker, found := k.GetOutTxTracker(ctx, chainID, tx.Nonce()) - assert.True(t, found) + require.True(t, found) require.False(t, tracker.HashList[0].Proved) msgServer := keeper.NewMsgServerImpl(*k) _, err = msgServer.AddToOutTxTracker(ctx, &types.MsgAddToOutTxTracker{ @@ -277,7 +275,7 @@ func TestMsgServer_AddToOutTxTracker(t *testing.T) { func setupTssAndNonceToCctx(k *keeper.Keeper, ctx sdk.Context, chainId, nonce int64) { tssPubKey := "zetapub1addwnpepq28c57cvcs0a2htsem5zxr6qnlvq9mzhmm76z3jncsnzz32rclangr2g35p" - k.GetObserverKeeper().SetTSS(ctx, observerTypes.TSS{ + k.GetObserverKeeper().SetTSS(ctx, observertypes.TSS{ TssPubkey: tssPubKey, }) k.GetObserverKeeper().SetPendingNonces(ctx, observertypes.PendingNonces{ diff --git a/x/crosschain/keeper/msg_server_refund_aborted_tx_test.go b/x/crosschain/keeper/msg_server_refund_aborted_tx_test.go index e42360975e..3cc1285863 100644 --- a/x/crosschain/keeper/msg_server_refund_aborted_tx_test.go +++ b/x/crosschain/keeper/msg_server_refund_aborted_tx_test.go @@ -5,7 +5,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ethcommon "github.com/ethereum/go-ethereum/common" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/cmd/zetacored/config" "github.com/zeta-chain/zetacore/common" @@ -27,12 +26,12 @@ func Test_GetRefundAddress(t *testing.T) { t.Run("should fail if refund address is empty", func(t *testing.T) { address, err := keeper.GetRefundAddress("") require.ErrorIs(t, crosschaintypes.ErrInvalidAddress, err) - assert.Equal(t, ethcommon.Address{}, address) + require.Equal(t, ethcommon.Address{}, address) }) t.Run("should fail if refund address is invalid", func(t *testing.T) { address, err := keeper.GetRefundAddress("invalid-address") require.ErrorIs(t, crosschaintypes.ErrInvalidAddress, err) - assert.Equal(t, ethcommon.Address{}, address) + require.Equal(t, ethcommon.Address{}, address) }) } diff --git a/x/crosschain/keeper/msg_server_update_tss_test.go b/x/crosschain/keeper/msg_server_update_tss_test.go index fbc8567d5f..6da9638343 100644 --- a/x/crosschain/keeper/msg_server_update_tss_test.go +++ b/x/crosschain/keeper/msg_server_update_tss_test.go @@ -5,7 +5,6 @@ import ( "github.com/stretchr/testify/require" - "github.com/stretchr/testify/assert" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/crosschain/keeper" @@ -34,17 +33,17 @@ func TestMsgServer_UpdateTssAddress(t *testing.T) { cctx.CctxStatus.Status = crosschaintypes.CctxStatus_OutboundMined k.SetCrossChainTx(ctx, *cctx) } - assert.Equal(t, len(k.GetObserverKeeper().GetAllTssFundMigrators(ctx)), len(k.GetObserverKeeper().GetSupportedChains(ctx))) + require.Equal(t, len(k.GetObserverKeeper().GetAllTssFundMigrators(ctx)), len(k.GetObserverKeeper().GetSupportedChains(ctx))) _, err := msgServer.UpdateTssAddress(ctx, &crosschaintypes.MsgUpdateTssAddress{ Creator: admin, TssPubkey: tssNew.TssPubkey, }) - assert.NoError(t, err) + require.NoError(t, err) tss, found := k.GetObserverKeeper().GetTSS(ctx) - assert.True(t, found) - assert.Equal(t, tssNew, tss) + require.True(t, found) + require.Equal(t, tssNew, tss) migrators := k.GetObserverKeeper().GetAllTssFundMigrators(ctx) - assert.Equal(t, 0, len(migrators)) + require.Equal(t, 0, len(migrators)) }) t.Run("new tss has not been added to tss history", func(t *testing.T) { @@ -66,17 +65,17 @@ func TestMsgServer_UpdateTssAddress(t *testing.T) { cctx.CctxStatus.Status = crosschaintypes.CctxStatus_OutboundMined k.SetCrossChainTx(ctx, *cctx) } - assert.Equal(t, len(k.GetObserverKeeper().GetAllTssFundMigrators(ctx)), len(k.GetObserverKeeper().GetSupportedChains(ctx))) + require.Equal(t, len(k.GetObserverKeeper().GetAllTssFundMigrators(ctx)), len(k.GetObserverKeeper().GetSupportedChains(ctx))) _, err := msgServer.UpdateTssAddress(ctx, &crosschaintypes.MsgUpdateTssAddress{ Creator: admin, TssPubkey: tssNew.TssPubkey, }) - assert.ErrorContains(t, err, "tss pubkey has not been generated") - assert.ErrorIs(t, err, crosschaintypes.ErrUnableToUpdateTss) + require.ErrorContains(t, err, "tss pubkey has not been generated") + require.ErrorIs(t, err, crosschaintypes.ErrUnableToUpdateTss) tss, found := k.GetObserverKeeper().GetTSS(ctx) - assert.True(t, found) - assert.Equal(t, tssOld, tss) - assert.Equal(t, len(k.GetObserverKeeper().GetAllTssFundMigrators(ctx)), len(k.GetObserverKeeper().GetSupportedChains(ctx))) + require.True(t, found) + require.Equal(t, tssOld, tss) + require.Equal(t, len(k.GetObserverKeeper().GetAllTssFundMigrators(ctx)), len(k.GetObserverKeeper().GetSupportedChains(ctx))) }) t.Run("old tss pubkey provided", func(t *testing.T) { @@ -97,17 +96,17 @@ func TestMsgServer_UpdateTssAddress(t *testing.T) { cctx.CctxStatus.Status = crosschaintypes.CctxStatus_OutboundMined k.SetCrossChainTx(ctx, *cctx) } - assert.Equal(t, len(k.GetObserverKeeper().GetAllTssFundMigrators(ctx)), len(k.GetObserverKeeper().GetSupportedChains(ctx))) + require.Equal(t, len(k.GetObserverKeeper().GetAllTssFundMigrators(ctx)), len(k.GetObserverKeeper().GetSupportedChains(ctx))) _, err := msgServer.UpdateTssAddress(ctx, &crosschaintypes.MsgUpdateTssAddress{ Creator: admin, TssPubkey: tssOld.TssPubkey, }) - assert.ErrorContains(t, err, "no new tss address has been generated") - assert.ErrorIs(t, err, crosschaintypes.ErrUnableToUpdateTss) + require.ErrorContains(t, err, "no new tss address has been generated") + require.ErrorIs(t, err, crosschaintypes.ErrUnableToUpdateTss) tss, found := k.GetObserverKeeper().GetTSS(ctx) - assert.True(t, found) - assert.Equal(t, tssOld, tss) - assert.Equal(t, len(k.GetObserverKeeper().GetAllTssFundMigrators(ctx)), len(k.GetObserverKeeper().GetSupportedChains(ctx))) + require.True(t, found) + require.Equal(t, tssOld, tss) + require.Equal(t, len(k.GetObserverKeeper().GetAllTssFundMigrators(ctx)), len(k.GetObserverKeeper().GetSupportedChains(ctx))) }) t.Run("unable to update tss when not enough migrators are present", func(t *testing.T) { @@ -145,7 +144,7 @@ func TestMsgServer_UpdateTssAddress(t *testing.T) { require.True(t, found) require.Equal(t, tssOld, tss) migrators := k.GetObserverKeeper().GetAllTssFundMigrators(ctx) - assert.Equal(t, 1, len(migrators)) + require.Equal(t, 1, len(migrators)) }) t.Run("unable to update tss when pending cctx is present", func(t *testing.T) { @@ -171,18 +170,18 @@ func TestMsgServer_UpdateTssAddress(t *testing.T) { cctx.CctxStatus.Status = crosschaintypes.CctxStatus_PendingOutbound k.SetCrossChainTx(ctx, *cctx) } - assert.Equal(t, len(k.GetObserverKeeper().GetAllTssFundMigrators(ctx)), len(k.GetObserverKeeper().GetSupportedChains(ctx))) + require.Equal(t, len(k.GetObserverKeeper().GetAllTssFundMigrators(ctx)), len(k.GetObserverKeeper().GetSupportedChains(ctx))) _, err := msgServer.UpdateTssAddress(ctx, &crosschaintypes.MsgUpdateTssAddress{ Creator: admin, TssPubkey: tssNew.TssPubkey, }) - assert.ErrorContains(t, err, "cannot update tss address while there are pending migrations") - assert.ErrorIs(t, err, crosschaintypes.ErrUnableToUpdateTss) + require.ErrorContains(t, err, "cannot update tss address while there are pending migrations") + require.ErrorIs(t, err, crosschaintypes.ErrUnableToUpdateTss) tss, found := k.GetObserverKeeper().GetTSS(ctx) - assert.True(t, found) - assert.Equal(t, tssOld, tss) + require.True(t, found) + require.Equal(t, tssOld, tss) migrators := k.GetObserverKeeper().GetAllTssFundMigrators(ctx) - assert.Equal(t, len(k.GetObserverKeeper().GetSupportedChains(ctx)), len(migrators)) + require.Equal(t, len(k.GetObserverKeeper().GetSupportedChains(ctx)), len(migrators)) }) t.Run("unable to update tss cctx is not present", func(t *testing.T) { @@ -205,17 +204,17 @@ func TestMsgServer_UpdateTssAddress(t *testing.T) { MigrationCctxIndex: sample.GetCctxIndexFromString(index), }) } - assert.Equal(t, len(k.GetObserverKeeper().GetAllTssFundMigrators(ctx)), len(k.GetObserverKeeper().GetSupportedChains(ctx))) + require.Equal(t, len(k.GetObserverKeeper().GetAllTssFundMigrators(ctx)), len(k.GetObserverKeeper().GetSupportedChains(ctx))) _, err := msgServer.UpdateTssAddress(ctx, &crosschaintypes.MsgUpdateTssAddress{ Creator: admin, TssPubkey: tssNew.TssPubkey, }) - assert.ErrorContains(t, err, "migration cross chain tx not found") - assert.ErrorIs(t, err, crosschaintypes.ErrUnableToUpdateTss) + require.ErrorContains(t, err, "migration cross chain tx not found") + require.ErrorIs(t, err, crosschaintypes.ErrUnableToUpdateTss) tss, found := k.GetObserverKeeper().GetTSS(ctx) - assert.True(t, found) - assert.Equal(t, tssOld, tss) + require.True(t, found) + require.Equal(t, tssOld, tss) migrators := k.GetObserverKeeper().GetAllTssFundMigrators(ctx) - assert.Equal(t, len(k.GetObserverKeeper().GetSupportedChains(ctx)), len(migrators)) + require.Equal(t, len(k.GetObserverKeeper().GetSupportedChains(ctx)), len(migrators)) }) } diff --git a/x/crosschain/keeper/msg_server_vote_inbound_tx_test.go b/x/crosschain/keeper/msg_server_vote_inbound_tx_test.go index 32a0578ed8..c484b585d3 100644 --- a/x/crosschain/keeper/msg_server_vote_inbound_tx_test.go +++ b/x/crosschain/keeper/msg_server_vote_inbound_tx_test.go @@ -7,7 +7,7 @@ import ( //"github.com/zeta-chain/zetacore/common" sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/common" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" @@ -23,9 +23,9 @@ func setObservers(t *testing.T, k *keeper.Keeper, ctx sdk.Context, zk keepertest validatorAddressListFormatted := make([]string, len(validators)) for i, validator := range validators { valAddr, err := sdk.ValAddressFromBech32(validator.OperatorAddress) - assert.NoError(t, err) + require.NoError(t, err) addressTmp, err := sdk.AccAddressFromHexUnsafe(hex.EncodeToString(valAddr.Bytes())) - assert.NoError(t, err) + require.NoError(t, err) validatorAddressListFormatted[i] = addressTmp.String() } @@ -57,14 +57,14 @@ func TestKeeper_VoteOnObservedInboundTx(t *testing.T) { ctx, &msg, ) - assert.NoError(t, err) + require.NoError(t, err) } ballot, _, _ := zk.ObserverKeeper.FindBallot(ctx, msg.Digest(), zk.ObserverKeeper.GetSupportedChainFromChainID(ctx, msg.SenderChainId), observerTypes.ObservationType_InBoundTx) - assert.Equal(t, ballot.BallotStatus, observerTypes.BallotStatus_BallotFinalized_SuccessObservation) + require.Equal(t, ballot.BallotStatus, observerTypes.BallotStatus_BallotFinalized_SuccessObservation) cctx, found := k.GetCrossChainTx(ctx, msg.Digest()) - assert.True(t, found) - assert.Equal(t, cctx.CctxStatus.Status, types.CctxStatus_OutboundMined) - assert.Equal(t, cctx.InboundTxParams.TxFinalizationStatus, types.TxFinalizationStatus_Executed) + require.True(t, found) + require.Equal(t, cctx.CctxStatus.Status, types.CctxStatus_OutboundMined) + require.Equal(t, cctx.InboundTxParams.TxFinalizationStatus, types.TxFinalizationStatus_Executed) }) // TODO : https://github.com/zeta-chain/node/issues/1542 } @@ -117,12 +117,12 @@ func TestNoDoubleEventProtections(t *testing.T) { ctx, msg, ) - assert.NoError(t, err) + require.NoError(t, err) // Check that the vote passed ballot, found := zk.ObserverKeeper.GetBallot(ctx, msg.Digest()) - assert.True(t, found) - assert.Equal(t, ballot.BallotStatus, observerTypes.BallotStatus_BallotFinalized_SuccessObservation) + require.True(t, found) + require.Equal(t, ballot.BallotStatus, observerTypes.BallotStatus_BallotFinalized_SuccessObservation) //Perform the SAME event. Except, this time, we resubmit the event. msg2 := &types.MsgVoteOnObservedInboundTx{ Creator: validatorAddr, @@ -145,9 +145,9 @@ func TestNoDoubleEventProtections(t *testing.T) { ctx, msg2, ) - assert.ErrorIs(t, err, types.ErrObservedTxAlreadyFinalized) + require.ErrorIs(t, err, types.ErrObservedTxAlreadyFinalized) _, found = zk.ObserverKeeper.GetBallot(ctx, msg2.Digest()) - assert.False(t, found) + require.False(t, found) } func TestStatus_StatusTransition(t *testing.T) { tt := []struct { @@ -188,9 +188,9 @@ func TestStatus_StatusTransition(t *testing.T) { t.Run(test.Name, func(t *testing.T) { test.Status.ChangeStatus(test.NonErrStatus, test.Msg) if test.IsErr { - assert.Equal(t, test.ErrStatus, test.Status.Status) + require.Equal(t, test.ErrStatus, test.Status.Status) } else { - assert.Equal(t, test.NonErrStatus, test.Status.Status) + require.Equal(t, test.NonErrStatus, test.Status.Status) } }) } diff --git a/x/crosschain/keeper/utils_test.go b/x/crosschain/keeper/utils_test.go index b5735ac0de..253e20dbb6 100644 --- a/x/crosschain/keeper/utils_test.go +++ b/x/crosschain/keeper/utils_test.go @@ -54,7 +54,7 @@ func getValidEthChainIDWithIndex(t *testing.T, index int) int64 { return 0 } -// assert that a contract has been deployed by checking stored code is non-empty. +// require that a contract has been deployed by checking stored code is non-empty. func assertContractDeployment(t *testing.T, k *evmkeeper.Keeper, ctx sdk.Context, contractAddress common.Address) { acc := k.GetAccount(ctx, contractAddress) require.NotNil(t, acc) diff --git a/x/crosschain/migrations/v4/migrate_test.go b/x/crosschain/migrations/v4/migrate_test.go index 5ff2f9ee54..d377f1a6fa 100644 --- a/x/crosschain/migrations/v4/migrate_test.go +++ b/x/crosschain/migrations/v4/migrate_test.go @@ -9,7 +9,6 @@ import ( sdkmath "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/common" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" @@ -25,10 +24,10 @@ func TestMigrateStore(t *testing.T) { k, ctx, _, _ := keepertest.CrosschainKeeper(t) amountZeta := SetRandomCctx(ctx, *k) err := v4.MigrateStore(ctx, k.GetObserverKeeper(), k) - assert.NoError(t, err) + require.NoError(t, err) zetaAccounting, found := k.GetZetaAccounting(ctx) - assert.True(t, found) - assert.Equal(t, amountZeta, zetaAccounting.AbortedZetaAmount) + require.True(t, found) + require.Equal(t, amountZeta, zetaAccounting.AbortedZetaAmount) }) t.Run("test migrate store move tss from cross chain to observer", func(t *testing.T) { k, ctx, _, zk := keepertest.CrosschainKeeper(t) @@ -46,15 +45,15 @@ func TestMigrateStore(t *testing.T) { store.Set(observertypes.KeyPrefix(fmt.Sprintf("%d", tss2.FinalizedZetaHeight)), tss2Bytes) err := v4.MigrateStore(ctx, k.GetObserverKeeper(), k) - assert.NoError(t, err) + require.NoError(t, err) tss, found := zk.ObserverKeeper.GetTSS(ctx) - assert.True(t, found) - assert.Equal(t, tss1, tss) + require.True(t, found) + require.Equal(t, tss1, tss) tssHistory := k.GetObserverKeeper().GetAllTSS(ctx) - assert.Equal(t, 2, len(tssHistory)) - assert.Equal(t, tss1, tssHistory[0]) - assert.Equal(t, tss2, tssHistory[1]) + require.Equal(t, 2, len(tssHistory)) + require.Equal(t, tss1, tssHistory[0]) + require.Equal(t, tss2, tssHistory[1]) }) t.Run("test migrate store move nonce from cross chain to observer", func(t *testing.T) { k, ctx, _, _ := keepertest.CrosschainKeeper(t) @@ -74,18 +73,18 @@ func TestMigrateStore(t *testing.T) { store.Set(types.KeyPrefix(fmt.Sprintf("%s-%d-%d", nonce.Tss, nonce.ChainId, nonce.Nonce)), k.GetCodec().MustMarshal(&nonce)) } err := v4.MigrateStore(ctx, k.GetObserverKeeper(), k) - assert.NoError(t, err) + require.NoError(t, err) pn, err := k.GetObserverKeeper().GetAllPendingNonces(ctx) - assert.NoError(t, err) + require.NoError(t, err) sort.Slice(pn, func(i, j int) bool { return pn[i].ChainId < pn[j].ChainId }) sort.Slice(pendingNonces, func(i, j int) bool { return pendingNonces[i].ChainId < pendingNonces[j].ChainId }) - assert.Equal(t, pendingNonces, pn) - assert.Equal(t, chainNonces, k.GetObserverKeeper().GetAllChainNonces(ctx)) - assert.Equal(t, nonceToCctxList, k.GetObserverKeeper().GetAllNonceToCctx(ctx)) + require.Equal(t, pendingNonces, pn) + require.Equal(t, chainNonces, k.GetObserverKeeper().GetAllChainNonces(ctx)) + require.Equal(t, nonceToCctxList, k.GetObserverKeeper().GetAllNonceToCctx(ctx)) }) } diff --git a/x/crosschain/migrations/v5/migrate_test.go b/x/crosschain/migrations/v5/migrate_test.go index 8033ddc3bf..19fa79b3a5 100644 --- a/x/crosschain/migrations/v5/migrate_test.go +++ b/x/crosschain/migrations/v5/migrate_test.go @@ -6,7 +6,6 @@ import ( "testing" "cosmossdk.io/math" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/common" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" @@ -30,7 +29,7 @@ func TestMigrateStore(t *testing.T) { v4ZetaAccountingAmount = v4ZetaAccountingAmount.Add(cctx.GetCurrentOutTxParam().Amount) } - assert.True(t, v5ZetaAccountingAmount.GT(v4ZetaAccountingAmount)) + require.True(t, v5ZetaAccountingAmount.GT(v4ZetaAccountingAmount)) // Previously set the zeta accounting k.SetZetaAccounting(ctx, crosschaintypes.ZetaAccounting{ AbortedZetaAmount: v4ZetaAccountingAmount, diff --git a/x/crosschain/types/message_refund_aborted_test.go b/x/crosschain/types/message_refund_aborted_test.go index 7f1a0643f6..40c432881b 100644 --- a/x/crosschain/types/message_refund_aborted_test.go +++ b/x/crosschain/types/message_refund_aborted_test.go @@ -3,7 +3,7 @@ package types_test import ( "testing" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/crosschain/types" ) @@ -12,25 +12,25 @@ func TestNewMsgRefundAbortedCCTX(t *testing.T) { t.Run("successfully validate message", func(t *testing.T) { cctx := sample.CrossChainTx(t, "test") msg := types.NewMsgRefundAbortedCCTX(sample.AccAddress(), cctx.Index, "") - assert.NoError(t, msg.ValidateBasic()) + require.NoError(t, msg.ValidateBasic()) }) t.Run("invalid creator address", func(t *testing.T) { cctx := sample.CrossChainTx(t, "test") msg := types.NewMsgRefundAbortedCCTX("invalid", cctx.Index, "") - assert.ErrorContains(t, msg.ValidateBasic(), "invalid creator address") + require.ErrorContains(t, msg.ValidateBasic(), "invalid creator address") }) t.Run("invalid cctx index", func(t *testing.T) { msg := types.NewMsgRefundAbortedCCTX(sample.AccAddress(), "invalid", "") - assert.ErrorContains(t, msg.ValidateBasic(), "invalid cctx index") + require.ErrorContains(t, msg.ValidateBasic(), "invalid cctx index") }) t.Run("invalid refund address", func(t *testing.T) { cctx := sample.CrossChainTx(t, "test") msg := types.NewMsgRefundAbortedCCTX(sample.AccAddress(), cctx.Index, "invalid") - assert.ErrorContains(t, msg.ValidateBasic(), "invalid address") + require.ErrorContains(t, msg.ValidateBasic(), "invalid address") }) t.Run("invalid refund address 2", func(t *testing.T) { cctx := sample.CrossChainTx(t, "test") msg := types.NewMsgRefundAbortedCCTX(sample.AccAddress(), cctx.Index, "0x91da5bf3F8Eb72724E6f50Ec6C3D199C6355c59") - assert.ErrorContains(t, msg.ValidateBasic(), "invalid address") + require.ErrorContains(t, msg.ValidateBasic(), "invalid address") }) } diff --git a/x/emissions/abci_test.go b/x/emissions/abci_test.go index 50651ca3e2..28ca327d50 100644 --- a/x/emissions/abci_test.go +++ b/x/emissions/abci_test.go @@ -142,27 +142,27 @@ package emissions_test // t.Run(tt.name, func(t *testing.T) { // app, ctx, _, minter := SetupApp(t, tt.params, getaZetaFromString(tt.startingEmissionPool)) // err := app.BankKeeper.SendCoinsFromAccountToModule(ctx, minter.GetAddress(), emissionsModuleTypes.ModuleName, getaZetaFromString(tt.startingEmissionPool)) -// assert.NoError(t, err) +// require.NoError(t, err) // GenerateTestDataMaths(app, ctx, tt.testMaxHeight, tt.inputFilename) // defer func(t *testing.T, fp string) { // err := os.RemoveAll(fp) -// assert.NoError(t, err) +// require.NoError(t, err) // }(t, tt.inputFilename) // // if tt.generateOnly { // return // } // inputTestData, err := GetInputData(tt.inputFilename) -// assert.NoError(t, err) +// require.NoError(t, err) // sort.SliceStable(inputTestData, func(i, j int) bool { return inputTestData[i].BlockHeight < inputTestData[j].BlockHeight }) // startHeight := ctx.BlockHeight() -// assert.Equal(t, startHeight, inputTestData[0].BlockHeight, "starting block height should be equal to the first block height in the input data") +// require.Equal(t, startHeight, inputTestData[0].BlockHeight, "starting block height should be equal to the first block height in the input data") // for i := startHeight; i < tt.testMaxHeight; i++ { // //The First distribution will occur only when begin-block is triggered // reservesFactor, bondFactor, durationFactor := app.EmissionsKeeper.GetBlockRewardComponents(ctx) -// assert.Equal(t, inputTestData[i-1].ReservesFactor, reservesFactor, "reserves factor should be equal to the input data"+fmt.Sprintf(" , block height: %d", i)) -// assert.Equal(t, inputTestData[i-1].BondFactor, bondFactor, "bond factor should be equal to the input data"+fmt.Sprintf(" , block height: %d", i)) -// assert.Equal(t, inputTestData[i-1].DurationFactor, durationFactor.String(), "duration factor should be equal to the input data"+fmt.Sprintf(" , block height: %d", i)) +// require.Equal(t, inputTestData[i-1].ReservesFactor, reservesFactor, "reserves factor should be equal to the input data"+fmt.Sprintf(" , block height: %d", i)) +// require.Equal(t, inputTestData[i-1].BondFactor, bondFactor, "bond factor should be equal to the input data"+fmt.Sprintf(" , block height: %d", i)) +// require.Equal(t, inputTestData[i-1].DurationFactor, durationFactor.String(), "duration factor should be equal to the input data"+fmt.Sprintf(" , block height: %d", i)) // emissionsModule.BeginBlocker(ctx, app.EmissionsKeeper) // ctx = ctx.WithBlockHeight(i + 1) // } diff --git a/x/emissions/keeper/block_rewards_components_test.go b/x/emissions/keeper/block_rewards_components_test.go index f8d206fbde..29acc7b07b 100644 --- a/x/emissions/keeper/block_rewards_components_test.go +++ b/x/emissions/keeper/block_rewards_components_test.go @@ -4,7 +4,7 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" emissionskeeper "github.com/zeta-chain/zetacore/x/emissions/keeper" ) @@ -43,8 +43,8 @@ func TestKeeper_CalculateFixedValidatorRewards(t *testing.T) { for _, tc := range tt { t.Run(tc.name, func(t *testing.T) { blockRewards, err := emissionskeeper.CalculateFixedValidatorRewards(tc.blockTimeInSecs) - assert.NoError(t, err) - assert.Equal(t, tc.expectedBlockRewards, blockRewards) + require.NoError(t, err) + require.Equal(t, tc.expectedBlockRewards, blockRewards) }) } } diff --git a/x/emissions/keeper/params_test.go b/x/emissions/keeper/params_test.go index 159e948a55..128d9ced3e 100644 --- a/x/emissions/keeper/params_test.go +++ b/x/emissions/keeper/params_test.go @@ -4,7 +4,7 @@ import ( "testing" sdkmath "cosmossdk.io/math" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" emissionstypes "github.com/zeta-chain/zetacore/x/emissions/types" ) @@ -235,9 +235,9 @@ func TestKeeper_GetParams(t *testing.T) { }, tt.isPanic) if tt.isPanic != "" { - assert.Equal(t, defaultParams, k.GetParams(ctx)) + require.Equal(t, defaultParams, k.GetParams(ctx)) } else { - assert.Equal(t, tt.params, k.GetParams(ctx)) + require.Equal(t, tt.params, k.GetParams(ctx)) } }) } @@ -247,7 +247,7 @@ func assertPanic(t *testing.T, f func(), errorLog string) { defer func() { r := recover() if r != nil { - assert.Contains(t, r, errorLog) + require.Contains(t, r, errorLog) } }() f() diff --git a/x/fungible/keeper/evm_hooks_test.go b/x/fungible/keeper/evm_hooks_test.go index 43e8a58326..696fbbd9cd 100644 --- a/x/fungible/keeper/evm_hooks_test.go +++ b/x/fungible/keeper/evm_hooks_test.go @@ -97,12 +97,12 @@ func TestKeeper_CheckPausedZRC20(t *testing.T) { t.Run(tc.name, func(t *testing.T) { k, ctx, _, _ := keepertest.FungibleKeeper(t) - requireUnpaused := func(zrc20 string) { + assertUnpaused := func(zrc20 string) { fc, found := k.GetForeignCoins(ctx, zrc20) require.True(t, found) require.False(t, fc.Paused) } - requirePaused := func(zrc20 string) { + assertPaused := func(zrc20 string) { fc, found := k.GetForeignCoins(ctx, zrc20) require.True(t, found) require.True(t, fc.Paused) @@ -117,10 +117,10 @@ func TestKeeper_CheckPausedZRC20(t *testing.T) { k.SetForeignCoins(ctx, pausedZRC20) // check paused status - requireUnpaused(addrUnpausedZRC20A.Hex()) - requireUnpaused(addrUnpausedZRC20B.Hex()) - requireUnpaused(addrUnpausedZRC20C.Hex()) - requirePaused(addrPausedZRC20.Hex()) + assertUnpaused(addrUnpausedZRC20A.Hex()) + assertUnpaused(addrUnpausedZRC20B.Hex()) + assertUnpaused(addrUnpausedZRC20C.Hex()) + assertPaused(addrPausedZRC20.Hex()) // process test err := k.CheckPausedZRC20(ctx, tc.receipt) diff --git a/x/fungible/keeper/evm_test.go b/x/fungible/keeper/evm_test.go index 80bd42a2f3..b6810a6998 100644 --- a/x/fungible/keeper/evm_test.go +++ b/x/fungible/keeper/evm_test.go @@ -32,7 +32,7 @@ func getValidChainID(t *testing.T) int64 { return list[0].ChainId } -// assert that a contract has been deployed by checking stored code is non-empty. +// require that a contract has been deployed by checking stored code is non-empty. func assertContractDeployment(t *testing.T, k *evmkeeper.Keeper, ctx sdk.Context, contractAddress common.Address) { acc := k.GetAccount(ctx, contractAddress) require.NotNil(t, acc) diff --git a/x/fungible/keeper/msg_server_update_zrc20_paused_status.go b/x/fungible/keeper/msg_server_update_zrc20_paused_status.go index fcbb37bfaa..e5527071ea 100644 --- a/x/fungible/keeper/msg_server_update_zrc20_paused_status.go +++ b/x/fungible/keeper/msg_server_update_zrc20_paused_status.go @@ -28,11 +28,11 @@ func (k msgServer) UpdateZRC20PausedStatus( // check if the sender is the admin // unpausing requires group2 admin - requirePolicyAccount := zetaObserverTypes.Policy_Type_group1 + requiredPolicyAccount := zetaObserverTypes.Policy_Type_group1 if msg.Action == types.UpdatePausedStatusAction_UNPAUSE { - requirePolicyAccount = zetaObserverTypes.Policy_Type_group2 + requiredPolicyAccount = zetaObserverTypes.Policy_Type_group2 } - if msg.Creator != k.observerKeeper.GetParams(ctx).GetAdminPolicyAccount(requirePolicyAccount) { + if msg.Creator != k.observerKeeper.GetParams(ctx).GetAdminPolicyAccount(requiredPolicyAccount) { return nil, cosmoserrors.Wrap(sdkerrors.ErrUnauthorized, "Update can only be executed by the correct policy account") } diff --git a/x/fungible/keeper/msg_server_update_zrc20_paused_status_test.go b/x/fungible/keeper/msg_server_update_zrc20_paused_status_test.go index 2183cccf9c..bc4238a780 100644 --- a/x/fungible/keeper/msg_server_update_zrc20_paused_status_test.go +++ b/x/fungible/keeper/msg_server_update_zrc20_paused_status_test.go @@ -18,12 +18,12 @@ func TestKeeper_UpdateZRC20PausedStatus(t *testing.T) { msgServer := keeper.NewMsgServerImpl(*k) admin := sample.AccAddress() - requireUnpaused := func(zrc20 string) { + assertUnpaused := func(zrc20 string) { fc, found := k.GetForeignCoins(ctx, zrc20) require.True(t, found) require.False(t, fc.Paused) } - requirePaused := func(zrc20 string) { + assertPaused := func(zrc20 string) { fc, found := k.GetForeignCoins(ctx, zrc20) require.True(t, found) require.True(t, fc.Paused) @@ -34,9 +34,9 @@ func TestKeeper_UpdateZRC20PausedStatus(t *testing.T) { k.SetForeignCoins(ctx, sample.ForeignCoins(t, zrc20A)) k.SetForeignCoins(ctx, sample.ForeignCoins(t, zrc20B)) k.SetForeignCoins(ctx, sample.ForeignCoins(t, zrc20C)) - requireUnpaused(zrc20A) - requireUnpaused(zrc20B) - requireUnpaused(zrc20C) + assertUnpaused(zrc20A) + assertUnpaused(zrc20B) + assertUnpaused(zrc20C) setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group1) @@ -50,9 +50,9 @@ func TestKeeper_UpdateZRC20PausedStatus(t *testing.T) { types.UpdatePausedStatusAction_PAUSE, )) require.NoError(t, err) - requirePaused(zrc20A) - requirePaused(zrc20B) - requireUnpaused(zrc20C) + assertPaused(zrc20A) + assertPaused(zrc20B) + assertUnpaused(zrc20C) setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group2) @@ -65,9 +65,9 @@ func TestKeeper_UpdateZRC20PausedStatus(t *testing.T) { types.UpdatePausedStatusAction_UNPAUSE, )) require.NoError(t, err) - requireUnpaused(zrc20A) - requirePaused(zrc20B) - requireUnpaused(zrc20C) + assertUnpaused(zrc20A) + assertPaused(zrc20B) + assertUnpaused(zrc20C) setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group1) @@ -80,9 +80,9 @@ func TestKeeper_UpdateZRC20PausedStatus(t *testing.T) { types.UpdatePausedStatusAction_PAUSE, )) require.NoError(t, err) - requireUnpaused(zrc20A) - requirePaused(zrc20B) - requireUnpaused(zrc20C) + assertUnpaused(zrc20A) + assertPaused(zrc20B) + assertUnpaused(zrc20C) setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group2) @@ -95,9 +95,9 @@ func TestKeeper_UpdateZRC20PausedStatus(t *testing.T) { types.UpdatePausedStatusAction_UNPAUSE, )) require.NoError(t, err) - requireUnpaused(zrc20A) - requirePaused(zrc20B) - requireUnpaused(zrc20C) + assertUnpaused(zrc20A) + assertPaused(zrc20B) + assertUnpaused(zrc20C) setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group1) @@ -112,9 +112,9 @@ func TestKeeper_UpdateZRC20PausedStatus(t *testing.T) { types.UpdatePausedStatusAction_PAUSE, )) require.NoError(t, err) - requirePaused(zrc20A) - requirePaused(zrc20B) - requirePaused(zrc20C) + assertPaused(zrc20A) + assertPaused(zrc20B) + assertPaused(zrc20C) setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group2) @@ -129,9 +129,9 @@ func TestKeeper_UpdateZRC20PausedStatus(t *testing.T) { types.UpdatePausedStatusAction_UNPAUSE, )) require.NoError(t, err) - requireUnpaused(zrc20A) - requireUnpaused(zrc20B) - requireUnpaused(zrc20C) + assertUnpaused(zrc20A) + assertUnpaused(zrc20B) + assertUnpaused(zrc20C) }) t.Run("should fail if invalid message", func(t *testing.T) { diff --git a/x/observer/keeper/grpc_query_node_account_test.go b/x/observer/keeper/grpc_query_node_account_test.go index 37585214cf..03facb08b4 100644 --- a/x/observer/keeper/grpc_query_node_account_test.go +++ b/x/observer/keeper/grpc_query_node_account_test.go @@ -5,7 +5,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/x/observer/types" "google.golang.org/grpc/codes" @@ -75,7 +74,7 @@ func TestNodeAccountQueryPaginated(t *testing.T) { resp, err := keeper.NodeAccountAll(wctx, request(nil, uint64(i), uint64(step), false)) require.NoError(t, err) for j := i; j < len(msgs) && j < i+step; j++ { - assert.Equal(t, &msgs[j], resp.NodeAccount[j-i]) + require.Equal(t, &msgs[j], resp.NodeAccount[j-i]) } } }) @@ -86,7 +85,7 @@ func TestNodeAccountQueryPaginated(t *testing.T) { resp, err := keeper.NodeAccountAll(wctx, request(next, 0, uint64(step), false)) require.NoError(t, err) for j := i; j < len(msgs) && j < i+step; j++ { - assert.Equal(t, &msgs[j], resp.NodeAccount[j-i]) + require.Equal(t, &msgs[j], resp.NodeAccount[j-i]) } next = resp.Pagination.NextKey } diff --git a/x/observer/keeper/grpc_query_nonces_test.go b/x/observer/keeper/grpc_query_nonces_test.go index 584f237e7b..6ec06efd28 100644 --- a/x/observer/keeper/grpc_query_nonces_test.go +++ b/x/observer/keeper/grpc_query_nonces_test.go @@ -5,7 +5,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" @@ -83,7 +82,7 @@ func TestChainNoncesQueryPaginated(t *testing.T) { resp, err := k.ChainNoncesAll(wctx, request(nil, uint64(i), uint64(step), false)) require.NoError(t, err) for j := i; j < len(chainNonces) && j < i+step; j++ { - assert.Equal(t, chainNonces[j], resp.ChainNonces[j-i]) + require.Equal(t, chainNonces[j], resp.ChainNonces[j-i]) } } }) @@ -94,7 +93,7 @@ func TestChainNoncesQueryPaginated(t *testing.T) { resp, err := k.ChainNoncesAll(wctx, request(next, 0, uint64(step), false)) require.NoError(t, err) for j := i; j < len(chainNonces) && j < i+step; j++ { - assert.Equal(t, chainNonces[j], resp.ChainNonces[j-i]) + require.Equal(t, chainNonces[j], resp.ChainNonces[j-i]) } next = resp.Pagination.NextKey } diff --git a/x/observer/keeper/keygen_test.go b/x/observer/keeper/keygen_test.go index a48c769c37..f14fa3aeef 100644 --- a/x/observer/keeper/keygen_test.go +++ b/x/observer/keeper/keygen_test.go @@ -4,7 +4,7 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/x/observer/types" ) @@ -22,13 +22,13 @@ func TestKeygenGet(t *testing.T) { keeper, ctx := SetupKeeper(t) item := createTestKeygen(keeper, ctx) rst, found := keeper.GetKeygen(ctx) - assert.True(t, found) - assert.Equal(t, item, rst) + require.True(t, found) + require.Equal(t, item, rst) } func TestKeygenRemove(t *testing.T) { keeper, ctx := SetupKeeper(t) createTestKeygen(keeper, ctx) keeper.RemoveKeygen(ctx) _, found := keeper.GetKeygen(ctx) - assert.False(t, found) + require.False(t, found) } diff --git a/x/observer/keeper/msg_server_add_block_header_test.go b/x/observer/keeper/msg_server_add_block_header_test.go index 7f475bad4c..34bde9c115 100644 --- a/x/observer/keeper/msg_server_add_block_header_test.go +++ b/x/observer/keeper/msg_server_add_block_header_test.go @@ -6,7 +6,6 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/ethereum/go-ethereum/rlp" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/common" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" @@ -17,19 +16,19 @@ import ( func TestMsgServer_AddBlockHeader(t *testing.T) { header, header2, header3, err := sample.EthHeader() - assert.NoError(t, err) + require.NoError(t, err) header1RLP, err := rlp.EncodeToBytes(header) - assert.NoError(t, err) + require.NoError(t, err) header2RLP, err := rlp.EncodeToBytes(header2) _ = header2RLP - assert.NoError(t, err) + require.NoError(t, err) header3RLP, err := rlp.EncodeToBytes(header3) - assert.NoError(t, err) + require.NoError(t, err) r := rand.New(rand.NewSource(9)) validator := sample.Validator(t, r) observerAddress, err := types.GetAccAddressFromOperatorAddress(validator.OperatorAddress) - assert.NoError(t, err) + require.NoError(t, err) // Add tests for btc headers : https://github.com/zeta-chain/node/issues/1336 tt := []struct { name string @@ -66,7 +65,7 @@ func TestMsgServer_AddBlockHeader(t *testing.T) { IsBtcTypeChainEnabled: true, validator: validator, wantErr: func(t require.TestingT, err error, i ...interface{}) { - assert.ErrorIs(t, err, types.ErrBlockHeaderVerificationDisabled) + require.ErrorIs(t, err, types.ErrBlockHeaderVerificationDisabled) }, }, { @@ -82,7 +81,7 @@ func TestMsgServer_AddBlockHeader(t *testing.T) { IsBtcTypeChainEnabled: true, validator: validator, wantErr: func(t require.TestingT, err error, i ...interface{}) { - assert.ErrorIs(t, err, types.ErrNotAuthorizedPolicy) + require.ErrorIs(t, err, types.ErrNotAuthorizedPolicy) }, }, { diff --git a/x/observer/keeper/msg_server_update_observer_test.go b/x/observer/keeper/msg_server_update_observer_test.go index 649ce6ca13..7fe73734d8 100644 --- a/x/observer/keeper/msg_server_update_observer_test.go +++ b/x/observer/keeper/msg_server_update_observer_test.go @@ -8,7 +8,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/observer/keeper" @@ -30,7 +30,7 @@ func TestMsgServer_UpdateObserver(t *testing.T) { k.GetStakingKeeper().SetValidator(ctx, validator) consAddress, err := validator.GetConsAddr() - assert.NoError(t, err) + require.NoError(t, err) k.GetSlashingKeeper().SetValidatorSigningInfo(ctx, consAddress, slashingtypes.ValidatorSigningInfo{ Address: consAddress.String(), StartHeight: 0, @@ -40,10 +40,10 @@ func TestMsgServer_UpdateObserver(t *testing.T) { }) accAddressOfValidator, err := types.GetAccAddressFromOperatorAddress(validator.OperatorAddress) - assert.NoError(t, err) + require.NoError(t, err) newOperatorAddress, err := types.GetAccAddressFromOperatorAddress(validatorNew.OperatorAddress) - assert.NoError(t, err) + require.NoError(t, err) count := uint64(0) @@ -66,10 +66,10 @@ func TestMsgServer_UpdateObserver(t *testing.T) { NewObserverAddress: newOperatorAddress.String(), UpdateReason: types.ObserverUpdateReason_Tombstoned, }) - assert.NoError(t, err) + require.NoError(t, err) acc, found := k.GetNodeAccount(ctx, newOperatorAddress.String()) - assert.True(t, found) - assert.Equal(t, newOperatorAddress.String(), acc.Operator) + require.True(t, found) + require.Equal(t, newOperatorAddress.String(), acc.Operator) }) t.Run("unable to update to a non validator address", func(t *testing.T) { @@ -84,7 +84,7 @@ func TestMsgServer_UpdateObserver(t *testing.T) { k.GetStakingKeeper().SetValidator(ctx, validator) consAddress, err := validator.GetConsAddr() - assert.NoError(t, err) + require.NoError(t, err) k.GetSlashingKeeper().SetValidatorSigningInfo(ctx, consAddress, slashingtypes.ValidatorSigningInfo{ Address: consAddress.String(), StartHeight: 0, @@ -94,10 +94,10 @@ func TestMsgServer_UpdateObserver(t *testing.T) { }) accAddressOfValidator, err := types.GetAccAddressFromOperatorAddress(validator.OperatorAddress) - assert.NoError(t, err) + require.NoError(t, err) newOperatorAddress, err := types.GetAccAddressFromOperatorAddress(validatorNew.OperatorAddress) - assert.NoError(t, err) + require.NoError(t, err) count := uint64(0) k.SetObserverSet(ctx, types.ObserverSet{ @@ -118,7 +118,7 @@ func TestMsgServer_UpdateObserver(t *testing.T) { NewObserverAddress: newOperatorAddress.String(), UpdateReason: types.ObserverUpdateReason_Tombstoned, }) - assert.ErrorIs(t, err, types.ErrUpdateObserver) + require.ErrorIs(t, err, types.ErrUpdateObserver) }) t.Run("unable to update tombstoned validator with with non operator account", func(t *testing.T) { @@ -135,7 +135,7 @@ func TestMsgServer_UpdateObserver(t *testing.T) { k.GetStakingKeeper().SetValidator(ctx, validator) consAddress, err := validator.GetConsAddr() - assert.NoError(t, err) + require.NoError(t, err) k.GetSlashingKeeper().SetValidatorSigningInfo(ctx, consAddress, slashingtypes.ValidatorSigningInfo{ Address: consAddress.String(), StartHeight: 0, @@ -145,7 +145,7 @@ func TestMsgServer_UpdateObserver(t *testing.T) { }) accAddressOfValidator, err := types.GetAccAddressFromOperatorAddress(validator.OperatorAddress) - assert.NoError(t, err) + require.NoError(t, err) count := uint64(0) k.SetObserverSet(ctx, types.ObserverSet{ @@ -162,7 +162,7 @@ func TestMsgServer_UpdateObserver(t *testing.T) { }) newOperatorAddress, err := types.GetAccAddressFromOperatorAddress(validatorNew.OperatorAddress) - assert.NoError(t, err) + require.NoError(t, err) _, err = srv.UpdateObserver(sdk.WrapSDKContext(ctx), &types.MsgUpdateObserver{ Creator: sample.AccAddress(), @@ -170,7 +170,7 @@ func TestMsgServer_UpdateObserver(t *testing.T) { NewObserverAddress: newOperatorAddress.String(), UpdateReason: types.ObserverUpdateReason_Tombstoned, }) - assert.ErrorIs(t, err, types.ErrUpdateObserver) + require.ErrorIs(t, err, types.ErrUpdateObserver) }) t.Run("unable to update non-tombstoned observer with update reason tombstoned", func(t *testing.T) { k, ctx := keepertest.ObserverKeeper(t) @@ -186,7 +186,7 @@ func TestMsgServer_UpdateObserver(t *testing.T) { k.GetStakingKeeper().SetValidator(ctx, validator) consAddress, err := validator.GetConsAddr() - assert.NoError(t, err) + require.NoError(t, err) k.GetSlashingKeeper().SetValidatorSigningInfo(ctx, consAddress, slashingtypes.ValidatorSigningInfo{ Address: consAddress.String(), StartHeight: 0, @@ -196,7 +196,7 @@ func TestMsgServer_UpdateObserver(t *testing.T) { }) accAddressOfValidator, err := types.GetAccAddressFromOperatorAddress(validator.OperatorAddress) - assert.NoError(t, err) + require.NoError(t, err) count := uint64(0) k.SetObserverSet(ctx, types.ObserverSet{ ObserverList: []string{accAddressOfValidator.String()}, @@ -212,7 +212,7 @@ func TestMsgServer_UpdateObserver(t *testing.T) { }) newOperatorAddress, err := types.GetAccAddressFromOperatorAddress(validatorNew.OperatorAddress) - assert.NoError(t, err) + require.NoError(t, err) _, err = srv.UpdateObserver(sdk.WrapSDKContext(ctx), &types.MsgUpdateObserver{ Creator: accAddressOfValidator.String(), @@ -220,7 +220,7 @@ func TestMsgServer_UpdateObserver(t *testing.T) { NewObserverAddress: newOperatorAddress.String(), UpdateReason: types.ObserverUpdateReason_Tombstoned, }) - assert.ErrorIs(t, err, types.ErrUpdateObserver) + require.ErrorIs(t, err, types.ErrUpdateObserver) }) t.Run("unable to update observer with no node account", func(t *testing.T) { k, ctx := keepertest.ObserverKeeper(t) @@ -236,7 +236,7 @@ func TestMsgServer_UpdateObserver(t *testing.T) { k.GetStakingKeeper().SetValidator(ctx, validator) consAddress, err := validator.GetConsAddr() - assert.NoError(t, err) + require.NoError(t, err) k.GetSlashingKeeper().SetValidatorSigningInfo(ctx, consAddress, slashingtypes.ValidatorSigningInfo{ Address: consAddress.String(), StartHeight: 0, @@ -246,7 +246,7 @@ func TestMsgServer_UpdateObserver(t *testing.T) { }) accAddressOfValidator, err := types.GetAccAddressFromOperatorAddress(validator.OperatorAddress) - assert.NoError(t, err) + require.NoError(t, err) count := uint64(0) k.SetObserverSet(ctx, types.ObserverSet{ ObserverList: []string{accAddressOfValidator.String()}, @@ -258,7 +258,7 @@ func TestMsgServer_UpdateObserver(t *testing.T) { }) newOperatorAddress, err := types.GetAccAddressFromOperatorAddress(validatorNew.OperatorAddress) - assert.NoError(t, err) + require.NoError(t, err) _, err = srv.UpdateObserver(sdk.WrapSDKContext(ctx), &types.MsgUpdateObserver{ Creator: accAddressOfValidator.String(), @@ -266,7 +266,7 @@ func TestMsgServer_UpdateObserver(t *testing.T) { NewObserverAddress: newOperatorAddress.String(), UpdateReason: types.ObserverUpdateReason_Tombstoned, }) - assert.ErrorIs(t, err, types.ErrNodeAccountNotFound) + require.ErrorIs(t, err, types.ErrNodeAccountNotFound) }) t.Run("unable to update observer when last observer count is missing", func(t *testing.T) { k, ctx := keepertest.ObserverKeeper(t) @@ -282,7 +282,7 @@ func TestMsgServer_UpdateObserver(t *testing.T) { k.GetStakingKeeper().SetValidator(ctx, validator) consAddress, err := validator.GetConsAddr() - assert.NoError(t, err) + require.NoError(t, err) k.GetSlashingKeeper().SetValidatorSigningInfo(ctx, consAddress, slashingtypes.ValidatorSigningInfo{ Address: consAddress.String(), StartHeight: 0, @@ -292,7 +292,7 @@ func TestMsgServer_UpdateObserver(t *testing.T) { }) accAddressOfValidator, err := types.GetAccAddressFromOperatorAddress(validator.OperatorAddress) - assert.NoError(t, err) + require.NoError(t, err) count := uint64(0) k.SetObserverSet(ctx, types.ObserverSet{ ObserverList: []string{accAddressOfValidator.String()}, @@ -303,7 +303,7 @@ func TestMsgServer_UpdateObserver(t *testing.T) { }) newOperatorAddress, err := types.GetAccAddressFromOperatorAddress(validatorNew.OperatorAddress) - assert.NoError(t, err) + require.NoError(t, err) _, err = srv.UpdateObserver(sdk.WrapSDKContext(ctx), &types.MsgUpdateObserver{ Creator: accAddressOfValidator.String(), @@ -311,7 +311,7 @@ func TestMsgServer_UpdateObserver(t *testing.T) { NewObserverAddress: newOperatorAddress.String(), UpdateReason: types.ObserverUpdateReason_Tombstoned, }) - assert.ErrorIs(t, err, types.ErrLastObserverCountNotFound) + require.ErrorIs(t, err, types.ErrLastObserverCountNotFound) }) t.Run("update observer using admin policy", func(t *testing.T) { k, ctx := keepertest.ObserverKeeper(t) @@ -330,7 +330,7 @@ func TestMsgServer_UpdateObserver(t *testing.T) { k.GetStakingKeeper().SetValidator(ctx, validator) consAddress, err := validator.GetConsAddr() - assert.NoError(t, err) + require.NoError(t, err) k.GetSlashingKeeper().SetValidatorSigningInfo(ctx, consAddress, slashingtypes.ValidatorSigningInfo{ Address: consAddress.String(), StartHeight: 0, @@ -340,7 +340,7 @@ func TestMsgServer_UpdateObserver(t *testing.T) { }) accAddressOfValidator, err := types.GetAccAddressFromOperatorAddress(validator.OperatorAddress) - assert.NoError(t, err) + require.NoError(t, err) count := uint64(0) k.SetObserverSet(ctx, types.ObserverSet{ ObserverList: []string{accAddressOfValidator.String()}, @@ -351,7 +351,7 @@ func TestMsgServer_UpdateObserver(t *testing.T) { }) newOperatorAddress, err := types.GetAccAddressFromOperatorAddress(validatorNew.OperatorAddress) - assert.NoError(t, err) + require.NoError(t, err) k.SetLastObserverCount(ctx, &types.LastObserverCount{ Count: count, @@ -363,10 +363,10 @@ func TestMsgServer_UpdateObserver(t *testing.T) { NewObserverAddress: newOperatorAddress.String(), UpdateReason: types.ObserverUpdateReason_AdminUpdate, }) - assert.NoError(t, err) + require.NoError(t, err) acc, found := k.GetNodeAccount(ctx, newOperatorAddress.String()) - assert.True(t, found) - assert.Equal(t, newOperatorAddress.String(), acc.Operator) + require.True(t, found) + require.Equal(t, newOperatorAddress.String(), acc.Operator) }) t.Run("fail to update observer using regular account and update type admin", func(t *testing.T) { k, ctx := keepertest.ObserverKeeper(t) @@ -383,7 +383,7 @@ func TestMsgServer_UpdateObserver(t *testing.T) { k.GetStakingKeeper().SetValidator(ctx, validator) consAddress, err := validator.GetConsAddr() - assert.NoError(t, err) + require.NoError(t, err) k.GetSlashingKeeper().SetValidatorSigningInfo(ctx, consAddress, slashingtypes.ValidatorSigningInfo{ Address: consAddress.String(), StartHeight: 0, @@ -393,7 +393,7 @@ func TestMsgServer_UpdateObserver(t *testing.T) { }) accAddressOfValidator, err := types.GetAccAddressFromOperatorAddress(validator.OperatorAddress) - assert.NoError(t, err) + require.NoError(t, err) count := uint64(0) k.SetObserverSet(ctx, types.ObserverSet{ ObserverList: []string{accAddressOfValidator.String()}, @@ -405,7 +405,7 @@ func TestMsgServer_UpdateObserver(t *testing.T) { }) newOperatorAddress, err := types.GetAccAddressFromOperatorAddress(validatorNew.OperatorAddress) - assert.NoError(t, err) + require.NoError(t, err) k.SetLastObserverCount(ctx, &types.LastObserverCount{ Count: count, @@ -417,7 +417,7 @@ func TestMsgServer_UpdateObserver(t *testing.T) { NewObserverAddress: newOperatorAddress.String(), UpdateReason: types.ObserverUpdateReason_AdminUpdate, }) - assert.ErrorIs(t, err, types.ErrUpdateObserver) + require.ErrorIs(t, err, types.ErrUpdateObserver) }) } @@ -426,9 +426,9 @@ func TestUpdateObserverList(t *testing.T) { oldObserverAddress := sample.AccAddress() newObserverAddress := sample.AccAddress() list := []string{sample.AccAddress(), sample.AccAddress(), sample.AccAddress(), oldObserverAddress} - assert.Equal(t, oldObserverAddress, list[3]) + require.Equal(t, oldObserverAddress, list[3]) keeper.UpdateObserverList(list, oldObserverAddress, newObserverAddress) - assert.Equal(t, 4, len(list)) - assert.Equal(t, newObserverAddress, list[3]) + require.Equal(t, 4, len(list)) + require.Equal(t, newObserverAddress, list[3]) }) } diff --git a/x/observer/keeper/node_account_test.go b/x/observer/keeper/node_account_test.go index 034b48ba67..26a5c47d1c 100644 --- a/x/observer/keeper/node_account_test.go +++ b/x/observer/keeper/node_account_test.go @@ -5,7 +5,7 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/x/observer/types" ) @@ -25,8 +25,8 @@ func TestNodeAccountGet(t *testing.T) { items := createNNodeAccount(keeper, ctx, 10) for _, item := range items { rst, found := keeper.GetNodeAccount(ctx, item.Operator) - assert.True(t, found) - assert.Equal(t, item, rst) + require.True(t, found) + require.Equal(t, item, rst) } } func TestNodeAccountRemove(t *testing.T) { @@ -35,12 +35,12 @@ func TestNodeAccountRemove(t *testing.T) { for _, item := range items { keeper.RemoveNodeAccount(ctx, item.Operator) _, found := keeper.GetNodeAccount(ctx, item.Operator) - assert.False(t, found) + require.False(t, found) } } func TestNodeAccountGetAll(t *testing.T) { keeper, ctx := SetupKeeper(t) items := createNNodeAccount(keeper, ctx, 10) - assert.Equal(t, items, keeper.GetAllNodeAccount(ctx)) + require.Equal(t, items, keeper.GetAllNodeAccount(ctx)) } diff --git a/x/observer/keeper/nonces_test.go b/x/observer/keeper/nonces_test.go index 2e201ae67e..aaf7369df1 100644 --- a/x/observer/keeper/nonces_test.go +++ b/x/observer/keeper/nonces_test.go @@ -3,7 +3,7 @@ package keeper_test import ( "testing" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" ) @@ -16,8 +16,8 @@ func TestChainNoncesGet(t *testing.T) { } for _, item := range items { rst, found := k.GetChainNonces(ctx, item.Index) - assert.True(t, found) - assert.Equal(t, item, rst) + require.True(t, found) + require.Equal(t, item, rst) } } func TestChainNoncesRemove(t *testing.T) { @@ -29,7 +29,7 @@ func TestChainNoncesRemove(t *testing.T) { for _, item := range items { k.RemoveChainNonces(ctx, item.Index) _, found := k.GetChainNonces(ctx, item.Index) - assert.False(t, found) + require.False(t, found) } } @@ -39,5 +39,5 @@ func TestChainNoncesGetAll(t *testing.T) { for _, item := range items { k.SetChainNonces(ctx, item) } - assert.Equal(t, items, k.GetAllChainNonces(ctx)) + require.Equal(t, items, k.GetAllChainNonces(ctx)) } diff --git a/x/observer/keeper/observer_set_test.go b/x/observer/keeper/observer_set_test.go index f1ca38fc8c..ca7212704a 100644 --- a/x/observer/keeper/observer_set_test.go +++ b/x/observer/keeper/observer_set_test.go @@ -3,7 +3,7 @@ package keeper_test import ( "testing" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" ) @@ -14,8 +14,8 @@ func TestKeeper_GetObserverSet(t *testing.T) { os := sample.ObserverSet(10) k.SetObserverSet(ctx, os) tfm, found := k.GetObserverSet(ctx) - assert.True(t, found) - assert.Equal(t, os, tfm) + require.True(t, found) + require.Equal(t, os, tfm) }) } @@ -24,8 +24,8 @@ func TestKeeper_IsAddressPartOfObserverSet(t *testing.T) { k, ctx := keepertest.ObserverKeeper(t) os := sample.ObserverSet(10) k.SetObserverSet(ctx, os) - assert.True(t, k.IsAddressPartOfObserverSet(ctx, os.ObserverList[0])) - assert.False(t, k.IsAddressPartOfObserverSet(ctx, sample.AccAddress())) + require.True(t, k.IsAddressPartOfObserverSet(ctx, os.ObserverList[0])) + require.False(t, k.IsAddressPartOfObserverSet(ctx, sample.AccAddress())) }) } @@ -36,11 +36,11 @@ func TestKeeper_AddObserverToSet(t *testing.T) { k.SetObserverSet(ctx, os) newObserver := sample.AccAddress() k.AddObserverToSet(ctx, newObserver) - assert.True(t, k.IsAddressPartOfObserverSet(ctx, newObserver)) - assert.False(t, k.IsAddressPartOfObserverSet(ctx, sample.AccAddress())) + require.True(t, k.IsAddressPartOfObserverSet(ctx, newObserver)) + require.False(t, k.IsAddressPartOfObserverSet(ctx, sample.AccAddress())) osNew, found := k.GetObserverSet(ctx) - assert.True(t, found) - assert.Len(t, osNew.ObserverList, len(os.ObserverList)+1) + require.True(t, found) + require.Len(t, osNew.ObserverList, len(os.ObserverList)+1) }) } @@ -50,10 +50,10 @@ func TestKeeper_RemoveObserverFromSet(t *testing.T) { os := sample.ObserverSet(10) k.SetObserverSet(ctx, os) k.RemoveObserverFromSet(ctx, os.ObserverList[0]) - assert.False(t, k.IsAddressPartOfObserverSet(ctx, os.ObserverList[0])) + require.False(t, k.IsAddressPartOfObserverSet(ctx, os.ObserverList[0])) osNew, found := k.GetObserverSet(ctx) - assert.True(t, found) - assert.Len(t, osNew.ObserverList, len(os.ObserverList)-1) + require.True(t, found) + require.Len(t, osNew.ObserverList, len(os.ObserverList)-1) }) } @@ -66,10 +66,10 @@ func TestKeeper_UpdateObserverAddress(t *testing.T) { observerSet.ObserverList = append(observerSet.ObserverList, oldObserverAddress) k.SetObserverSet(ctx, observerSet) err := k.UpdateObserverAddress(ctx, oldObserverAddress, newObserverAddress) - assert.NoError(t, err) + require.NoError(t, err) observerSet, found := k.GetObserverSet(ctx) - assert.True(t, found) - assert.Equal(t, newObserverAddress, observerSet.ObserverList[len(observerSet.ObserverList)-1]) + require.True(t, found) + require.Equal(t, newObserverAddress, observerSet.ObserverList[len(observerSet.ObserverList)-1]) }) t.Run("update observer address long observerList", func(t *testing.T) { k, ctx := keepertest.ObserverKeeper(t) @@ -79,10 +79,10 @@ func TestKeeper_UpdateObserverAddress(t *testing.T) { observerSet.ObserverList = append(observerSet.ObserverList, oldObserverAddress) k.SetObserverSet(ctx, observerSet) err := k.UpdateObserverAddress(ctx, oldObserverAddress, newObserverAddress) - assert.NoError(t, err) + require.NoError(t, err) observerMappers, found := k.GetObserverSet(ctx) - assert.True(t, found) - assert.Equal(t, newObserverAddress, observerMappers.ObserverList[len(observerMappers.ObserverList)-1]) + require.True(t, found) + require.Equal(t, newObserverAddress, observerMappers.ObserverList[len(observerMappers.ObserverList)-1]) }) t.Run("update observer address short observerList", func(t *testing.T) { k, ctx := keepertest.ObserverKeeper(t) @@ -92,9 +92,9 @@ func TestKeeper_UpdateObserverAddress(t *testing.T) { observerSet.ObserverList = append(observerSet.ObserverList, oldObserverAddress) k.SetObserverSet(ctx, observerSet) err := k.UpdateObserverAddress(ctx, oldObserverAddress, newObserverAddress) - assert.NoError(t, err) + require.NoError(t, err) observerMappers, found := k.GetObserverSet(ctx) - assert.True(t, found) - assert.Equal(t, newObserverAddress, observerMappers.ObserverList[len(observerMappers.ObserverList)-1]) + require.True(t, found) + require.Equal(t, newObserverAddress, observerMappers.ObserverList[len(observerMappers.ObserverList)-1]) }) } diff --git a/x/observer/keeper/tss_funds_migrator_test.go b/x/observer/keeper/tss_funds_migrator_test.go index b7cd45bec1..62d622e179 100644 --- a/x/observer/keeper/tss_funds_migrator_test.go +++ b/x/observer/keeper/tss_funds_migrator_test.go @@ -3,7 +3,7 @@ package keeper_test import ( "testing" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" ) @@ -14,8 +14,8 @@ func TestKeeper_GetTssFundMigrator(t *testing.T) { chain := sample.TssFundsMigrator(1) k.SetFundMigrator(ctx, chain) tfm, found := k.GetFundMigrator(ctx, chain.ChainId) - assert.True(t, found) - assert.Equal(t, chain, tfm) + require.True(t, found) + require.Equal(t, chain, tfm) }) t.Run("Verify only one migrator can be created for a chain", func(t *testing.T) { k, ctx := keepertest.ObserverKeeper(t) @@ -25,8 +25,8 @@ func TestKeeper_GetTssFundMigrator(t *testing.T) { tfm2.MigrationCctxIndex = "sampleIndex2" k.SetFundMigrator(ctx, tfm2) migratorList := k.GetAllTssFundMigrators(ctx) - assert.Equal(t, 1, len(migratorList)) - assert.Equal(t, tfm2, migratorList[0]) + require.Equal(t, 1, len(migratorList)) + require.Equal(t, tfm2, migratorList[0]) }) } diff --git a/x/observer/keeper/tss_test.go b/x/observer/keeper/tss_test.go index 37099a519b..0af8bae7f3 100644 --- a/x/observer/keeper/tss_test.go +++ b/x/observer/keeper/tss_test.go @@ -13,7 +13,6 @@ import ( "google.golang.org/grpc/status" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/assert" "github.com/zeta-chain/zetacore/x/observer/types" ) @@ -22,8 +21,8 @@ func TestTSSGet(t *testing.T) { tss := sample.Tss() k.SetTSS(ctx, tss) tssQueried, found := k.GetTSS(ctx) - assert.True(t, found) - assert.Equal(t, tss, tssQueried) + require.True(t, found) + require.Equal(t, tss, tssQueried) } func TestTSSRemove(t *testing.T) { @@ -32,7 +31,7 @@ func TestTSSRemove(t *testing.T) { k.SetTSS(ctx, tss) k.RemoveTSS(ctx) _, found := k.GetTSS(ctx) - assert.False(t, found) + require.False(t, found) } func TestTSSQuerySingle(t *testing.T) { @@ -105,9 +104,9 @@ func TestTSSQueryHistory(t *testing.T) { } else { require.Equal(t, len(tssList), len(response.TssList)) prevTss, found := keeper.GetPreviousTSS(ctx) - assert.Equal(t, tc.foundPrevious, found) + require.Equal(t, tc.foundPrevious, found) if found { - assert.Equal(t, tssList[len(tssList)-2], prevTss) + require.Equal(t, tssList[len(tssList)-2], prevTss) } } }) diff --git a/x/observer/keeper/utils_test.go b/x/observer/keeper/utils_test.go index e62cc57758..6534fc6200 100644 --- a/x/observer/keeper/utils_test.go +++ b/x/observer/keeper/utils_test.go @@ -7,7 +7,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" zetacommon "github.com/zeta-chain/zetacore/common" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" @@ -52,7 +51,7 @@ func TestKeeper_IsAuthorized(t *testing.T) { validator := sample.Validator(t, r) k.GetStakingKeeper().SetValidator(ctx, validator) consAddress, err := validator.GetConsAddr() - assert.NoError(t, err) + require.NoError(t, err) k.GetSlashingKeeper().SetValidatorSigningInfo(ctx, consAddress, slashingtypes.ValidatorSigningInfo{ Address: consAddress.String(), StartHeight: 0, @@ -66,7 +65,7 @@ func TestKeeper_IsAuthorized(t *testing.T) { k.SetObserverSet(ctx, types.ObserverSet{ ObserverList: []string{accAddressOfValidator.String()}, }) - assert.True(t, k.IsAuthorized(ctx, accAddressOfValidator.String())) + require.True(t, k.IsAuthorized(ctx, accAddressOfValidator.String())) }) t.Run("not authorized for tombstoned observer", func(t *testing.T) { @@ -78,7 +77,7 @@ func TestKeeper_IsAuthorized(t *testing.T) { validator := sample.Validator(t, r) k.GetStakingKeeper().SetValidator(ctx, validator) consAddress, err := validator.GetConsAddr() - assert.NoError(t, err) + require.NoError(t, err) k.GetSlashingKeeper().SetValidatorSigningInfo(ctx, consAddress, slashingtypes.ValidatorSigningInfo{ Address: consAddress.String(), StartHeight: 0, @@ -92,7 +91,7 @@ func TestKeeper_IsAuthorized(t *testing.T) { ObserverList: []string{accAddressOfValidator.String()}, }) - assert.False(t, k.IsAuthorized(ctx, accAddressOfValidator.String())) + require.False(t, k.IsAuthorized(ctx, accAddressOfValidator.String())) }) t.Run("not authorized for non-validator observer", func(t *testing.T) { @@ -104,7 +103,7 @@ func TestKeeper_IsAuthorized(t *testing.T) { validator := sample.Validator(t, r) consAddress, err := validator.GetConsAddr() - assert.NoError(t, err) + require.NoError(t, err) k.GetSlashingKeeper().SetValidatorSigningInfo(ctx, consAddress, slashingtypes.ValidatorSigningInfo{ Address: consAddress.String(), StartHeight: 0, @@ -118,7 +117,7 @@ func TestKeeper_IsAuthorized(t *testing.T) { ObserverList: []string{accAddressOfValidator.String()}, }) - assert.False(t, k.IsAuthorized(ctx, accAddressOfValidator.String())) + require.False(t, k.IsAuthorized(ctx, accAddressOfValidator.String())) }) } diff --git a/x/observer/migrations/v4/migrate_test.go b/x/observer/migrations/v4/migrate_test.go index b7d025fa60..a5bfd67f56 100644 --- a/x/observer/migrations/v4/migrate_test.go +++ b/x/observer/migrations/v4/migrate_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/cosmos/cosmos-sdk/store/prefix" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" v4 "github.com/zeta-chain/zetacore/x/observer/migrations/v4" "github.com/zeta-chain/zetacore/x/observer/types" @@ -22,10 +22,10 @@ func TestMigrateCrosschainFlags(t *testing.T) { store.Set([]byte{0}, val) err := v4.MigrateCrosschainFlags(ctx, k.StoreKey(), k.Codec()) - assert.NoError(t, err) + require.NoError(t, err) flags, found := k.GetCrosschainFlags(ctx) - assert.True(t, found) - assert.True(t, flags.BlockHeaderVerificationFlags.IsBtcTypeChainEnabled) - assert.True(t, flags.BlockHeaderVerificationFlags.IsEthTypeChainEnabled) + require.True(t, found) + require.True(t, flags.BlockHeaderVerificationFlags.IsBtcTypeChainEnabled) + require.True(t, flags.BlockHeaderVerificationFlags.IsEthTypeChainEnabled) } diff --git a/x/observer/migrations/v5/migrate_test.go b/x/observer/migrations/v5/migrate_test.go index d97b3dde69..8b83d5d0ed 100644 --- a/x/observer/migrations/v5/migrate_test.go +++ b/x/observer/migrations/v5/migrate_test.go @@ -5,7 +5,6 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/common" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" @@ -23,11 +22,11 @@ func TestMigrateObserverMapper(t *testing.T) { legacyObserverMapperStore.Set(types.KeyPrefix(legacyObserverMapper.Index), k.Codec().MustMarshal(legacyObserverMapper)) } err := v5.MigrateObserverMapper(ctx, k.StoreKey(), k.Codec()) - assert.NoError(t, err) + require.NoError(t, err) observerSet, found := k.GetObserverSet(ctx) - assert.True(t, found) + require.True(t, found) - assert.Equal(t, legacyObserverMapperList[0].ObserverList, observerSet.ObserverList) + require.Equal(t, legacyObserverMapperList[0].ObserverList, observerSet.ObserverList) iterator := sdk.KVStorePrefixIterator(legacyObserverMapperStore, []byte{}) defer iterator.Close() @@ -39,7 +38,7 @@ func TestMigrateObserverMapper(t *testing.T) { observerMappers = append(observerMappers, &val) } } - assert.Equal(t, 0, len(observerMappers)) + require.Equal(t, 0, len(observerMappers)) }) } diff --git a/x/observer/migrations/v6/migrate_test.go b/x/observer/migrations/v6/migrate_test.go index 574ece4be4..925c1b0b32 100644 --- a/x/observer/migrations/v6/migrate_test.go +++ b/x/observer/migrations/v6/migrate_test.go @@ -4,7 +4,7 @@ import ( "math" "testing" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" v6 "github.com/zeta-chain/zetacore/x/observer/migrations/v6" "github.com/zeta-chain/zetacore/x/observer/types" @@ -49,12 +49,12 @@ func TestMigrateObserverParams(t *testing.T) { FinalizedZetaHeight: finalizedZetaHeight, }) err := v6.MigrateStore(ctx, k) - assert.NoError(t, err) + require.NoError(t, err) keygen, found := k.GetKeygen(ctx) - assert.True(t, found) - assert.Equal(t, types.KeygenStatus_KeyGenSuccess, keygen.Status) - assert.Equal(t, keygenHeight, keygenHeight) - assert.Equal(t, participantList, participantList) + require.True(t, found) + require.Equal(t, types.KeygenStatus_KeyGenSuccess, keygen.Status) + require.Equal(t, keygenHeight, keygenHeight) + require.Equal(t, participantList, participantList) }) t.Run("Migrate when keygen is not Pending", func(t *testing.T) { k, ctx := keepertest.ObserverKeeper(t) @@ -76,12 +76,12 @@ func TestMigrateObserverParams(t *testing.T) { GranteePubkeys: participantList, }) err := v6.MigrateStore(ctx, k) - assert.NoError(t, err) + require.NoError(t, err) keygen, found := k.GetKeygen(ctx) - assert.True(t, found) - assert.Equal(t, types.KeygenStatus_KeyGenSuccess, keygen.Status) - assert.Equal(t, keygen.BlockNumber, keygenHeight) - assert.Equal(t, keygen.GranteePubkeys, participantList) + require.True(t, found) + require.Equal(t, types.KeygenStatus_KeyGenSuccess, keygen.Status) + require.Equal(t, keygen.BlockNumber, keygenHeight) + require.Equal(t, keygen.GranteePubkeys, participantList) }) } diff --git a/x/observer/types/ballot_test.go b/x/observer/types/ballot_test.go index 0e087309e3..2bd6441c48 100644 --- a/x/observer/types/ballot_test.go +++ b/x/observer/types/ballot_test.go @@ -4,7 +4,7 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func TestBallot_AddVote(t *testing.T) { @@ -206,9 +206,9 @@ func TestBallot_AddVote(t *testing.T) { } finalBallot, isFinalized := ballot.IsFinalizingVote() - assert.Equal(t, test.finalStatus, finalBallot.BallotStatus) - assert.Equal(t, test.finalVotes, finalBallot.Votes) - assert.Equal(t, test.isFinalized, isFinalized) + require.Equal(t, test.finalStatus, finalBallot.BallotStatus) + require.Equal(t, test.finalVotes, finalBallot.Votes) + require.Equal(t, test.isFinalized, isFinalized) }) } } @@ -336,10 +336,10 @@ func TestBallot_IsFinalizingVote(t *testing.T) { ballot.Votes = append(ballot.Votes, vote) ballot, isFinalizingVote = ballot.IsFinalizingVote() if isFinalizingVote { - assert.Equal(t, test.finalizingVote, index) + require.Equal(t, test.finalizingVote, index) } } - assert.Equal(t, test.finalStatus, ballot.BallotStatus) + require.Equal(t, test.finalStatus, ballot.BallotStatus) }) } } @@ -391,7 +391,7 @@ func Test_BuildRewardsDistribution(t *testing.T) { } rewardsMap := map[string]int64{} ballot.BuildRewardsDistribution(rewardsMap) - assert.Equal(t, test.expectedMap, rewardsMap) + require.Equal(t, test.expectedMap, rewardsMap) }) } diff --git a/x/observer/types/message_crosschain_flags_test.go b/x/observer/types/message_crosschain_flags_test.go index 199b80c13a..44fab49bbf 100644 --- a/x/observer/types/message_crosschain_flags_test.go +++ b/x/observer/types/message_crosschain_flags_test.go @@ -149,7 +149,7 @@ func TestMsgUpdateCrosschainFlags_GetRequiredGroup(t *testing.T) { want: types.Policy_Type_group1, }, { - name: "updating gas price increase flags requires group 2", + name: "updating gas price increase flags asserts group 2", msg: types.MsgUpdateCrosschainFlags{ Creator: sample.AccAddress(), IsInboundEnabled: false, @@ -168,7 +168,7 @@ func TestMsgUpdateCrosschainFlags_GetRequiredGroup(t *testing.T) { want: types.Policy_Type_group2, }, { - name: "enabling inbound requires group 2", + name: "enabling inbound asserts group 2", msg: types.MsgUpdateCrosschainFlags{ Creator: sample.AccAddress(), IsInboundEnabled: true, @@ -182,7 +182,7 @@ func TestMsgUpdateCrosschainFlags_GetRequiredGroup(t *testing.T) { want: types.Policy_Type_group2, }, { - name: "enabling outbound requires group 2", + name: "enabling outbound asserts group 2", msg: types.MsgUpdateCrosschainFlags{ Creator: sample.AccAddress(), IsInboundEnabled: false, @@ -196,7 +196,7 @@ func TestMsgUpdateCrosschainFlags_GetRequiredGroup(t *testing.T) { want: types.Policy_Type_group2, }, { - name: "enabling eth header verification requires group 2", + name: "enabling eth header verification asserts group 2", msg: types.MsgUpdateCrosschainFlags{ Creator: sample.AccAddress(), IsInboundEnabled: false, @@ -210,7 +210,7 @@ func TestMsgUpdateCrosschainFlags_GetRequiredGroup(t *testing.T) { want: types.Policy_Type_group2, }, { - name: "enabling btc header verification requires group 2", + name: "enabling btc header verification asserts group 2", msg: types.MsgUpdateCrosschainFlags{ Creator: sample.AccAddress(), IsInboundEnabled: false, diff --git a/zetaclient/bitcoin/bitcoin_signer_test.go b/zetaclient/bitcoin/bitcoin_signer_test.go index f8180a92f0..bbf15c1bba 100644 --- a/zetaclient/bitcoin/bitcoin_signer_test.go +++ b/zetaclient/bitcoin/bitcoin_signer_test.go @@ -22,7 +22,6 @@ import ( "github.com/btcsuite/btcutil" "github.com/ethereum/go-ethereum/crypto" "github.com/rs/zerolog" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/zetaclient/config" @@ -501,7 +500,7 @@ func TestSelectUTXOs(t *testing.T) { // output: [0.00002001, 0.01, 0.12, 0.18, 0.24, 0.5], 1.05002001 result, amount, _, _, err = ob.SelectUTXOs(1.0, 5, 2, math.MaxUint16, true) require.Nil(t, err) - assert.InEpsilon(t, 1.05002001, amount, 1e-8) + require.InEpsilon(t, 1.05002001, amount, 1e-8) require.Equal(t, ob.utxos[0:6], result) mineTxNSetNonceMark(ob, 2, dummyTxID, 0) // mine a transaction and set nonce-mark utxo for nonce 2 @@ -510,7 +509,7 @@ func TestSelectUTXOs(t *testing.T) { // output: [0.00002002, 0.24, 0.5, 1.26, 2.97, 3.28], 8.25002002 result, amount, _, _, err = ob.SelectUTXOs(8.05, 5, 3, math.MaxUint16, true) require.Nil(t, err) - assert.InEpsilon(t, 8.25002002, amount, 1e-8) + require.InEpsilon(t, 8.25002002, amount, 1e-8) expected := append([]btcjson.ListUnspentResult{ob.utxos[0]}, ob.utxos[4:9]...) require.Equal(t, expected, result) mineTxNSetNonceMark(ob, 24105431, dummyTxID, 0) // mine a transaction and set nonce-mark utxo for nonce 24105431 @@ -520,7 +519,7 @@ func TestSelectUTXOs(t *testing.T) { // output: [0.24107432, 0.01, 0.12, 0.18, 0.24], 0.55002002 result, amount, _, _, err = ob.SelectUTXOs(0.503, 5, 24105432, math.MaxUint16, true) require.Nil(t, err) - assert.InEpsilon(t, 0.79107431, amount, 1e-8) + require.InEpsilon(t, 0.79107431, amount, 1e-8) expected = append([]btcjson.ListUnspentResult{ob.utxos[4]}, ob.utxos[0:4]...) require.Equal(t, expected, result) mineTxNSetNonceMark(ob, 24105432, dummyTxID, 4) // mine a transaction and set nonce-mark utxo for nonce 24105432 @@ -530,7 +529,7 @@ func TestSelectUTXOs(t *testing.T) { // output: [0.24107432, 0.12, 0.18, 0.24, 0.5], 1.28107432 result, amount, _, _, err = ob.SelectUTXOs(1.0, 5, 24105433, math.MaxUint16, true) require.Nil(t, err) - assert.InEpsilon(t, 1.28107432, amount, 1e-8) + require.InEpsilon(t, 1.28107432, amount, 1e-8) expected = append([]btcjson.ListUnspentResult{ob.utxos[4]}, ob.utxos[1:4]...) expected = append(expected, ob.utxos[5]) require.Equal(t, expected, result) @@ -540,7 +539,7 @@ func TestSelectUTXOs(t *testing.T) { // output: [0.24107432, 1.26, 2.97, 3.28, 5.16, 8.72], 21.63107432 result, amount, _, _, err = ob.SelectUTXOs(16.03, 5, 24105433, math.MaxUint16, true) require.Nil(t, err) - assert.InEpsilon(t, 21.63107432, amount, 1e-8) + require.InEpsilon(t, 21.63107432, amount, 1e-8) expected = append([]btcjson.ListUnspentResult{ob.utxos[4]}, ob.utxos[6:11]...) require.Equal(t, expected, result) @@ -631,7 +630,7 @@ func TestUTXOConsolidation(t *testing.T) { // output: [0.24107431, 0.01, 0.12, 1.26, 0.5, 0.24], 2.37107431 result, amount, clsdtUtxo, clsdtValue, err := ob.SelectUTXOs(0.13, 5, 24105432, 5, true) require.Nil(t, err) - assert.InEpsilon(t, 2.37107431, amount, 1e-8) + require.InEpsilon(t, 2.37107431, amount, 1e-8) expected := append([]btcjson.ListUnspentResult{ob.utxos[4]}, ob.utxos[0:2]...) expected = append(expected, ob.utxos[6]) expected = append(expected, ob.utxos[5]) @@ -649,7 +648,7 @@ func TestUTXOConsolidation(t *testing.T) { // output: [0.24107431, 0.01, 0.12, 8.72, 5.16, 3.28, 2.97, 1.26, 0.5, 0.24, 0.18], 22.68107431 result, amount, clsdtUtxo, clsdtValue, err := ob.SelectUTXOs(0.13, 12, 24105432, 1, true) require.Nil(t, err) - assert.InEpsilon(t, 22.68107431, amount, 1e-8) + require.InEpsilon(t, 22.68107431, amount, 1e-8) expected := append([]btcjson.ListUnspentResult{ob.utxos[4]}, ob.utxos[0:2]...) for i := 10; i >= 5; i-- { // append consolidated utxos in descending order expected = append(expected, ob.utxos[i]) diff --git a/zetaclient/supplychecker/zeta_supply_checker_test.go b/zetaclient/supplychecker/zeta_supply_checker_test.go index c2b788cff1..73e3afd32d 100644 --- a/zetaclient/supplychecker/zeta_supply_checker_test.go +++ b/zetaclient/supplychecker/zeta_supply_checker_test.go @@ -6,7 +6,7 @@ import ( sdkmath "cosmossdk.io/math" "github.com/rs/zerolog" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func MustNewIntFromString(val string) sdkmath.Int { @@ -25,7 +25,7 @@ func TestZetaSupplyChecker_ValidateZetaSupply(t *testing.T) { externalChainTotalSupply sdkmath.Int zetaTokenSupplyOnNode sdkmath.Int ethLockedAmount sdkmath.Int - validate assert.BoolAssertionFunc + validate require.BoolAssertionFunc }{ { name: "1 zeta cctx in progress", @@ -35,8 +35,8 @@ func TestZetaSupplyChecker_ValidateZetaSupply(t *testing.T) { genesisAmounts: MustNewIntFromString("1000000000000000000"), zetaTokenSupplyOnNode: MustNewIntFromString("1000000000000000000"), ethLockedAmount: MustNewIntFromString("10000000000000000000"), - validate: func(t assert.TestingT, b bool, i ...interface{}) bool { - return assert.True(t, b, i...) + validate: func(t require.TestingT, b bool, i ...interface{}) { + require.True(t, b, i...) }, }, // Todo add more scenarios diff --git a/zetaclient/tss/tss_signer_test.go b/zetaclient/tss/tss_signer_test.go index 3a78c4a4d0..d4cc48f7ce 100644 --- a/zetaclient/tss/tss_signer_test.go +++ b/zetaclient/tss/tss_signer_test.go @@ -9,7 +9,7 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/testdata" "github.com/rs/zerolog" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/common/cosmos" ) @@ -36,17 +36,17 @@ func Test_LoadTssFilesFromDirectory(t *testing.T) { for _, tc := range tt { t.Run(tc.name, func(t *testing.T) { tempdir, err := os.MkdirTemp("", "test-tss") - assert.NoError(t, err) + require.NoError(t, err) err = GenerateKeyshareFiles(tc.n, tempdir) - assert.NoError(t, err) + require.NoError(t, err) tss := TSS{ logger: zerolog.New(os.Stdout), Keys: map[string]*Key{}, CurrentPubkey: "", } err = tss.LoadTssFilesFromDirectory(tempdir) - assert.NoError(t, err) - assert.Equal(t, tc.n, len(tss.Keys)) + require.NoError(t, err) + require.Equal(t, tc.n, len(tss.Keys)) }) } }