Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Organize UserOperation data types #819

Merged
merged 4 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading