Commit Graph

322 Commits

Author SHA1 Message Date
Boog900
5e710e0c96 MLSAG (de)serialisation fix
ss_2_elements will not always be 2 as rct type 1 transactions are not enforced to have one input
2023-07-04 19:59:29 +01:00
Boog900
c4c90cbb4b Fix for block 202612 and fix merkel root calculations 2023-07-04 18:30:57 +01:00
Luke Parker
9ebf438645 Add necessary checks to Eventuality re: supported protocols 2023-07-04 11:59:57 -04:00
Luke Parker
d9f145cd72 Replace Vec<Bulletproofs> with Bulletproofs
Monero uses aggregated range proofs, so there's only ever one Bulletproof. This
is enforced with a consensus rule as well, making this safe.

As for why Monero uses a vec, it's probably due to the lack of variadic typing
used. Its effectively an Option for them, yet we don't need an Option since we
do have variadic typing (enums).
2023-07-04 11:41:00 -04:00
Luke Parker
6fe01d1f15 Make a proper RctType enum
No longer caches RctType in the RctSignatures as well.
2023-07-04 11:22:53 -04:00
Luke Parker
35d7fa5f71 Misc lint 2023-07-03 19:20:23 -04:00
Luke Parker
e9befb856e Route read_array through read_raw_vec 2023-07-03 19:12:09 -04:00
Luke Parker
26fdc1d1f1 Correct handling of commitment masks when scanning 2023-07-03 19:04:33 -04:00
Luke Parker
81cfd841ce Replace EcdhInfo terminology
The ECDH encrypted the amount, yet this struct contained the encrypted amount,
not some ECDH.

Also corrects the types on the original EcdhInfo struct.
2023-07-03 18:57:26 -04:00
Luke Parker
b598639ac9 Move mlsag/mod.rs to mlsag.rs
This should only be a folder if it has multiple files.
2023-07-03 18:42:31 -04:00
Luke Parker
7a75020dc8 Remove verify_rct_* from Mlsag
Both methods were ports from Monero, overtly specific without clear
documentation. They need to be added back in, with documentation, or included
in a node which provides the necessary further context for them to be naturally
understandable.
2023-07-03 18:41:14 -04:00
Luke Parker
56ee1eaf9c Tidy Mlsag 2023-07-03 18:36:26 -04:00
Luke Parker
23b19fcd91 Use a clearer algorithm for the merkle
Should also be more efficient due to not shifting as often.
2023-07-03 18:18:31 -04:00
Luke Parker
2bbd545704 Only pull in things only needed for experimental when experimental 2023-07-03 12:38:36 -04:00
Luke Parker
733a5c1f8a Write a new impl of the merkle algorithm
This one tries to be understandable.
2023-07-03 12:33:19 -04:00
Luke Parker
2b190851a7 Correct comments 2023-07-03 12:06:52 -04:00
Luke Parker
0453bfb4b2 Mark legacy EcdhInfo amount decryption as experimental 2023-07-03 10:25:57 -04:00
Luke Parker
15546b6e27 Tidy Borromean, fix bugs in last commit, replace todo! with unreachable! 2023-07-03 10:15:56 -04:00
Luke Parker
c20f85da64 Tidy block.rs 2023-07-03 09:45:30 -04:00
Luke Parker
6d90c8b4f9 Merge branch 'develop' into HEAD
Also updates monero-generators per comments in
https://github.com/serai-dex/serai/pull/308.
2023-07-03 09:02:27 -04:00
Luke Parker
a95ecc2512 Represent RCT amounts with None, not 0.
Fixes #282.

Does allow any v1 TXs which exist, and v2 miner-TXs, to specify Some(0). As far
as I can tell, both were/are theoreitcally possible.
2023-06-29 13:16:51 -04:00
Luke Parker
ac708b3b2a no-std support for monero-serai (#311)
* Move monero-serai from std to std-shims, where possible

* no-std fixes

* Make the HttpRpc its own feature, thiserror only on std

* Drop monero-rs's epee for a homegrown one

We only need it for a single function. While I tried jeffro's, it didn't work
out of the box, had three unimplemented!s, and is no where near viable for
no_std.

Fixes #182, though should be further tested.

* no-std monero-serai

* Allow base58-monero via git

* cargo fmt
2023-06-29 04:14:29 -04:00
Luke Parker
d25c668ee4 Replace lazy_static with OnceLock inside monero-serai
lazy_static, if no_std environments were used, effectively required always
using spin locks. This resolves the ergonomics of that while adopting Rust std
code.

no_std does still use a spin based solution. Theoretically, we could use
atomics, yet writing our own Mutex wasn't a priority.
2023-06-28 21:45:57 -04:00
Boog900
02750193f3 Add MgSig proving 2023-06-26 00:26:30 +01:00
Boog900
e4a615aa76 update MLSAG, ss2_elements will always be 2 2023-06-23 23:29:43 +01:00
Boog900
c1a2aafc83 fmt & clippy :) 2023-06-23 17:58:33 +01:00
Boog900
d1656d378e Add MLSAG verifying functionality 2023-06-23 13:29:59 +01:00
Boog900
ac30e3afaa Add Borromean range proof verifying functionality 2023-06-23 12:23:33 +01:00
Boog900
71ffcc8ef7 fix for the jokester that added unreduced scalars
to the borromean signature of
2368d846e671bf79a1f84c6d3af9f0bfe296f043f50cf17ae5e485384a53707b
2023-05-31 23:06:06 +01:00
Boog900
4a2f512b8d add block hash calculations 2023-05-31 20:44:11 +01:00
Boog900
f81f5c386d add borromean + fix mlsag 2023-05-31 19:32:47 +01:00
Boog900
d8b8ce9837 fix non-miner v1 txs 2023-05-30 21:05:45 +01:00
Boog900
eb7058801c fix miner v1 txs 2023-05-30 19:24:15 +01:00
Boog900
b014a78e3c fix last commit 2023-05-30 17:29:25 +01:00
Boog900
76f5c23b7f add mlsag 2023-05-30 16:29:57 +01:00
Luke Parker
1aa293cc4a Fix for prior commit 2023-05-27 04:15:57 -04:00
Luke Parker
8a24fc39a6 Only scan v2 Monero TXs 2023-05-27 04:13:40 -04:00
Luke Parker
adfbde6e24 Support arbitrary RPC providers in monero-serai
Sets a clean path for no-std premised RPCs (buffers to an external RPC impl)/
Tor-based RPCs/client-side load balancing/...
2023-05-02 02:39:08 -04:00
Luke Parker
5765d1d278 Update to May's nightly
Doesn't use the PR due to the needed changes.
2023-05-01 04:58:50 -04:00
Luke Parker
be8c25aef0 Move json word lists to rs
Allows building the seed code without serde_json.
2023-04-23 22:26:05 -04:00
Luke Parker
1e448dec21 Add no_std support to transcript, dalek-ff-group, ed448, ciphersuite, multiexp, schnorr, and monero-generators
transcript, dalek-ff-group, ed449, and ciphersuite are all usable with no_std
alone. The rest additionally require alloc.

Part of #279.
2023-04-22 04:38:47 -04:00
Luke Parker
92ad689c7e cargo update
Since p256 now pulls in an extra crate with this update, the {k,p}256 imports
disable default-features to prevent growing the tree.
2023-04-15 23:21:18 -04:00
Luke Parker
f6206b60ec Update to bitcoin 0.30
Also performs a general update with a variety of upgraded Substrate depends.
2023-04-09 02:31:13 -04:00
Luke Parker
648d237df5 Finish updating to the latest Rust/handle broken cargo update 2023-04-01 05:44:18 -04:00
Luke Parker
6fa405a728 Update Monero README 2023-03-31 07:02:57 -04:00
Luke Parker
79aff5d4c8 ff 0.13 (#269)
* Partial move to ff 0.13

It turns out the newly released k256 0.12 isn't on ff 0.13, preventing further
work at this time.

* Update all crates to work on ff 0.13

The provided curves still need to be expanded to fit the new API.

* Finish adding dalek-ff-group ff 0.13 constants

* Correct FieldElement::product definition

Also stops exporting macros.

* Test most new parts of ff 0.13

* Additionally test ff-group-tests with BLS12-381 and the pasta curves

We only tested curves from RustCrypto. Now we test a curve offered by zk-crypto,
the group behind ff/group, and the pasta curves, which is by Zcash (though
Zcash developers are also behind zk-crypto).

* Finish Ed448

Fully specifies all constants, passes all tests in ff-group-tests, and finishes moving to ff-0.13.

* Add RustCrypto/elliptic-curves to allowed git repos

Needed due to k256/p256 incorrectly defining product.

* Finish writing ff 0.13 tests

* Add additional comments to dalek

* Further comments

* Update ethereum-serai to ff 0.13
2023-03-28 04:38:01 -04:00
Luke Parker
534e1bb11d Fix Monero's Extra::fee_weight and handling of data limits 2023-03-26 03:43:51 -04:00
Luke Parker
9157f8d0a0 Update procesor/correct prior commit 2023-03-25 04:06:25 -04:00
Luke Parker
397d79040c Update monero-serai to limit the size of TX extra 2023-03-25 01:26:42 -04:00
Luke Parker
11a0803ea5 Make the bitcoin Algorithm test a unit test 2023-03-21 18:50:23 -04:00