This repository has been archived by the owner on Oct 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 795
Remove the eip712 feature flag and have it enabled by default #2409
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
78e3faa
Remove the eip712 feature flag and have it enabled by default. Fmt files
dbelv 442e4f7
Nightly fmt
dbelv ee33f3d
Fix clippy issues
dbelv 3d90bea
Test clippy
dbelv ac268a7
Address review comments
dbelv 8575d71
Address review comments
dbelv 59d9489
fmt
dbelv 8047220
Merge branch 'master' into eip712-remove
dbelv 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 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
This file contains 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
This file contains 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 |
---|---|---|
|
@@ -72,4 +72,4 @@ legacy = [] | |
macros = ["syn", "cargo_metadata", "once_cell"] | ||
|
||
# Deprecated | ||
eip712 = [] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same |
||
eip712 = [] |
This file contains 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 |
---|---|---|
|
@@ -12,7 +12,7 @@ For more information, please refer to the [book](https://gakonst.com/ethers-rs). | |
|
||
## Feature flags | ||
|
||
- `eip712`: Provides the `Eip712` trait and derive procedural macro for EIP-712 encoding of typed data. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. modify to say "does nothing" |
||
- `eip712`: Does nothing. | ||
|
||
## ABI | ||
|
||
|
This file contains 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
This file contains 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 |
---|---|---|
|
@@ -69,22 +69,6 @@ impl fmt::Display for Signature { | |
} | ||
} | ||
|
||
#[cfg(feature = "eip712")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. combine with main impl block |
||
impl Signature { | ||
/// Recovers the ethereum address which was used to sign a given EIP712 | ||
/// typed data payload. | ||
/// | ||
/// Recovery signature data uses 'Electrum' notation, this means the `v` | ||
/// value is expected to be either `27` or `28`. | ||
pub fn recover_typed_data<T>(&self, payload: T) -> Result<Address, SignatureError> | ||
where | ||
T: super::transaction::eip712::Eip712, | ||
{ | ||
let encoded = payload.encode_eip712().map_err(|_| SignatureError::RecoveryError)?; | ||
self.recover(encoded) | ||
} | ||
} | ||
|
||
impl Signature { | ||
/// Verifies that signature on `message` was produced by `address` | ||
pub fn verify<M, A>(&self, message: M, address: A) -> Result<(), SignatureError> | ||
|
@@ -130,6 +114,19 @@ impl Signature { | |
Ok(Address::from_slice(&hash[12..])) | ||
} | ||
|
||
/// Recovers the ethereum address which was used to sign a given EIP712 | ||
/// typed data payload. | ||
/// | ||
/// Recovery signature data uses 'Electrum' notation, this means the `v` | ||
/// value is expected to be either `27` or `28`. | ||
pub fn recover_typed_data<T>(&self, payload: T) -> Result<Address, SignatureError> | ||
where | ||
T: super::transaction::eip712::Eip712, | ||
{ | ||
let encoded = payload.encode_eip712().map_err(|_| SignatureError::RecoveryError)?; | ||
self.recover(encoded) | ||
} | ||
|
||
/// Retrieves the recovery signature. | ||
fn as_signature(&self) -> Result<(RecoverableSignature, RecoveryId), SignatureError> { | ||
let recovery_id = self.recovery_id()?; | ||
|
This file contains 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
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.
Could you add them back here too?
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.
Ah right, yep.