Skip to content

Commit e8a7c9c

Browse files
committed
tests: add cip_145_fix tests
1 parent 4ebb1a0 commit e8a7c9c

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

integration_tests/tests/cips/cip_145_fix_test.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ class CIP145BeforeFixTestEnv(ConfluxTestFramework):
1111
def set_test_params(self):
1212
self.num_nodes = 1
1313
self.conf_parameters["eoa_code_transition_height"] = 1
14+
self.conf_parameters["cip151_transition_height"] = 1
15+
self.conf_parameters["cip645_transition_height"] = 1
1416
self.conf_parameters["public_evm_rpc_apis"] = '"all"'
1517
self.conf_parameters["executive_trace"] = "true"
1618

@@ -21,6 +23,9 @@ def setup_network(self):
2123
class CIP145AfterFixTestEnv(ConfluxTestFramework):
2224
def set_test_params(self):
2325
self.num_nodes = 1
26+
self.conf_parameters["eoa_code_transition_height"] = 1
27+
self.conf_parameters["cip151_transition_height"] = 1
28+
self.conf_parameters["cip645_transition_height"] = 1
2429
self.conf_parameters["cip145_fix_transition_height"] = 1
2530
self.conf_parameters["public_evm_rpc_apis"] = '"all"'
2631
self.conf_parameters["executive_trace"] = "true"

integration_tests/tests/rpc/espace/test_tx_and_receipt.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import pytest
22
from integration_tests.test_framework.test_framework import ConfluxTestFramework
3-
from integration_tests.test_framework.util import *
4-
from eth_utils import decode_hex
3+
from integration_tests.test_framework.util import assert_equal
54
from integration_tests.conflux.rpc import RpcClient
65
from integration_tests.test_framework.blocktools import encode_hex_0x
76

@@ -31,18 +30,29 @@ def test_cross_space_transfer(cw3, ew3, erc20_contract, evm_accounts, network):
3130
epoch = receipt["epochNumber"]
3231
ret = network.nodes[0].debug_getTransactionsByEpoch(hex(epoch))
3332
assert_equal(len(ret), 1)
34-
35-
def test_tx_and_receipt(ew3, evm_accounts, receiver_account, network):
33+
34+
@pytest.fixture(scope="module")
35+
def tx_hash(ew3, evm_accounts, receiver_account):
3636
account = evm_accounts[0]
37-
nonce = ew3.eth.get_transaction_count(account.address)
3837
tx_hash = ew3.eth.send_transaction({
3938
"from": account.address,
4039
"to": receiver_account.address,
4140
"value": ew3.to_wei(1, "ether"),
4241
"gasPrice": 1,
4342
"gas": 21000,
44-
"nonce": nonce,
4543
})
44+
ew3.eth.wait_for_transaction_receipt(tx_hash)
45+
return tx_hash
46+
47+
def test_tx_data(ew3, tx_hash, receiver_account):
48+
data = ew3.eth.get_transaction(tx_hash)
49+
assert data["gasPrice"] == 1
50+
assert data["gas"] == 21000
51+
assert data["to"] == receiver_account.address
52+
assert data["value"] == ew3.to_wei(1, "ether")
53+
54+
55+
def test_tx_and_receipt(ew3, network, tx_hash):
4656
receipt = ew3.eth.wait_for_transaction_receipt(tx_hash)
4757
assert receipt["status"] == 1
4858
assert receipt["gasUsed"] == 21000

0 commit comments

Comments
 (0)