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

Calculate SafeOperation preimage #818

Merged
merged 1 commit into from
Mar 8, 2024
Merged

Conversation

Uxio0
Copy link
Member

@Uxio0 Uxio0 commented Mar 5, 2024

  • It's needed for validating EIP1271 signatures

- It's needed for validating EIP1271 signatures
@Uxio0 Uxio0 requested a review from a team as a code owner March 5, 2024 16:46
@@ -87,11 +88,11 @@ def get_domain_separator(
)
return _domain_separator_cache[key]

def get_safe_operation_hash(
def get_safe_operation_hash_preimage(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be cached_property and avoid to check if exists the pre-image?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dataclasses are not hashable by default, so cache decorators cannot be used. Also a property cannot be used as it receives parameters

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dataclasses are not hashable by default, so cache decorators cannot be used. Also a property cannot be used as it receives parameters

Got it.
My concern is if you create an instance of UserOperation, maybe you are not aware that the useroperation_hash is None until call the get function.
Maybe we can add chain and module as atributes of UserOperation like DOMAIN_HASH_SEPARATOR is and remove safe_operation_hash and safe_operation_hash_preimage as parameters and create the property functions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chain and module are not available when retrieving the UserOperation, that's why I don't want to force to define then as properties as they are not mandatory for working with the UserOperation and only needed when calculating the hash

@Uxio0 Uxio0 merged commit a04f96d into main Mar 8, 2024
8 checks passed
@Uxio0 Uxio0 deleted the calculate-safe-operation-preimage branch March 8, 2024 13:06
@github-actions github-actions bot locked and limited conversation to collaborators Mar 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants