-
Notifications
You must be signed in to change notification settings - Fork 249
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
feat: add eip-7702 helpers #950
Conversation
26a7009
to
bca4239
Compare
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.
one comment on validation
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.
lgtm
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 we has some sanity tests? :)
|
||
/// A signed EIP-7702 authorization. | ||
#[derive(Debug, Clone, RlpEncodable, RlpDecodable)] | ||
pub struct SignedAuthorization<S> { |
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 we add RecoveredAuthorization
? Where we will cache the recovered account as Option<Address (Option as it can fail).
Recovery can be expensive and can be done before revm gets called. We are okay to do that as it is covered by gas.
The idea that I have is to have an enum in Revm as input:
AuthorisationList {
Recovered(Vec<RecoveredAuthorization>),
Signed(Vec<SignedAuthorization>),
}
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.
added
@@ -70,6 +70,7 @@ serde = [ | |||
kzg = ["kzg-sidecar", "sha2", "dep:derive_more", "dep:c-kzg", "dep:once_cell"] | |||
kzg-sidecar = ["sha2"] | |||
sha2 = ["dep:sha2"] | |||
k256 = ["alloy-primitives/k256"] |
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.
Would be good to have seck256k1
lib/feature flag as it is faster. But looking at it as a low priority.
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.
lgtm
* feat: add eip-7702 auth list types * chore: fmt * chore: no_std * feat: add k256 feature to alloy-eips * chore: const fns * chore: lint * chore: rm vec type alias * feat: split into signed/unsigned types * fix: use `signature_prehash` * chore: fmt * chore: const fn * docs: fix doc link * chore: fmt -.- * chore: make pub * chore: cleanup * fix: error on list longer than 1 for nonce * chore: const fn -.- * feat: default derive * chore: manual decode impl for `OptionalNonce` * docs: small driveby link nits * test: add small rt ser/de tests * feat: add `RecoveredAuthorization` * fix: partial move
Motivation
EIP-7702 is up for inclusion in Prague.
Solution
Adds helpers and some types specified in EIP-7702.
The transaction type itself will be added in another PR as it is not relevant right now (for example, the RPC spec has not been updated yet).
This also adds a
k256
feature toalloy_eips
since authority recovery requires signature recovery which is only possible withk256
enabled inalloy_primitives
PR Checklist