Commit graph

1905 commits

Author SHA1 Message Date
Luke Parker
33c55b8506
Extend the test workflow to also test against Monero v14 (v0.17) 2022-07-28 23:31:27 -04:00
Luke Parker
bba93a64c2
Implement view tags 2022-07-27 06:29:14 -04:00
Luke Parker
755dc84859
Replace rand with rand_core where possible
Turns out rand_core offers OsRng.
2022-07-27 05:45:08 -04:00
Luke Parker
023afaf7ce
Bulletproofs+ (#70)
* Initial stab at Bulletproofs+

Does move around the existing Bulletproofs code, does still work as 
expected.

* Make the Clsag RCTPrunable type work with BP and BP+

* Initial set of BP+ bug fixes

* Further bug fixes

* Remove RING_LEN as a constant

* Monero v16 TX support

Doesn't implement view tags, nor going back to v14, nor the updated BP 
clawback logic.

* Support v14 and v16 at the same time
2022-07-27 04:05:43 -05:00
Luke Parker
37b8e3c025
Modularize Bulletproofs in prep for BP+ 2022-07-26 08:06:56 -04:00
Luke Parker
60e15d5160
Remove re-calculation of N
Moves most BP assertions to debug.
2022-07-26 05:31:15 -04:00
Luke Parker
7d9834be87
Correct clippy, remove Monero build depends 2022-07-26 03:48:46 -04:00
Luke Parker
696da8228e
Remove Monero as a dependency
Introduces missing CLSAG checks. The only difference now should be the 
additional rejection of torsioned points, which is relevant to 
https://github.com/serai-dex/serai/issues/25. Considering this is only 
currently used for FROST verification, this should be fine.

Closes https://github.com/serai-dex/serai/issues/19 by making it 
irrelevant.

Increases priority of https://github.com/serai-dex/serai/issues/68, as 
now it's used for the BP generators which are done at first-proof.

Also merges BP's stricter hash_to_point with the library's, since CLSAG 
has the same bound.
2022-07-26 03:25:57 -04:00
Luke Parker
ee29f6d6d8
Implement Bulletproofs in Rust (#69)
* Initial attempt at Bulletproofs

I don't know why this doesn't work. The generators and hash_cache lines
up without issue. AFAICT, the inner product proof is valid as well, as
are all included formulas.

* Add yinvpow asserts

* Clean code

* Correct bad imports

* Fix the definition of TWO_N

Bulletproofs work now :D

* Tidy up a bit

* fmt + clippy

* Compile a variety of XMR dependencies with optimizations, even under dev

The Rust bulletproof implementation is 8% slower than C right now, under 
release. This is acceptable, even if suboptimal. Under debug, they take 
a quarter of a second to two seconds though, depending on the amount of 
outputs, which justifies this move.

* Remove unnecessary deref in BPs
2022-07-26 02:05:15 -05:00
Luke Parker
3711e13009
Remove old duplicates of the AGPL-3.0 2022-07-24 09:33:08 -04:00
Luke Parker
f25bd88030
Test bulletproof creation and verification 2022-07-24 09:00:55 -04:00
Luke Parker
10ab467160
Don't use a constant for H yet re-calculate it 2022-07-24 08:57:33 -04:00
Luke Parker
1362764b2b
Only cache cargo registry and git 2022-07-23 07:10:25 -04:00
Luke Parker
18a1d15f78
Use composite actions in CI (#65)
* Attempt composite actions in CI

* Remove needs monero-daemon for the action

* Correct actions folder layout

* Remove empty inputs/outputs, add shell

* Try moving env declaration spot

* Remove usage of env

* Cached Rust composite action

* Replace [] with ""

Remove empty outputs
2022-07-23 06:05:31 -05:00
Luke Parker
bb3ffa9021
Add social links to the README 2022-07-23 05:20:36 -04:00
Luke Parker
5b80ead18c
Remove the build CI task now
It's identical to test, except it doesn't grab Foundry nor spawn a 
Monero regtest daemon. It doubles the amount of time test takes though, 
as it's doing everything twice.

While it may have value as a component, we're not using it like that 
right now, and if desired, we could add it back. While it may have value 
to produce binaries, we're note doing that either, and it wasn't 
building in release.
2022-07-23 05:07:13 -04:00
Luke Parker
42d62c38b9
Remove the Monero build (#64)
* Remove the Monero CMake and make

* Download the Monero daemon instead of building it

* Cache the Monero daemon

Prevents hammering the Monero servers, should reduce CI time.

* Correct YAML

* Add back sodium-dev

* Create an independent job for downloading the Monero daemon

Improves parallelism while decreasing the amount of work re-done if 
build fails. Also increases modularity.

* Correct Monero job definition

* Correct skipping the Monero download on cache hit
2022-07-23 03:35:32 -05:00
Luke Parker
b80c1bec4c
Update dependencies
ethers previously used a git spec due to depending on not-yet-published 
updates. Now that they've been released, a properly published version is 
used.
2022-07-22 12:36:30 -04:00
noot
bd93d6ec8a
set up CI (#45)
* begin to setup ci

* attempt to fix build

* fix paths in build script

* fix

* satisfy clippy

* update fmt check to use nightly

* use nightly for build

* fmt

* fix fmt install

* update test script

* try to fix fmt

* merge w develop

* maybe fix build script

* install wasm toolchain

* install solc-select, use stable rust to build

* Correct clippy warnings

Currently intended to be done with:
cargo clippy --features "recommended merlin batch serialize experimental 
ed25519 ristretto p256 secp256k1 multisig" -- -A clippy::type_complexity 
-A dead_code

* Remove try-runtime

I tried to get this to work for an hour. I have no idea why it doesn't, 
yet it doesn't.

* Rewrite workflow

Splits tasks into a more modular structure. Also uses 
actions-rs/toolchain.

* Add a cache

* Immediately try building ETH/Monero while this is fixed

Adds solc-select use.

* Revert selective advance building of ETH/XMR

ETH builds now, so it hopefully should work now.

Also moves from on push to on push to develop.

* Install Monero runtime dependencies

Specify missing Rust toolchain setting.

* Correct multi-line commands

* Fix multi-line commands again

Cache Ethereum artifacts.

* Add Foundry

* Move Clippy under build

* Minimal rustup

Adds wasm Clippy. Puts Clippy before build.

* Use nightly clippy

* Remove old clippy call from under build

* Have the Monero build script support ARCH specification

Requirement for CI.

* Add WASM toolchain to tests

* Remove Ethereum cache which did not work as needed

* Remove extraneous quotes which broke builds on Arch

Co-authored-by: Luke Parker <lukeparker5132@gmail.com>
2022-07-22 11:31:29 -05:00
Luke Parker
76a7160ea5
Correct clippy warnings
Currently intended to be done with:
cargo clippy --features "recommended merlin batch serialize experimental 
ed25519 ristretto p256 secp256k1 multisig" -- -A clippy::type_complexity 
-A dead_code
2022-07-22 02:35:17 -04:00
Luke Parker
3556584478
Correct missing escape sequences 2022-07-22 00:32:18 -04:00
Luke Parker
9f6eb205b0 Address review comments from #53 2022-07-21 23:30:51 -05:00
Luke Parker
e617783f09 Correct bullet point spacing 2022-07-21 23:30:51 -05:00
Luke Parker
146db6836e Update Validators doc per https://github.com/serai-dex/serai/issues/55 2022-07-21 23:30:51 -05:00
Luke Parker
cd8b116fd8 cargo fmt 2022-07-21 23:30:51 -05:00
Luke Parker
a733bb5865 Update the ink! contract to match docs 2022-07-21 23:30:51 -05:00
Luke Parker
375967b165 Correct table formatting and clarify network docs 2022-07-21 23:30:51 -05:00
Luke Parker
4186bc93a8 Update the Multisig documentation to be designed around Validator Sets 2022-07-21 23:30:51 -05:00
Luke Parker
1994dab634 Add documentation on Validator Sets 2022-07-21 23:30:51 -05:00
Luke Parker
d320af06a7 Rewrite the Validators spec
Moves Oraclization/Report to Consensus for now.
2022-07-21 23:30:51 -05:00
Luke Parker
1b461ca5be Split Validators and Consensus docs 2022-07-21 23:30:51 -05:00
Luke Parker
895fbae2dc Add a full success route test for the multisig contract 2022-07-21 23:30:51 -05:00
Luke Parker
21e555192c Add subsequent_vote test
This is the contracts/extension that triggered a Rust ICE, as noted in 
my issue there.
2022-07-21 23:30:51 -05:00
Luke Parker
aa0d364fc2 First passing multisig vote test 2022-07-21 23:30:51 -05:00
Luke Parker
43c4487804 Create a dedicated crate for the extension 2022-07-21 23:30:51 -05:00
Luke Parker
5583bf3447 Initial multisig tracking contract in ink 2022-07-21 23:30:51 -05:00
Luke Parker
be921ab2d3 Document various Scenarios
- Pong
- Wrap
- SRI -> BTC
- BTC -> Monero
- Add Liquidity (fresh)
- Add Liquidity (SRI holder)
2022-07-21 23:22:48 -05:00
Luke Parker
c48992ab94 Update according to comment 2022-07-21 23:22:48 -05:00
Luke Parker
f7f67f72a2 Correct link in Instructions 2022-07-21 23:22:48 -05:00
Luke Parker
c3ab201517 Document Serai's Application Calls and update Instructions accordingly 2022-07-21 23:22:48 -05:00
Luke Parker
9cc35a06ab Add authenticated calls to Ethereum
Also uses numbered lists for function descriptions.
2022-07-21 23:22:48 -05:00
Luke Parker
004086b85b Include origin as an Option in Shorthand
Converts (Network, Address) to Enum { Native(Address), Serai(Address) } 
as it's not valid to send Bitcoin to Ethereum.

Corrects a legacy comment regarding serialization.
2022-07-21 23:22:48 -05:00
Luke Parker
ae3525ca2c Document Instructions and various network's integrations
Tracking issue: https://github.com/serai-dex/serai/issues/57
2022-07-21 23:22:48 -05:00
silverpill
194c5acebb Fix compilation errors in monero-serai 2022-07-17 16:55:49 -05:00
Luke Parker
c0cac7591d
Correct a missing fmt 2022-07-17 17:18:56 -04:00
Luke Parker
9cb2d8aa4a
Integrate ink! 2022-07-16 21:06:54 -04:00
Luke Parker
314c9cd8f7
Clean Substrate Cargo.tomls 2022-07-16 20:53:28 -04:00
Luke Parker
2bddce2087
Add a patch for zip so ethereum-serai doesn't conflict with Substrate
Also commits the lock file and updates documentation.
2022-07-16 17:49:35 -04:00
noot
c589743e2b
ethereum: implement schnorr verification contract deployment and related crypto (#36)
* basic schnorr verify working

* add schnorr-verify as submodule

* remove previous code

* Misc Ethereum work which will probably be disregarded

* add ecrecover hack test, worksgit add src/

* merge w develop

* starting w/ rust-web3

* trying to use ethers

* deploy_schnorr_verifier_contract finally working

* modify EthereumHram to use 27/28 for point parity

* updated address calc, solidity schnorr verify now working

* add verify failure to test

* update readme

* move ethereum/ to coins/

* un fmt coins/monero

* update .gitmodules

* fix cargo paths

* fix coins/monero

* add #[allow(non_snake_case)]

* un-fmt stuff

* move crypto to coins/ethereum

* move unit tests to ethereum/tests

* remove js, build w ethers

* update .gitignore

* address comments

* add q != 0 check

* update contract param order

* update contract license to AGPL

* update ethereum-serai license to GPL and fmt

* GPLv3 for ethereum-serai

* AGPLv3 for ethereum-serai

* actually fix license

Co-authored-by: Luke Parker <lukeparker5132@gmail.com>
2022-07-16 16:45:41 -05:00
Luke Parker
e67033a207 Apply an initial set of rustfmt rules 2022-07-16 15:16:30 -05:00