-
Notifications
You must be signed in to change notification settings - Fork 320
Add support to entrypoint v0.07 useroperations #2692
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
Draft
sherifahmed990
wants to merge
25
commits into
safe-global:main
Choose a base branch
from
sherifahmed990:entrypointv7
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 20 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
4cf76e5
Add EntryPoint v0.7 and v0.6 constants
sherifahmed990 a6e2c4e
Add v0.7 entrypoint and module addresses to default settings
sherifahmed990 b0d76f9
Add UserOperationV7 class for entrypoint v0.7 support
sherifahmed990 2a7b386
Add SafeOperation wrapper class to oveeride from_user_operation to acβ¦
sherifahmed990 e161f56
Add database migration for entrypoint v0.7 support
sherifahmed990 8ff1f96
Update class UserOperation to support both v0.6 and v0.7 useroperations
sherifahmed990 f0bfdc2
Update serializer classes to support v0.7 useroperation
sherifahmed990 99c9dc5
Add support for useroperation v7 to index_user_operation
sherifahmed990 d52bbab
Use the new SafeOperation wrapper class for tests
sherifahmed990 c3f5cf4
Override settings to only support v0.6 for test_process_aa_transactioβ¦
sherifahmed990 be1e1b2
Merge branch 'safe-global:main' into entrypointv7
sherifahmed990 c6ca161
Merge branch 'safe-global:main' into entrypointv7
sherifahmed990 1a03408
Merge branch 'safe-global:main' into entrypointv7
sherifahmed990 808007c
Bump safe-eth-py from 7.14.0 to 7.17.0
sherifahmed990 cfcfca1
import ETHEREUM_4337_ENTRYPOINT_V6 &v7 from base.py
sherifahmed990 eaae31a
import SafeOperation and UserOperationV07 from safe-eth-py 7.17.0
sherifahmed990 f097ccd
update comment
sherifahmed990 2b851a0
fix: import user_operation_v07_hash_1 and user_operation_v07_mock_1 fβ¦
sherifahmed990 d8aee49
fix: ETHEREUM_4337_ENTRYPOINT_V6 and ETHEREUM_4337_ENTRYPOINT_V7
sherifahmed990 c2e4b16
Merge branch 'main' into entrypointv7
sherifahmed990 fcc9da4
Merge branch 'safe-global:main' into entrypointv7
sherifahmed990 0934612
use parentheses instead of brackets for validated_data.get()
sherifahmed990 96e7b5c
Add paymaster and paymaster_data fields for v7 fields
sherifahmed990 4965128
fix validation and handling for some fields
sherifahmed990 fa4aa7a
Add tests for SafeOperationSerializer including valid_after and validβ¦
sherifahmed990 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
safe_transaction_service/account_abstraction/migrations/0006_useroperation_v7_support.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| # Generated by Django 5.2.7 on 2025-10-28 17:35 | ||
|
|
||
| import safe_eth.eth.django.models | ||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ('account_abstraction', '0005_alter_safeoperation_module_address_and_more'), | ||
| ('history', '0095_remove_internaltx_history_internaltx_value_idx_and_more'), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AddField( | ||
| model_name='useroperation', | ||
| name='factory', | ||
| field=safe_eth.eth.django.models.EthereumAddressBinaryField(blank=True, db_index=True, null=True), | ||
| ), | ||
| migrations.AddField( | ||
| model_name='useroperation', | ||
| name='factory_data', | ||
| field=models.BinaryField(blank=True, editable=True, null=True), | ||
| ), | ||
| migrations.AddField( | ||
| model_name='useroperation', | ||
| name='paymaster_post_op_gas_limit', | ||
| field=safe_eth.eth.django.models.Uint256Field(blank=True, null=True), | ||
| ), | ||
| migrations.AddField( | ||
| model_name='useroperation', | ||
| name='paymaster_verification_gas_limit', | ||
| field=safe_eth.eth.django.models.Uint256Field(blank=True, null=True), | ||
| ), | ||
| migrations.AddConstraint( | ||
| model_name='useroperation', | ||
| constraint=models.CheckConstraint(condition=models.Q(('factory__isnull', True), ('init_code__isnull', True), _connector='OR'), name='factory_or_init_code_not_both'), | ||
| ), | ||
| migrations.AddConstraint( | ||
| model_name='useroperation', | ||
| constraint=models.CheckConstraint(condition=models.Q(models.Q(('paymaster_data__isnull', True), ('paymaster_post_op_gas_limit__isnull', True), ('paymaster_verification_gas_limit__isnull', True)), ('paymaster__isnull', False), _connector='OR'), name='paymaster_required_with_paymaster_fields'), | ||
| ), | ||
| migrations.AddConstraint( | ||
| model_name='useroperation', | ||
| constraint=models.CheckConstraint(condition=models.Q(('init_code__isnull', True), models.Q(('paymaster_post_op_gas_limit__isnull', True), ('paymaster_verification_gas_limit__isnull', True)), _connector='OR'), name='v7_paymaster_gas_limits_not_with_init_code'), | ||
| ), | ||
| migrations.AddConstraint( | ||
| model_name='useroperation', | ||
| constraint=models.CheckConstraint(condition=models.Q(('factory_data__isnull', True), ('factory__isnull', False), _connector='OR'), name='factory_required_with_factory_data'), | ||
| ), | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do entrypoints have the same address for every network? Remember that we run tx service for a lot of different networks, and it needs to be compatible with them.
There's no other way to tell appart v6 from v7? I would prefer to check a field that exists on v7 and not on v6, for example. Checking
entrypoint addressis a good solution for your use case, but not for the serviceThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the 4337 tooling that i know of assumes the official entrypoints addresses.
eth-infinitism/account-abstraction#372 (comment)
I think it is safe to only support the official entrypoints addresses.
Because we are using the same class for both useroperation types, a useroperation without init/factory and without paymaster would be identical for both v6 and v7(except for the entrypoint address).
Also v7, v8 and v9 have the same useroperation structure.
So i think using the entrypoint address is the only option with the current structure.
I added some model constrains as sanity checks to verify that some values should be none for each useroperation type, i can repeat these sanity checks here too.