mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-24 23:35:19 +00:00
test(e2e): add Committee & Upgrade query clients (#1618)
Also: - updates kvtool - adds helper comment to upgrade e2e file - adjusts e2e account funding logging - [testnets] enable eip712 signing of cosmos coin msgs - [testnets] enable cosmos coin conversion for HARD
This commit is contained in:
parent
4b01b70e0c
commit
141e8ac450
47
ci/env/kava-internal-testnet/genesis.json
vendored
47
ci/env/kava-internal-testnet/genesis.json
vendored
@ -1964,6 +1964,44 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"nested_types": []
|
"nested_types": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"msg_type_url": "/kava.evmutil.v1beta1.MsgConvertCosmosCoinToERC20",
|
||||||
|
"msg_value_type_name": "MsgConvertCosmosCoinToERC20",
|
||||||
|
"value_types": [
|
||||||
|
{
|
||||||
|
"name": "initiator",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "receiver",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "amount",
|
||||||
|
"type": "Coin"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"nested_types": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"msg_type_url": "/kava.evmutil.v1beta1.MsgConvertCosmosCoinFromERC20",
|
||||||
|
"msg_value_type_name": "MsgConvertCosmosCoinFromERC20",
|
||||||
|
"value_types": [
|
||||||
|
{
|
||||||
|
"name": "initiator",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "receiver",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "amount",
|
||||||
|
"type": "Coin"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"nested_types": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"allow_unprotected_txs": false
|
"allow_unprotected_txs": false
|
||||||
@ -1972,7 +2010,14 @@
|
|||||||
"evmutil": {
|
"evmutil": {
|
||||||
"accounts": [],
|
"accounts": [],
|
||||||
"params": {
|
"params": {
|
||||||
"allowed_cosmos_denoms": [],
|
"allowed_cosmos_denoms": [
|
||||||
|
{
|
||||||
|
"cosmos_denom": "hard",
|
||||||
|
"name": "HARD",
|
||||||
|
"symbol": "HARD",
|
||||||
|
"decimals": 6
|
||||||
|
}
|
||||||
|
],
|
||||||
"enabled_conversion_pairs": [
|
"enabled_conversion_pairs": [
|
||||||
{
|
{
|
||||||
"kava_erc20_address": "0xBb304f44b7EFD865361F2AD973d8ebA433893ABC",
|
"kava_erc20_address": "0xBb304f44b7EFD865361F2AD973d8ebA433893ABC",
|
||||||
|
47
ci/env/kava-protonet/genesis.json
vendored
47
ci/env/kava-protonet/genesis.json
vendored
@ -1996,6 +1996,44 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"nested_types": []
|
"nested_types": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"msg_type_url": "/kava.evmutil.v1beta1.MsgConvertCosmosCoinToERC20",
|
||||||
|
"msg_value_type_name": "MsgConvertCosmosCoinToERC20",
|
||||||
|
"value_types": [
|
||||||
|
{
|
||||||
|
"name": "initiator",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "receiver",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "amount",
|
||||||
|
"type": "Coin"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"nested_types": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"msg_type_url": "/kava.evmutil.v1beta1.MsgConvertCosmosCoinFromERC20",
|
||||||
|
"msg_value_type_name": "MsgConvertCosmosCoinFromERC20",
|
||||||
|
"value_types": [
|
||||||
|
{
|
||||||
|
"name": "initiator",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "receiver",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "amount",
|
||||||
|
"type": "Coin"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"nested_types": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"allow_unprotected_txs": false
|
"allow_unprotected_txs": false
|
||||||
@ -2004,7 +2042,14 @@
|
|||||||
"evmutil": {
|
"evmutil": {
|
||||||
"accounts": [],
|
"accounts": [],
|
||||||
"params": {
|
"params": {
|
||||||
"allowed_cosmos_denoms": [],
|
"allowed_cosmos_denoms": [
|
||||||
|
{
|
||||||
|
"cosmos_denom": "hard",
|
||||||
|
"name": "HARD",
|
||||||
|
"symbol": "HARD",
|
||||||
|
"decimals": 6
|
||||||
|
}
|
||||||
|
],
|
||||||
"enabled_conversion_pairs": [
|
"enabled_conversion_pairs": [
|
||||||
{
|
{
|
||||||
"kava_erc20_address": "0xBb304f44b7EFD865361F2AD973d8ebA433893ABC",
|
"kava_erc20_address": "0xBb304f44b7EFD865361F2AD973d8ebA433893ABC",
|
||||||
|
@ -19,7 +19,7 @@ E2E_INCLUDE_AUTOMATED_UPGRADE=false
|
|||||||
# E2E_KAVA_UPGRADE_NAME is the name of the upgrade that must be in the current local image.
|
# E2E_KAVA_UPGRADE_NAME is the name of the upgrade that must be in the current local image.
|
||||||
E2E_KAVA_UPGRADE_NAME=
|
E2E_KAVA_UPGRADE_NAME=
|
||||||
# E2E_KAVA_UPGRADE_HEIGHT is the height at which the upgrade will be applied.
|
# E2E_KAVA_UPGRADE_HEIGHT is the height at which the upgrade will be applied.
|
||||||
# If IBC tests are enabled this should be >50. Otherwise, this should be >10.
|
# If IBC tests are enabled this should be >30. Otherwise, this should be >10.
|
||||||
E2E_KAVA_UPGRADE_HEIGHT=
|
E2E_KAVA_UPGRADE_HEIGHT=
|
||||||
# E2E_KAVA_UPGRADE_BASE_IMAGE_TAG is the tag of the docker image the chain should upgrade from.
|
# E2E_KAVA_UPGRADE_BASE_IMAGE_TAG is the tag of the docker image the chain should upgrade from.
|
||||||
E2E_KAVA_UPGRADE_BASE_IMAGE_TAG=
|
E2E_KAVA_UPGRADE_BASE_IMAGE_TAG=
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package e2e_test
|
package e2e_test
|
||||||
|
|
||||||
import "fmt"
|
import (
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
// TestUpgradeHandler can be used to run tests post-upgrade. If an upgrade is enabled, all tests
|
// TestUpgradeHandler can be used to run tests post-upgrade. If an upgrade is enabled, all tests
|
||||||
// are run against the upgraded chain. However, this file is a good place to consolidate all
|
// are run against the upgraded chain. However, this file is a good place to consolidate all
|
||||||
@ -9,4 +11,8 @@ func (suite *IntegrationTestSuite) TestUpgradeHandler() {
|
|||||||
suite.SkipIfUpgradeDisabled()
|
suite.SkipIfUpgradeDisabled()
|
||||||
fmt.Println("An upgrade has run!")
|
fmt.Println("An upgrade has run!")
|
||||||
suite.True(true)
|
suite.True(true)
|
||||||
|
|
||||||
|
// Uncomment & use these contexts to compare chain state before & after the upgrade occurs.
|
||||||
|
// beforeUpgradeCtx := util.CtxAtHeight(suite.UpgradeHeight - 1)
|
||||||
|
// afterUpgradeCtx := util.CtxAtHeight(suite.UpgradeHeight)
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 98d25c9b659eaee465c72198f387268ce763400c
|
Subproject commit 40f6311b6e92aa5b716d029da6047c2f3f22c882
|
@ -6,22 +6,27 @@ import (
|
|||||||
"math/big"
|
"math/big"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/cosmos/cosmos-sdk/client/grpc/tmservice"
|
"github.com/cosmos/cosmos-sdk/client/grpc/tmservice"
|
||||||
"github.com/cosmos/cosmos-sdk/crypto/hd"
|
"github.com/cosmos/cosmos-sdk/crypto/hd"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
txtypes "github.com/cosmos/cosmos-sdk/types/tx"
|
txtypes "github.com/cosmos/cosmos-sdk/types/tx"
|
||||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||||
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
|
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||||
|
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum"
|
"github.com/ethereum/go-ethereum"
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/ethclient"
|
"github.com/ethereum/go-ethereum/ethclient"
|
||||||
|
|
||||||
evmtypes "github.com/evmos/ethermint/x/evm/types"
|
evmtypes "github.com/evmos/ethermint/x/evm/types"
|
||||||
"github.com/stretchr/testify/require"
|
|
||||||
|
|
||||||
"github.com/kava-labs/kava/app"
|
"github.com/kava-labs/kava/app"
|
||||||
kavaparams "github.com/kava-labs/kava/app/params"
|
kavaparams "github.com/kava-labs/kava/app/params"
|
||||||
"github.com/kava-labs/kava/tests/e2e/runner"
|
"github.com/kava-labs/kava/tests/e2e/runner"
|
||||||
"github.com/kava-labs/kava/tests/util"
|
"github.com/kava-labs/kava/tests/util"
|
||||||
|
committeetypes "github.com/kava-labs/kava/x/committee/types"
|
||||||
communitytypes "github.com/kava-labs/kava/x/community/types"
|
communitytypes "github.com/kava-labs/kava/x/community/types"
|
||||||
earntypes "github.com/kava-labs/kava/x/earn/types"
|
earntypes "github.com/kava-labs/kava/x/earn/types"
|
||||||
evmutiltypes "github.com/kava-labs/kava/x/evmutil/types"
|
evmutiltypes "github.com/kava-labs/kava/x/evmutil/types"
|
||||||
@ -42,12 +47,14 @@ type Chain struct {
|
|||||||
|
|
||||||
Auth authtypes.QueryClient
|
Auth authtypes.QueryClient
|
||||||
Bank banktypes.QueryClient
|
Bank banktypes.QueryClient
|
||||||
|
Committee committeetypes.QueryClient
|
||||||
Community communitytypes.QueryClient
|
Community communitytypes.QueryClient
|
||||||
Earn earntypes.QueryClient
|
Earn earntypes.QueryClient
|
||||||
Evm evmtypes.QueryClient
|
Evm evmtypes.QueryClient
|
||||||
Evmutil evmutiltypes.QueryClient
|
Evmutil evmutiltypes.QueryClient
|
||||||
Tm tmservice.ServiceClient
|
Tm tmservice.ServiceClient
|
||||||
Tx txtypes.ServiceClient
|
Tx txtypes.ServiceClient
|
||||||
|
Upgrade upgradetypes.QueryClient
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewChain creates the query clients & signing account management for a chain run on a set of ports.
|
// NewChain creates the query clients & signing account management for a chain run on a set of ports.
|
||||||
@ -76,12 +83,14 @@ func NewChain(t *testing.T, details *runner.ChainDetails, fundedAccountMnemonic
|
|||||||
|
|
||||||
chain.Auth = authtypes.NewQueryClient(grpcConn)
|
chain.Auth = authtypes.NewQueryClient(grpcConn)
|
||||||
chain.Bank = banktypes.NewQueryClient(grpcConn)
|
chain.Bank = banktypes.NewQueryClient(grpcConn)
|
||||||
|
chain.Committee = committeetypes.NewQueryClient(grpcConn)
|
||||||
chain.Community = communitytypes.NewQueryClient(grpcConn)
|
chain.Community = communitytypes.NewQueryClient(grpcConn)
|
||||||
chain.Earn = earntypes.NewQueryClient(grpcConn)
|
chain.Earn = earntypes.NewQueryClient(grpcConn)
|
||||||
chain.Evm = evmtypes.NewQueryClient(grpcConn)
|
chain.Evm = evmtypes.NewQueryClient(grpcConn)
|
||||||
chain.Evmutil = evmutiltypes.NewQueryClient(grpcConn)
|
chain.Evmutil = evmutiltypes.NewQueryClient(grpcConn)
|
||||||
chain.Tm = tmservice.NewServiceClient(grpcConn)
|
chain.Tm = tmservice.NewServiceClient(grpcConn)
|
||||||
chain.Tx = txtypes.NewServiceClient(grpcConn)
|
chain.Tx = txtypes.NewServiceClient(grpcConn)
|
||||||
|
chain.Upgrade = upgradetypes.NewQueryClient(grpcConn)
|
||||||
|
|
||||||
// initialize accounts map
|
// initialize accounts map
|
||||||
chain.accounts = make(map[string]*SigningAccount)
|
chain.accounts = make(map[string]*SigningAccount)
|
||||||
@ -94,7 +103,7 @@ func NewChain(t *testing.T, details *runner.ChainDetails, fundedAccountMnemonic
|
|||||||
)
|
)
|
||||||
|
|
||||||
// check that funded account is actually funded.
|
// check that funded account is actually funded.
|
||||||
fmt.Printf("account used for funding (%s) address: %s\n", FundedAccountName, whale.SdkAddress)
|
fmt.Printf("[%s] account used for funding (%s) address: %s\n", chain.ChainId, FundedAccountName, whale.SdkAddress)
|
||||||
whaleFunds := chain.QuerySdkForBalances(whale.SdkAddress)
|
whaleFunds := chain.QuerySdkForBalances(whale.SdkAddress)
|
||||||
if whaleFunds.IsZero() {
|
if whaleFunds.IsZero() {
|
||||||
chain.t.Fatal("funded account mnemonic is for account with no funds")
|
chain.t.Fatal("funded account mnemonic is for account with no funds")
|
||||||
|
Loading…
Reference in New Issue
Block a user