Skip to content

Commit

Permalink
test chain id
Browse files Browse the repository at this point in the history
  • Loading branch information
mmsqe committed Oct 20, 2023
1 parent 832585e commit ed641eb
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
5 changes: 4 additions & 1 deletion integration_tests/cosmoscli.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ def staking_pool(self, bonded=True):

def transfer(self, from_, to, coins, generate_only=False, fees=None, **kwargs):
kwargs.setdefault("gas_prices", DEFAULT_GAS_PRICE)
return json.loads(
rsp = json.loads(
self.raw(
"tx",
"bank",
Expand All @@ -333,6 +333,9 @@ def transfer(self, from_, to, coins, generate_only=False, fees=None, **kwargs):
**kwargs,
)
)
if rsp["code"] == 0:
rsp = self.event_query_tx_for(rsp["txhash"])
return rsp

def get_delegated_amount(self, which_addr):
return json.loads(
Expand Down
30 changes: 30 additions & 0 deletions integration_tests/test_client_id.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import pytest
import tomlkit
from pystarport import ports

from .utils import wait_for_port


def test_config_client_id(cronos):
n0 = "cronos_777-1-node0"
cronos.supervisorctl("stop", n0)
cli = cronos.cosmos_cli(0)
home = cli.data_dir
file = "config/client.toml"

def edit_client_cfg(chain_id):
node0 = tomlkit.parse((home / file).read_text())
node0["chain-id"] = chain_id
(home / file).write_text(tomlkit.dumps(node0))

edit_client_cfg("")
with pytest.raises(Exception):
cronos.supervisorctl("start", n0)

edit_client_cfg("cronos_777-1")
cronos.supervisorctl("start", n0)
wait_for_port(ports.rpc_port(cronos.base_port(0)))

# transfer without chain-id flag should work
rsp = cli.transfer("signer1", cli.address("validator"), "1basetcro")
assert rsp["code"] == 0, rsp["raw_log"]

Check failure on line 30 in integration_tests/test_client_id.py

View workflow job for this annotation

GitHub Actions / integration_tests

test_config_client_id[True] AssertionError: github.com/cosmos/cosmos-sdk/x/auth/ante.SigVerificationDecorator.AnteHandle github.com/cosmos/cosmos-sdk/x/auth/ante/sigverify.go:302 github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1 github.com/cosmos/cosmos-sdk/types/handler.go:49 github.com/cosmos/cosmos-sdk/x/auth/ante.SigGasConsumeDecorator.AnteHandle github.com/cosmos/cosmos-sdk/x/auth/ante/sigverify.go:194 github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1 github.com/cosmos/cosmos-sdk/types/handler.go:49 github.com/cosmos/cosmos-sdk/x/auth/ante.ValidateSigCountDecorator.AnteHandle github.com/cosmos/cosmos-sdk/x/auth/ante/sigverify.go:384 github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1 github.com/cosmos/cosmos-sdk/types/handler.go:49 github.com/cosmos/cosmos-sdk/x/auth/ante.SetPubKeyDecorator.AnteHandle github.com/cosmos/cosmos-sdk/x/auth/ante/sigverify.go:126 github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1 github.com/cosmos/cosmos-sdk/types/handler.go:49 github.com/cosmos/cosmos-sdk/x/auth/ante.DeductFeeDecorator.AnteHandle github.com/cosmos/cosmos-sdk/x/auth/ante/fee.go:67 github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1 github.com/cosmos/cosmos-sdk/types/handler.go:49 github.com/cosmos/cosmos-sdk/x/auth/ante.ConsumeTxSizeGasDecorator.AnteHandle github.com/cosmos/cosmos-sdk/x/auth/ante/basic.go:143 github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1 github.com/cosmos/cosmos-sdk/types/handler.go:49 github.com/cosmos/cosmos-sdk/x/auth/ante.ValidateMemoDecorator.AnteHandle github.com/cosmos/cosmos-sdk/x/auth/ante/basic.go:67 github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1 github.com/cosmos/cosmos-sdk/types/handler.go:49 github.com/evmos/ethermint/app/ante.MinGasPriceDecorator.AnteHandle github.com/evmos/ethermint/app/ante/fees.go:91 github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1 github.com/cosmos/cosmos-sdk/types/handler.go:49 github.com/cosmos/cosmos-sdk/x/auth/ante.TxTimeoutHeightDecorator.AnteHandle github.com/cosmos/cosmos-sdk/x/auth/ante/basic.go:206 github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1 github.com/cosmos/cosmos-sdk/types/handler.go:49 github.com/cosmos/cosmos-sdk/x/auth/ante.ValidateBasicDecorator.AnteHandle github.com/cosmos/cosmos-sdk/x/auth/ante/basic.go:34 github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1 github.com/cosmos/cosmos-sdk/types/handler.go:49 github.com/cosmos/cosmos-sdk/x/auth/ante.RejectExtensionOptionsDecorator.AnteHandle github.com/cosmos/cosmos-sdk/x/auth/ante/ext.go:52 github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1 github.com/cosmos/cosmos-sdk/types/handler.go:49 github.com/cosmos/cosmos-sdk/x/auth/ante.SetUpContextDecorator.AnteHandle github.com/cosmos/cosmos-sdk/x/auth/ante/setup.go:70 github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1 github.com/cosmos/cosmos-sdk/types/handler.go:49 github.com/evmos/ethermint/app/ante.AuthzLimiterDecorator.AnteHandle github.com/evmos/ethermint/app/ante/authz.go:54 github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1 github.com/cosmos/cosmos-sdk/types/handler.go:49 github.com/evmos/ethermint/app/ante.RejectMessagesDecorator.AnteHandle github.com/evmos/ethermint/app/ante/reject_msgs.go:40 github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1 github.com/cosmos/cosmos-sdk/types/handler.go:49 github.com/evmos/ethermint/app/ante.NewAnteHandler.func1 github.com/evmos/ethermint/app/ante/ante.go:102 github.com/crypto-org-chain/cronos/v2/app/ante.NewAnteHandler.func1 github.com/crypto-org-chain/cronos/v2/app/ante/ante.go:52 github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).runTx github.com/cosmos/cosmos-sdk/baseapp/baseapp.go:698 signature verification failed; please verify account number (0) and chain-id (cronos_777-1): unauthorized assert 4 == 0

0 comments on commit ed641eb

Please sign in to comment.