Serai is a new DEX, built from the ground up, initially planning on listing Bitcoin, Ethereum, DAI, and Monero, offering a liquidity-pool-based trading experience. Funds are stored in an economically secured threshold-multisig wallet.
Find a file
Boog900 89eef95fb3
Monero: support for legacy transactions (#308)
* add mlsag

* fix last commit

* fix miner v1 txs

* fix non-miner v1 txs

* add borromean + fix mlsag

* add block hash calculations

* fix for the jokester that added unreduced scalars

to the borromean signature of
2368d846e671bf79a1f84c6d3af9f0bfe296f043f50cf17ae5e485384a53707b

* Add Borromean range proof verifying functionality

* Add MLSAG verifying functionality

* fmt & clippy :)

* update MLSAG, ss2_elements will always be 2

* Add MgSig proving

* Tidy block.rs

* Tidy Borromean, fix bugs in last commit, replace todo! with unreachable!

* Mark legacy EcdhInfo amount decryption as experimental

* Correct comments

* Write a new impl of the merkle algorithm

This one tries to be understandable.

* Only pull in things only needed for experimental when experimental

* Stop caching the Monero block hash now in processor that we have Block::hash

* Corrections for recent processor commit

* Use a clearer algorithm for the merkle

Should also be more efficient due to not shifting as often.

* Tidy Mlsag

* 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.

* Move mlsag/mod.rs to mlsag.rs

This should only be a folder if it has multiple files.

* 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.

* Correct handling of commitment masks when scanning

* Route read_array through read_raw_vec

* Misc lint

* Make a proper RctType enum

No longer caches RctType in the RctSignatures as well.

* 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).

* Add necessary checks to Eventuality re: supported protocols

* Fix for block 202612 and fix merkel root calculations

* MLSAG (de)serialisation fix

ss_2_elements will not always be 2 as rct type 1 transactions are not enforced to have one input

* Revert "MLSAG (de)serialisation fix"

This reverts commit 5e710e0c96.

here it checks number of MGs == number of inputs:
0a1eaf26f9/src/cryptonote_core/tx_verification_utils.cpp (L60-59)

and here it checks for RctTypeFull number of MGs == 1:
0a1eaf26f9/src/ringct/rctSigs.cpp (L1325)

so number of inputs == 1
so ss_2_elements == 2

* update `MlsagAggregate` comment

* cargo update

Resolves a yanked crate

* Move location of serai-client in Cargo.toml

---------

Co-authored-by: Luke Parker <lukeparker5132@gmail.com>
2023-07-04 17:18:05 -04:00
.github Disable Rust caching 2023-07-03 18:03:09 -04:00
audits/Cypher Stack crypto March 2023 Correct audit file upload 2023-03-20 17:35:45 -04:00
coins Monero: support for legacy transactions (#308) 2023-07-04 17:18:05 -04:00
common std-shims: six Read for &[u8] 2023-07-03 07:13:06 -04:00
coordinator Use serai- prefixes on Serai-specific packages 2023-07-03 08:50:23 -04:00
crypto Add a message queue 2023-07-01 08:53:46 -04:00
deploy Correct Serai Dockerfile 2023-05-08 02:08:31 -04:00
docs Document the processor/tributary/coordinator/serai flow 2023-04-25 15:05:58 -04:00
message-queue Add a message queue 2023-07-01 08:53:46 -04:00
processor Monero: support for legacy transactions (#308) 2023-07-04 17:18:05 -04:00
substrate Use serai- prefixes on Serai-specific packages 2023-07-03 08:50:23 -04:00
tests/no-std no-std support for monero-serai (#311) 2023-06-29 04:14:29 -04:00
.gitattributes Correct audit file upload 2023-03-20 17:35:45 -04:00
.gitignore fix for #166 & cleanup (#184) 2022-12-07 10:08:04 -05:00
.rustfmt.toml Apply an initial set of rustfmt rules 2022-07-16 15:16:30 -05:00
AGPL-3.0 Add an initial Substrate instantiation 2022-07-15 00:05:00 -04:00
Cargo.lock cargo update 2023-07-04 13:20:59 -04:00
Cargo.toml Move location of serai-client in Cargo.toml 2023-07-04 13:21:52 -04:00
CONTRIBUTING.md Clarify identation policy 2022-10-11 00:40:50 -05:00
deny.toml Use serai- prefixes on Serai-specific packages 2023-07-03 08:50:23 -04:00
LICENSE Update licenses 2023-01-11 23:05:31 -05:00
README.md Documentation and cargo update 2023-04-13 21:06:11 -04:00

Serai

Serai is a new DEX, built from the ground up, initially planning on listing Bitcoin, Ethereum, DAI, and Monero, offering a liquidity-pool-based trading experience. Funds are stored in an economically secured threshold-multisig wallet.

Getting Started

Layout

  • audits: Audits for various parts of Serai.

  • docs: Documentation on the Serai protocol.

  • common: Crates containing utilities common to a variety of areas under Serai, none neatly fitting under another category.

  • crypto: A series of composable cryptographic libraries built around the ff/group APIs achieving a variety of tasks. These range from generic infrastructure, to our IETF-compliant FROST implementation, to a DLEq proof as needed for Bitcoin-Monero atomic swaps.

  • coins: Various coin libraries intended for usage in Serai yet also by the wider community. This means they will always support the functionality Serai needs, yet won't disadvantage other use cases when possible.

  • processor: A generic chain processor to process data for Serai and process events from Serai, executing transactions as expected and needed.

  • coordinator: A service to manage processors and communicate over a P2P network with other validators.

  • substrate: Substrate crates used to instantiate the Serai network.

  • deploy: Scripts to deploy a Serai node/test environment.