mirror of
https://github.com/serai-dex/serai.git
synced 2024-11-16 17:07:35 +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:
parent
205bec36e5
commit
c9003874ad
5 changed files with 40 additions and 61 deletions
44
Cargo.lock
generated
44
Cargo.lock
generated
|
@ -2115,14 +2115,17 @@ dependencies = [
|
|||
name = "ethereum-serai"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"ethers",
|
||||
"ethers-contract",
|
||||
"ethers-core",
|
||||
"ethers-middleware",
|
||||
"ethers-providers",
|
||||
"ethers-signers",
|
||||
"ethers-solc",
|
||||
"eyre",
|
||||
"group",
|
||||
"k256",
|
||||
"modular-frost",
|
||||
"rand_core",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha2",
|
||||
"sha3",
|
||||
|
@ -2146,34 +2149,6 @@ dependencies = [
|
|||
"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]]
|
||||
name = "ethers-contract"
|
||||
version = "2.0.10"
|
||||
|
@ -2268,7 +2243,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "0e53451ea4a8128fbce33966da71132cf9e1040dcfd2a2084fd7733ada7b2045"
|
||||
dependencies = [
|
||||
"ethers-core",
|
||||
"ethers-solc",
|
||||
"reqwest",
|
||||
"semver 1.0.20",
|
||||
"serde",
|
||||
|
@ -8592,9 +8566,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.190"
|
||||
version = "1.0.191"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7"
|
||||
checksum = "a834c4821019838224821468552240d4d95d14e751986442c816572d39a080c9"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
@ -8610,9 +8584,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.190"
|
||||
version = "1.0.191"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3"
|
||||
checksum = "46fa52d5646bce91b680189fe5b1c049d2ea38dabb4e2e7c8d00ca12cfbfbcfd"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
|
|
@ -13,25 +13,28 @@ all-features = true
|
|||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[dependencies]
|
||||
thiserror = "1"
|
||||
rand_core = "0.6"
|
||||
thiserror = { version = "1", default-features = false }
|
||||
eyre = { version = "0.6", default-features = false }
|
||||
|
||||
serde_json = "1"
|
||||
serde = "1"
|
||||
serde_json = { version = "1", default-features = false, features = ["std"] }
|
||||
|
||||
sha2 = "0.10"
|
||||
sha3 = "0.10"
|
||||
sha3 = { version = "0.10", default-features = false, features = ["std"] }
|
||||
|
||||
group = "0.13"
|
||||
k256 = { version = "^0.13.1", default-features = false, features = ["std", "arithmetic", "bits", "ecdsa"] }
|
||||
group = { version = "0.13", default-features = false }
|
||||
k256 = { version = "^0.13.1", default-features = false, features = ["std", "ecdsa"] }
|
||||
frost = { package = "modular-frost", path = "../../crypto/frost", features = ["secp256k1", "tests"] }
|
||||
|
||||
eyre = "0.6"
|
||||
|
||||
ethers = { version = "2", default-features = false, features = ["abigen", "ethers-solc"] }
|
||||
ethers-core = { version = "2", default-features = false }
|
||||
ethers-signers = { version = "2", default-features = false }
|
||||
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]
|
||||
ethers-solc = { version = "2", default-features = false }
|
||||
|
||||
[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"] }
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
use crate::crypto::ProcessedSignature;
|
||||
use ethers::{contract::ContractFactory, prelude::*, solc::artifacts::contract::ContractBytecode};
|
||||
use eyre::{eyre, Result};
|
||||
use std::fs::File;
|
||||
use std::sync::Arc;
|
||||
use std::{sync::Arc, fs::File};
|
||||
|
||||
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)]
|
||||
pub enum EthereumError {
|
||||
|
@ -11,11 +17,7 @@ pub enum EthereumError {
|
|||
VerificationError,
|
||||
}
|
||||
|
||||
abigen!(
|
||||
Schnorr,
|
||||
"./artifacts/Schnorr.sol/Schnorr.json",
|
||||
event_derives(serde::Deserialize, serde::Serialize),
|
||||
);
|
||||
abigen!(Schnorr, "./artifacts/Schnorr.sol/Schnorr.json",);
|
||||
|
||||
pub async fn deploy_schnorr_verifier_contract(
|
||||
client: Arc<SignerMiddleware<Provider<Http>, LocalWallet>>,
|
||||
|
|
|
@ -11,7 +11,7 @@ use k256::{
|
|||
use frost::{algorithm::Hram, curve::Secp256k1};
|
||||
|
||||
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 {
|
||||
|
|
|
@ -4,10 +4,10 @@ use rand_core::OsRng;
|
|||
|
||||
use ::k256::{elliptic_curve::bigint::ArrayEncoding, U256};
|
||||
|
||||
use ethers::{
|
||||
prelude::*,
|
||||
utils::{keccak256, Anvil, AnvilInstance},
|
||||
};
|
||||
use ethers_core::utils::{keccak256, Anvil, AnvilInstance};
|
||||
use ethers_middleware::{Middleware, SignerMiddleware};
|
||||
use ethers_providers::{Provider, Http};
|
||||
use ethers_signers::LocalWallet;
|
||||
|
||||
use frost::{
|
||||
curve::Secp256k1,
|
||||
|
|
Loading…
Reference in a new issue