Commit Graph

892 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
e066083404 Merge branch 'develop' into monero-legacy 2023-07-03 18:04:12 -04:00
Luke Parker
6ac57be4e3 Disable Rust caching
We hit the cache limit after just one or two builds, making it infeasible.
2023-07-03 18:03:09 -04:00
Luke Parker
06bbc5b1cf Corrections for recent processor commit 2023-07-03 12:45:08 -04:00
Luke Parker
3480b3cdc2 Merge branch 'develop' into monero-legacy 2023-07-03 12:41:04 -04:00
Luke Parker
08e7ca955b Correct depends for processor-messages 2023-07-03 12:40:56 -04:00
Luke Parker
06faeec5bc Stop caching the Monero block hash now in processor that we have Block::hash 2023-07-03 12:39:53 -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
239800cfcf Update monero-tests workflow to new name for the processor 2023-07-03 09:12:29 -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
d49c636f0f Use serai- prefixes on Serai-specific packages
Fixes deny.toml, also runs a minor cargo update shrinking the tree.
2023-07-03 08:50:23 -04:00
Boog900
30834fe4d2 std-shims: six Read for &[u8] 2023-07-03 07:13:06 -04:00
GitHub Actions
d928b787f7 Update nightly 2023-07-03 07:10:53 -04:00
Luke Parker
c7b232949a Correct deny.toml with inclusion of message-queue 2023-07-03 07:09:35 -04:00
Luke Parker
acf2469dd8 cargo update
Resolves https://github.com/serai-dex/serai/security/dependabot/29
2023-07-01 20:27:03 -04:00
Luke Parker
6267acf3df Add a message queue
This is intended to be a reliable transport between the processors and
coordinator. Since it'll be intranet only, it's written as never fail.

Primarily needs testing and a proper ID.
2023-07-01 08:53:46 -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
GitHub Actions
8ced63eaac Update nightly 2023-06-28 18:42:19 -04:00
Luke Parker
f6a497f3ac Slight terminology correction in sync test
Also correct a mistake from merging the most recent polkadot version.
2023-06-28 15:20:50 -04:00
akildemir
790fe7ee23 fix tributary sync test 2023-06-28 15:01:55 -04:00
Luke Parker
8c020abb86 Update to substrate polkadot-v0.9.43 2023-06-28 14:57:58 -04:00
Luke Parker
21f0bb2721 Pin setup-protoc to v2.0.0 2023-06-28 12:28:14 -04:00
Luke Parker
385ed2e97a Build no-std tests with RISC-V 32 IMAC
Turns out wasm still has std, making it suboptimal to use here.
2023-06-28 12:26:53 -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
Luke Parker
fca567f61d cargo update
Resolves an openssl advisory and nets ~-8 crates.
2023-06-22 06:25:33 -04:00
Luke Parker
dfa3106a38 Fix incorrect sig_hash generation
sig_hash was used as a challenge. challenges should be of the form H(R, A, m).
These sig hashes were solely H(A, m), allowing trivial forgeries.
2023-06-08 06:38:25 -04: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