mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-09 04:39:24 +00:00
Publish an alpha version of the Monero crate (#123)
* Label the version as an alpha * Add versions to Cargo.tomls * Update to Zeroize 1.5 * Drop patch versions from monero-serai Cargo.toml * Add a repository field * Move generators to OUT_DIR IIRC, I didn't do this originally as it constantly re-generated them. Unfortunately, since cargo is complaining about .generators, we have to. * Remove Timelock::fee_weight Transaction::fee_weight's has a comment, "Assumes Timelock::None since this library won't let you create a TX with a timelock". Accordingly, this is dead code.
This commit is contained in:
1
coins/monero/.gitignore
vendored
1
coins/monero/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
.generators
|
||||
@@ -1,8 +1,9 @@
|
||||
[package]
|
||||
name = "monero-serai"
|
||||
version = "0.1.0"
|
||||
version = "0.1.0-alpha"
|
||||
description = "A modern Monero transaction library"
|
||||
license = "MIT"
|
||||
repository = "https://github.com/serai-dex/serai"
|
||||
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
|
||||
edition = "2021"
|
||||
|
||||
@@ -19,7 +20,7 @@ rand_chacha = { version = "0.3", optional = true }
|
||||
rand = "0.8"
|
||||
rand_distr = "0.4"
|
||||
|
||||
zeroize = { version = "1.3", features = ["zeroize_derive"] }
|
||||
zeroize = { version = "1.5", features = ["zeroize_derive"] }
|
||||
subtle = "2.4"
|
||||
|
||||
sha3 = "0.10"
|
||||
@@ -28,14 +29,14 @@ blake2 = { version = "0.10", optional = true }
|
||||
curve25519-dalek = { version = "3", features = ["std"] }
|
||||
|
||||
group = { version = "0.12" }
|
||||
dalek-ff-group = { path = "../../crypto/dalek-ff-group" }
|
||||
multiexp = { path = "../../crypto/multiexp", features = ["batch"] }
|
||||
dalek-ff-group = { path = "../../crypto/dalek-ff-group", version = "0.1" }
|
||||
multiexp = { path = "../../crypto/multiexp", version = "0.2", features = ["batch"] }
|
||||
|
||||
transcript = { package = "flexible-transcript", path = "../../crypto/transcript", features = ["recommended"], optional = true }
|
||||
frost = { package = "modular-frost", path = "../../crypto/frost", features = ["ed25519"], optional = true }
|
||||
dleq = { path = "../../crypto/dleq", features = ["serialize"], optional = true }
|
||||
transcript = { package = "flexible-transcript", path = "../../crypto/transcript", version = "0.1", features = ["recommended"], optional = true }
|
||||
frost = { package = "modular-frost", path = "../../crypto/frost", version = "0.2", features = ["ed25519"], optional = true }
|
||||
dleq = { path = "../../crypto/dleq", version = "0.1", features = ["serialize"], optional = true }
|
||||
|
||||
monero-generators = { path = "generators" }
|
||||
monero-generators = { path = "generators", version = "0.1" }
|
||||
|
||||
hex = "0.4"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
@@ -50,8 +51,8 @@ reqwest = { version = "0.11", features = ["json"] }
|
||||
multisig = ["rand_chacha", "blake2", "transcript", "frost", "dleq"]
|
||||
|
||||
[build-dependencies]
|
||||
dalek-ff-group = { path = "../../crypto/dalek-ff-group" }
|
||||
monero-generators = { path = "generators" }
|
||||
dalek-ff-group = { path = "../../crypto/dalek-ff-group", version = "0.1" }
|
||||
monero-generators = { path = "generators", version = "0.1" }
|
||||
|
||||
[dev-dependencies]
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
use std::{
|
||||
io::Write,
|
||||
env,
|
||||
path::Path,
|
||||
fs::{File, DirBuilder, remove_file},
|
||||
fs::{File, remove_file},
|
||||
};
|
||||
|
||||
use dalek_ff_group::EdwardsPoint;
|
||||
@@ -33,8 +34,7 @@ fn generators(prefix: &'static str, path: &str) {
|
||||
let mut H_str = "".to_string();
|
||||
serialize(&mut H_str, &generators.H);
|
||||
|
||||
DirBuilder::new().recursive(true).create(".generators").unwrap();
|
||||
let path = Path::new(".generators").join(path);
|
||||
let path = Path::new(&env::var("OUT_DIR").unwrap()).join(path);
|
||||
let _ = remove_file(&path);
|
||||
File::create(&path)
|
||||
.unwrap()
|
||||
@@ -60,7 +60,6 @@ fn generators(prefix: &'static str, path: &str) {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
// For some reason, filtering off .generators does not work. This prevents re-building overall
|
||||
println!("cargo:rerun-if-changed=build.rs");
|
||||
|
||||
generators("bulletproof", "generators.rs");
|
||||
|
||||
@@ -18,5 +18,5 @@ tiny-keccak = { version = "2", features = ["keccak"] }
|
||||
|
||||
curve25519-dalek = { version = "3", features = ["std"] }
|
||||
|
||||
group = { version = "0.12" }
|
||||
dalek-ff-group = { path = "../../../crypto/dalek-ff-group" }
|
||||
group = "0.12"
|
||||
dalek-ff-group = { path = "../../../crypto/dalek-ff-group", version = "0.1.4" }
|
||||
|
||||
@@ -12,7 +12,7 @@ use multiexp::BatchVerifier;
|
||||
|
||||
use crate::{Commitment, ringct::bulletproofs::core::*};
|
||||
|
||||
include!("../../../.generators/generators.rs");
|
||||
include!(concat!(env!("OUT_DIR"), "/generators.rs"));
|
||||
|
||||
lazy_static! {
|
||||
static ref ONE_N: ScalarVector = ScalarVector(vec![Scalar::one(); N]);
|
||||
|
||||
@@ -15,7 +15,7 @@ use crate::{
|
||||
ringct::{hash_to_point::raw_hash_to_point, bulletproofs::core::*},
|
||||
};
|
||||
|
||||
include!("../../../.generators/generators_plus.rs");
|
||||
include!(concat!(env!("OUT_DIR"), "/generators_plus.rs"));
|
||||
|
||||
lazy_static! {
|
||||
static ref TRANSCRIPT: [u8; 32] =
|
||||
|
||||
@@ -119,10 +119,6 @@ impl Timelock {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn fee_weight() -> usize {
|
||||
8
|
||||
}
|
||||
|
||||
fn serialize<W: std::io::Write>(&self, w: &mut W) -> std::io::Result<()> {
|
||||
write_varint(
|
||||
&match self {
|
||||
|
||||
@@ -167,6 +167,7 @@ impl Scanner {
|
||||
/// When a new scanner is created, ALL saved output keys must be passed in to be secure.
|
||||
/// If None is passed, a modified shared key derivation is used which is immune to the burning
|
||||
/// bug (specifically the Guaranteed feature from Featured Addresses).
|
||||
// TODO: Should this take in a DB access handle to ensure output keys are saved?
|
||||
pub fn from_view(
|
||||
pair: ViewPair,
|
||||
network: Network,
|
||||
|
||||
@@ -196,8 +196,7 @@ impl SpendableOutput {
|
||||
pub struct Timelocked<O: Clone + Zeroize>(Timelock, Vec<O>);
|
||||
impl<O: Clone + Zeroize> Drop for Timelocked<O> {
|
||||
fn drop(&mut self) {
|
||||
self.0.zeroize();
|
||||
self.1.zeroize();
|
||||
self.zeroize();
|
||||
}
|
||||
}
|
||||
impl<O: Clone + Zeroize> ZeroizeOnDrop for Timelocked<O> {}
|
||||
|
||||
Reference in New Issue
Block a user