In `workspace`:
- New dependencies: `arti_client`, `Cuprate/tokio-socks.git`, `tor-cell`, `tor-config-path`, `tor-hsservice`, `tor-persist`, `tor-proto`, `tor-rtcompat` (yes nothing was exported).
- In `deny.toml`, whitelisted `Unlicense` license for `arti_client`.
In `cuprate-p2p-transport`:
- Implemented `Transport<ClearNet>` and `Transport<Tor>` for `Arti`. New `ArtiClientConfig`, `ArtiServerConfig` configuration. New `OnionListener` for accepting inbound connections from arti's generated onion service.
- Implemented `Transport<Tor>` for `Daemon`. New `DaemonClientConfig`, `DaemonServerConfig` configuration. New `DaemonInboundStream` listening for incoming TCP connections from the tor daemon.
- `DisabledListener` as a polyfill for transports with inbound disabled, such as `Transport<ClearNet> for Arti` and in the future `Transport<ClearNet> for Socks5`.
In `cuprate-p2p-core`:
- Removed `Default` and `Debug` bound from `Transport::ClientConfig` and `Transport::ServerConfig`.
- Removed `Clone` bound from `Transport::ServerConfig`.
In `cuprate-p2p`:
- Changed some function visibility to `pub(super)` instead of `pub`.
In `cuprate-wire`:
- Added `borsh` dependency and `BorshSerialize` and `BorshDeserialize` derived implementation to `OnionAddr` for `BorshNetworkZone` requirement in address book.
In `cuprated`:
- New `tor` module containing the initialization of Arti, config helpers and context structure `TorContext` to pass down to p2p initialization function and other helpers.
- New `config/tor` module containing the `[tor]` configuration table. It define tor daemon related variables, as well as arti settings.
- Added `enable_inbound` field to `ClearNetConfig` to disable incoming listener by default.
- Added `proxy` field to `ClearNetConfig` for enabling clearnet over arti and in the future proxy urls.
- Added `TorNetConfig` for setting `Tor` network zone parameters such as listening ports, enabling arti inbound server, or setting an anonymous inbound onion address from an external daemon.
- Modified `initialize_zones_p2p` to now start Tor network zone and use the correct transport depending on user configuration.
- In `txpool/*`, generalized `DiffuseService`, `OutboundPeerStream` and `ConcreteDandelionRouter` for `Z: NetworkZone`. Created a new `MainDandelionRouter` service that will route local txs to a Tor router instead of clearnet if available. Adapted initialization to the changes.
---------
Co-authored-by: Boog900 <54e72d8a-345f-4599-bd90-c6b9bc7d0ec5@aleeas.com>
* Define Tor Zone, add onion addressing, extend AddressBook, adapt `handle_timed_sync_request`, changes in cuprated + some cleanup
In `cuprated`:
- Added `Z: NetworkZone` as a generic requirement for `address_book_config`. Now takes the optional node address in argument.
- Added `tor_net_seed_nodes` fn for obtaining tor seed nodes.
- Added `CrossNetworkInternalPeerId::Tor(_)` variant and `From<InternalPeerId<OnionAddr>>`
In `cuprate-wire`:
- Added `src/network_address/onion_addr.rs` implementing `OnionAddr` type used by `Tor` network zone.
- Implemented parsing, formatting, conversion and validation of `OnionAddr`.
- Implemented 2 validation tests and 2 parsing tests for `OnionAddr`.
- Documented and cleaned up `src/network_address/epee_builder.rs`.
- Changed `u8` `type` field of `TaggedNetworkAddress` to `AddressType` enum equivalent to monerod's `address_type`.
- Added additional `host` and `port` fields to `AllFieldedNetworkAddress` collection type.
- Added `NetworkAddress:Tor` variant and added conversion to related functions.
In `cuprate-address-book`:
- Added `our_own_addr: Z::Addr` field to AddressBookConfig. This adds a `Z: NetworkZone` requirement to `AddressBookConfig`.
- Adapted code to the new generic requirement.
- Implemented handling of new `AddressBookRequest::OwnAddress` for querying the node self specified address for the zone.
In `cuprate-p2p`:
- If `Z::BROADCAST_OUR_OWN_ADDR` = `true`, `handle_timed_sync_request` will insert the node's address to the peerlist being sent.
In `cuprate-p2p-core`:
- Removed `#[async_trait::async_trait]` attribute to `impl NetworkZone for *`.
- Added `AddressBookRequest::OwnAddress` and `AddressBookResponse::OwnAddress(Option<Z::Addr>)`.
- Defined new `Tor` `NetworkZone`
* fmt
* fix typo and fmt
* final edits?
* fix test
* forgor
Abstract TCP methods under the Transport Trait.
In workspace:
- Added a new `cuprate-p2p-transport` crate that will later welcome
complex or crate dependent transport implementations. (Arti for example.)
In `cuprate-p2p-core`:
- Implemented a new Transport trait that abstract methods to listen
for or connect to other peers over a NetworkZone Z.
- Reduced `NetworkZone` trait accordingly.
- Added a new `BROADCAST_OWN_ADDR` to `NetworkZone` for anonymized
networks.
- Implemented `Tcp` transport for `ClearNet`.
- Implemented `Dummy` transport for placeholder/testing purposes
- Adapted definition of P2P components to the new `Transport` trait.
- Changed original `InBoundStream` implementation to support two
different but optional listeners (IPv4/IPv6)
In `p2p-core/tests`:
- Implemented `FragTcp` for fragmented message testing
In `cuprated`:
- Added `p2p.enable_inbound_v6` and `listen_on_v6` config field.
- Added `From<&ClearNetConfig>` for `TransportConfig<ClearNet, Tcp>`.
- Abstracted original `start_clearnet_p2p` to `start_zone_p2p` with a
given `NetworkZone` and `Transport`.
- Zone/NetworkInterface<Z> P2P initialization has been moved to `cuprated::p2p` in
`initialize_zones_p2p` fn.
- Defined `NetworkInterfaces` collection (useless at the moment).
* add specific method for context
* add new statemachine for tx verification
* fix consensus crates build
* working builds
* fix CI
* add docs
* fix CI
* fix docs
* fix clippy
* cleanup
* add docs to `blockchain_context`
* fix doc tests
* add output cache
* new monero-serai
* todo
* todo
* Revert "new monero-serai"
This reverts commit fe3f6acc676fe59e794d5f92f07f76445db35199.
* use indexmap to request outputs
* clean up
* fix typos
* fix CI
* fix cargo hack
* fix reorgs
* check if a block is already present before adding it to the alt block cache
* fmt
* update to new monero oxide API
* fmt & fix cache
* update config values
* fix tests
* add fast sync
* fix start_height check
* disable kill switch for now
* add fast sync config options
* add docs
* wait for all blocks to download before starting the syncer again.
* fix permit
* typo
* fix import order
* fmt
* add docs + order imports
* fix clippy
* review fixes
* rename top -> stop
* add specific method for context
* add new statemachine for tx verification
* fix consensus crates build
* working builds
* fix CI
* add docs
* fix CI
* fix docs
* fix clippy
* cleanup
* add docs to `blockchain_context`
* fix doc tests
* add output cache
* new monero-serai
* todo
* todo
* Revert "new monero-serai"
This reverts commit fe3f6acc676fe59e794d5f92f07f76445db35199.
* use indexmap to request outputs
* clean up
* fix typos
* fix CI
* fix cargo hack
* fix reorgs
* check if a block is already present before adding it to the alt block cache
* fmt
* update to new monero oxide API
* fmt & fix cache
* update config values
* fix tests
* fix no-std builds
* rpc/types 32 bit support
* fix docs
* add 32 bit check to CI
* remove `cuprate-types`
* add comments to CI
* Apply suggestions from code review
Co-authored-by: hinto-janai <hinto.janai@protonmail.com>
---------
Co-authored-by: hinto-janai <hinto.janai@protonmail.com>
Implements P2P Bucket data structure
This commit implements a "Bucket" data structure that is a collection
of data that discriminates its items into "buckets" (vector of size N)
following a defined function.
- Implements Bucket data structure and Bucketable trait
- Implements Bucketable for Ipv4Addr
- Added the crate to the workspace dependencies
- Added arrayvec as a dependency
* removed FORCE_USE_HEAP to from c code
* removed unused headers
* simplifying C code to better understand it
* more c code simplifications
* removed conditional code for the v4 register size
* got one version of keccak working
* not so important hash_process unwound
* got keccak working using the sha3 lib
* hash state unions created
* slow hash through VARIANT1_PORTABLE_INIT is working
* variant 2 init working
* ported version of random_math_init compiling, but not yet passing tests
* fixed hash algorithm, tests working
* formatting
* more macro reduction
* monero AES working in Rust
* fixed AES key expansion expected key size
* first 75% of slow hash converted and working correctly
* adjusted key format for aesb_single_round
* converted some macros to functions
* variant2_integer_math working with test cases
* broke sqrt out of variant2_integer_math for code coverage
* variant2_portable_shuffle_add working with unit tests
* added skein and jh hashes
* 524287 iteration loop producing correct results
* all tests working in Rust
* subarray macros added
* aes simplifications
* code cleanups
* code cleanups part 2
* removed unused blake C code as prep for port to rust
* original blake algorithm in pure rust is working
* converted macro in compress to a lamda
* added module documentation for blake256
* Gave Blake256 a Digest trait
* adding more documentation
* more documentation and cleanup
* more slow hash tests
* removed C code
* misc refactoring
* fix
* lint fix
* additional linting
* downgraded deps to latest stable versions
* made thiserror a workspace dep
* removed commented dead code
* lint fixes
* fixed lint issues in test code
* limited util macro scopes to the crate
* Reformatted dependencies using:
group_imports = "StdExternalCrate"
reorder_modules = true
reorder_impl_items = true
imports_granularity = "crate"
* converted util macros to inline functions
* hex dep comes from workspace
Co-authored-by: hinto-janai <hinto.janai@protonmail.com>
* panic subarray tests
Co-authored-by: hinto-janai <hinto.janai@protonmail.com>
* updates to doc comments
* removes extra parens in hash_v4.rs
Co-authored-by: hinto-janai <hinto.janai@protonmail.com>
* early return to remove indentation in hash_v2.rs
Co-authored-by: hinto-janai <hinto.janai@protonmail.com>
* gropuing expect annotations in hash_v2.rs
Co-authored-by: hinto-janai <hinto.janai@protonmail.com>
* use matches macro to simplify code hash_v4.rs
Co-authored-by: hinto-janai <hinto.janai@protonmail.com>
* remove extra paren in hash_v4.rs
Co-authored-by: hinto-janai <hinto.janai@protonmail.com>
* eary return to remove indentation in hash_v2.rs
Co-authored-by: hinto-janai <hinto.janai@protonmail.com>
* minor comment fixes
* early loop continue to remove indentation in hash_v4.rs
Co-authored-by: hinto-janai <hinto.janai@protonmail.com>
* convert non-capturing llamda to fn in hash_v2.rs
Co-authored-by: hinto-janai <hinto.janai@protonmail.com>
* another lamda to fn conversion in hash_v2.rs
Co-authored-by: hinto-janai <hinto.janai@protonmail.com>
* llamda to fn conversion in cnaes.rs
Co-authored-by: hinto-janai <hinto.janai@protonmail.com>
* 2nd llamda to fn conversion in cnaes.rs
Co-authored-by: hinto-janai <hinto.janai@protonmail.com>
* test lamdas in lib.rs are now functions
* round_fwd optimized
* added myself as an author
* fixed place that needed wrapping_add
* clippy allow->expect change needed after merging master
* moving state to u128
* round_fwd changes sped up fuzzer by 10%
* 1st working version using u128 for long state
* text converted to u128 array
* removed LongState union
* simplified long_state's initialization
* aes round keys now use u128
* CRYPTONIGHT_SBOX is now u32 instead of u8
* cleaner hash_v4 loop unrolling semantics (same peformance)
* switched to a better maintained loop unrolling macro
* remove peer sync service
* change `p2p` to not use the peer sync service
* fmt & clippy
* doc updates
* review fixes
* add a little more detail to comment