* add monero seed support
* fix some of the pr comments
* remove languages module and unnecessary error returns
* Clean classic seed impl
Fixes a few issues regarding Zeroize usage/API safety. Mainly a cleanup.
---------
Co-authored-by: Luke Parker <lukeparker5132@gmail.com>
* serai Dockerfile & Makefile fixed
* added new bitcoin mod & bitcoinhram
* couple changes
* added odd&even check for bitcoin signing
* sign message updated
* print_keys commented out
* fixed signing process
* Added new bitcoin library & added most of bitcoin processor logic
* added new crate and refactored the bitcoin coin library
* added signing test function
* moved signature.rs
* publish set to false
* tests moved back to the root
* added new functions to rpc
* added utxo test
* added new rpc methods and refactored bitcoin processor
* added spendable output & fixed errors & added new logic for sighash & opened port 18443 for bitcoin docker
* changed tweak keys
* added tweak_keys & publish transaction and refactored bitcoin processor
* added new structs and fixed problems for testing purposes
* reverted dockerfile back its original
* reverted block generation of bitcoin to 5 seconds
* deleted unnecessary test function
* added new sighash & added new dbg messages & fixed couple errors
* fixed couple issue & removed unused functions
* fix for signing process
* crypto file for bitcoin refactored
* disabled test_send & removed some of the debug logs
* signing implemented & transaction weight calculation added & change address logic added
* refactored tweak_keys
* refactored mine_block & fixed change_address logic
* implemented new traits to bitcoin processor& refactored bitcoin processor
* added new line to tests file
* added new line to bitcoin's wallet.rs
* deleted Cargo.toml from coins folder
* edited bitcoin's Cargo.toml and added LICENSE
* added new line to bitcoin's Cargo.toml
* added spaces
* added spaces
* deleted unnecessary object
* added spaces
* deleted patch numbers
* updated sha256 parameter for message
* updated tag as const
* deleted unnecessary brackets and imports
* updated rpc.rs to 2 space indent
* deleted unnecessary brackers
* deleted unnecessary brackets
* changed it to explicit
* updated to explicit
* deleted unnecessary parsing
* added ? for easy return
* updated imports
* updated height to number
* deleted unnecessary brackets
* updated clsag to sig & to_vec to as_ref
* updated _sig to schnorr_signature
* deleted unnecessary variable
* updated Cargo.toml of processor and bitcoin
* updated imports of bitcoin processor
* updated MBlock to BBlock
* updated MSignable to BSignable
* updated imports
* deleted mask from Fee
* updated get_block function return
* updated comparison logic for scripts
* updated assert to debug_assert
* updated height to number
* updated txid logic
* updated tweak_keys definition
* updated imports
* deleted new line
* delete HashMap from monero
* deleted old test code parts
* updated test amount to a round number
* changed the test code part back to its original
* updated imports of rpc.rs
* deleted unnecessary return assignments
* deleted get_fee_per_byte
* deleted create_raw_transaction
* deleted fund_raw_transaction
* deleted sign transaction rpc
* delete verify_message rpc
* deleted get_balance
* deleted decode_raw_transaction rpc
* deleted list_transactions rpc
* changed test_send to p2wpkh
* updated imports of test_send
* fixed imports of test_send
* updated bitcoin's mine_block function
* updated bitcoin's test_send
* updated bitcoin's hram and test_signing
* deleted 2 rpc function (is_confirmed & get_transaction_block_number)
* deleted get_raw_transaction_hex
* deleted get_raw_transaction_info
* deleted new_address
* deleted test_mempool_accept
* updated remove(0) to remove(index)
* deleted ger_raw_transaction
* deleted RawTx trait and converted type to Transaction
* reverted raw_hex feature back
* added NotEnoughFunds to CoinError
* changed Sighash to all
* removed lifetime of RpcParams
* changed pub to pub(crate) & changed sig_hash line
* changed taproot_key_spend_signature_hash to internal
* added Clone to RpcError & deleted get_utxo_for
* changed to_hex to as_bytes for weight calculation
* updated SpendableOutput
* deleted unnecessary parentheses
* updated serialize of Output s id field
* deleted unused crate & added lazy_static
* updated RPC init function
* added lazy_static for TAG_HASH & updated imported crates
* changed get_block_index to get_block_number
* deleted get_block_info
* updated get_height to get_latest_block_number
* removed GetBlockWithDetailResult and get_block_with_transactions
* deleted unnecessary imports from rpc_helper
* removed lock and unlock_unspent
* deleted get_transactions and get_transaction and renamed get_raw_transaction to get_transaction
* updated opt_into_json
* changed payment_address and amount to output_script and amount for transcript
* refactored error logic for rpc & deleted anyhow crate
* added a dedicated file for json helper functions
* refactored imports and deleted unused code
* added clippy::non_snake_case
* removed unused Error items
* added new line to Cargo
* rekmoved Block and used bitcoin::Block direcetly
* removed added println and futures.len check
* removed HashMap from coin mod.rs
* updated Testnet to Regtest
* removed unnecessary variable
* updated as_str to &
* removed RawTx trait
* added newline
* changed test transaction to p2pkh
* updated test_send
* updated test_send
* updated test_send
* reformatted bitcoin processor
* moved sighash logic into signmachine
* removed generate_to_address
* added test_address function to bitcoin processor
* updated RpcResponse to enum and added Clone trait
* removed old RpcResponse
* updated shared_key to internal_key
* updated fee part
* updated test_send block logic
* added a test function for getting spendables
* updated tweaking keys logic
* updated calculate_weight logic
* added todo for BitcoinSchnorr Algorithm
* updated calculate_weight
* updated calculate_weight
* updated calculate_weight
* added a TODO for bitcoin's signing process
* removed unused code
* Finish merging develop
* cargo fmt
* cargo machete
* Handle most clippy lints on bitcoin
Doesn't handle the unused transcript due to pending cryptographic considerations.
* Rearrange imports and clippy tests
* Misc processor lint
* Update deny.toml
* Remove unnecessary RPC code
* updated test_send
* added bitcoin ci & updated test-dependencies yml
* fixed bitcoin ci
* updated bitcoin ci yml
* Remove mining from the bitcoin/monero docker files
The tests should control block production in order to test various
circumstances. The automatic mining disrupts assumptions made in testing. Since
we're now using the Bitcoin docker container for testing...
* Multiple fixes to the Bitcoin processor
Doesn't unwrap on RPC errors. Returns the expected connection error.
Fee calculation has a random - 1. This has been removed.
Supports the change address being an Option, as it is. This should not have
been blindly unwrapped.
* Remove unnecessary RPC code
* Further RPC simplifications
* Simplify Bitcoin action
It should not be mining.
* cargo fmt
* Finish RPC simplifications
* Run bitcoind as a daemon
* Remove the requirement on txindex
Saves tens of GB.
Also has attempt_send no longer return a list of outputs. That's incompatible
with this and only relevant to old scheduling designs.
* Remove number from Bitcoin SignableTransaction
Monero requires the current block number for decoy selection. Bitcoin doesn't
have a use.
* Ban coinbase transactions
These are burdened by maturity, so it's critically flawed to support them.
This causes the test_send function to fail as its working was premised on
a coinbase output. While it does make an actual output, it had insufficient
funds for the test's expectations due to regtest halving every 150 blocks.
In order to workaround this, the test will invalidate any existing chain,
offering a fresh start.
Also removes test_get_spendables and simplifies test_send.
* Various simplifications
Modifies SpendableOutput further to not require RPC calls at time of sign.
Removes the need to have get_transaction in the RPC.
* Clean prepare_send
* Update the Bitcoin TransactionMachine to output a Transaction
* Bitcoin TransactionMachine simplifications
* Update XOnly key handling
* Use a single sighash cache
* Move tweak_keys
* Remove unnecessary PSBT sets
* Restore removed newlines
* Other newlines
* Replace calculate_weight's custom math with a dummy TX serialize
* Move BTC TX construction code from processor to bitcoin
* Rename transactions.rs to wallet.rs
* Remove unused crate
* Note TODO
* Clean bitcoin signature test
* Make unit test out of BTC FROST signing test
* Final lint
* Remove usage of PartiallySignedTransaction
---------
Co-authored-by: Luke Parker <lukeparker5132@gmail.com>
This still sends a fingerprinting flare up if you send to a subaddress which
needs to be fixed. Despite that, Monero no should no longer fail to scan TXs
from monero-serai regarding additional keys.
Previously it failed becuase we supplied one key as THE key, and n-1 as
additional. Monero expects n for additional.
This does correctly select when to use THE key versus when to use the additional
key when sending. That removes the ability for recipients to fingerprint
monero-serai by receiving to a standard address yet needing to use an additional
key.
* Initial work on an In Inherents pallet
* Add an event for when a batch is executed
* Add a dummy provider for InInstructions
* Add in-instructions to the node
* Add the Serai runtime API to the processor
* Move processor tests around
* Build a subxt Client around Serai
* Successfully get Batch events from Serai
Renamed processor/substrate to processor/serai.
* Much more robust InInstruction pallet
* Implement the workaround from https://github.com/paritytech/subxt/issues/602
* Initial prototype of processor generated InInstructions
* Correct PendingCoins data flow for InInstructions
* Minor lint to in-instructions
* Remove the global Serai connection for a partial re-impl
* Correct ID handling of the processor test
* Workaround the delay in the subscription
* Make an unwrap an if let Some, remove old comments
* Lint the processor toml
* Rebase and update
* Move substrate/in-instructions to substrate/in-instructions/pallet
* Start an in-instructions primitives lib
* Properly update processor to subxt 0.24
Also corrects failures from the rebase.
* in-instructions cargo update
* Implement IsFatalError
* is_inherent -> true
* Rename in-instructions crates and misc cleanup
* Update documentation
* cargo update
* Misc update fixes
* Replace height with block_number
* Update processor src to latest subxt
* Correct pipeline for InInstructions testing
* Remove runtime::AccountId for serai_primitives::NativeAddress
* Rewrite the in-instructions pallet
Complete with respect to the currently written docs.
Drops the custom serializer for just using SCALE.
Makes slight tweaks as relevant.
* Move instructions' InherentDataProvider to a client crate
* Correct doc gen
* Add serde to in-instructions-primitives
* Add in-instructions-primitives to pallet
* Heights -> BlockNumbers
* Get batch pub test loop working
* Update in instructions pallet terminology
Removes the ambiguous Coin for Update.
Removes pending/artificial latency for furture client work.
Also moves to using serai_primitives::Coin.
* Add a BlockNumber primitive
* Belated cargo fmt
* Further document why DifferentBatch isn't fatal
* Correct processor sleeps
* Remove metadata at compile time, add test framework for Serai nodes
* Remove manual RPC client
* Simplify update test
* Improve re-exporting behavior of serai-runtime
It now re-exports all pallets underneath it.
* Add a function to get storage values to the Serai RPC
* Update substrate/ to latest substrate
* Create a dedicated crate for the Serai RPC
* Remove unused dependencies in substrate/
* Remove unused dependencies in coins/
Out of scope for this branch, just minor and path of least resistance.
* Use substrate/serai/client for the Serai RPC lib
It's a bit out of place, since these client folders are intended for the node to
access pallets and so on. This is for end-users to access Serai as a whole.
In that sense, it made more sense as a top level folder, yet that also felt
out of place.
* Move InInstructions test to serai-client for now
* Final cleanup
* Update deny.toml
* Cargo.lock update from merging develop
* Update nightly
Attempt to work around the current CI failure, which is a Rust ICE.
We previously didn't upgrade due to clippy 10134, yet that's been reverted.
* clippy
* clippy
* fmt
* NativeAddress -> SeraiAddress
* Sec fix on non-provided updates and doc fixes
* Add Serai as a Coin
Necessary in order to swap to Serai.
* Add a BlockHash type, used for batch IDs
* Remove origin from InInstruction
Makes InInstructionTarget. Adds RefundableInInstruction with origin.
* Document storage items in in-instructions
* Rename serai/client/tests/serai.rs to updates.rs
It only tested publishing updates and their successful acceptance.
* convert AddressSpec subbaddress to tuple
* add wallet-rpc tests
* fix payment id decryption bug
* run fmt
* fix CI
* use monero-rs wallet-rpc for tests
* update the subaddress index type
* fix wallet-rpc CI
* fix monero-wallet-rpc CI actions
* pull latest monero for CI
* fix pr issues
* detach monero wallet rpc
Co-authored-by: Luke Parker <lukeparker5132@gmail.com>
Not only did we already have multiple booleans in it, yet it theoretically
could expand in the future. Not only is this more explicit, it actually cleans
some existing code.
commit e0a9e8825d6c22c797fb84e26ed6ef10136ca9c2
Author: Luke Parker <lukeparker5132@gmail.com>
Date: Fri Jan 6 04:24:08 2023 -0500
Remove Scanner::address
It either needed to return an Option, panic on misconfiguration, or return a
distinct Scanner type based on burning bug immunity to offer this API properly.
Panicking wouldn't be proper, and the Option<Address> would've been... awkward.
The new register_subaddress function, maintaining the needed functionality,
also provides further clarity on the intended side effect of the previously
present Scanner::address function.
commit 7359360ab2fc8c9255c6f58250c214252ce217a4
Author: Luke Parker <lukeparker5132@gmail.com>
Date: Fri Jan 6 01:35:02 2023 -0500
fmt/clippy from last commit
commit 80d912fc19cd268f3b019a9d9961a48b2c45e828
Author: Luke Parker <lukeparker5132@gmail.com>
Date: Thu Jan 5 19:36:49 2023 -0500
Add Substrate "assets" pallet
While over-engineered for our purposes, it's still usable.
Also cleans the runtime a bit.
commit 2ed2944b6598d75bdc3c995aaf39b717846207de
Author: Luke Parker <lukeparker5132@gmail.com>
Date: Wed Jan 4 23:09:58 2023 -0500
Remove the timestamp pallet
It was needed for contracts, which has since been removed. We now no longer
need it.
commit 7fc1fc2dccecebe1d94cb7b4c00f2b5cb271c87b
Author: Luke Parker <lukeparker5132@gmail.com>
Date: Wed Jan 4 22:52:41 2023 -0500
Initial validator sets pallet (#187)
* Initial work on a Validator Sets pallet
* Update Validator Set docs per current discussions
* Update validator-sets primitives and storage handling
* Add validator set pallets to deny.toml
* Remove Curve from primitives
Since we aren't reusing keys across coins, there's no reason for it to be
on-chain (as previously planned).
* Update documentation on Validator Sets
* Use Twox64Concat instead of Identity
Ensures an even distribution of keys. While xxhash is breakable, these keys
aren't manipulatable by users.
* Add math ops on Amount and define a coin as 1e8
* Add validator-sets to the runtime and remove contracts
Also removes the randomness pallet which was only required by the contracts
runtime.
Does not remove the contracts folder yet so they can still be referred to while
validator-sets is under development. Does remove them from Cargo.toml.
* Add vote function to validator-sets
* Remove contracts folder
* Create an event for the Validator Sets pallet
* Remove old contracts crates from deny.toml
* Remove line from staking branch
* Remove staking from runtime
* Correct VS Config in runtime
* cargo update
* Resolve a few PR comments on terminology
* Create a serai-primitives crate
Move types such as Amount/Coin out of validator-sets. Will be expanded in the
future.
* Fixes for last commit
* Don't reserve set 0
* Further fixes
* Add files meant for last commit
* Remove Staking transfer
commit 3309295911d22177bd68972d138aea2f8658eb5f
Author: Luke Parker <lukeparker5132@gmail.com>
Date: Wed Jan 4 06:17:00 2023 -0500
Reorder coins in README by market cap
commit db5d19cad33ccf067d876b7f5b7cca47c228e2fc
Author: Luke Parker <lukeparker5132@gmail.com>
Date: Wed Jan 4 06:07:58 2023 -0500
Update README
commit 606484d744b1c6cc408382994c77f1def25d3e7d
Author: Luke Parker <lukeparker5132@gmail.com>
Date: Wed Jan 4 03:17:36 2023 -0500
cargo update
commit 3a319b229f
Author: akildemir <aeg_asd@hotmail.com>
Date: Wed Jan 4 16:26:25 2023 +0300
update address public API design
commit d9fa88fa76
Author: akildemir <aeg_asd@hotmail.com>
Date: Mon Jan 2 13:35:06 2023 +0300
fix clippy error
commit cc722e897b
Merge: cafa9b3eeca440
Author: akildemir <aeg_asd@hotmail.com>
Date: Mon Jan 2 11:39:04 2023 +0300
Merge https://github.com/serai-dex/serai into develop
commit cafa9b361e
Author: akildemir <aeg_asd@hotmail.com>
Date: Mon Jan 2 11:38:26 2023 +0300
fix build errors
commit ce5b5f2b37
Merge: f502d6749c4acf
Author: akildemir <aeg_asd@hotmail.com>
Date: Sun Jan 1 15:16:25 2023 +0300
Merge https://github.com/serai-dex/serai into develop
commit f502d67282
Author: akildemir <aeg_asd@hotmail.com>
Date: Thu Dec 22 13:13:09 2022 +0300
fix pr issues
commit 26ffb226d4
Author: akildemir <aeg_asd@hotmail.com>
Date: Thu Dec 22 13:11:43 2022 +0300
remove extraneous rpc call
commit 0e829f8531
Author: akildemir <aeg_asd@hotmail.com>
Date: Thu Dec 15 13:56:53 2022 +0300
add scan tests
commit 5123c7f121
Author: akildemir <aeg_asd@hotmail.com>
Date: Thu Dec 15 13:56:13 2022 +0300
add new address functions & comments
* Standardize the DLEq serialization function naming
They mismatched from the rest of the project.
This commit is technically incomplete as it doesn't update the dkg crate.
* Rewrite DKG encryption to enable per-message decryption without side effects
This isn't technically true as I already know a break in this which I'll
correct for shortly.
Does update documentation to explain the new scheme. Required for blame.
* Add a verifiable system for blame during the FROST DKG
Previously, if sent an invalid key share, the participant would realize that
and could accuse the sender. Without further evidence, either the accuser
or the accused could be guilty. Now, the accuser has a proof the accused is
in the wrong.
Reworks KeyMachine to return BlameMachine. This explicitly acknowledges how
locally complete keys still need group acknowledgement before the protocol
can be complete and provides a way for others to verify blame, even after a
locally successful run.
If any blame is cast, the protocol is no longer considered complete-able
(instead aborting). Further accusations of blame can still be handled however.
Updates documentation on network behavior.
Also starts to remove "OnDrop". We now use Zeroizing for anything which should
be zeroized on drop. This is a lot more piece-meal and reduces clones.
* Tweak Zeroizing and Debug impls
Expands Zeroizing to be more comprehensive.
Also updates Zeroizing<CachedPreprocess([u8; 32])> to
CachedPreprocess(Zeroizing<[u8; 32]>) so zeroizing is the first thing done
and last step before exposing the copy-able [u8; 32].
Removes private keys from Debug.
* Fix a bug where adversaries could claim to be using another user's encryption keys to learn their messages
Mentioned a few commits ago, now fixed.
This wouldn't have affected Serai, which aborts on failure, nor any DKG
currently supported. It's just about ensuring the DKG encryption is robust and
proper.
* Finish moving dleq from ser/deser to write/read
* Add tests for dkg blame
* Add a FROST test for invalid signature shares
* Batch verify encrypted messages' ephemeral keys' PoP
While the previous construction achieved n/2 average detection,
this will run in log2(n). Unfortunately, the need to keep entropy
around (or take in an RNG here) remains.
Technically, non-0-amount outputs can still appear and this considered them
as part of the global 0-amount pool. Now, only outputs which are 0-amount are
counted.
* Remove the explicit included participants from FROST
Now, whoever submits preprocesses becomes the signing set. Better separates
preprocess from sign, at the cost of slightly more annoying integrations
(Monero needs to now independently lagrange/offset its key images).
* Support caching preprocesses
Closes https://github.com/serai-dex/serai/issues/40.
I *could* have added a serialization trait to Algorithm and written a ton of
data to disk, while requiring Algorithm implementors also accept such work.
Instead, I moved preprocess to a seeded RNG (Chacha20) which should be as
secure as the regular RNG. Rebuilding from cache simply loads the previously
used Chacha seed, making the Algorithm oblivious to the fact it's being
rebuilt from a cache. This removes any requirements for it to be modified
while guaranteeing equivalency.
This builds on the last commit which delayed determining the signing set till
post-preprocess acquisition. Unfortunately, that commit did force preprocess
from ThresholdView to ThresholdKeys which had visible effects on Monero.
Serai will actually need delayed set determination for #163, and overall,
it remains better, hence it's inclusion.
* Document FROST preprocess caching
* Update ethereum to new FROST
* Fix bug in Monero offset calculation and update processor