Skip to content

Commit

Permalink
feat: add k256 feature to alloy-eips
Browse files Browse the repository at this point in the history
  • Loading branch information
onbjerg committed Jun 20, 2024
1 parent bc9d3e8 commit 26a7009
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
9 changes: 5 additions & 4 deletions crates/alloy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ full = [
"kzg",
"network",
"provider-http", # includes `providers`
"provider-ws", # includes `providers`
"provider-ipc", # includes `providers`
"rpc-types", # includes `rpc-types-eth`
"signer-local", # includes `signers`
"provider-ws", # includes `providers`
"provider-ipc", # includes `providers`
"rpc-types", # includes `rpc-types-eth`
"signer-local", # includes `signers`
]

# configuration
Expand Down Expand Up @@ -218,6 +218,7 @@ arbitrary = [
k256 = [
"alloy-core/k256",
"alloy-consensus?/k256",
"alloy-eips?/k256",
"alloy-network?/k256",
"alloy-rpc-types?/k256",
]
Expand Down
2 changes: 1 addition & 1 deletion crates/consensus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ serde_json.workspace = true
[features]
default = ["std"]
std = ["alloy-eips/std", "c-kzg?/std"]
k256 = ["alloy-primitives/k256"]
k256 = ["alloy-primitives/k256", "alloy-eips/k256"]
kzg = ["dep:c-kzg", "alloy-eips/kzg", "std"]
arbitrary = [
"std",
Expand Down
1 change: 1 addition & 0 deletions crates/eips/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ std = [
"c-kzg?/std",
"once_cell?/std",
]
k256 = ["alloy-primitives/k256"]
serde = ["dep:serde", "alloy-primitives/serde", "c-kzg?/serde"]
kzg = ["dep:derive_more", "dep:c-kzg", "dep:once_cell"]
ssz = [
Expand Down
2 changes: 2 additions & 0 deletions crates/eips/src/eip7702/auth_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ impl Authorization {
///
/// The authority prehash is `keccak(MAGIC || rlp([chain_id, [nonce], address]))`
#[inline]
#[cfg(feature = "k256")]
fn authority_prehash(&self) -> B256 {
#[derive(RlpEncodable)]
struct Auth {
Expand All @@ -75,6 +76,7 @@ impl Authorization {
/// # Note
///
/// Implementers should check that the authority has no code.
#[cfg(feature = "k256")]
pub fn recover_authority(&self) -> Result<Address, SignatureError> {
self.signature.recover_address_from_prehash(&self.authority_prehash())
}
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc-types-eth/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ arbitrary = [
]
jsonrpsee-types = ["dep:jsonrpsee-types"]
ssz = ["alloy-primitives/ssz", "alloy-eips/ssz"]
k256 = ["alloy-consensus/k256"]
k256 = ["alloy-consensus/k256", "alloy-eips/k256"]

0 comments on commit 26a7009

Please sign in to comment.