Update monero-oxide to the branch with the new RPC

See https://github.com/monero-oxide/monero-oxide/pull/66.

Allows us to remove the shim `simple-request 0.1` we had to define as we now
have `simple-request 0.2` in tree.
This commit is contained in:
Luke Parker
2025-09-18 19:00:10 -04:00
parent 3955f92cc2
commit d74b00b9e4
9 changed files with 105 additions and 89 deletions

View File

@@ -28,8 +28,8 @@ dalek-ff-group = { path = "../../crypto/dalek-ff-group", default-features = fals
dkg = { package = "dkg-evrf", path = "../../crypto/dkg/evrf", default-features = false, features = ["std", "ed25519"] }
frost = { package = "modular-frost", path = "../../crypto/frost", default-features = false }
monero-wallet = { git = "https://github.com/monero-oxide/monero-oxide", rev = "2c847f71079a105456376f9957cee86c4b6a9eb8", default-features = false, features = ["std", "multisig"] }
monero-simple-request-rpc = { git = "https://github.com/monero-oxide/monero-oxide", rev = "2c847f71079a105456376f9957cee86c4b6a9eb8", default-features = false }
monero-wallet = { git = "https://github.com/monero-oxide/monero-oxide", rev = "f6f4dd7dc5b7c6e057b2eac2ec4980bb7a1c707c", default-features = false, features = ["std", "multisig"] }
monero-simple-request-rpc = { git = "https://github.com/monero-oxide/monero-oxide", rev = "f6f4dd7dc5b7c6e057b2eac2ec4980bb7a1c707c", default-features = false }
serai-client = { path = "../../substrate/client", default-features = false, features = ["monero"] }

View File

@@ -6,7 +6,7 @@
static ALLOCATOR: zalloc::ZeroizingAlloc<std::alloc::System> =
zalloc::ZeroizingAlloc(std::alloc::System);
use monero_simple_request_rpc::SimpleRequestRpc;
use monero_simple_request_rpc::SimpleRequestTransport;
mod primitives;
pub(crate) use crate::primitives::*;
@@ -23,7 +23,7 @@ async fn main() {
let db = bin::init();
let feed = Rpc {
rpc: loop {
match SimpleRequestRpc::new(bin::url()).await {
match SimpleRequestTransport::new(bin::url()).await {
Ok(rpc) => break rpc,
Err(e) => {
log::error!("couldn't connect to the Monero node: {e:?}");

View File

@@ -4,7 +4,8 @@ use ciphersuite::*;
use dalek_ff_group::Ed25519;
use monero_wallet::{
block::Block as MBlock, rpc::ScannableBlock as MScannableBlock, ScanError, GuaranteedScanner,
block::Block as MBlock, interface::ScannableBlock as MScannableBlock, ScanError,
GuaranteedScanner,
};
use serai_client::networks::monero::Address;

View File

@@ -1,7 +1,6 @@
use core::future::Future;
use monero_wallet::rpc::{RpcError, Rpc as RpcTrait};
use monero_simple_request_rpc::SimpleRequestRpc;
use monero_simple_request_rpc::{prelude::*, SimpleRequestTransport};
use serai_client::primitives::{network_id::ExternalNetworkId, coin::ExternalCoin, balance::Amount};
@@ -15,7 +14,7 @@ use crate::{
#[derive(Clone)]
pub(crate) struct Rpc {
pub(crate) rpc: SimpleRequestRpc,
pub(crate) rpc: MoneroDaemon<SimpleRequestTransport>,
}
impl ScannerFeed for Rpc {
@@ -31,21 +30,16 @@ impl ScannerFeed for Rpc {
type Block = Block;
type EphemeralError = RpcError;
type EphemeralError = InterfaceError;
fn latest_finalized_block_number(
&self,
) -> impl Send + Future<Output = Result<u64, Self::EphemeralError>> {
async move {
Ok(
self
.rpc
.get_height()
.await?
.checked_sub(1)
.expect("connected to an invalid Monero RPC")
.try_into()
.unwrap(),
u64::try_from(self.rpc.latest_block_number().await?)
.unwrap()
.saturating_sub(Self::CONFIRMATIONS - 1),
)
}
}
@@ -64,11 +58,11 @@ impl ScannerFeed for Rpc {
}
// Fetch all the timestamps within the window
let block_for_time_of = self.rpc.get_block_by_number(number.try_into().unwrap()).await?;
let block_for_time_of = self.rpc.block_by_number(number.try_into().unwrap()).await?;
let mut timestamps = vec![block_for_time_of.header.timestamp];
let mut parent = block_for_time_of.header.previous;
for _ in 1 .. BLOCKCHAIN_TIMESTAMP_CHECK_WINDOW {
let parent_block = self.rpc.get_block(parent).await?;
let parent_block = self.rpc.block(parent).await?;
timestamps.push(parent_block.header.timestamp);
parent = parent_block.header.previous;
}
@@ -94,7 +88,7 @@ impl ScannerFeed for Rpc {
) -> impl Send
+ Future<Output = Result<<Self::Block as primitives::Block>::Header, Self::EphemeralError>>
{
async move { Ok(BlockHeader(self.rpc.get_block_by_number(number.try_into().unwrap()).await?)) }
async move { Ok(BlockHeader(self.rpc.block_by_number(number.try_into().unwrap()).await?)) }
}
#[rustfmt::skip] // It wants to improperly format the `async move` to a single line
@@ -103,7 +97,7 @@ impl ScannerFeed for Rpc {
number: u64,
) -> impl Send + Future<Output = Result<Self::Block, Self::EphemeralError>> {
async move {
Ok(Block(self.rpc.get_scannable_block_by_number(number.try_into().unwrap()).await?))
Ok(Block(self.rpc.scannable_block_by_number(number.try_into().unwrap()).await?))
}
}
@@ -128,7 +122,7 @@ impl ScannerFeed for Rpc {
}
impl TransactionPublisher<Transaction> for Rpc {
type EphemeralError = RpcError;
type EphemeralError = PublishTransactionError;
fn publish(
&self,

View File

@@ -7,7 +7,7 @@ use rand_chacha::ChaCha20Rng;
use ciphersuite::*;
use dalek_ff_group::Ed25519;
use monero_wallet::rpc::{FeeRate, RpcError};
use monero_wallet::interface::prelude::*;
use serai_client::{
primitives::{coin::ExternalCoin, balance::Amount},
@@ -55,7 +55,7 @@ async fn signable_transaction(
inputs: Vec<OutputFor<Rpc>>,
payments: Vec<Payment<AddressFor<Rpc>>>,
change: Option<KeyFor<Rpc>>,
) -> Result<Result<(SignableTransaction, MSignableTransaction), SendError>, RpcError> {
) -> Result<Result<(SignableTransaction, MSignableTransaction), SendError>, TransactionsError> {
assert!(inputs.len() < <Planner as TransactionPlanner<Rpc, ()>>::MAX_INPUTS);
assert!(
(payments.len() + usize::from(u8::from(change.is_some()))) <
@@ -148,7 +148,7 @@ async fn signable_transaction(
#[derive(Clone)]
pub(crate) struct Planner(pub(crate) Rpc);
impl TransactionPlanner<Rpc, ()> for Planner {
type EphemeralError = RpcError;
type EphemeralError = TransactionsError;
type SignableTransaction = SignableTransaction;
@@ -221,8 +221,9 @@ impl TransactionPlanner<Rpc, ()> for Planner {
payments: Vec<Payment<AddressFor<Rpc>>>,
change: Option<KeyFor<Rpc>>,
) -> impl Send
+ Future<Output = Result<PlannedTransaction<Rpc, Self::SignableTransaction, ()>, RpcError>>
{
+ Future<
Output = Result<PlannedTransaction<Rpc, Self::SignableTransaction, ()>, TransactionsError>,
> {
let singular_spent_output = (inputs.len() == 1).then(|| inputs[0].id());
async move {