mirror of
https://github.com/serai-dex/serai.git
synced 2025-03-11 17:06:25 +00:00
Remove coin crate
Effective reversion of past few commits by request.
This commit is contained in:
parent
5ce06cf1b7
commit
ec7d8ac67b
9 changed files with 36 additions and 120 deletions
23
Cargo.lock
generated
23
Cargo.lock
generated
|
@ -7497,23 +7497,6 @@ version = "0.5.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "930c0acf610d3fdb5e2ab6213019aaa04e227ebe9547b0649ba599b16d788bd7"
|
||||
|
||||
[[package]]
|
||||
name = "serai-coin"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"curve25519-dalek 3.2.0",
|
||||
"dalek-ff-group",
|
||||
"flexible-transcript",
|
||||
"group",
|
||||
"modular-frost",
|
||||
"monero-serai",
|
||||
"rand_core 0.6.4",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serai-consensus"
|
||||
version = "0.1.0"
|
||||
|
@ -7604,13 +7587,17 @@ name = "serai-processor"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"curve25519-dalek 3.2.0",
|
||||
"dalek-ff-group",
|
||||
"flexible-transcript",
|
||||
"futures",
|
||||
"group",
|
||||
"hex",
|
||||
"modular-frost",
|
||||
"monero-serai",
|
||||
"rand_core 0.6.4",
|
||||
"serai-coin",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
]
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
[package]
|
||||
name = "serai-coin"
|
||||
version = "0.1.0"
|
||||
description = "An abstract interface representing a coin, along with implementations for various coins."
|
||||
license = "MIT"
|
||||
repository = "https://github.com/serai-dex/serai/tree/develop/coin"
|
||||
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
|
||||
keywords = []
|
||||
edition = "2021"
|
||||
publish = false
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[dependencies]
|
||||
async-trait = "0.1"
|
||||
thiserror = "1"
|
||||
|
||||
curve25519-dalek = { version = "3", features = ["std"] }
|
||||
|
||||
transcript = { package = "flexible-transcript", path = "../crypto/transcript", features = ["recommended"] }
|
||||
dalek-ff-group = { path = "../crypto/dalek-ff-group" }
|
||||
frost = { package = "modular-frost", path = "../crypto/frost", features = ["secp256k1", "ed25519"] }
|
||||
|
||||
monero-serai = { path = "../coins/monero", features = ["multisig"] }
|
||||
|
||||
# Test Dependencies
|
||||
rand_core = { version = "0.6", optional = true }
|
||||
|
||||
group = { version = "0.12", optional = true }
|
||||
|
||||
serde = { version = "1.0", features = ["derive"], optional = true }
|
||||
serde_json = { version = "1.0", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
rand_core = "0.6"
|
||||
|
||||
group = "0.12"
|
||||
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
|
||||
[features]
|
||||
monero = []
|
||||
monero_test = ["rand_core", "group", "serde", "serde_json"]
|
||||
test = ["monero_test"]
|
21
coin/LICENSE
21
coin/LICENSE
|
@ -1,21 +0,0 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2022 Luke Parker
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
|
@ -1,4 +0,0 @@
|
|||
# Serai Coin
|
||||
|
||||
An abstract interface representing a coin, along with implementations for
|
||||
various coins.
|
|
@ -1,11 +0,0 @@
|
|||
use frost::curve::Curve;
|
||||
|
||||
use crate::Coin;
|
||||
|
||||
// Generate a static additional key for a given chain in a globally consistent manner
|
||||
// Doesn't consider the current group key to increase the simplicity of verifying Serai's status
|
||||
// Takes an index, k, to support protocols which use multiple secondary keys
|
||||
// Presumably a view key
|
||||
pub(crate) fn additional_key<C: Coin>(k: u64) -> <C::Curve as Curve>::F {
|
||||
C::Curve::hash_to_F(b"Serai DEX Additional Key", &[C::ID, &k.to_le_bytes()].concat())
|
||||
}
|
|
@ -20,17 +20,22 @@ thiserror = "1"
|
|||
|
||||
group = "0.12"
|
||||
|
||||
curve25519-dalek = { version = "3", features = ["std"] }
|
||||
|
||||
transcript = { package = "flexible-transcript", path = "../crypto/transcript", features = ["recommended"] }
|
||||
dalek-ff-group = { path = "../crypto/dalek-ff-group" }
|
||||
frost = { package = "modular-frost", path = "../crypto/frost", features = ["ed25519"] }
|
||||
|
||||
serai-coin = { path = "../coin", features = ["monero"] }
|
||||
monero-serai = { path = "../coins/monero", features = ["multisig"] }
|
||||
|
||||
[dev-dependencies]
|
||||
rand_core = "0.6"
|
||||
|
||||
hex = "0.4"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
|
||||
futures = "0.3"
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
|
||||
frost = { package = "modular-frost", path = "../crypto/frost", features = ["ed25519", "tests"] }
|
||||
|
||||
serai-coin = { path = "../coin", features = ["monero", "test"] }
|
||||
|
|
|
@ -6,11 +6,7 @@ use thiserror::Error;
|
|||
use transcript::RecommendedTranscript;
|
||||
use frost::{curve::Curve, FrostKeys, sign::PreprocessMachine};
|
||||
|
||||
pub(crate) mod utils;
|
||||
|
||||
#[cfg(feature = "monero")]
|
||||
pub mod monero;
|
||||
#[cfg(feature = "monero")]
|
||||
pub use self::monero::Monero;
|
||||
|
||||
#[derive(Clone, Error, Debug)]
|
||||
|
@ -83,12 +79,12 @@ pub trait Coin {
|
|||
tx: &Self::Transaction,
|
||||
) -> Result<(Vec<u8>, Vec<<Self::Output as Output>::Id>), CoinError>;
|
||||
|
||||
#[cfg(any(test, feature = "test"))]
|
||||
#[cfg(test)]
|
||||
async fn get_fee(&self) -> Self::Fee;
|
||||
|
||||
#[cfg(any(test, feature = "test"))]
|
||||
#[cfg(test)]
|
||||
async fn mine_block(&self);
|
||||
|
||||
#[cfg(any(test, feature = "test"))]
|
||||
#[cfg(test)]
|
||||
async fn test_send(&self, key: Self::Address);
|
||||
}
|
|
@ -17,7 +17,10 @@ use monero_serai::{
|
|||
},
|
||||
};
|
||||
|
||||
use crate::{CoinError, Output as OutputTrait, Coin, utils::additional_key};
|
||||
use crate::{
|
||||
additional_key,
|
||||
coin::{CoinError, Output as OutputTrait, Coin},
|
||||
};
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Output(SpendableOutput);
|
||||
|
@ -74,7 +77,7 @@ impl Monero {
|
|||
Scanner::from_view(ViewPair::new(spend.0, self.view), Network::Mainnet, None)
|
||||
}
|
||||
|
||||
#[cfg(any(test, feature = "test"))]
|
||||
#[cfg(test)]
|
||||
fn empty_scanner() -> Scanner {
|
||||
use group::Group;
|
||||
Scanner::from_view(
|
||||
|
@ -84,7 +87,7 @@ impl Monero {
|
|||
)
|
||||
}
|
||||
|
||||
#[cfg(any(test, feature = "test"))]
|
||||
#[cfg(test)]
|
||||
fn empty_address() -> Address {
|
||||
Self::empty_scanner().address()
|
||||
}
|
||||
|
@ -206,12 +209,12 @@ impl Coin for Monero {
|
|||
Ok((tx.hash().to_vec(), tx.prefix.outputs.iter().map(|output| output.key.to_bytes()).collect()))
|
||||
}
|
||||
|
||||
#[cfg(any(test, feature = "test"))]
|
||||
#[cfg(test)]
|
||||
async fn get_fee(&self) -> Self::Fee {
|
||||
self.rpc.get_fee().await.unwrap()
|
||||
}
|
||||
|
||||
#[cfg(any(test, feature = "test"))]
|
||||
#[cfg(test)]
|
||||
async fn mine_block(&self) {
|
||||
#[derive(serde::Deserialize, Debug)]
|
||||
struct EmptyResponse {}
|
||||
|
@ -231,7 +234,7 @@ impl Coin for Monero {
|
|||
.unwrap();
|
||||
}
|
||||
|
||||
#[cfg(any(test, feature = "test"))]
|
||||
#[cfg(test)]
|
||||
async fn test_send(&self, address: Self::Address) {
|
||||
use rand_core::OsRng;
|
||||
|
|
@ -3,10 +3,10 @@ use std::{marker::Send, io::Cursor, collections::HashMap};
|
|||
use async_trait::async_trait;
|
||||
use thiserror::Error;
|
||||
|
||||
use frost::FrostError;
|
||||
use frost::{curve::Curve, FrostError};
|
||||
|
||||
pub use serai_coin as coin;
|
||||
use coin::CoinError;
|
||||
mod coin;
|
||||
use coin::{CoinError, Coin};
|
||||
|
||||
mod wallet;
|
||||
|
||||
|
@ -30,3 +30,11 @@ pub enum SignError {
|
|||
#[error("network had an error {0}")]
|
||||
NetworkError(NetworkError),
|
||||
}
|
||||
|
||||
// Generate a static additional key for a given chain in a globally consistent manner
|
||||
// Doesn't consider the current group key to increase the simplicity of verifying Serai's status
|
||||
// Takes an index, k, to support protocols which use multiple secondary keys
|
||||
// Presumably a view key
|
||||
pub(crate) fn additional_key<C: Coin>(k: u64) -> <C::Curve as Curve>::F {
|
||||
C::Curve::hash_to_F(b"Serai DEX Additional Key", &[C::ID, &k.to_le_bytes()].concat())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue