From df9fda29711eeeeaaa57472d7a6d4e0eac7b1fcf Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Thu, 18 Sep 2025 17:26:02 -0400 Subject: [PATCH] Fixes from errors in cherry-picked commits --- Cargo.lock | 136 ++++++++++-------- Cargo.toml | 11 +- common/std-shims/src/lib.rs | 6 +- crypto/schnorrkel/Cargo.toml | 2 +- networks/bitcoin/Cargo.toml | 2 +- .../alloy-simple-request-transport/Cargo.toml | 2 +- patches/dalek-ff-group/Cargo.toml | 29 ++++ patches/dalek-ff-group/LICENSE | 21 +++ patches/dalek-ff-group/README.md | 4 + patches/dalek-ff-group/src/lib.rs | 44 ++++++ patches/simple-request/Cargo.toml | 23 +++ patches/simple-request/src/lib.rs | 18 +++ patches/std-shims/Cargo.toml | 23 +++ patches/std-shims/src/lib.rs | 5 + substrate/client/Cargo.toml | 2 +- 15 files changed, 257 insertions(+), 71 deletions(-) create mode 100644 patches/dalek-ff-group/Cargo.toml create mode 100644 patches/dalek-ff-group/LICENSE create mode 100644 patches/dalek-ff-group/README.md create mode 100644 patches/dalek-ff-group/src/lib.rs create mode 100644 patches/simple-request/Cargo.toml create mode 100644 patches/simple-request/src/lib.rs create mode 100644 patches/std-shims/Cargo.toml create mode 100644 patches/std-shims/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index fa6d95c2..7ca9d2cb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -544,7 +544,7 @@ dependencies = [ "alloy-json-rpc", "alloy-transport", "serde_json", - "simple-request", + "simple-request 0.2.0", "tower 0.5.2", ] @@ -1461,8 +1461,8 @@ dependencies = [ "secp256k1 0.29.1", "serde", "serde_json", - "simple-request", - "std-shims", + "simple-request 0.2.0", + "std-shims 0.1.5", "subtle", "thiserror 2.0.16", "tokio", @@ -1928,7 +1928,7 @@ dependencies = [ "ff-group-tests", "group", "hex", - "std-shims", + "std-shims 0.1.5", "subtle", "zeroize", ] @@ -1938,8 +1938,8 @@ name = "ciphersuite" version = "0.4.99" dependencies = [ "ciphersuite 0.4.2", - "dalek-ff-group", - "std-shims", + "dalek-ff-group 0.5.0", + "std-shims 0.1.5", "zeroize", ] @@ -2470,6 +2470,16 @@ dependencies = [ "zeroize", ] +[[package]] +name = "dalek-ff-group" +version = "0.5.99" +dependencies = [ + "crypto-bigint 0.5.5", + "crypto-bigint 0.6.1", + "dalek-ff-group 0.5.0", + "prime-field", +] + [[package]] name = "darling" version = "0.20.11" @@ -2542,7 +2552,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d162beedaa69905488a8da94f5ac3edb4dd4788b732fadb7bd120b2625c1976" dependencies = [ "data-encoding", - "syn 2.0.106", + "syn 1.0.109", ] [[package]] @@ -2773,7 +2783,7 @@ version = "0.6.1" dependencies = [ "borsh", "ciphersuite 0.4.2", - "std-shims", + "std-shims 0.1.5", "thiserror 2.0.16", "zeroize", ] @@ -2785,7 +2795,7 @@ dependencies = [ "ciphersuite 0.4.2", "dkg", "rand_core 0.6.4", - "std-shims", + "std-shims 0.1.5", "zeroize", ] @@ -2796,7 +2806,7 @@ dependencies = [ "blake2 0.11.0-rc.2", "ciphersuite 0.4.2", "ciphersuite-kp256", - "dalek-ff-group", + "dalek-ff-group 0.5.0", "dkg", "dkg-recovery", "ec-divisors", @@ -2811,7 +2821,7 @@ dependencies = [ "rand_chacha 0.3.1", "rand_core 0.6.4", "secq256k1", - "std-shims", + "std-shims 0.1.5", "thiserror 2.0.16", "zeroize", ] @@ -2821,12 +2831,12 @@ name = "dkg-musig" version = "0.6.0" dependencies = [ "ciphersuite 0.4.2", - "dalek-ff-group", + "dalek-ff-group 0.5.0", "dkg", "dkg-recovery", "multiexp", "rand_core 0.6.4", - "std-shims", + "std-shims 0.1.5", "thiserror 2.0.16", "zeroize", ] @@ -2914,11 +2924,11 @@ name = "ec-divisors" version = "0.1.0" source = "git+https://github.com/monero-oxide/monero-oxide?rev=dc1b3dbe436aae61ec363505052d4715d38ce1df#dc1b3dbe436aae61ec363505052d4715d38ce1df" dependencies = [ - "dalek-ff-group", + "dalek-ff-group 0.5.99", "ff", "group", "rand_core 0.6.4", - "std-shims", + "std-shims 0.1.99", "subtle", "zeroize", ] @@ -3033,7 +3043,7 @@ dependencies = [ "prime-field", "rand_core 0.6.4", "short-weierstrass", - "std-shims", + "std-shims 0.1.5", "typenum", "zeroize", ] @@ -3546,7 +3556,7 @@ dependencies = [ "rand_core 0.6.4", "schnorr-signatures", "schnorrkel", - "std-shims", + "std-shims 0.1.5", "zeroize", ] @@ -3775,7 +3785,7 @@ dependencies = [ "flexible-transcript", "multiexp", "rand_core 0.6.4", - "std-shims", + "std-shims 0.1.99", "zeroize", ] @@ -3786,7 +3796,7 @@ source = "git+https://github.com/monero-oxide/monero-oxide?rev=dc1b3dbe436aae61e dependencies = [ "ciphersuite 0.4.99", "generalized-bulletproofs", - "std-shims", + "std-shims 0.1.99", "zeroize", ] @@ -3798,7 +3808,7 @@ dependencies = [ "ciphersuite 0.4.99", "generalized-bulletproofs-circuit-abstraction", "generic-array 1.2.0", - "std-shims", + "std-shims 0.1.99", ] [[package]] @@ -4250,7 +4260,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2 0.5.8", + "socket2 0.4.10", "tokio", "tower-service", "tracing", @@ -6089,7 +6099,7 @@ version = "0.11.0" dependencies = [ "ciphersuite 0.4.2", "ciphersuite-kp256", - "dalek-ff-group", + "dalek-ff-group 0.5.0", "dkg", "dkg-dealer", "dkg-recovery", @@ -6103,7 +6113,7 @@ dependencies = [ "schnorr-signatures", "serde_json", "sha2 0.10.9", - "std-shims", + "std-shims 0.1.5", "subtle", "thiserror 2.0.16", "zeroize", @@ -6127,7 +6137,7 @@ version = "0.1.0" source = "git+https://github.com/monero-oxide/monero-oxide?rev=2c847f71079a105456376f9957cee86c4b6a9eb8#2c847f71079a105456376f9957cee86c4b6a9eb8" dependencies = [ "monero-primitives", - "std-shims", + "std-shims 0.1.99", ] [[package]] @@ -6139,7 +6149,7 @@ dependencies = [ "monero-generators", "monero-io", "monero-primitives", - "std-shims", + "std-shims 0.1.99", "zeroize", ] @@ -6153,7 +6163,7 @@ dependencies = [ "monero-io", "monero-primitives", "rand_core 0.6.4", - "std-shims", + "std-shims 0.1.99", "thiserror 2.0.16", "zeroize", ] @@ -6164,7 +6174,7 @@ version = "0.1.0" source = "git+https://github.com/monero-oxide/monero-oxide?rev=2c847f71079a105456376f9957cee86c4b6a9eb8#2c847f71079a105456376f9957cee86c4b6a9eb8" dependencies = [ "curve25519-dalek", - "dalek-ff-group", + "dalek-ff-group 0.5.99", "flexible-transcript", "group", "modular-frost", @@ -6173,7 +6183,7 @@ dependencies = [ "monero-primitives", "rand_chacha 0.3.1", "rand_core 0.6.4", - "std-shims", + "std-shims 0.1.99", "subtle", "thiserror 2.0.16", "zeroize", @@ -6186,11 +6196,11 @@ source = "git+https://github.com/monero-oxide/monero-oxide?rev=2c847f71079a10545 dependencies = [ "crypto-bigint 0.5.5", "curve25519-dalek", - "dalek-ff-group", + "dalek-ff-group 0.5.99", "group", "monero-io", "sha3 0.10.8", - "std-shims", + "std-shims 0.1.99", "subtle", ] @@ -6200,7 +6210,7 @@ version = "0.1.0" source = "git+https://github.com/monero-oxide/monero-oxide?rev=2c847f71079a105456376f9957cee86c4b6a9eb8#2c847f71079a105456376f9957cee86c4b6a9eb8" dependencies = [ "curve25519-dalek", - "std-shims", + "std-shims 0.1.99", "zeroize", ] @@ -6213,7 +6223,7 @@ dependencies = [ "monero-generators", "monero-io", "monero-primitives", - "std-shims", + "std-shims 0.1.99", "thiserror 2.0.16", "zeroize", ] @@ -6232,7 +6242,7 @@ dependencies = [ "monero-io", "monero-mlsag", "monero-primitives", - "std-shims", + "std-shims 0.1.99", "zeroize", ] @@ -6245,7 +6255,7 @@ dependencies = [ "monero-generators", "monero-io", "sha3 0.10.8", - "std-shims", + "std-shims 0.1.99", "zeroize", ] @@ -6260,7 +6270,7 @@ dependencies = [ "monero-oxide", "serde", "serde_json", - "std-shims", + "std-shims 0.1.99", "thiserror 2.0.16", "zeroize", ] @@ -6273,7 +6283,7 @@ dependencies = [ "digest_auth", "hex", "monero-rpc", - "simple-request", + "simple-request 0.1.99", "tokio", "zeroize", ] @@ -6295,7 +6305,7 @@ dependencies = [ "rand_chacha 0.3.1", "rand_core 0.6.4", "rand_distr", - "std-shims", + "std-shims 0.1.99", "thiserror 2.0.16", "zeroize", ] @@ -6334,7 +6344,7 @@ dependencies = [ name = "multiexp" version = "0.4.2" dependencies = [ - "dalek-ff-group", + "dalek-ff-group 0.5.0", "ff", "group", "k256", @@ -9470,14 +9480,14 @@ name = "schnorr-signatures" version = "0.5.2" dependencies = [ "ciphersuite 0.4.2", - "dalek-ff-group", + "dalek-ff-group 0.5.0", "digest 0.11.0-rc.1", "flexible-transcript", "hex", "multiexp", "rand_core 0.6.4", "sha2 0.10.9", - "std-shims", + "std-shims 0.1.5", "zeroize", ] @@ -9610,7 +9620,7 @@ dependencies = [ "rand_core 0.6.4", "sha2 0.11.0-rc.2", "short-weierstrass", - "std-shims", + "std-shims 0.1.5", ] [[package]] @@ -9756,7 +9766,7 @@ dependencies = [ "borsh", "ciphersuite 0.4.2", "ciphersuite-kp256", - "dalek-ff-group", + "dalek-ff-group 0.5.0", "dkg-musig", "dockertest", "frame-system", @@ -9771,7 +9781,7 @@ dependencies = [ "serai-docker-tests", "serde", "serde_json", - "simple-request", + "simple-request 0.2.0", "sp-core", "sp-runtime", "thiserror 2.0.16", @@ -9817,7 +9827,7 @@ dependencies = [ "blake2 0.11.0-rc.2", "borsh", "ciphersuite 0.4.2", - "dalek-ff-group", + "dalek-ff-group 0.5.0", "dkg-musig", "env_logger", "frost-schnorrkel", @@ -9906,7 +9916,7 @@ dependencies = [ "blake2 0.11.0-rc.2", "borsh", "ciphersuite 0.4.2", - "dalek-ff-group", + "dalek-ff-group 0.5.0", "dkg", "log", "parity-scale-codec", @@ -10170,7 +10180,7 @@ version = "0.1.0" dependencies = [ "borsh", "ciphersuite 0.4.2", - "dalek-ff-group", + "dalek-ff-group 0.5.0", "env_logger", "flexible-transcript", "hex", @@ -10191,7 +10201,7 @@ name = "serai-message-queue-tests" version = "0.1.0" dependencies = [ "ciphersuite 0.4.2", - "dalek-ff-group", + "dalek-ff-group 0.5.0", "dockertest", "hex", "rand_core 0.6.4", @@ -10208,7 +10218,7 @@ version = "0.1.0" dependencies = [ "borsh", "ciphersuite 0.4.2", - "dalek-ff-group", + "dalek-ff-group 0.5.0", "dkg-evrf", "log", "modular-frost", @@ -10238,7 +10248,7 @@ version = "0.1.0" dependencies = [ "bitcoin-serai", "ciphersuite 0.4.2", - "dalek-ff-group", + "dalek-ff-group 0.5.0", "dkg", "dkg-dealer", "dkg-evrf", @@ -10254,7 +10264,7 @@ dependencies = [ "schnorr-signatures", "secq256k1", "short-weierstrass", - "std-shims", + "std-shims 0.1.5", ] [[package]] @@ -10266,7 +10276,7 @@ dependencies = [ "ciphersuite-kp256", "clap", "curve25519-dalek", - "dalek-ff-group", + "dalek-ff-group 0.5.0", "embedwards25519", "frame-benchmarking", "futures-util", @@ -10317,7 +10327,7 @@ name = "serai-orchestrator" version = "0.0.1" dependencies = [ "ciphersuite 0.4.2", - "dalek-ff-group", + "dalek-ff-group 0.5.0", "embedwards25519", "flexible-transcript", "hex", @@ -10734,7 +10744,7 @@ version = "0.1.0" dependencies = [ "bitvec", "ciphersuite 0.4.2", - "dalek-ff-group", + "dalek-ff-group 0.5.0", "dkg-musig", "frame-support", "frame-system", @@ -10769,7 +10779,7 @@ version = "0.1.0" dependencies = [ "borsh", "ciphersuite 0.4.2", - "dalek-ff-group", + "dalek-ff-group 0.5.0", "dkg-musig", "parity-scale-codec", "scale-info", @@ -11054,7 +11064,14 @@ dependencies = [ [[package]] name = "simple-request" -version = "0.1.1" +version = "0.1.99" +dependencies = [ + "simple-request 0.2.0", +] + +[[package]] +name = "simple-request" +version = "0.2.0" dependencies = [ "base64ct", "futures-util", @@ -11878,6 +11895,13 @@ dependencies = [ "spin 0.10.0", ] +[[package]] +name = "std-shims" +version = "0.1.99" +dependencies = [ + "std-shims 0.1.5", +] + [[package]] name = "strobe-rs" version = "0.8.1" @@ -12623,7 +12647,7 @@ version = "0.1.0" dependencies = [ "blake2 0.11.0-rc.2", "ciphersuite 0.4.2", - "dalek-ff-group", + "dalek-ff-group 0.5.0", "flexible-transcript", "futures-channel", "futures-util", diff --git a/Cargo.toml b/Cargo.toml index 3234fac9..3285abd1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,11 +14,6 @@ members = [ "patches/option-ext", "patches/directories-next", - # monero-oxide expects `ciphersuite`, yet the `ciphersuite` in-tree here has breaking changes - # This re-exports the in-tree `ciphersuite` _without_ changes breaking to monero-oxide - # Not included in workspace to prevent having two crates with the same name (an error) - # "patches/ciphersuite", - "common/std-shims", "common/zalloc", "common/patchable-async-sleep", @@ -191,12 +186,12 @@ overflow-checks = true [patch.crates-io] # Dependencies from monero-oxide which originate from within our own tree -std-shims = { path = "common/std-shims" } -simple-request = { path = "common/request" } +std-shims = { path = "patches/std-shims" } +simple-request = { path = "patches/simple-request" } multiexp = { path = "crypto/multiexp" } flexible-transcript = { path = "crypto/transcript" } ciphersuite = { path = "patches/ciphersuite" } -dalek-ff-group = { path = "crypto/dalek-ff-group" } +dalek-ff-group = { path = "patches/dalek-ff-group" } minimal-ed448 = { path = "crypto/ed448" } modular-frost = { path = "crypto/frost" } diff --git a/common/std-shims/src/lib.rs b/common/std-shims/src/lib.rs index 0ea8da07..ed40db40 100644 --- a/common/std-shims/src/lib.rs +++ b/common/std-shims/src/lib.rs @@ -17,8 +17,8 @@ pub mod error { #[rustversion::since(1.81)] pub use core::error; -#[cfg(all(feature = "alloc", not(feature = "std")))] -pub extern crate alloc as extern_alloc; +#[cfg(feature = "alloc")] +extern crate alloc as extern_alloc; #[cfg(all(feature = "alloc", not(feature = "std")))] pub use extern_alloc::{alloc, borrow, boxed, ffi, fmt, rc, slice, str, string, task, vec, format}; #[cfg(feature = "std")] @@ -30,7 +30,7 @@ pub mod sync; pub mod prelude { // Shim the `std` prelude - #[cfg(all(feature = "alloc", not(feature = "std")))] + #[cfg(feature = "alloc")] pub use extern_alloc::{ format, vec, borrow::ToOwned, diff --git a/crypto/schnorrkel/Cargo.toml b/crypto/schnorrkel/Cargo.toml index 1fe90be3..24e4e24d 100644 --- a/crypto/schnorrkel/Cargo.toml +++ b/crypto/schnorrkel/Cargo.toml @@ -17,7 +17,7 @@ rustdoc-args = ["--cfg", "docsrs"] workspace = true [dependencies] -std-shims = { version = "0.1", default-features = false, features = ["alloc"] } +std-shims = { version = "0.1", path = "../../common/std-shims", default-features = false, features = ["alloc"] } rand_core = { version = "0.6", default-features = false } zeroize = { version = "1.5", default-features = false, features = ["zeroize_derive", "alloc"] } diff --git a/networks/bitcoin/Cargo.toml b/networks/bitcoin/Cargo.toml index 40823f9d..66c24a67 100644 --- a/networks/bitcoin/Cargo.toml +++ b/networks/bitcoin/Cargo.toml @@ -32,7 +32,7 @@ frost = { package = "modular-frost", path = "../../crypto/frost", version = "0.1 hex = { version = "0.4", default-features = false, optional = true } serde = { version = "1", default-features = false, features = ["derive"], optional = true } serde_json = { version = "1", default-features = false, optional = true } -simple-request = { path = "../../common/request", version = "0.1", default-features = false, features = ["tls", "basic-auth"], optional = true } +simple-request = { path = "../../common/request", version = "0.2", default-features = false, features = ["tls", "basic-auth"], optional = true } [dev-dependencies] secp256k1 = { version = "0.29", default-features = false, features = ["std"] } diff --git a/networks/ethereum/alloy-simple-request-transport/Cargo.toml b/networks/ethereum/alloy-simple-request-transport/Cargo.toml index 69dc25b4..bff76492 100644 --- a/networks/ethereum/alloy-simple-request-transport/Cargo.toml +++ b/networks/ethereum/alloy-simple-request-transport/Cargo.toml @@ -19,7 +19,7 @@ workspace = true tower = "0.5" serde_json = { version = "1", default-features = false } -simple-request = { path = "../../../common/request", version = "0.1", default-features = false } +simple-request = { path = "../../../common/request", version = "0.2", default-features = false } alloy-json-rpc = { version = "1", default-features = false } alloy-transport = { version = "1", default-features = false } diff --git a/patches/dalek-ff-group/Cargo.toml b/patches/dalek-ff-group/Cargo.toml new file mode 100644 index 00000000..0cac3c94 --- /dev/null +++ b/patches/dalek-ff-group/Cargo.toml @@ -0,0 +1,29 @@ +[package] +name = "dalek-ff-group" +version = "0.5.99" +description = "ff/group bindings around curve25519-dalek" +license = "MIT" +repository = "https://github.com/serai-dex/serai/tree/develop/crypto/dalek-ff-group" +authors = ["Luke Parker "] +keywords = ["curve25519", "ed25519", "ristretto", "dalek", "group"] +edition = "2021" +rust-version = "1.85" + +[package.metadata.docs.rs] +all-features = true +rustdoc-args = ["--cfg", "docsrs"] + +[lints] +workspace = true + +[dependencies] +dalek-ff-group = { path = "../../crypto/dalek-ff-group", default-features = false } + +crypto-bigint-05 = { package = "crypto-bigint", version = "0.5", default-features = false, features = ["zeroize"] } +crypto-bigint = { version = "0.6", default-features = false, features = ["zeroize"] } +prime-field = { path = "../../crypto/prime-field", default-features = false } + +[features] +alloc = ["dalek-ff-group/alloc", "crypto-bigint-05/alloc", "crypto-bigint/alloc", "prime-field/alloc"] +std = ["alloc", "dalek-ff-group/std", "prime-field/std"] +default = ["std"] diff --git a/patches/dalek-ff-group/LICENSE b/patches/dalek-ff-group/LICENSE new file mode 100644 index 00000000..32ff304a --- /dev/null +++ b/patches/dalek-ff-group/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022-2025 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. diff --git a/patches/dalek-ff-group/README.md b/patches/dalek-ff-group/README.md new file mode 100644 index 00000000..5a25d05b --- /dev/null +++ b/patches/dalek-ff-group/README.md @@ -0,0 +1,4 @@ +# Dalek FF/Group + +Patch for the `crates.io` `dalek-ff-group` to use the in-tree `dalek-ff-group`, +resolving relevant breaking changes made since. diff --git a/patches/dalek-ff-group/src/lib.rs b/patches/dalek-ff-group/src/lib.rs new file mode 100644 index 00000000..848f2a8f --- /dev/null +++ b/patches/dalek-ff-group/src/lib.rs @@ -0,0 +1,44 @@ +#![allow(deprecated)] +#![cfg_attr(docsrs, feature(doc_auto_cfg))] +#![no_std] // Prevents writing new code, in what should be a simple wrapper, which requires std +#![doc = include_str!("../README.md")] +#![allow(clippy::redundant_closure_call)] + +pub use dalek_ff_group::{Scalar, EdwardsPoint, RistrettoPoint, Ed25519, Ristretto}; + +type ThirtyTwoArray = [u8; 32]; +prime_field::odd_prime_field_with_specific_repr!( + FieldElement, + "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed", + "02", + false, + crate::ThirtyTwoArray +); + +impl FieldElement { + /// Create a FieldElement from a `crypto_bigint::U256`. + /// + /// This will reduce the `U256` by the modulus, into a member of the field. + #[deprecated] + pub const fn from_u256(u256: &crypto_bigint_05::U256) -> Self { + const MODULUS: crypto_bigint::U256 = crypto_bigint::U256::from_be_hex( + "7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed", + ); + let mut u256 = crypto_bigint::U256::from_words(*u256.as_words()); + loop { + let result = FieldElement::from_bytes(&u256.to_le_bytes()); + if let Some(result) = result { + return result; + } + u256 = u256.wrapping_sub(&MODULUS); + } + } + + /// Create a `FieldElement` from the reduction of a 512-bit number. + /// + /// The bytes are interpreted in little-endian format. + #[deprecated] + pub fn wide_reduce(value: [u8; 64]) -> Self { + >::from_uniform_bytes(&value) + } +} diff --git a/patches/simple-request/Cargo.toml b/patches/simple-request/Cargo.toml new file mode 100644 index 00000000..80ff44ec --- /dev/null +++ b/patches/simple-request/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "simple-request" +version = "0.1.99" +description = "simple-request which patches to the latest update" +license = "MIT" +repository = "https://github.com/serai-dex/serai/tree/develop/patches/simple-request" +authors = ["Luke Parker "] +keywords = ["nostd", "no_std", "alloc", "io"] +edition = "2021" +rust-version = "1.65" + +[package.metadata.docs.rs] +all-features = true +rustdoc-args = ["--cfg", "docsrs"] + +[lints] +workspace = true + +[dependencies] +simple-request = { path = "../../common/request" } + +[features] +tls = ["simple-request/tls"] diff --git a/patches/simple-request/src/lib.rs b/patches/simple-request/src/lib.rs new file mode 100644 index 00000000..c4ddd3e6 --- /dev/null +++ b/patches/simple-request/src/lib.rs @@ -0,0 +1,18 @@ +pub use simple_request::{hyper, Error, Request, Response}; + +#[derive(Clone, Debug)] +pub struct Client(simple_request::Client); + +impl Client { + pub fn with_connection_pool() -> Client { + Self(simple_request::Client::with_connection_pool().unwrap()) + } + + pub fn without_connection_pool(host: &str) -> Result { + simple_request::Client::without_connection_pool(host).map(Self) + } + + pub async fn request>(&self, request: R) -> Result, Error> { + self.0.request(request).await + } +} diff --git a/patches/std-shims/Cargo.toml b/patches/std-shims/Cargo.toml new file mode 100644 index 00000000..537c8286 --- /dev/null +++ b/patches/std-shims/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "std-shims" +version = "0.1.99" +description = "std-shims which patches to the latest update" +license = "MIT" +repository = "https://github.com/serai-dex/serai/tree/develop/patches/std-shims" +authors = ["Luke Parker "] +keywords = ["nostd", "no_std", "alloc", "io"] +edition = "2021" +rust-version = "1.65" + +[package.metadata.docs.rs] +all-features = true +rustdoc-args = ["--cfg", "docsrs"] + +[lints] +workspace = true + +[dependencies] +std-shims = { path = "../../common/std-shims", default-features = false, features = ["alloc"] } + +[features] +std = ["std-shims/std"] diff --git a/patches/std-shims/src/lib.rs b/patches/std-shims/src/lib.rs new file mode 100644 index 00000000..673132ea --- /dev/null +++ b/patches/std-shims/src/lib.rs @@ -0,0 +1,5 @@ +#![cfg_attr(docsrs, feature(doc_auto_cfg))] +#![cfg_attr(not(feature = "std"), no_std)] + +pub extern crate alloc; +pub use std_shims::{str, vec, string, collections, io, sync, prelude}; diff --git a/substrate/client/Cargo.toml b/substrate/client/Cargo.toml index dbf3a56a..641ccbc9 100644 --- a/substrate/client/Cargo.toml +++ b/substrate/client/Cargo.toml @@ -37,7 +37,7 @@ frame-system = { git = "https://github.com/serai-dex/substrate", optional = true async-lock = "3" -simple-request = { path = "../../common/request", version = "0.1", optional = true } +simple-request = { path = "../../common/request", version = "0.2", optional = true } bitcoin = { version = "0.32", optional = true }