mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
Remove ethers mono-crate
Reduces size of ethereum-serai and gives us clarity on what's used. Next should be rmeoving the ethers-provided signing code.
This commit is contained in:
44
Cargo.lock
generated
44
Cargo.lock
generated
@@ -2115,14 +2115,17 @@ dependencies = [
|
|||||||
name = "ethereum-serai"
|
name = "ethereum-serai"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ethers",
|
"ethers-contract",
|
||||||
|
"ethers-core",
|
||||||
|
"ethers-middleware",
|
||||||
|
"ethers-providers",
|
||||||
|
"ethers-signers",
|
||||||
"ethers-solc",
|
"ethers-solc",
|
||||||
"eyre",
|
"eyre",
|
||||||
"group",
|
"group",
|
||||||
"k256",
|
"k256",
|
||||||
"modular-frost",
|
"modular-frost",
|
||||||
"rand_core",
|
"rand_core",
|
||||||
"serde",
|
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"sha2",
|
"sha2",
|
||||||
"sha3",
|
"sha3",
|
||||||
@@ -2146,34 +2149,6 @@ dependencies = [
|
|||||||
"uint",
|
"uint",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ethers"
|
|
||||||
version = "2.0.10"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1ad13497f6e0a24292fc7b408e30d22fe9dc262da1f40d7b542c3a44e7fc0476"
|
|
||||||
dependencies = [
|
|
||||||
"ethers-addressbook",
|
|
||||||
"ethers-contract",
|
|
||||||
"ethers-core",
|
|
||||||
"ethers-etherscan",
|
|
||||||
"ethers-middleware",
|
|
||||||
"ethers-providers",
|
|
||||||
"ethers-signers",
|
|
||||||
"ethers-solc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ethers-addressbook"
|
|
||||||
version = "2.0.10"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "c6e9e8acd0ed348403cc73a670c24daba3226c40b98dc1a41903766b3ab6240a"
|
|
||||||
dependencies = [
|
|
||||||
"ethers-core",
|
|
||||||
"once_cell",
|
|
||||||
"serde",
|
|
||||||
"serde_json",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ethers-contract"
|
name = "ethers-contract"
|
||||||
version = "2.0.10"
|
version = "2.0.10"
|
||||||
@@ -2268,7 +2243,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "0e53451ea4a8128fbce33966da71132cf9e1040dcfd2a2084fd7733ada7b2045"
|
checksum = "0e53451ea4a8128fbce33966da71132cf9e1040dcfd2a2084fd7733ada7b2045"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ethers-core",
|
"ethers-core",
|
||||||
"ethers-solc",
|
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"semver 1.0.20",
|
"semver 1.0.20",
|
||||||
"serde",
|
"serde",
|
||||||
@@ -8592,9 +8566,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.190"
|
version = "1.0.191"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7"
|
checksum = "a834c4821019838224821468552240d4d95d14e751986442c816572d39a080c9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
]
|
]
|
||||||
@@ -8610,9 +8584,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_derive"
|
name = "serde_derive"
|
||||||
version = "1.0.190"
|
version = "1.0.191"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3"
|
checksum = "46fa52d5646bce91b680189fe5b1c049d2ea38dabb4e2e7c8d00ca12cfbfbcfd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
|||||||
@@ -13,25 +13,28 @@ all-features = true
|
|||||||
rustdoc-args = ["--cfg", "docsrs"]
|
rustdoc-args = ["--cfg", "docsrs"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
thiserror = "1"
|
thiserror = { version = "1", default-features = false }
|
||||||
rand_core = "0.6"
|
eyre = { version = "0.6", default-features = false }
|
||||||
|
|
||||||
serde_json = "1"
|
serde_json = { version = "1", default-features = false, features = ["std"] }
|
||||||
serde = "1"
|
|
||||||
|
|
||||||
sha2 = "0.10"
|
sha3 = { version = "0.10", default-features = false, features = ["std"] }
|
||||||
sha3 = "0.10"
|
|
||||||
|
|
||||||
group = "0.13"
|
group = { version = "0.13", default-features = false }
|
||||||
k256 = { version = "^0.13.1", default-features = false, features = ["std", "arithmetic", "bits", "ecdsa"] }
|
k256 = { version = "^0.13.1", default-features = false, features = ["std", "ecdsa"] }
|
||||||
frost = { package = "modular-frost", path = "../../crypto/frost", features = ["secp256k1", "tests"] }
|
frost = { package = "modular-frost", path = "../../crypto/frost", features = ["secp256k1", "tests"] }
|
||||||
|
|
||||||
eyre = "0.6"
|
ethers-core = { version = "2", default-features = false }
|
||||||
|
ethers-signers = { version = "2", default-features = false }
|
||||||
ethers = { version = "2", default-features = false, features = ["abigen", "ethers-solc"] }
|
ethers-middleware = { version = "2", default-features = false }
|
||||||
|
ethers-providers = { version = "2", default-features = false }
|
||||||
|
ethers-contract = { version = "2", default-features = false, features = ["abigen", "providers"] }
|
||||||
|
ethers-solc = { version = "2", default-features = false }
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
ethers-solc = { version = "2", default-features = false }
|
ethers-solc = { version = "2", default-features = false }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
rand_core = { version = "0.6", default-features = false, features = ["std"] }
|
||||||
|
sha2 = { version = "0.10", default-features = false, features = ["std"] }
|
||||||
tokio = { version = "1", features = ["macros"] }
|
tokio = { version = "1", features = ["macros"] }
|
||||||
|
|||||||
@@ -1,9 +1,15 @@
|
|||||||
use crate::crypto::ProcessedSignature;
|
use std::{sync::Arc, fs::File};
|
||||||
use ethers::{contract::ContractFactory, prelude::*, solc::artifacts::contract::ContractBytecode};
|
|
||||||
use eyre::{eyre, Result};
|
|
||||||
use std::fs::File;
|
|
||||||
use std::sync::Arc;
|
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
use eyre::{eyre, Result};
|
||||||
|
|
||||||
|
use ethers_signers::LocalWallet;
|
||||||
|
use ethers_middleware::SignerMiddleware;
|
||||||
|
use ethers_providers::{Provider, Http};
|
||||||
|
use ethers_contract::{abigen, ContractFactory};
|
||||||
|
use ethers_solc::artifacts::contract::ContractBytecode;
|
||||||
|
|
||||||
|
use crate::crypto::ProcessedSignature;
|
||||||
|
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
pub enum EthereumError {
|
pub enum EthereumError {
|
||||||
@@ -11,11 +17,7 @@ pub enum EthereumError {
|
|||||||
VerificationError,
|
VerificationError,
|
||||||
}
|
}
|
||||||
|
|
||||||
abigen!(
|
abigen!(Schnorr, "./artifacts/Schnorr.sol/Schnorr.json",);
|
||||||
Schnorr,
|
|
||||||
"./artifacts/Schnorr.sol/Schnorr.json",
|
|
||||||
event_derives(serde::Deserialize, serde::Serialize),
|
|
||||||
);
|
|
||||||
|
|
||||||
pub async fn deploy_schnorr_verifier_contract(
|
pub async fn deploy_schnorr_verifier_contract(
|
||||||
client: Arc<SignerMiddleware<Provider<Http>, LocalWallet>>,
|
client: Arc<SignerMiddleware<Provider<Http>, LocalWallet>>,
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ use k256::{
|
|||||||
use frost::{algorithm::Hram, curve::Secp256k1};
|
use frost::{algorithm::Hram, curve::Secp256k1};
|
||||||
|
|
||||||
pub fn keccak256(data: &[u8]) -> [u8; 32] {
|
pub fn keccak256(data: &[u8]) -> [u8; 32] {
|
||||||
Keccak256::digest(data).try_into().unwrap()
|
Keccak256::digest(data).into()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn hash_to_scalar(data: &[u8]) -> Scalar {
|
pub fn hash_to_scalar(data: &[u8]) -> Scalar {
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ use rand_core::OsRng;
|
|||||||
|
|
||||||
use ::k256::{elliptic_curve::bigint::ArrayEncoding, U256};
|
use ::k256::{elliptic_curve::bigint::ArrayEncoding, U256};
|
||||||
|
|
||||||
use ethers::{
|
use ethers_core::utils::{keccak256, Anvil, AnvilInstance};
|
||||||
prelude::*,
|
use ethers_middleware::{Middleware, SignerMiddleware};
|
||||||
utils::{keccak256, Anvil, AnvilInstance},
|
use ethers_providers::{Provider, Http};
|
||||||
};
|
use ethers_signers::LocalWallet;
|
||||||
|
|
||||||
use frost::{
|
use frost::{
|
||||||
curve::Secp256k1,
|
curve::Secp256k1,
|
||||||
|
|||||||
Reference in New Issue
Block a user