Skip to content

Commit

Permalink
Refactor neon_getTransactionReceipt
Browse files Browse the repository at this point in the history
  • Loading branch information
afalaleev committed Dec 20, 2023
1 parent 535c59d commit 4a52e80
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions integration/tests/basic/evm/opcodes/test_extcodehash.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@ def test_extcodehash_for_reverted_destroyed_contract(self, eip1052_checker):
receipt = self.web3_client.send_transaction(self.sender_account, instruction_tx)
neon_logs = self.proxy_api.send_rpc(
method="neon_getTransactionReceipt",
params=[receipt["transactionHash"].hex()],
params=[receipt["transactionHash"].hex(), "neon"],
)["result"]["logs"]
data = [log["data"] for log in neon_logs if log["topics"] != []]
data = [log["data"] for log in neon_logs if log["neonEventType"] == "Log"]
# TODO fix checking
# assert data[0] != ZERO_HASH
# assert len(data) == 3
Expand Down
10 changes: 5 additions & 5 deletions integration/tests/basic/helpers/rpc_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ def assert_block_fields(block: dict, full_trx: bool, tx_receipt: tp.Optional[typ


def assert_log_field_in_neon_trx_receipt(response, events_count):
expected_event_types = ["ENTER CALL"]
expected_event_types = ["EnterCall"]
for i in range(events_count):
expected_event_types.append("LOG")
expected_event_types.append("EXIT STOP")
expected_event_types.append("RETURN")
expected_event_types.append("Log")
expected_event_types.append("ExitStop")
expected_event_types.append("Return")
all_logs = []

for trx in response["result"]["solanaTransactions"]:
Expand Down Expand Up @@ -138,7 +138,7 @@ def assert_log_field_in_neon_trx_receipt(response, events_count):
assert neon_logs != []
for log in neon_logs:
all_logs.append(log)
event_types = [log["neonEventType"] for log in sorted(all_logs, key=lambda x: x["neonEventOrder"])]
event_types = [log["neonEventType"] for log in sorted(all_logs, key=lambda x: int(x["neonEventOrder"], 16))]

assert event_types == expected_event_types, f"Actual: {event_types}; Expected: {expected_event_types}"

Expand Down
6 changes: 5 additions & 1 deletion integration/tests/basic/rpc/test_rpc_get_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,11 @@ def test_get_transaction_receipt(self, method):
"""Verify implemented rpc calls work with neon_getTransactionReceipt and eth_getTransactionReceipt"""
tx_receipt = self.send_neon(self.sender_account, self.recipient_account, 10)
transaction_hash = tx_receipt.transactionHash.hex()
response = self.proxy_api.send_rpc(method=method, params=transaction_hash)
params = [transaction_hash]
if method.startswith('neon_'):
params.append('ethereum')
response = self.proxy_api.send_rpc(method=method, params=params)
# response = self.proxy_api.send_rpc(method=method, params=transaction_hash)
assert "error" not in response
assert "result" in response, AssertMessage.DOES_NOT_CONTAIN_RESULT
result = response["result"]
Expand Down
2 changes: 1 addition & 1 deletion integration/tests/basic/test_trx_rlp_decoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def test_modify_s(self, signed_tx, new_s, expected_error):

@pytest.mark.parametrize("new_r, expected_error", [
(13237258775825350966557245051891674271982401474769237400875435660443279001850,
"failed to recover ECDSA public key"),
"Invalid signature"),
(123, "insufficient funds for transfer"),
('', "Invalid signature values")])
def test_modify_r(self, signed_tx, new_r, expected_error):
Expand Down

0 comments on commit 4a52e80

Please sign in to comment.