mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-15 07:29:25 +00:00
Compare commits
3 Commits
4e834873d3
...
0d5756ffcf
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0d5756ffcf | ||
|
|
ac7b98daac | ||
|
|
efc7d70ab1 |
1
.github/workflows/common-tests.yml
vendored
1
.github/workflows/common-tests.yml
vendored
@@ -27,6 +27,7 @@ jobs:
|
||||
GITHUB_CI=true RUST_BACKTRACE=1 cargo test --all-features \
|
||||
-p std-shims \
|
||||
-p zalloc \
|
||||
-p patchable-async-sleep \
|
||||
-p serai-db \
|
||||
-p serai-env \
|
||||
-p simple-request
|
||||
|
||||
652
Cargo.lock
generated
652
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,6 @@ members = [
|
||||
"patches/parking_lot",
|
||||
"patches/zstd",
|
||||
"patches/rocksdb",
|
||||
"patches/proc-macro-crate",
|
||||
|
||||
# std patches
|
||||
"patches/matches",
|
||||
@@ -18,6 +17,7 @@ members = [
|
||||
|
||||
"common/std-shims",
|
||||
"common/zalloc",
|
||||
"common/patchable-async-sleep",
|
||||
"common/db",
|
||||
"common/env",
|
||||
"common/request",
|
||||
@@ -147,8 +147,6 @@ parking_lot = { path = "patches/parking_lot" }
|
||||
zstd = { path = "patches/zstd" }
|
||||
# Needed for WAL compression
|
||||
rocksdb = { path = "patches/rocksdb" }
|
||||
# proc-macro-crate 2 binds to an old version of toml for msrv so we patch to 3
|
||||
proc-macro-crate = { path = "patches/proc-macro-crate" }
|
||||
|
||||
# is-terminal now has an std-based solution with an equivalent API
|
||||
is-terminal = { path = "patches/is-terminal" }
|
||||
|
||||
19
common/patchable-async-sleep/Cargo.toml
Normal file
19
common/patchable-async-sleep/Cargo.toml
Normal file
@@ -0,0 +1,19 @@
|
||||
[package]
|
||||
name = "patchable-async-sleep"
|
||||
version = "0.1.0"
|
||||
description = "An async sleep function, patchable to the preferred runtime"
|
||||
license = "MIT"
|
||||
repository = "https://github.com/serai-dex/serai/tree/develop/common/patchable-async-sleep"
|
||||
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
|
||||
keywords = ["async", "sleep", "tokio", "smol", "async-std"]
|
||||
edition = "2021"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
tokio = { version = "1", default-features = false, features = [ "time"] }
|
||||
21
common/patchable-async-sleep/LICENSE
Normal file
21
common/patchable-async-sleep/LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024 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.
|
||||
7
common/patchable-async-sleep/README.md
Normal file
7
common/patchable-async-sleep/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# Patchable Async Sleep
|
||||
|
||||
An async sleep function, patchable to the preferred runtime.
|
||||
|
||||
This crate is `tokio`-backed. Applications which don't want to use `tokio`
|
||||
should patch this crate to one which works witht heir preferred runtime. The
|
||||
point of it is to have a minimal API surface to trivially facilitate such work.
|
||||
10
common/patchable-async-sleep/src/lib.rs
Normal file
10
common/patchable-async-sleep/src/lib.rs
Normal file
@@ -0,0 +1,10 @@
|
||||
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
||||
#![doc = include_str!("../README.md")]
|
||||
#![deny(missing_docs)]
|
||||
|
||||
use core::time::Duration;
|
||||
|
||||
/// Sleep for the specified duration.
|
||||
pub fn sleep(duration: Duration) -> impl core::future::Future<Output = ()> {
|
||||
tokio::time::sleep(duration)
|
||||
}
|
||||
@@ -25,7 +25,7 @@ parity-scale-codec = { version = "3", default-features = false, features = ["std
|
||||
|
||||
futures-util = { version = "0.3", default-features = false, features = ["std", "async-await-macro", "sink", "channel"] }
|
||||
futures-channel = { version = "0.3", default-features = false, features = ["std", "sink"] }
|
||||
tokio = { version = "1", default-features = false, features = ["time"] }
|
||||
patchable-async-sleep = { version = "0.1", path = "../../../common/patchable-async-sleep", default-features = false }
|
||||
|
||||
serai-db = { path = "../../../common/db", version = "0.1", default-features = false }
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ use futures_util::{
|
||||
FutureExt, StreamExt, SinkExt,
|
||||
future::{self, Fuse},
|
||||
};
|
||||
use tokio::time::sleep;
|
||||
use patchable_async_sleep::sleep;
|
||||
|
||||
use serai_db::{Get, DbTxn, Db};
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ use std::{
|
||||
};
|
||||
|
||||
use futures_util::{FutureExt, future};
|
||||
use tokio::time::sleep;
|
||||
use patchable_async_sleep::sleep;
|
||||
|
||||
use crate::{
|
||||
time::CanonicalInstant,
|
||||
|
||||
@@ -27,23 +27,23 @@ group = { version = "0.13", default-features = false }
|
||||
k256 = { version = "^0.13.1", default-features = false, features = ["std", "ecdsa", "arithmetic"] }
|
||||
frost = { package = "modular-frost", path = "../../crypto/frost", default-features = false, features = ["secp256k1"] }
|
||||
|
||||
alloy-core = { version = "0.7", default-features = false }
|
||||
alloy-sol-types = { version = "0.7", default-features = false, features = ["json"] }
|
||||
alloy-consensus = { version = "0.1", default-features = false, features = ["k256"] }
|
||||
alloy-network = { version = "0.1", default-features = false }
|
||||
alloy-rpc-types-eth = { version = "0.1", default-features = false }
|
||||
alloy-rpc-client = { version = "0.1", default-features = false }
|
||||
alloy-core = { version = "0.8", default-features = false }
|
||||
alloy-sol-types = { version = "0.8", default-features = false, features = ["json"] }
|
||||
alloy-consensus = { version = "0.3", default-features = false, features = ["k256"] }
|
||||
alloy-network = { version = "0.3", default-features = false }
|
||||
alloy-rpc-types-eth = { version = "0.3", default-features = false }
|
||||
alloy-rpc-client = { version = "0.3", default-features = false }
|
||||
alloy-simple-request-transport = { path = "./alloy-simple-request-transport", default-features = false }
|
||||
alloy-provider = { version = "0.1", default-features = false }
|
||||
alloy-provider = { version = "0.3", default-features = false }
|
||||
|
||||
alloy-node-bindings = { version = "0.1", default-features = false, optional = true }
|
||||
alloy-node-bindings = { version = "0.3", default-features = false, optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
frost = { package = "modular-frost", path = "../../crypto/frost", default-features = false, features = ["tests"] }
|
||||
|
||||
tokio = { version = "1", features = ["macros"] }
|
||||
|
||||
alloy-node-bindings = { version = "0.1", default-features = false }
|
||||
alloy-node-bindings = { version = "0.3", default-features = false }
|
||||
|
||||
[features]
|
||||
tests = ["alloy-node-bindings", "frost/tests"]
|
||||
|
||||
@@ -21,8 +21,8 @@ tower = "0.4"
|
||||
serde_json = { version = "1", default-features = false }
|
||||
simple-request = { path = "../../../common/request", default-features = false }
|
||||
|
||||
alloy-json-rpc = { version = "0.1", default-features = false }
|
||||
alloy-transport = { version = "0.1", default-features = false }
|
||||
alloy-json-rpc = { version = "0.3", default-features = false }
|
||||
alloy-transport = { version = "0.3", default-features = false }
|
||||
|
||||
[features]
|
||||
default = ["tls"]
|
||||
|
||||
@@ -301,12 +301,28 @@ impl WalletOutput {
|
||||
|
||||
/// The payment ID included with this output.
|
||||
///
|
||||
/// This field may be `Some` even if wallet2 would not return a payment ID. This will happen if
|
||||
/// the scanned output belongs to the subaddress which spent Monero within the transaction which
|
||||
/// created the output. If multiple subaddresses spent Monero within this transactions, the key
|
||||
/// image with the highest index is determined to be the subaddress considered as the one
|
||||
/// spending.
|
||||
// TODO: Clarify and cite for point A ("highest index spent key image"??)
|
||||
/// This field may be `Some` even if wallet2 would not return a payment ID. wallet2 will only
|
||||
/// decrypt a payment ID if either:
|
||||
///
|
||||
/// A) The transaction wasn't made by the wallet (via checking if any key images are recognized)
|
||||
/// B) For the highest-indexed input with a recognized key image, it spends an output with
|
||||
/// subaddress account `(a, _)` which is distinct from this output's subaddress account
|
||||
///
|
||||
/// Neither of these cases are handled by `monero-wallet` as scanning doesn't have the context
|
||||
/// of key images.
|
||||
//
|
||||
// Identification of the subaddress account for the highest-indexed input with a recognized key
|
||||
// image:
|
||||
// https://github.com/monero-project/monero/blob/a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623
|
||||
// /src/wallet/wallet2.cpp/#L2637-L2670
|
||||
//
|
||||
// Removal of 'transfers' received to this account:
|
||||
// https://github.com/monero-project/monero/blob/a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623
|
||||
// /src/wallet/wallet2.cpp/#L2782-L2794
|
||||
//
|
||||
// Payment IDs only being decrypted for the remaining transfers:
|
||||
// https://github.com/monero-project/monero/blob/a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623
|
||||
// /src/wallet/wallet2.cpp/#L2796-L2844
|
||||
pub fn payment_id(&self) -> Option<PaymentId> {
|
||||
self.metadata.payment_id
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
[package]
|
||||
name = "proc-macro-crate"
|
||||
version = "2.0.1"
|
||||
description = "Patches proc-macro-crate 2 to 3"
|
||||
license = "MIT"
|
||||
repository = "https://github.com/serai-dex/serai/tree/develop/patches/proc-macro-crate"
|
||||
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
|
||||
keywords = []
|
||||
edition = "2021"
|
||||
rust-version = "1.66"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[dependencies]
|
||||
proc-macro-crate = "3"
|
||||
@@ -1 +0,0 @@
|
||||
pub use proc_macro_crate::*;
|
||||
Reference in New Issue
Block a user