mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
Generate Bulletproofs(+) generators at compile time
Creates a new monero-generators crate so the monero crate can run the code in question at build time. Saves several seconds from running the tests. Closes https://github.com/serai-dex/serai/issues/101.
This commit is contained in:
@@ -7,7 +7,6 @@ use transcript::RecommendedTranscript;
|
||||
use frost::{curve::Ed25519, FrostKeys};
|
||||
|
||||
use monero_serai::{
|
||||
ringct::bulletproofs::Bulletproofs,
|
||||
transaction::Transaction,
|
||||
rpc::Rpc,
|
||||
wallet::{
|
||||
@@ -69,14 +68,7 @@ pub struct Monero {
|
||||
|
||||
impl Monero {
|
||||
pub async fn new(url: String) -> Monero {
|
||||
let view = view_key::<Monero>(0).0;
|
||||
let res = Monero { rpc: Rpc::new(url), view };
|
||||
|
||||
// Initialize Bulletproofs now to prevent the first call from taking several seconds
|
||||
// TODO: Do this for both, unless we're sure we're only working on a single protocol
|
||||
Bulletproofs::init(res.rpc.get_protocol().await.unwrap().bp_plus());
|
||||
|
||||
res
|
||||
Monero { rpc: Rpc::new(url), view: view_key::<Monero>(0).0 }
|
||||
}
|
||||
|
||||
fn view_pair(&self, spend: dfg::EdwardsPoint) -> ViewPair {
|
||||
|
||||
@@ -86,7 +86,7 @@ impl CoinDb for MemCoinDb {
|
||||
fn add_output<O: Output>(&mut self, output: &O) -> bool {
|
||||
// This would be insecure as we're indexing by ID and this will replace the output as a whole
|
||||
// Multiple outputs may have the same ID in edge cases such as Monero, where outputs are ID'd
|
||||
// by key image, not by hash + index
|
||||
// by output key, not by hash + index
|
||||
// self.outputs.insert(output.id(), output).is_some()
|
||||
let id = output.id().as_ref().to_vec();
|
||||
if self.outputs.contains_key(&id) {
|
||||
|
||||
Reference in New Issue
Block a user