Skip to content

Commit

Permalink
Updated rbac.sol abi and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
talhadaar committed Oct 27, 2023
1 parent b3ce15c commit f173cbe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
12 changes: 0 additions & 12 deletions ETH/rbac/rbac.sol.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@
"name": "sender",
"type": "address"
},
{
"indexed": false,
"internalType": "bytes32",
"name": "owner",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "bytes32",
Expand All @@ -39,12 +33,6 @@
"name": "sender",
"type": "address"
},
{
"indexed": false,
"internalType": "bytes32",
"name": "owner",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "bytes32",
Expand Down
8 changes: 4 additions & 4 deletions tests/bridge_rbac_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}')

Expand All @@ -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)
self.assertEqual(data[1], ROLE_ID_1_NAME)

0 comments on commit f173cbe

Please sign in to comment.