-
Notifications
You must be signed in to change notification settings - Fork 43
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
fix: EREP-015 rule Paymaster opsSeen decrement #905
base: main
Are you sure you want to change the base?
Conversation
58d178b
to
d4c23aa
Compare
.. | ||
}) => { | ||
// [EREP-015] If user operations error derived from factory or account, paymaster opsSeen amendment is required. | ||
let re = Regex::new(r"^AA[21]").unwrap(); |
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.
Same as what reference implementation does.
https://github.com/eth-infinitism/bundler/blob/8bc5028caaf2b380c12e057110f9bba950e49b09/packages/bundler/src/modules/BundleManager.ts#L353
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.
Instead of bringing in regex, can we keep the same pattern that we use above? Something like
paymaster_amendment_required |= matches!(&message[..3], "AA1" | "AA2")
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.
Great work! Thank you for the contribution. A few small comments and would love if you could add a unit test for this condition.
.. | ||
}) => { | ||
// [EREP-015] If user operations error derived from factory or account, paymaster opsSeen amendment is required. | ||
let re = Regex::new(r"^AA[21]").unwrap(); |
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.
Instead of bringing in regex, can we keep the same pattern that we use above? Something like
paymaster_amendment_required |= matches!(&message[..3], "AA1" | "AA2")
if !entity.is_paymaster() { | ||
warn!( | ||
"Attempted to add EREP-015 paymaster amendment for non-paymaster entity: {:?}", | ||
entity | ||
); | ||
return; | ||
} |
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.
I think we should use an assert!
instead of a log here as this indicates a coding error.
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.
if !entity.is_paymaster() { | |
warn!( | |
"Attempted to add EREP-015 paymaster amendment for non-paymaster entity: {:?}", | |
entity | |
); | |
return; | |
} | |
assert!(entity.is_paymaster(), "Attempted to add EREP-015 paymaster amendment for non-paymaster entity") |
update_type: EntityUpdateType::PaymasterAmendment, | ||
}, | ||
); | ||
} | ||
} | ||
|
||
#[cfg(test)] |
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.
Can you add a test for this case?
[Closes/Fixes] #904
Proposed Changes