Skip to content

Commit

Permalink
Organize UserOperation data types (#819)
Browse files Browse the repository at this point in the history
* Add missing address to the mock
* Make paymaster data return optional
  • Loading branch information
Uxio0 authored Mar 11, 2024
1 parent 68e6552 commit 3757a7a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 3 additions & 2 deletions gnosis/eth/account_abstraction/user_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ def paymaster(self) -> Optional[ChecksumAddress]:
return None

@cached_property
def paymaster_data(self) -> bytes:
return self.paymaster_and_data[:20]
def paymaster_data(self) -> Optional[bytes]:
result = self.paymaster_and_data[:20]
return result if result else None

def calculate_user_operation_hash(self, chain_id: int) -> bytes:
hash_init_code = fast_keccak(self.init_code)
Expand Down
4 changes: 4 additions & 0 deletions gnosis/eth/tests/mocks/mock_bundler.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
from eth_typing import ChecksumAddress, HexAddress, HexStr
from hexbytes import HexBytes

# Module address and chainId used for the following mocks
safe_4337_address = ChecksumAddress(
HexStr(HexAddress("0xB0B5c0578Aa134b0496a6C0e51A7aae47C522861"))
)
safe_4337_user_operation_hash_mock = HexBytes(
"0x39b3e2171c04539d9b3f848d04364dfaa42cc0b412ff65ce2a85c566cf8bf281"
)
Expand Down

0 comments on commit 3757a7a

Please sign in to comment.