From f173cbe360599b5a1feec035df6a5d204890c983 Mon Sep 17 00:00:00 2001 From: Muhammad Talha Dar Date: Fri, 27 Oct 2023 19:49:16 +0500 Subject: [PATCH] Updated rbac.sol abi and tests --- ETH/rbac/rbac.sol.json | 12 ------------ tests/bridge_rbac_test.py | 8 ++++---- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/ETH/rbac/rbac.sol.json b/ETH/rbac/rbac.sol.json index 02952e8..48f9ddb 100644 --- a/ETH/rbac/rbac.sol.json +++ b/ETH/rbac/rbac.sol.json @@ -8,12 +8,6 @@ "name": "sender", "type": "address" }, - { - "indexed": false, - "internalType": "bytes32", - "name": "owner", - "type": "bytes32" - }, { "indexed": false, "internalType": "bytes32", @@ -39,12 +33,6 @@ "name": "sender", "type": "address" }, - { - "indexed": false, - "internalType": "bytes32", - "name": "owner", - "type": "bytes32" - }, { "indexed": false, "internalType": "bytes32", diff --git a/tests/bridge_rbac_test.py b/tests/bridge_rbac_test.py index b0e5d63..7962d97 100644 --- a/tests/bridge_rbac_test.py +++ b/tests/bridge_rbac_test.py @@ -73,12 +73,11 @@ def setUp(self): def check_item_from_event(self, event, account, role_id, name): events = event.get_all_entries() - self.assertEqual(f"0x{events[0]['args']['owner'].hex()}", account) + self.assertEqual(f"0x{events[0]['args']['sender'].hex()}", account) self.assertEqual(f"0x{events[0]['args']['role_id'].hex()}", f"{role_id}") self.assertEqual(f"0x{events[0]['args']['name'].hex()}", f"{name}") def test_add_role_and_check(self): - print("ROLE_ID ", ROLE_ID_1, "len: ", len(ROLE_ID_1)) substrate = self._substrate eth_src = self._eth_src @@ -89,6 +88,7 @@ def test_add_role_and_check(self): # Setup eth_ko_src with some tokens transfer(substrate, KP_SRC, calculate_evm_account(eth_src), TOKEN_NUM) bl_hash = call_eth_transfer_a_lot(substrate, KP_SRC, eth_src, eth_kp_src.ss58_address.lower()) + # verify tokens have been transferred self.assertTrue(bl_hash, f'Failed to transfer token to {eth_kp_src.ss58_address}') @@ -102,10 +102,10 @@ def test_add_role_and_check(self): # Check: Add Role event = contract.events.RoleAdded.create_filter(fromBlock=block_idx, toBlock=block_idx) - self.check_item_from_event(event, account, ROLE_ID_1, ROLE_ID_1_NAME) + self.check_item_from_event(event, account, ROLE_ID_1, ROLE_ID_1_NAME) # TODO event.get_all_entries() is empty # Execute: Fetch Role data = contract.functions.fetch_role(account, ROLE_ID_1).call() # Check: Fetch Role - self.assertEqual(f'0x{data.hex()}', ROLE_ID_1_NAME) \ No newline at end of file + self.assertEqual(data[1], ROLE_ID_1_NAME)