diff --git a/tests/integration/generate_fixtures/common.py b/tests/integration/generate_fixtures/common.py index 4a1e490f80..937f6ceba8 100644 --- a/tests/integration/generate_fixtures/common.py +++ b/tests/integration/generate_fixtures/common.py @@ -35,7 +35,7 @@ "chainId": 1337, "homesteadBlock": 0, "eip150Block": 0, - "eip155Block": 10, + "eip155Block": 0, "eip158Block": 10, "eip160Block": 10, }, diff --git a/tests/integration/generate_fixtures/go_ethereum.py b/tests/integration/generate_fixtures/go_ethereum.py index 4fb366ff59..0a0da1d24f 100644 --- a/tests/integration/generate_fixtures/go_ethereum.py +++ b/tests/integration/generate_fixtures/go_ethereum.py @@ -27,6 +27,10 @@ MATH_ABI, MATH_BYTECODE, ) +from web3._utils.module_testing.revert_contract import ( + _REVERT_CONTRACT_ABI, + REVERT_CONTRACT_BYTECODE, +) # this script is used for generating the parity fixture # to generate geth fixtures use tests/generate_go_ethereum_fixture.py @@ -114,7 +118,7 @@ def setup_chain_state(web3): abi=_REVERT_CONTRACT_ABI, bytecode=REVERT_CONTRACT_BYTECODE, ) - revert_deploy_receipt = deploy_contract(web3, 'revert', revert_contract_factory) + revert_deploy_receipt = common.deploy_contract(web3, 'revert', revert_contract_factory) revert_contract = revert_contract_factory(revert_deploy_receipt['contractAddress']) txn_hash_normal_function = revert_contract.functions.normalFunction().transact( @@ -125,7 +129,7 @@ def setup_chain_state(web3): {'gas': 320000, 'from': web3.eth.coinbase} ) print('TXN_HASH_REVERT_WITH_MSG:', txn_hash_revert_with_msg) - txn_receipt_revert_with_msg = mine_transaction_hash(web3, txn_hash_revert_with_msg) + txn_receipt_revert_with_msg = common.mine_transaction_hash(web3, txn_hash_revert_with_msg) block_hash_revert_with_msg = web3.eth.getBlock(txn_receipt_revert_with_msg['blockHash']) print('BLOCK_HASH_REVERT_WITH_MSG:', block_hash_revert_with_msg['hash']) @@ -133,7 +137,7 @@ def setup_chain_state(web3): {'gas': 320000, 'from': web3.eth.coinbase} ) print('TXN_HASH_REVERT_WITH_NO_MSG:', txn_hash_revert_with_no_msg) - txn_receipt_revert_with_no_msg = mine_transaction_hash(web3, txn_hash_revert_with_no_msg) + txn_receipt_revert_with_no_msg = common.mine_transaction_hash(web3, txn_hash_revert_with_no_msg) block_hash_revert_no_msg = web3.eth.getBlock(txn_receipt_revert_with_no_msg['blockHash']) print('BLOCK_HASH_REVERT_NO_MSG:', block_hash_revert_no_msg['hash']) @@ -174,6 +178,9 @@ def setup_chain_state(web3): 'empty_block_hash': empty_block['hash'], 'mined_txn_hash': mined_txn_hash, 'block_with_txn_hash': block_with_txn['hash'], + 'revert_address': revert_deploy_receipt['contractAddress'], + 'block_hash_revert_with_msg': block_hash_revert_with_msg['hash'], + 'block_hash_revert_no_msg': block_hash_revert_no_msg['hash'], } return geth_fixture diff --git a/tests/integration/generate_fixtures/parity.py b/tests/integration/generate_fixtures/parity.py index 903640530f..aa9de11d91 100644 --- a/tests/integration/generate_fixtures/parity.py +++ b/tests/integration/generate_fixtures/parity.py @@ -38,7 +38,7 @@ "gasLimitBoundDivisor": "0x0400", "registrar": "0x81a4b044831c4f12ba601adb9274516939e9b8a2", "eip150Transition": 0, - "eip155Transition": 10, + "eip155Transition": 0, "eip160Transition": 10, "eip161abcTransition": 10, "eip161dTransition": 10, @@ -200,8 +200,8 @@ def generate_parity_fixture(destination_dir): genesis_file_path, geth_ipc_path, geth_port, - str(CHAIN_CONFIG['params']['networkID'])) - ) + str(CHAIN_CONFIG['params']['networkID']) + )) # set up fixtures common.wait_for_socket(geth_ipc_path) web3_geth = Web3(Web3.IPCProvider(geth_ipc_path)) diff --git a/tests/integration/parity/conftest.py b/tests/integration/parity/conftest.py index 17f37c71ce..7fbf8d84f7 100644 --- a/tests/integration/parity/conftest.py +++ b/tests/integration/parity/conftest.py @@ -22,18 +22,20 @@ PARITY_2_3_5_FIXTURE = { 'zip': 'parity-235-fixture.zip', 'coinbase': 'dc544d1aa88ff8bbd2f2aec754b1f1e99e1812fd', - 'block_hash_with_log': '0x8633d4b5497e5a7e81356cbe3f0a49b63fb2020ddeb6c8c27bcecec541055a3b', - 'block_with_txn_hash': '0xf474a7b80cb6cb2b728b290ce6a0893f5f85d2998c4b252d73300da56de205de', + 'block_hash_revert_no_msg': '0x3244617196b9467687cbab23798c00077954452771d38d05d3b8d484b83c5de5', + 'block_hash_revert_with_msg': '0x7d7917231f1a9e816f11ff93842d543c35075a7cd5d75854f28324409910836c', + 'block_hash_with_log': '0x19947203802e02d4659698c5684322ef67c4146fb1f420a6da371116be78047c', + 'block_with_txn_hash': '0xc26f5610ddbfd6fbe179110e09af6df06c2998ed0c9c623417480b2c795a6f01', 'emitter_address': '0x4aA591a07989b4F810E2F5cE97e769D60710f168', - 'emitter_deploy_txn_hash': '0xa3e3838c01e73dafc7fc9d7e4e6c97523445006ae125ad1085abcf065feed382', - 'empty_block_hash': '0xc46c025ae50a970408a429a5a2baa65f056a173ff1dae0cab4b490d2ee94413f', + 'emitter_deploy_txn_hash': '0xbd4ca1b3cdb6bd711aec67dbb5a90c4d8f7910dab5bde70e5b8a9f8ad689b373', + 'empty_block_hash': '0x7a877c858e2d5447305e0901580022553cab34fdbc78c22c33b627e2a6a9ba5a', 'keyfile_pw': 'web3py-test', 'math_address': '0xd794C821fCCFF5D96F5Db44af7e29977630A9dc2', - 'math_deploy_txn_hash': '0xb680f86c00d69484ce68b4d3932c27c4e858c91d6ba8a27f8c499006fe4ced4a', - 'mined_txn_hash': '0x6401f455c01f9eb79fa672a4d24cc7cbbe3891e89eea8db8be39969dc9c480bc', + 'math_deploy_txn_hash': '0xa266faa2c729660d88e0c72994b5cd0e85ff9fe05846a6575b9095d433f51957', + 'mined_txn_hash': '0xd9f2298f6bc02f5ede8db75eac721f2365b6d9a96e1ca1bb0724d316de8f626c', 'raw_txn_account': '0x39EEed73fb1D3855E90Cbd42f348b3D7b340aAA6', - 'txn_hash_with_log': '0xf6ffb7387cd0288cd1db1b1e368e7d4a21bc6e70fd2ef0e9af41f6c32b9e2cc7' -} + 'revert_address': '0x14F3674571D76Bf66cA8EBD84dC02060933400b4', + 'txn_hash_with_log': '0x51c7e37746062cb7ff1f337d3ab725fa540c6d20fc9304b08dad5e80b3601511'} @pytest.fixture(scope='module') @@ -204,3 +206,19 @@ def txn_filter_params(coinbase): "toBlock": "latest", "fromAddress": [coinbase], } + + + +@pytest.fixture(scope="module") +def block_hash_revert_no_msg(parity_fixture_data): + return parity_fixture_data['block_hash_revert_no_msg'] + + +@pytest.fixture(scope="module") +def block_hash_revert_with_msg(parity_fixture_data): + return parity_fixture_data['block_hash_revert_with_msg'] + + +@pytest.fixture(scope="module") +def revert_contract(revert_contract_factory, parity_fixture_data): + return revert_contract_factory(address=parity_fixture_data['revert_address']) diff --git a/web3/_utils/module_testing/eth_module.py b/web3/_utils/module_testing/eth_module.py index f215bdfb3d..eb95449a43 100644 --- a/web3/_utils/module_testing/eth_module.py +++ b/web3/_utils/module_testing/eth_module.py @@ -659,7 +659,6 @@ def test_eth_call_revert_with_msg(self, web3: "Web3", revert_contract: "Contract coinbase = web3.eth.coinbase txn_params = revert_contract._prepare_transaction(fn_name='revertWithMessage', transaction={'from': unlocked_account_dual_type, 'to': revert_contract.address}) foo = revert_contract.functions.revertWithMessage().transact({'from': coinbase, 'to': revert_contract.address, 'gas': 320000}) - import pdb; pdb.set_trace() call_result = web3.eth.call(txn_params) assert is_string(call_result) result = web3.codec.decode_single('bool', call_result) diff --git a/web3/_utils/module_testing/parity_module.py b/web3/_utils/module_testing/parity_module.py index d3054d62f2..66c924a6f7 100644 --- a/web3/_utils/module_testing/parity_module.py +++ b/web3/_utils/module_testing/parity_module.py @@ -30,7 +30,7 @@ class ParityTraceModuleTest: def test_trace_replay_transaction( - self, web3: "Web3", parity_fixture_data: Dict[str, str] + self, web3: "Web3", parity_fixture_data: Dict[str, str], ) -> None: trace = web3.parity.traceReplayTransaction(HexStr(parity_fixture_data['mined_txn_hash']))