diff --git a/tests/integration/generate_fixtures/go_ethereum.py b/tests/integration/generate_fixtures/go_ethereum.py index 4242d753b0..6e1ddbddbf 100644 --- a/tests/integration/generate_fixtures/go_ethereum.py +++ b/tests/integration/generate_fixtures/go_ethereum.py @@ -12,10 +12,8 @@ is_bytes, is_dict, is_same_address, - remove_0x_prefix, to_hex, to_text, - to_wei, ) from eth_utils.toolz import ( merge, @@ -41,50 +39,6 @@ REVERT_CONTRACT_BYTECODE, ) -COINBASE = '0xdc544d1aa88ff8bbd2f2aec754b1f1e99e1812fd' -COINBASE_PK = '0x58d23b55bc9cdce1f18c2500f40ff4ab7245df9a89505e9b1fa4851f623d241d' - -KEYFILE_DATA = '{"address":"dc544d1aa88ff8bbd2f2aec754b1f1e99e1812fd","crypto":{"cipher":"aes-128-ctr","ciphertext":"52e06bc9397ea9fa2f0dae8de2b3e8116e92a2ecca9ad5ff0061d1c449704e98","cipherparams":{"iv":"aa5d0a5370ef65395c1a6607af857124"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":262144,"p":1,"r":8,"salt":"9fdf0764eb3645ffc184e166537f6fe70516bf0e34dc7311dea21f100f0c9263"},"mac":"4e0b51f42b865c15c485f4faefdd1f01a38637e5247f8c75ffe6a8c0eba856f6"},"id":"5a6124e0-10f1-4c1c-ae3e-d903eacb740a","version":3}' # noqa: E501 - -KEYFILE_PW = 'web3py-test' -KEYFILE_FILENAME = 'UTC--2017-08-24T19-42-47.517572178Z--dc544d1aa88ff8bbd2f2aec754b1f1e99e1812fd' # noqa: E501 - -RAW_TXN_ACCOUNT = '0x39EEed73fb1D3855E90Cbd42f348b3D7b340aAA6' - -UNLOCKABLE_PRIVATE_KEY = '0x392f63a79b1ff8774845f3fa69de4a13800a59e7083f5187f1558f0797ad0f01' -UNLOCKABLE_ACCOUNT = '0x12efdc31b1a8fa1a1e756dfd8a1601055c971e13' -UNLOCKABLE_ACCOUNT_PW = KEYFILE_PW - - -GENESIS_DATA = { - "nonce": "0xdeadbeefdeadbeef", - "timestamp": "0x0", - "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", # noqa: E501 - "extraData": "0x7765623370792d746573742d636861696e", - "gasLimit": "0x47d5cc", - "difficulty": "0x01", - "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000", # noqa: E501 - "coinbase": "0x3333333333333333333333333333333333333333", - "alloc": { - remove_0x_prefix(COINBASE): { - 'balance': str(to_wei(1000000000, 'ether')), - }, - remove_0x_prefix(RAW_TXN_ACCOUNT): { - 'balance': str(to_wei(10, 'ether')), - }, - remove_0x_prefix(UNLOCKABLE_ACCOUNT): { - 'balance': str(to_wei(10, 'ether')), - }, - }, - "config": { - "chainId": 131277322940537, # the string 'web3py' as an integer - "homesteadBlock": 0, - "eip150Block": 0, - "eip155Block": 0, - "eip158Block": 0 - }, -} - @contextlib.contextmanager def graceful_kill_on_exit(proc): @@ -120,7 +74,7 @@ def get_geth_process(geth_binary, '--gcmode', 'archive', '--nodiscover', '--port', geth_port, - '--etherbase', COINBASE[2:], + '--etherbase', common.COINBASE[2:], ) popen_proc = subprocess.Popen( @@ -162,12 +116,12 @@ def generate_go_ethereum_fixture(destination_dir): keystore_dir = os.path.join(datadir, 'keystore') common.ensure_path_exists(keystore_dir) - keyfile_path = os.path.join(keystore_dir, KEYFILE_FILENAME) + keyfile_path = os.path.join(keystore_dir, common.KEYFILE_FILENAME) with open(keyfile_path, 'w') as keyfile: - keyfile.write(KEYFILE_DATA) + keyfile.write(common.KEYFILE_DATA) genesis_file_path = os.path.join(datadir, 'genesis.json') with open(genesis_file_path, 'w') as genesis_file: - genesis_file.write(json.dumps(GENESIS_DATA)) + genesis_file.write(json.dumps(common.GENESIS_DATA)) geth_ipc_path_dir = stack.enter_context(common.tempdir()) geth_ipc_path = os.path.join(geth_ipc_path_dir, 'geth.ipc') @@ -203,8 +157,8 @@ def generate_go_ethereum_fixture(destination_dir): verify_chain_state(web3, chain_data) static_data = { - 'raw_txn_account': RAW_TXN_ACCOUNT, - 'keyfile_pw': KEYFILE_PW, + 'raw_txn_account': common.RAW_TXN_ACCOUNT, + 'keyfile_pw': common.KEYFILE_PW, } config = merge(chain_data, static_data) pprint.pprint(config) @@ -222,7 +176,7 @@ def verify_chain_state(web3, chain_data): def mine_transaction_hash(web3, txn_hash): web3.geth.miner.start(1) try: - return web3.eth.waitForTransactionReceipt(txn_hash, timeout=180) + return web3.eth.waitForTransactionReceipt(txn_hash, timeout=120) finally: web3.geth.miner.stop() @@ -243,22 +197,10 @@ def mine_block(web3): raise ValueError("No block mined during wait period") -# def deploy_contract(web3, name, factory): - # web3.geth.personal.unlock_account(web3.eth.coinbase, KEYFILE_PW) - # deploy_txn_hash = factory.constructor().transact({'from': web3.eth.coinbase}) - # print('{0}_CONTRACT_DEPLOY_HASH: '.format(name.upper()), deploy_txn_hash) - # deploy_receipt = mine_transaction_hash(web3, deploy_txn_hash) - # print('{0}_CONTRACT_DEPLOY_TRANSACTION_MINED'.format(name.upper())) - # contract_address = deploy_receipt['contractAddress'] - # assert is_checksum_address(contract_address) - # print('{0}_CONTRACT_ADDRESS:'.format(name.upper()), contract_address) - # return deploy_receipt - - def setup_chain_state(web3): coinbase = web3.eth.coinbase - assert is_same_address(coinbase, COINBASE) + assert is_same_address(coinbase, common.COINBASE) # # Math Contract @@ -333,7 +275,7 @@ def setup_chain_state(web3): # # Block with Transaction # - web3.geth.personal.unlock_account(coinbase, KEYFILE_PW) + web3.geth.personal.unlock_account(coinbase, common.KEYFILE_PW) web3.geth.miner.start(1) mined_txn_hash = web3.eth.sendTransaction({ 'from': coinbase, diff --git a/tests/integration/generate_fixtures/parity.py b/tests/integration/generate_fixtures/parity.py index 927f98d413..c9d44e4758 100644 --- a/tests/integration/generate_fixtures/parity.py +++ b/tests/integration/generate_fixtures/parity.py @@ -147,8 +147,7 @@ def get_parity_binary(): If generating a fixture from a local binary, update this value to that bin, e.g., return '/Users/xzy/Downloads/openethereum-2.5.13/target/release/parity' """ - return '/Users/mg/Downloads/openethereum-2.5.13/target/release/parity' - # return 'parity' + return 'parity' @contextlib.contextmanager diff --git a/tests/integration/geth-1.9.19-fixture.zip b/tests/integration/geth-1.9.19-fixture.zip index 13acb7b02c..16a515e6a5 100644 Binary files a/tests/integration/geth-1.9.19-fixture.zip and b/tests/integration/geth-1.9.19-fixture.zip differ diff --git a/tests/integration/go_ethereum/conftest.py b/tests/integration/go_ethereum/conftest.py index b5e63c19c0..8c2d963c04 100644 --- a/tests/integration/go_ethereum/conftest.py +++ b/tests/integration/go_ethereum/conftest.py @@ -19,8 +19,7 @@ KEYFILE_PW = 'web3py-test' -# GETH_1919_ZIP = 'geth-1.9.19-fixture.zip' -GETH_1919_ZIP = 'test.zip' +GETH_1919_ZIP = 'geth-1.9.19-fixture.zip' @pytest.fixture(scope='module') diff --git a/tests/integration/test.zip b/tests/integration/test.zip deleted file mode 100644 index 2b3dae1dbb..0000000000 Binary files a/tests/integration/test.zip and /dev/null differ