Update monero-oxide, Substrate

This commit is contained in:
Luke Parker
2025-11-22 08:54:46 -05:00
parent e1e6e67d4a
commit 2ffdd2a01d
23 changed files with 503 additions and 482 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 = "030c60974f0f0306849c1795bca854a3bbb757b4", default-features = false, features = ["std", "multisig"] }
monero-simple-request-rpc = { git = "https://github.com/monero-oxide/monero-oxide", rev = "030c60974f0f0306849c1795bca854a3bbb757b4", default-features = false }
monero-wallet = { git = "https://github.com/monero-oxide/monero-oxide", rev = "af0368e16395dbdda47cd53e54ccdb78a80b87bf", default-features = false, features = ["std", "multisig"] }
monero-simple-request-rpc = { git = "https://github.com/monero-oxide/monero-oxide", rev = "af0368e16395dbdda47cd53e54ccdb78a80b87bf", default-features = false }
serai-primitives = { path = "../../substrate/primitives", default-features = false, features = ["std"] }
serai-client-monero = { path = "../../substrate/client/monero", default-features = false }

View File

@@ -1,9 +1,13 @@
use zeroize::Zeroizing;
use ciphersuite::*;
use ciphersuite::{group::ff::PrimeField, WrappedGroup, GroupIo};
use dalek_ff_group::Ed25519;
use monero_wallet::{address::SubaddressIndex, ViewPairError, GuaranteedViewPair};
use monero_wallet::{
ed25519::{Scalar, CompressedPoint},
address::SubaddressIndex,
ViewPairError, GuaranteedViewPair,
};
use view_keys::view_key;
@@ -29,7 +33,10 @@ pub(crate) const FORWARDED_SUBADDRESS: SubaddressIndex = match SubaddressIndex::
};
pub(crate) fn view_pair(key: <Ed25519 as WrappedGroup>::G) -> GuaranteedViewPair {
match GuaranteedViewPair::new(key.0, Zeroizing::new(view_key::<Ed25519>(0))) {
match GuaranteedViewPair::new(
CompressedPoint::from(key.0.compress().to_bytes()).decompress().unwrap(),
Zeroizing::new(Scalar::read(&mut view_key::<Ed25519>(0).to_repr().as_slice()).unwrap()),
) {
Ok(view_pair) => view_pair,
Err(ViewPairError::TorsionedSpendKey) => {
unreachable!("dalek_ff_group::EdwardsPoint had torsion")

View File

@@ -1,6 +1,9 @@
use std::io;
use ciphersuite::WrappedGroup;
use ciphersuite::{
group::{ff::PrimeField, GroupEncoding},
WrappedGroup,
};
use dalek_ff_group::Ed25519;
use monero_wallet::WalletOutput;
@@ -65,9 +68,11 @@ impl ReceivedOutput<<Ed25519 as WrappedGroup>::G, Address> for Output {
// The spend key will be a key we generated, so it'll be in the prime-order subgroup
// The output's key is the spend key + (key_offset * G), so it's in the prime-order subgroup if
// the spend key is
dalek_ff_group::EdwardsPoint(
self.0.key() - (*<Ed25519 as WrappedGroup>::generator() * self.0.key_offset()),
)
dalek_ff_group::EdwardsPoint::from_bytes(&self.0.key().compress().to_bytes()).unwrap() -
dalek_ff_group::EdwardsPoint(
*<Ed25519 as WrappedGroup>::generator() *
dalek_ff_group::Scalar::from_repr(<[u8; 32]>::from(self.0.key_offset())).unwrap(),
)
}
fn presumed_origin(&self) -> Option<Address> {

View File

@@ -7,7 +7,7 @@ use rand_chacha::ChaCha20Rng;
use ciphersuite::*;
use dalek_ff_group::Ed25519;
use monero_wallet::interface::prelude::*;
use monero_wallet::{ed25519::CompressedPoint, interface::prelude::*};
use serai_primitives::{coin::ExternalCoin, balance::Amount};
use serai_client_monero::Address;
@@ -116,8 +116,8 @@ async fn signable_transaction(
MoneroAddress::new(
Network::Mainnet,
AddressType::Legacy,
<Ed25519 as WrappedGroup>::generator().0,
<Ed25519 as WrappedGroup>::generator().0,
CompressedPoint::G.decompress().unwrap(),
CompressedPoint::G.decompress().unwrap(),
),
0,
));