Repository: ethereum/web3.py

Issue:
web3.eth.getTransaction with EthereumTesterProvider return data instead of input
* Version: 4.3.0
* Python: 3.6
* OS: osx

### What was wrong?
I am using `web3.eth.getTransaction` to check transaction data in my tests. If I use geth node as HTTPProvider I got:
```
AttributeDict({'blockHash': HexBytes('0xc9dd4255ee1a3be19ef2ebd9939518ac97930884736d393955b96a57d6514ce4'),
 'blockNumber': 2455498,
 'from': '0x3b6aE508805aDc8d93A7FaBE7c44853fD1E5508a',
 'gas': 387057,
 'gasPrice': 1000000000,
 'hash': HexBytes('0xe30dc8d4177d653d78796742d4c2d8d2d6a5caed7a5e458f285b4c59d73da19f'),
 'input': '0xea94496b0000000000000000000000000000000000000000000000000000000000053c1b000000000000000000000000000000000000000000000000000000000000fa4b',
 'nonce': 1718,
 'r': HexBytes('0xdd4e1c435a0815e68b4c78663d7583d6283bf625e321eaf1610e55cc2686f4b1'),
 's': HexBytes('0x1df25aebb44d5045afff728a95aa823dcac2b62bfba68094faedb2769399c11a'),
 'to': '0xFe2149773B3513703E79Ad23D05A778A185016ee',
 'transactionIndex': 23,
 'v': 44,
 'value': 3000000000000000})
```
But if I use EthereumTesterProvider with PyEVM I got:
```
AttributeDict({'blockHash': HexBytes('0x769ab5efa0150bd42f3daf3b5e6073f1776980f8067bc5278f0579782a43bee8'),
 'blockNumber': 4,
 'data': '0x40c10f19000000000000000000000000b0a3f48478d84a497f930d8455711d9981b66a7000000000000000000000000000000000000000000000000000000000000007ca',
 'from': '0x73015966604928A312F79F7E69291a656Cb88602',
 'gas': 40000,
 'gasPrice': 5000000000,
 'hash': HexBytes('0x76ba2e6a718a921f33afde65e3251ac6fa0df8f7ba5c7aefb0930a0e5c7de9ab'),
 'nonce': 0,
 'r': HexBytes('0xa4bc06d2cc7ab8888a4f0d5dd7cf3f0f77c43e0f60d60af7da3e3024f2d57440'),
 's': HexBytes('0x7a220bb17c3e25e006a6b3df60ccd8a3fecb911f1eb4cd5d2332912e0fd7381e'),
 'to': '0x2feB9363a9bb1E16Ab90F6d4007264774e959F34',
 'transactionIndex': 0,
 'v': 28,
 'value': 0})
```
AttributeDict keys is the same except for `'input'`/`'data'`. According to [geth](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionbyhash) and [parity](https://wiki.parity.io/JSONRPC-eth-module.html#eth_gettransactionbyhash) JSON-RPC docs,  there should be`input`.

[Here](https://github.com/ethereum/eth-tester/blob/09b97b2f03795923ef19ae11b4b6dc32c33728e5/eth_tester/backends/pyevm/serializers.py#L73) in eth_tester this field defined.

### How can it be fixed?
Add `'data': 'input'` to [TRANSACTION_KEY_MAPPINGS](https://github.com/ethereum/web3.py/blob/70b7ded70c7ff324a4ad65524297f3df226ef36e/web3/providers/eth_tester/middleware.py#L50)


Discussion:
Hm, this change might actually belong in eth-tester. Either way, we'll have to copy it and deprecate `input` (rather than just move it) in case anyone is depending on this current behavior.

Resolving patch:
diff --git a/web3/providers/eth_tester/middleware.py b/web3/providers/eth_tester/middleware.py
--- a/web3/providers/eth_tester/middleware.py
+++ b/web3/providers/eth_tester/middleware.py
@@ -131,6 +131,7 @@ def is_hexstr(value: Any) -> bool:
     "max_priority_fee_per_gas": "maxPriorityFeePerGas",
     "transaction_hash": "transactionHash",
     "transaction_index": "transactionIndex",
+    "data": "input",
 }
 transaction_result_remapper = apply_key_map(TRANSACTION_RESULT_KEY_MAPPING)
 


Test patch:
diff --git a/tests/core/contracts/test_contract_constructor.py b/tests/core/contracts/test_contract_constructor.py
--- a/tests/core/contracts/test_contract_constructor.py
+++ b/tests/core/contracts/test_contract_constructor.py
@@ -220,11 +220,11 @@ def test_contract_constructor_build_transaction_no_constructor(
     txn = w3.eth.get_transaction(txn_hash)
     nonce = w3.eth.get_transaction_count(w3.eth.coinbase)
     unsent_txn = math_contract_factory.constructor().build_transaction({"nonce": nonce})
-    assert txn["data"] == HexBytes(unsent_txn["data"])
+    assert txn["input"] == HexBytes(unsent_txn["data"])
 
     new_txn_hash = w3.eth.send_transaction(unsent_txn)
     new_txn = w3.eth.get_transaction(new_txn_hash)
-    assert new_txn["data"] == HexBytes(unsent_txn["data"])
+    assert new_txn["input"] == HexBytes(unsent_txn["data"])
     assert new_txn["nonce"] == nonce
 
 
@@ -237,11 +237,11 @@ def test_contract_constructor_build_transaction_without_arguments(
     txn = w3.eth.get_transaction(txn_hash)
     nonce = w3.eth.get_transaction_count(w3.eth.coinbase)
     unsent_txn = math_contract_factory.constructor().build_transaction({"nonce": nonce})
-    assert txn["data"] == HexBytes(unsent_txn["data"])
+    assert txn["input"] == HexBytes(unsent_txn["data"])
 
     new_txn_hash = w3.eth.send_transaction(unsent_txn)
     new_txn = w3.eth.get_transaction(new_txn_hash)
-    assert new_txn["data"] == HexBytes(unsent_txn["data"])
+    assert new_txn["input"] == HexBytes(unsent_txn["data"])
     assert new_txn["nonce"] == nonce
 
 
@@ -269,11 +269,11 @@ def test_contract_constructor_build_transaction_with_arguments(
     unsent_txn = non_strict_contract_with_constructor_args_factory.constructor(
         *constructor_args, **constructor_kwargs
     ).build_transaction({"nonce": nonce})
-    assert txn["data"] == HexBytes(unsent_txn["data"])
+    assert txn["input"] == HexBytes(unsent_txn["data"])
 
     new_txn_hash = w3_non_strict_abi.eth.send_transaction(unsent_txn)
     new_txn = w3_non_strict_abi.eth.get_transaction(new_txn_hash)
-    assert new_txn["data"] == HexBytes(unsent_txn["data"])
+    assert new_txn["input"] == HexBytes(unsent_txn["data"])
     assert new_txn["nonce"] == nonce
 
 
@@ -528,11 +528,11 @@ async def test_async_contract_constructor_build_transaction_no_constructor(
     unsent_txn = await async_math_contract_factory.constructor().build_transaction(
         {"nonce": nonce}
     )
-    assert txn["data"] == HexBytes(unsent_txn["data"])
+    assert txn["input"] == HexBytes(unsent_txn["data"])
 
     new_txn_hash = await async_w3.eth.send_transaction(unsent_txn)
     new_txn = await async_w3.eth.get_transaction(new_txn_hash)
-    assert new_txn["data"] == HexBytes(unsent_txn["data"])
+    assert new_txn["input"] == HexBytes(unsent_txn["data"])
     assert new_txn["nonce"] == nonce
 
 
@@ -550,11 +550,11 @@ async def test_async_contract_constructor_build_transaction_without_arguments(
     unsent_txn = await async_math_contract_factory.constructor().build_transaction(
         {"nonce": nonce}
     )
-    assert txn["data"] == HexBytes(unsent_txn["data"])
+    assert txn["input"] == HexBytes(unsent_txn["data"])
 
     new_txn_hash = await async_w3.eth.send_transaction(unsent_txn)
     new_txn = await async_w3.eth.get_transaction(new_txn_hash)
-    assert new_txn["data"] == HexBytes(unsent_txn["data"])
+    assert new_txn["input"] == HexBytes(unsent_txn["data"])
     assert new_txn["nonce"] == nonce
 
 
@@ -589,9 +589,9 @@ async def test_async_contract_constructor_build_transaction_with_arguments(
             *constructor_args, **constructor_kwargs
         ).build_transaction({"nonce": nonce})
     )
-    assert txn["data"] == HexBytes(unsent_txn["data"])
+    assert txn["input"] == HexBytes(unsent_txn["data"])
 
     new_txn_hash = await async_w3_non_strict_abi.eth.send_transaction(unsent_txn)
     new_txn = await async_w3_non_strict_abi.eth.get_transaction(new_txn_hash)
-    assert new_txn["data"] == HexBytes(unsent_txn["data"])
+    assert new_txn["input"] == HexBytes(unsent_txn["data"])
     assert new_txn["nonce"] == nonce
diff --git a/tests/core/eth-module/test_transactions.py b/tests/core/eth-module/test_transactions.py
--- a/tests/core/eth-module/test_transactions.py
+++ b/tests/core/eth-module/test_transactions.py
@@ -261,7 +261,6 @@ def test_get_transaction_formatters(w3, request_mocker):
             },
         ],
         "input": "0x5b34b966",
-        "data": "0x5b34b966",
     }
 
     with request_mocker(
@@ -318,7 +317,6 @@ def test_get_transaction_formatters(w3, request_mocker):
                 ),
             ],
             "input": HexBytes(unformatted_transaction["input"]),
-            "data": HexBytes(unformatted_transaction["data"]),
         }
     )