diff --git a/integration_tests/contracts/contracts/Random.sol b/integration_tests/contracts/contracts/Random.sol new file mode 100644 index 0000000000..8f1665d0fb --- /dev/null +++ b/integration_tests/contracts/contracts/Random.sol @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.15; + +contract Random { + function randomTokenId() public returns (uint256) { + return uint256(keccak256(abi.encodePacked(block.prevrandao))); + } +} \ No newline at end of file diff --git a/integration_tests/test_basic.py b/integration_tests/test_basic.py index d25ac588f8..5b9bcae095 100644 --- a/integration_tests/test_basic.py +++ b/integration_tests/test_basic.py @@ -79,6 +79,16 @@ def approve_proposal_legacy(node, rsp): return amount +def test_random(cronos): + w3 = cronos.w3 + contract = deploy_contract( + w3, + CONTRACTS["Random"], + key=KEYS["validator"], + ) + print(contract.caller.randomTokenId()) + + def test_ica_enabled(cronos): cli = cronos.cosmos_cli() p = cli.query_icacontroller_params() diff --git a/integration_tests/test_upgrade.py b/integration_tests/test_upgrade.py index 54cdb6813e..67d0043022 100644 --- a/integration_tests/test_upgrade.py +++ b/integration_tests/test_upgrade.py @@ -155,6 +155,9 @@ def exec(c, tmp_path_factory, testnet=True): assert rsp["code"] == 0, rsp["raw_log"] approve_proposal(c, rsp, event_query_tx=testnet) + nonce_bf = c.w3.eth.get_transaction_count(ADDRS["validator"]) + print("mm-nonce-bf", nonce_bf) + # update cli chain binary c.chain_binary = ( Path(c.chain_binary).parent.parent.parent / f"{plan_name}/bin/cronosd" @@ -170,6 +173,9 @@ def exec(c, tmp_path_factory, testnet=True): # check basic tx works wait_for_port(ports.evmrpc_port(c.base_port(0))) + + nonce_af = c.w3.eth.get_transaction_count(ADDRS["validator"]) + print("mm-nonce-af", nonce_af) receipt = send_transaction( c.w3, { @@ -180,6 +186,7 @@ def exec(c, tmp_path_factory, testnet=True): }, ) assert receipt.status == 1 + return if not testnet: # after upgrade, PUSH0 opcode is supported diff --git a/integration_tests/utils.py b/integration_tests/utils.py index 3dd6bf190b..323207d83e 100644 --- a/integration_tests/utils.py +++ b/integration_tests/utils.py @@ -59,6 +59,7 @@ "CosmosERC20": "CosmosToken.sol", "TestBank": "TestBank.sol", "TestICA": "TestICA.sol", + "Random": "Random.sol", } diff --git a/scripts/run-integration-tests b/scripts/run-integration-tests index c2278eb22b..76a457a2f3 100755 --- a/scripts/run-integration-tests +++ b/scripts/run-integration-tests @@ -10,12 +10,13 @@ cd ../integration_tests/contracts HUSKY_SKIP_INSTALL=1 npm install npm run typechain cd .. -TESTS_TO_RUN="${TESTS_TO_RUN:-all}" -if [[ "$TESTS_TO_RUN" == "all" ]]; then - echo "run all tests" - cmd="pytest -vv -s" -else - echo "run tests matching $TESTS_TO_RUN" - cmd="pytest -vv -s -m '$TESTS_TO_RUN'" -fi +# TESTS_TO_RUN="${TESTS_TO_RUN:-all}" +# if [[ "$TESTS_TO_RUN" == "all" ]]; then +# echo "run all tests" +# cmd="pytest -vv -s" +# else +# echo "run tests matching $TESTS_TO_RUN" +# cmd="pytest -vv -s -m '$TESTS_TO_RUN'" +# fi +cmd="pytest -v -s test_upgrade.py::test_cosmovisor_upgrade_mainnet" nix-shell --run "$cmd"