Skip to content

Commit 51e984e

Browse files
authored
fix: bump alloy to latest (#83)
1 parent d17f94b commit 51e984e

File tree

7 files changed

+52
-61
lines changed

7 files changed

+52
-61
lines changed

relay_rpc/Cargo.toml

+3-20
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,7 @@ license = "Apache-2.0"
88
cacao = [
99
"dep:k256",
1010
"dep:sha3",
11-
"dep:alloy-provider",
12-
"dep:alloy-transport",
13-
"dep:alloy-transport-http",
14-
"dep:alloy-rpc-types",
15-
"dep:alloy-json-rpc",
16-
"dep:alloy-json-abi",
17-
"dep:alloy-sol-types",
18-
"dep:alloy-primitives",
19-
"dep:alloy-node-bindings",
20-
"dep:alloy-contract"
11+
"dep:alloy"
2112
]
2213

2314
[dependencies]
@@ -46,20 +37,12 @@ k256 = { version = "0.13", optional = true }
4637
sha3 = { version = "0.10", optional = true }
4738
sha2 = { version = "0.10.6" }
4839
url = "2"
49-
alloy-provider = { git = "https://github.com/alloy-rs/alloy.git", rev = "d68a6b7", optional = true }
50-
alloy-transport = { git = "https://github.com/alloy-rs/alloy.git", rev = "d68a6b7", optional = true }
51-
alloy-transport-http = { git = "https://github.com/alloy-rs/alloy.git", rev = "d68a6b7", optional = true }
52-
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy.git", rev = "d68a6b7", optional = true }
53-
alloy-json-rpc = { git = "https://github.com/alloy-rs/alloy.git", rev = "d68a6b7", optional = true }
54-
alloy-node-bindings = { git = "https://github.com/alloy-rs/alloy.git", rev = "d68a6b7", optional = true }
55-
alloy-contract = { git = "https://github.com/alloy-rs/alloy.git", rev = "d68a6b7", optional = true }
56-
alloy-json-abi = { version = "0.7.0", optional = true }
57-
alloy-sol-types = { version = "0.7.0", optional = true }
58-
alloy-primitives = { version = "0.7.0", optional = true }
40+
alloy = { version = "0.3.6", optional = true, features = ["json-rpc", "provider-http", "contract", "rpc-types-eth"] }
5941
strum = { version = "0.26", features = ["strum_macros", "derive"] }
6042

6143
[dev-dependencies]
6244
tokio = { version = "1.35.1", features = ["test-util", "macros"] }
45+
alloy = { version = "0.3.6", features = ["node-bindings"] }
6346

6447
[build-dependencies]
6548
serde_json = "1.0"

relay_rpc/src/auth/cacao.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use {
44
payload::Payload,
55
signature::{get_rpc_url::GetRpcUrl, Signature},
66
},
7-
alloy_primitives::hex::FromHexError,
7+
alloy::primitives::hex::FromHexError,
88
core::fmt::Debug,
99
serde::{Deserialize, Serialize},
1010
serde_json::value::RawValue,
@@ -52,10 +52,14 @@ pub enum CacaoError {
5252
Verification,
5353

5454
#[error("Internal EIP-1271 resolution error: {0}")]
55-
Eip1271Internal(alloy_json_rpc::RpcError<alloy_transport::TransportErrorKind, Box<RawValue>>),
55+
Eip1271Internal(
56+
alloy::rpc::json_rpc::RpcError<alloy::transports::TransportErrorKind, Box<RawValue>>,
57+
),
5658

5759
#[error("Internal EIP-6492 resolution error: {0}")]
58-
Eip6492Internal(alloy_json_rpc::RpcError<alloy_transport::TransportErrorKind, Box<RawValue>>),
60+
Eip6492Internal(
61+
alloy::rpc::json_rpc::RpcError<alloy::transports::TransportErrorKind, Box<RawValue>>,
62+
),
5963
}
6064

6165
impl From<std::fmt::Error> for CacaoError {

relay_rpc/src/auth/cacao/signature/eip1271.rs

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
use {
22
super::CacaoError,
3-
alloy_primitives::Address,
4-
alloy_provider::{network::Ethereum, Provider, ReqwestProvider},
5-
alloy_rpc_types::{TransactionInput, TransactionRequest},
6-
alloy_sol_types::{sol, SolCall},
3+
alloy::{
4+
primitives::Address,
5+
providers::{network::Ethereum, Provider, ReqwestProvider},
6+
rpc::types::{TransactionInput, TransactionRequest},
7+
sol,
8+
sol_types::SolCall,
9+
},
710
url::Url,
811
};
912

@@ -39,20 +42,17 @@ pub async fn verify_eip1271(
3942
.into(),
4043
));
4144

42-
let result = provider
43-
.call(&call_request, Default::default())
44-
.await
45-
.map_err(|e| {
46-
if let Some(error_response) = e.as_error_resp() {
47-
if error_response.message.starts_with("execution reverted:") {
48-
CacaoError::Verification
49-
} else {
50-
CacaoError::Eip1271Internal(e)
51-
}
45+
let result = provider.call(&call_request).await.map_err(|e| {
46+
if let Some(error_response) = e.as_error_resp() {
47+
if error_response.message.starts_with("execution reverted:") {
48+
CacaoError::Verification
5249
} else {
5350
CacaoError::Eip1271Internal(e)
5451
}
55-
})?;
52+
} else {
53+
CacaoError::Eip1271Internal(e)
54+
}
55+
})?;
5656

5757
let magic = result.get(..4);
5858
if let Some(magic) = magic {
@@ -81,7 +81,7 @@ mod test {
8181
EIP1271_MOCK_CONTRACT,
8282
},
8383
},
84-
alloy_primitives::address,
84+
alloy::primitives::address,
8585
k256::ecdsa::SigningKey,
8686
sha3::{Digest, Keccak256},
8787
};

relay_rpc/src/auth/cacao/signature/eip191.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use {
22
super::CacaoError,
33
crate::auth::cacao::signature::strip_hex_prefix,
4-
alloy_primitives::Address,
4+
alloy::primitives::Address,
55
sha3::{Digest, Keccak256},
66
};
77

@@ -58,7 +58,7 @@ mod tests {
5858
eip191::verify_eip191,
5959
test_helpers::{message_hash_internal, sign_message},
6060
},
61-
alloy_primitives::Address,
61+
alloy::primitives::Address,
6262
k256::ecdsa::SigningKey,
6363
};
6464

relay_rpc/src/auth/cacao/signature/eip6492.rs

+19-17
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
use {
22
crate::auth::cacao::CacaoError,
3-
alloy_primitives::Address,
4-
alloy_provider::{network::Ethereum, Provider, ReqwestProvider},
5-
alloy_rpc_types::{TransactionInput, TransactionRequest},
6-
alloy_sol_types::{sol, SolConstructor},
3+
alloy::{
4+
primitives::Address,
5+
providers::{network::Ethereum, Provider, ReqwestProvider},
6+
rpc::types::{TransactionInput, TransactionRequest},
7+
sol,
8+
sol_types::SolConstructor,
9+
},
710
url::Url,
811
};
912

@@ -42,20 +45,17 @@ pub async fn verify_eip6492(
4245
let transaction_request =
4346
TransactionRequest::default().input(TransactionInput::new(bytes.into()));
4447

45-
let result = provider
46-
.call(&transaction_request, Default::default())
47-
.await
48-
.map_err(|e| {
49-
if let Some(error_response) = e.as_error_resp() {
50-
if error_response.message == "execution reverted" {
51-
CacaoError::Verification
52-
} else {
53-
CacaoError::Eip6492Internal(e)
54-
}
48+
let result = provider.call(&transaction_request).await.map_err(|e| {
49+
if let Some(error_response) = e.as_error_resp() {
50+
if error_response.message == "execution reverted" {
51+
CacaoError::Verification
5552
} else {
5653
CacaoError::Eip6492Internal(e)
5754
}
58-
})?;
55+
} else {
56+
CacaoError::Eip6492Internal(e)
57+
}
58+
})?;
5959

6060
let magic = result.first();
6161
if let Some(magic) = magic {
@@ -84,8 +84,10 @@ mod test {
8484
EIP1271_MOCK_CONTRACT,
8585
},
8686
},
87-
alloy_primitives::{address, b256, Uint},
88-
alloy_sol_types::{SolCall, SolValue},
87+
alloy::{
88+
primitives::{address, b256, Uint},
89+
sol_types::{SolCall, SolValue},
90+
},
8991
k256::ecdsa::SigningKey,
9092
};
9193

relay_rpc/src/auth/cacao/signature/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use {
66
get_rpc_url::GetRpcUrl,
77
},
88
super::{Cacao, CacaoError},
9-
alloy_primitives::Address,
9+
alloy::primitives::Address,
1010
serde::{Deserialize, Serialize},
1111
sha3::{Digest, Keccak256},
1212
std::str::FromStr,

relay_rpc/src/auth/cacao/signature/test_helpers.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
use {
22
super::eip191::eip191_bytes,
3-
alloy_node_bindings::{Anvil, AnvilInstance},
4-
alloy_primitives::Address,
3+
alloy::{
4+
node_bindings::{Anvil, AnvilInstance},
5+
primitives::Address,
6+
},
57
k256::ecdsa::SigningKey,
68
regex::Regex,
79
sha2::Digest,

0 commit comments

Comments
 (0)