monero: match monero's stricter check when decompressing points (#515)

* monero: match monero's stricter check when decompressing points

* Reverted type change for output key
This commit is contained in:
Justin Berman
2024-02-17 20:16:16 -08:00
committed by GitHub
parent 62a619a312
commit df85c09435
17 changed files with 727 additions and 58 deletions

View File

@@ -336,9 +336,7 @@ async fn mint_and_burn_test() {
// Send in XMR
{
use curve25519_dalek::{
constants::ED25519_BASEPOINT_POINT, scalar::Scalar, edwards::CompressedEdwardsY,
};
use curve25519_dalek::{constants::ED25519_BASEPOINT_POINT, scalar::Scalar};
use monero_serai::{
Protocol,
transaction::Timelock,
@@ -346,6 +344,7 @@ async fn mint_and_burn_test() {
ViewPair, Scanner, Decoys, Change, FeePriority, SignableTransaction,
address::{Network, AddressType, AddressMeta, MoneroAddress},
},
decompress_point,
};
// Grab the first output on the chain
@@ -382,9 +381,7 @@ async fn mint_and_burn_test() {
Network::Mainnet,
AddressType::Featured { guaranteed: true, subaddress: false, payment_id: None },
),
CompressedEdwardsY(monero_key_pair.1.to_vec().try_into().unwrap())
.decompress()
.unwrap(),
decompress_point(monero_key_pair.1.to_vec().try_into().unwrap()).unwrap(),
ED25519_BASEPOINT_POINT *
processor::additional_key::<processor::networks::monero::Monero>(0).0,
),

View File

@@ -283,7 +283,7 @@ impl Wallet {
}
Wallet::Monero { handle, ref spend_key, ref view_pair, ref mut inputs } => {
use curve25519_dalek::{constants::ED25519_BASEPOINT_POINT, edwards::CompressedEdwardsY};
use curve25519_dalek::constants::ED25519_BASEPOINT_POINT;
use monero_serai::{
Protocol,
wallet::{
@@ -291,6 +291,7 @@ impl Wallet {
SpendableOutput, Decoys, Change, FeePriority, Scanner, SignableTransaction,
},
rpc::HttpRpc,
decompress_point,
};
use processor::{additional_key, networks::Monero};
@@ -317,8 +318,7 @@ impl Wallet {
.await
.unwrap();
let to_spend_key =
CompressedEdwardsY(<[u8; 32]>::try_from(to.as_ref()).unwrap()).decompress().unwrap();
let to_spend_key = decompress_point(<[u8; 32]>::try_from(to.as_ref()).unwrap()).unwrap();
let to_view_key = additional_key::<Monero>(0);
let to_addr = Address::new(
AddressMeta::new(