Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ members = ["crates/*"]

[workspace.dependencies]
alloy = { version = "1.7.3", default-features = false }
# alloy-signer was added because eip712 on the regular alloy crate brings way too much stuff with it
# as such, this is a workaround to force feature unification over alloy to the feature set we want
alloy-contract = { version = "1.7.3", default-features = false }
alloy-primitives = { version = "1.5.2", default-features = false }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To fully replace the alloy crate in crates/model, alloy-sol-types is also needed. Please add it to the workspace dependencies to make it available.

Suggested change
alloy-primitives = { version = "1.5.2", default-features = false }
alloy-primitives = { version = "1.5.2", default-features = false }
alloy-sol-types = { version = "1.5.2", default-features = false }

alloy-signer = { version = "1.7.3", default-features = false}
alloy-signer-local = { version = "1.7.3", default-features = false}
alloy-sol-types = { version = "1.5.2" }
anyhow = "1.0.100"
async-trait = "0.1.80"
axum = "0.8"
Expand Down Expand Up @@ -93,7 +95,6 @@ solvers-dto = { path = "crates/solvers-dto" }
testlib = { path = "crates/testlib" }
winner-selection = { path = "crates/winner-selection" }
time = "0.3.47"
tiny-keccak = "2.0.2"
tower = "0.5"
tower-http = "0.6"
tracing-opentelemetry = "0.32.1"
Expand Down
3 changes: 1 addition & 2 deletions crates/app-data/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2024"
license = "MIT OR Apache-2.0"

[dependencies]
alloy = { workspace = true, features = ["serde"] }
alloy-primitives = { workspace = true, features = ["serde"] }
anyhow = { workspace = true }
bytes-hex = { workspace = true }
const-hex = { workspace = true }
Expand All @@ -15,7 +15,6 @@ number = { path = "../number" }
serde = { workspace = true }
serde_json = { workspace = true }
serde_with = { workspace = true }
tiny-keccak = { workspace = true, features = ["keccak"] }

[dev-dependencies]
hex-literal = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/app-data/src/app_data.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use {
crate::{AppDataHash, Hooks, app_data_hash::hash_full_app_data},
alloy::primitives::{Address, U256},
alloy_primitives::{Address, U256},
anyhow::{Context, Result, anyhow},
bytes_hex::BytesHex,
moka::sync::Cache,
Expand Down
7 changes: 1 addition & 6 deletions crates/app-data/src/app_data_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ use {
fmt::{self, Debug, Formatter},
str::FromStr,
},
tiny_keccak::{Hasher, Keccak},
};

/// A JSON object used to represent app data documents for uploading and
Expand Down Expand Up @@ -107,11 +106,7 @@ impl PartialEq<[u8; 32]> for AppDataHash {
/// Hash full app data to get the bytes expected to be set as the contract level
/// app data.
pub fn hash_full_app_data(app_data: &[u8]) -> [u8; 32] {
let mut hasher = Keccak::v256();
hasher.update(app_data);
let mut hash = [0u8; 32];
hasher.finalize(&mut hash);
hash
alloy_primitives::keccak256(app_data).0
}

/// Create an IPFS CIDv1 from a hash created by `hash_full_app_data`.
Expand Down
2 changes: 1 addition & 1 deletion crates/app-data/src/hooks.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use {
alloy::primitives::Address,
alloy_primitives::Address,
bytes_hex::BytesHex,
serde::{Deserialize, Serialize},
serde_with::{DisplayFromStr, serde_as},
Expand Down
3 changes: 1 addition & 2 deletions crates/chain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ edition = "2024"
license = "MIT OR Apache-2.0"

[dependencies]
alloy = { workspace = true }
alloy-primitives = { workspace = true }
serde = { workspace = true }
thiserror = { workspace = true }

[dev-dependencies]
serde_json = { workspace = true }
Expand Down
16 changes: 11 additions & 5 deletions crates/chain/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use {
alloy::primitives::U256,
alloy_primitives::U256,
serde::{Deserialize, Deserializer, de},
std::time::Duration,
thiserror::Error,
std::{error::Error, fmt::Display, time::Duration},
};

/// Represents each available chain
Expand Down Expand Up @@ -177,10 +176,17 @@ impl<'de> Deserialize<'de> for Chain {
}
}

#[derive(Error, Debug)]
#[error("chain id not supported")]
#[derive(Debug)]
pub struct ChainIdNotSupported;

impl Display for ChainIdNotSupported {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "chain id not supported")
}
}

impl Error for ChainIdNotSupported {}

#[cfg(test)]
mod test {
use super::*;
Expand Down
5 changes: 4 additions & 1 deletion crates/model/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ license = "MIT OR Apache-2.0"
doctest = false

[dependencies]
alloy = { workspace = true, features = ["sol-types", "signers", "signer-local", "rand"] }
alloy-primitives = { workspace = true }
alloy-signer = { workspace = true }
alloy-signer-local = { workspace = true }
alloy-sol-types = { workspace = true }
anyhow = { workspace = true }
app-data = { workspace = true }
bigdecimal = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/model/src/fee_policy.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use {
alloy::primitives::{Address, U256},
alloy_primitives::{Address, U256},
number::serialization::HexOrDecimalU256,
serde::Serialize,
serde_with::serde_as,
Expand Down
2 changes: 1 addition & 1 deletion crates/model/src/interaction.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use {
alloy::primitives::{Address, U256},
alloy_primitives::{Address, U256},
number::serialization::HexOrDecimalU256,
serde::{Deserialize, Serialize},
serde_with::serde_as,
Expand Down
9 changes: 5 additions & 4 deletions crates/model/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ pub mod time;
pub mod trade;

use {
alloy::primitives::Address,
alloy_primitives::{Address, U256},
alloy_sol_types::Eip712Domain,
const_hex::{FromHex, FromHexError},
std::fmt,
};
Expand Down Expand Up @@ -112,10 +113,10 @@ impl std::fmt::Debug for DomainSeparator {

impl DomainSeparator {
pub fn new(chain_id: u64, contract_address: Address) -> Self {
let domain = alloy::sol_types::Eip712Domain {
let domain = Eip712Domain {
name: Some("Gnosis Protocol".into()),
version: Some("v2".into()),
chain_id: Some(alloy::primitives::U256::from(chain_id)),
chain_id: Some(U256::from(chain_id)),
verifying_contract: Some(contract_address),
salt: None,
};
Expand All @@ -128,7 +129,7 @@ impl DomainSeparator {
mod tests {
use {
super::*,
alloy::primitives::address,
alloy_primitives::address,
hex_literal::hex,
std::{cmp::Ordering, str::FromStr},
};
Expand Down
Loading
Loading