mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
Merge branch 'next' into next-polkadot-sdk
This commit is contained in:
@@ -5,11 +5,6 @@ members = [
|
|||||||
"patches/option-ext",
|
"patches/option-ext",
|
||||||
"patches/directories-next",
|
"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/std-shims",
|
||||||
"common/zalloc",
|
"common/zalloc",
|
||||||
"common/patchable-async-sleep",
|
"common/patchable-async-sleep",
|
||||||
@@ -169,8 +164,8 @@ overflow-checks = true
|
|||||||
|
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
# Dependencies from monero-oxide which originate from within our own tree
|
# Dependencies from monero-oxide which originate from within our own tree
|
||||||
std-shims = { path = "common/std-shims" }
|
std-shims = { path = "patches/std-shims" }
|
||||||
simple-request = { path = "common/request" }
|
simple-request = { path = "patches/simple-request" }
|
||||||
multiexp = { path = "crypto/multiexp" }
|
multiexp = { path = "crypto/multiexp" }
|
||||||
flexible-transcript = { path = "crypto/transcript" }
|
flexible-transcript = { path = "crypto/transcript" }
|
||||||
ciphersuite = { path = "patches/ciphersuite" }
|
ciphersuite = { path = "patches/ciphersuite" }
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "simple-request"
|
name = "simple-request"
|
||||||
version = "0.1.1"
|
version = "0.2.0"
|
||||||
description = "A simple HTTP(S) request library"
|
description = "A simple HTTP(S) request library"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/serai-dex/serai/tree/develop/common/simple-request"
|
repository = "https://github.com/serai-dex/serai/tree/develop/common/request"
|
||||||
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
|
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
|
||||||
keywords = ["http", "https", "async", "request", "ssl"]
|
keywords = ["http", "https", "async", "request", "ssl"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
@@ -31,5 +31,6 @@ base64ct = { version = "1", features = ["alloc"], optional = true }
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
tls = ["hyper-rustls"]
|
tls = ["hyper-rustls"]
|
||||||
|
webpki-roots = ["tls", "hyper-rustls/webpki-roots"]
|
||||||
basic-auth = ["zeroize", "base64ct"]
|
basic-auth = ["zeroize", "base64ct"]
|
||||||
default = ["tls"]
|
default = ["tls"]
|
||||||
|
|||||||
@@ -52,24 +52,30 @@ pub struct Client {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Client {
|
impl Client {
|
||||||
|
#[allow(clippy::unnecessary_wraps)]
|
||||||
fn connector() -> Result<Connector, Error> {
|
fn connector() -> Result<Connector, Error> {
|
||||||
let mut res = HttpConnector::new();
|
let mut res = HttpConnector::new();
|
||||||
res.set_keepalive(Some(core::time::Duration::from_secs(60)));
|
res.set_keepalive(Some(core::time::Duration::from_secs(60)));
|
||||||
res.set_nodelay(true);
|
res.set_nodelay(true);
|
||||||
res.set_reuse_address(true);
|
res.set_reuse_address(true);
|
||||||
|
|
||||||
#[cfg(feature = "tls")]
|
#[cfg(feature = "tls")]
|
||||||
res.enforce_http(false);
|
res.enforce_http(false);
|
||||||
#[cfg(feature = "tls")]
|
#[cfg(feature = "tls")]
|
||||||
let res = HttpsConnectorBuilder::new()
|
let https = HttpsConnectorBuilder::new().with_native_roots();
|
||||||
.with_native_roots()
|
#[cfg(all(feature = "tls", not(feature = "webpki-roots")))]
|
||||||
.map_err(|e| {
|
let https = https.map_err(|e| {
|
||||||
Error::ConnectionError(
|
Error::ConnectionError(
|
||||||
format!("couldn't load system's SSL root certificates: {e:?}").into(),
|
format!("couldn't load system's SSL root certificates and webpki-roots unavilable: {e:?}")
|
||||||
)
|
.into(),
|
||||||
})?
|
)
|
||||||
.https_or_http()
|
})?;
|
||||||
.enable_http1()
|
// Fallback to `webpki-roots` if present
|
||||||
.wrap_connector(res);
|
#[cfg(all(feature = "tls", feature = "webpki-roots"))]
|
||||||
|
let https = https.unwrap_or(HttpsConnectorBuilder::new().with_webpki_roots());
|
||||||
|
#[cfg(feature = "tls")]
|
||||||
|
let res = https.https_or_http().enable_http1().wrap_connector(res);
|
||||||
|
|
||||||
Ok(res)
|
Ok(res)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ pub mod error {
|
|||||||
#[rustversion::since(1.81)]
|
#[rustversion::since(1.81)]
|
||||||
pub use core::error;
|
pub use core::error;
|
||||||
|
|
||||||
#[cfg(all(feature = "alloc", not(feature = "std")))]
|
#[cfg(feature = "alloc")]
|
||||||
pub extern crate alloc as extern_alloc;
|
extern crate alloc as extern_alloc;
|
||||||
#[cfg(all(feature = "alloc", not(feature = "std")))]
|
#[cfg(all(feature = "alloc", not(feature = "std")))]
|
||||||
pub use extern_alloc::{alloc, borrow, boxed, ffi, fmt, rc, slice, str, string, task, vec, format};
|
pub use extern_alloc::{alloc, borrow, boxed, ffi, fmt, rc, slice, str, string, task, vec, format};
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
@@ -30,7 +30,7 @@ pub mod sync;
|
|||||||
|
|
||||||
pub mod prelude {
|
pub mod prelude {
|
||||||
// Shim the `std` prelude
|
// Shim the `std` prelude
|
||||||
#[cfg(all(feature = "alloc", not(feature = "std")))]
|
#[cfg(feature = "alloc")]
|
||||||
pub use extern_alloc::{
|
pub use extern_alloc::{
|
||||||
format, vec,
|
format, vec,
|
||||||
borrow::ToOwned,
|
borrow::ToOwned,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ use rand::{RngCore, CryptoRng, rngs::OsRng};
|
|||||||
use blake2::{Digest, Blake2s256};
|
use blake2::{Digest, Blake2s256};
|
||||||
|
|
||||||
use dalek_ff_group::Ristretto;
|
use dalek_ff_group::Ristretto;
|
||||||
use ciphersuite::{group::Group, *};
|
use ciphersuite::*;
|
||||||
use schnorr::SchnorrSignature;
|
use schnorr::SchnorrSignature;
|
||||||
|
|
||||||
use ::tendermint::{
|
use ::tendermint::{
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ rustdoc-args = ["--cfg", "docsrs"]
|
|||||||
workspace = true
|
workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[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 }
|
rand_core = { version = "0.6", default-features = false }
|
||||||
zeroize = { version = "1.5", default-features = false, features = ["zeroize_derive", "alloc"] }
|
zeroize = { version = "1.5", default-features = false, features = ["zeroize_derive", "alloc"] }
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ frost = { package = "modular-frost", path = "../../crypto/frost", version = "0.1
|
|||||||
hex = { version = "0.4", default-features = false, optional = true }
|
hex = { version = "0.4", default-features = false, optional = true }
|
||||||
serde = { version = "1", default-features = false, features = ["derive"], optional = true }
|
serde = { version = "1", default-features = false, features = ["derive"], optional = true }
|
||||||
serde_json = { version = "1", default-features = false, 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]
|
[dev-dependencies]
|
||||||
secp256k1 = { version = "0.29", default-features = false, features = ["std"] }
|
secp256k1 = { version = "0.29", default-features = false, features = ["std"] }
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ workspace = true
|
|||||||
tower = "0.5"
|
tower = "0.5"
|
||||||
|
|
||||||
serde_json = { version = "1", default-features = false }
|
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-json-rpc = { version = "1", default-features = false }
|
||||||
alloy-transport = { version = "1", default-features = false }
|
alloy-transport = { version = "1", default-features = false }
|
||||||
|
|||||||
23
patches/simple-request/Cargo.toml
Normal file
23
patches/simple-request/Cargo.toml
Normal file
@@ -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 <lukeparker5132@gmail.com>"]
|
||||||
|
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"]
|
||||||
18
patches/simple-request/src/lib.rs
Normal file
18
patches/simple-request/src/lib.rs
Normal file
@@ -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<Client, Error> {
|
||||||
|
simple_request::Client::without_connection_pool(host).map(Self)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn request<R: Into<Request>>(&self, request: R) -> Result<Response<'_>, Error> {
|
||||||
|
self.0.request(request).await
|
||||||
|
}
|
||||||
|
}
|
||||||
23
patches/std-shims/Cargo.toml
Normal file
23
patches/std-shims/Cargo.toml
Normal file
@@ -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 <lukeparker5132@gmail.com>"]
|
||||||
|
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"]
|
||||||
5
patches/std-shims/src/lib.rs
Normal file
5
patches/std-shims/src/lib.rs
Normal file
@@ -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};
|
||||||
@@ -37,7 +37,7 @@ frame-system = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev =
|
|||||||
|
|
||||||
async-lock = "3"
|
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 }
|
bitcoin = { version = "0.32", optional = true }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user