Commit graph

55 commits

Author SHA1 Message Date
hinto-janai
3ef6a96d04
ci: fix clippy ()
* cargo clippy

* fix

* remove `needless_continue`

* readd `continue`
2025-04-08 20:13:11 +01:00
hinto-janai
d3b7ca3e65
cuprated: RPC handlers ()
* import diffs

* small fixes, hardfork changes

* lints

* hard_fork

* apply diffs

* review fixes

* binaries/cuprated/src/rpc/request: `pub(super)` -> `pub(crate)`

* add `BlockChainContextService`, `on_get_block_hash`

* map `tower::BoxError` to `anyhow::Error`

* get_block

* connection_info

* hard_fork_info

* set_bans

* get_bans

* banned

* flush_transaction_pool

* get_output_histogram

* get_coinbase_tx_sum

* get_version

* get_fee_estimate

* get_alternate_chains

* relay_tx

* response_base: `fn` -> `const`

* get_transaction_pool_backlog

* prune

* calc_pow

* add_aux_pow

* get_tx_ids_loose

* generate_blocks

* get_info

* sync_info

* get_miner_data

* `BlockchainManagerRequest` docs

* docs, `ConnectionInfo`, `AddressType`

* sig docs, remove `HardForks` request

* clean imports

* fix `on_get_block_hash`, `generate_blocks`, `get_block_headers_range`

* fix `get_info`, `banned`

* fix `sync_info`

* fix `get_miner_data`

* initial `add_aux_pow` impl

* fix `calculate_pow`

* add_aux_pow

* `get_output_distribution`

* checkup

* `find_nonce()` + `add_aux_pow` async wrapper

* fixes

* `helper::block_header`

* review fixes

* fixes

* doc fix

* p2p: remove tmp `AddressBookRequest::NextNeededPruningSeed`

* lint/todo fixes

* fix bans

* merge diffs from https://github.com/Cuprate/cuprate/pull/272

* `cuprate_types::rpc`, `from` module for `cuprate_rpc_types`

* `rpc-types` -> `types` pt. 2

* type fixes, move fn to `-helper`

* clippy fix

* rpc: move json-rpc types away from macros

* !!

* move types, fix orphan impl + cyclic dependency

* architecture book

* fix json-rpc handlers

* remove `::<N>`

* fix clippy

* fix type defaults, use `Hex`

* return defaults, hex test

* json_rpc: get_block_template

* `/get_transactions`

* `/is_key_image_spent`

* !!

* `/get_transactions` hex

* most of `/send_raw_transaction`

* `/send_raw_transaction`, `/save_bc`, response_base

* `/peerlist`

* `/get_transaction_pool`

* `/get_transaction_pool_stats`

* finish other draft

* get_blocks_by_height, shared::get_outs

* `/get_o_indexes.bin`

* `/get_output_distribution.bin`

* clippy

* `/get_blocks.bin`

* rpc-interface: add restricted invariant comments

* restricted json-rpc error

* get_output_distribution

* module cleanup

* txpool: all_hashes

* `HexVec`

* fix `get_txid` for `/get_outs`

miner transaction was not accounted for

* fix doc tests

* fix conflict

* json-rpc fixes

* `get_transaction_pool_hashes` fix

* rpc/interface: fix cargo hack

* review fixes

* cargo hack fix

* use `monero_address`

* Update binaries/cuprated/src/rpc/handlers/json_rpc.rs

Co-authored-by: Boog900 <boog900@tutanota.com>

* Update binaries/cuprated/src/rpc/handlers/json_rpc.rs

Co-authored-by: Boog900 <boog900@tutanota.com>

* review fixes

* fix `get_hashes`

* fix `is_key_image_spent`

* fix key image types

* fixes

* fix book

* output timelock fix + `blockchain_context()`

* fix

* fix

* fix

* fix getblocks.bin

* `cuprate_types` doc

* output fix

* fixme

* rct output fix

* fix cast

* clippy

---------

Co-authored-by: Boog900 <boog900@tutanota.com>
2025-04-08 17:09:43 +01:00
1c04634396
P2P: fix deadlock ()
* fix deadlock

* fix ci

* clean up + docs

* fmt

* remove extra tick

* fix typos
2025-03-04 21:36:27 +00:00
Yichi Zhang
4f3d11be1d
Modify wrong code ()
Modify_inconsistency
2025-02-27 15:19:12 +00:00
79e4789e6a
rpc/types 32 bit support ()
* 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>
2025-01-08 03:49:59 +00:00
7b8756fa80
cuprated: P2P protocol request handler ()
* add cuprated skeleton

* fmt and add deny exception

* add main chain batch handler

* add blockchain init

* very rough block manager

* misc changes

* move more config values

* add new tables & types

* add function to fully add an alt block

* resolve current todo!s

* add new requests

* WIP: starting re-orgs

* add last service request

* commit Cargo.lock

* add test

* more docs + cleanup + alt blocks request

* clippy + fmt

* document types

* move tx_fee to helper

* more doc updates

* fmt

* fix imports

* remove config files

* fix merge errors

* fix generated coins

* handle more p2p requests + alt blocks

* clean up handler code

* add function for incoming blocks

* add docs to handler functions

* broadcast new blocks + add commands

* add fluffy block handler

* fix new block handling

* small cleanup

* increase outbound peer count

* fix merge

* clean up the blockchain manger

* add more docs + cleanup imports

* fix typo

* fix doc

* remove unrelated changes

* add `get_objects` handler

* add `get_chain` handler

* add `fluffy_missing_txs` handler

* add `new_fluffy_block` handler

* improve interface globals

* manger -> manager

* enums instead of bools

* move chain service to separate file

* more review fixes

* sort imports + docs

* init dandelion integration

* add dandelion start function

* finish incoming tx handler

* Add tx blob hash table

* Add missing txpool requests

* handle duplicate stem txs

* check txpool on incoming block

* add request to remove tx in new blocks from the pool

* tell the txpool about incoming blocks

* fix merge

* typos

* remove blockchain height from txpool

* fix merge

* fix merge

* handle incoming txs in p2p request handler

* Allow `IncomingTxHandler` to be given later

* add p2p clearnet init

* fix build

* misc changes

* doc updates

* more doc updates

* sort imports

* review changes

* Result -> DbResult

* use `NonZero`

* review fixes

* remove `rust-2024-compatibility` lint
2024-12-03 20:21:05 +00:00
hinto-janai
38541dbfda
workspace: add/fix 1.83 lints ()
* 1.83 `cargo clippy --fix`

* fix type complexity, add `DbResult`

* clippy fix

* redb fix

* Update consensus/context/src/difficulty.rs

Co-authored-by: hinto-janai <hinto.janai@protonmail.com>

---------

Co-authored-by: Boog900 <boog900@tutanota.com>
2024-11-28 19:53:59 +00:00
241088e273
Wire: fix IPv4 Endianness ()
* fix IPv4 Endianness

* fix import order
2024-11-17 20:32:41 +00:00
44981f2b24
CI: add cargo hack ()
* add workflow

* fix errors

* fix workflow

* install dependencies

* fix more errors

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

Co-authored-by: hinto-janai <hinto.janai@protonmail.com>

* fix hack + enable it for cuprate-database

* move hack to main CI

* fix docs

* fix ci formatting

* fix txpool tests

* fix CONTRIBUTING.md formatting

* service -> tower::Service

* review fixes

* review fixes

* fix CI

---------

Co-authored-by: hinto-janai <hinto.janai@protonmail.com>
2024-11-01 20:22:14 +00:00
SyntheticBird
63216aecae
workspace: Defines cuprate members as workspace dependencies ()
Defines cuprate members as workspace dependencies

- Defines cuprate members as workspace dependencies
- Changed all `path` import into `workspace = true`

Co-authored-by: Boog900 <boog900@tutanota.com>
2024-10-24 23:12:30 +01:00
hinto-janai
5eb712f4de
cargo upgrade ()
cargo upgrade

Co-authored-by: Boog900 <boog900@tutanota.com>
2024-09-22 19:34:20 +01:00
hinto-janai
57af45e01d
epee-encoding: enable workspace lints ()
* epee-encoding: enable workspace lints

* fmt

* fixes

* fixes

* fmt
2024-09-20 15:13:55 +01:00
hinto-janai
5588671501
levin: enable workspace lints ()
* levin: enable workspace lints

* use `drop()`

* dep fixes
2024-09-20 15:11:27 +01:00
hinto-janai
e3a918bca5
wire: enable workspace lints ()
* wire: enable workspace lints

* revert match arm formatting
2024-09-18 23:19:32 +01:00
hinto-janai
b9842fcb18
fixed-bytes: enable workspace lints () 2024-09-18 23:12:35 +01:00
hinto-janai
b837d350a4
workspace: add naming convention lints ()
* add lint to {Cargo,clippy}.toml

* `RandomXVM` -> `RandomXVm`

* epee: `TT` -> `T2`
2024-09-02 18:10:45 +01:00
hinto-janai
bec8cc0aa4
helper: add and use cast module ()
* helper: add `cast` module

* fix crates

* spacing
2024-09-02 18:09:52 +01:00
hinto-janai
59adf6dcf8
std::mem::{size,align}_of -> {size,align}_of () 2024-08-10 00:09:25 +01:00
hinto-janai
6820da9848
types: add BlockCompleteEntry ()
* types: add `block_complete_entry.rs`

* net: fix imports

* p2p: fix imports

* turn off default-features

* p2p: fix imports

* Update net/wire/Cargo.toml

Co-authored-by: Boog900 <boog900@tutanota.com>

* wire: re-export types

---------

Co-authored-by: Boog900 <boog900@tutanota.com>
2024-07-16 22:47:50 +01:00
hinto-janai
0910c0a231
rpc: use ByteArrayVec and ContainerAsBlob ()
* fixed-bytes: add `serde`, document feature flags

* fixed-bytes: add derives

* rpc: add `as _` syntax to macro

* rpc: use `ByteArrayVec` and `ContainerAsBlob` for binary types

* fixed-bytes: re-add derives

* rpc-types: dedup default value within macro

* readme: fixed bytes section
2024-07-13 01:26:11 +01:00
hinto-janai
824651c8cf
fixed-bytes: add serde, document feature flags ()
* fixed-bytes: add `serde`, document feature flags

* manual impl `serde::Deserialize`

* add serde tests
2024-07-11 02:00:47 +01:00
d5c8eba1d8
P2P: API Improvements ()
* start handshaker builder

* finish builder

* remove borsh requirement

* fix poll_ready :/

* add more docs to builder

* more docs

* fix clippy

* merge fixes

* fix doc test

* fix imports

* cargo fmt

* split `PeerRequest` and `PeerResponse` enums up.

This splits them both into a protocol and admin enum

* add request handler file

* integrate request handler into connection

* fix docs

* doc updates

* add more docs

* fix docs

* misc changes

* review fixes

* fix merge

* add dummy file

* fix docs

* Update p2p/dandelion-tower/src/router.rs

* fix docs
2024-07-04 21:05:22 +01:00
hinto-janai
4b93dbec4c
workspace: enforce crate/directory naming scheme ()
* rename all directories and crates

* fix all `use`

* fix doc link

* `dandelion/` -> `dandelion-tower/`

* fix epee-encoding test

* fix `json-rpc`

* fix pruning

* crate import fixes

* fix leftover merge conflicts

* fix `epee-encoding`
2024-06-24 02:30:47 +01:00
hinto-janai
ff1172f2ab
epee: make {read,write}_varint public, create write_{bytes,container} ()
* make `{read,write}_varint` public, create `write_{container,bytes}`

* add doc tests to varint functions

* `write_container` -> `write_iterator`

* add `write_{iterator,bytes}` doc test

* fix `write_iterator()` doc
2024-06-22 01:25:21 +01:00
hinto-janai
bef2a2cbd4
epee: unseal trait EpeeValue ()
* unseal `trait EpeeValue`

* fix `container_as_blob.rs`

* clippy

* epee-encoding: remove `sealed`
2024-06-20 23:20:13 +01:00
hinto-janai
59a49b93ab
repo: update license ()
* add MIT license

* update LICENSE.md

* net: remove license files

* fix LICENSE-MIT formatting

use github formatting
2024-05-27 00:39:32 +01:00
00c3692eac
P2p changes ()
* p2p changes

* clippy

* a few more docs

* review comments

* fix peer list bug
2024-05-02 22:58:22 +00:00
93372fa4b5
P2P Address book & Handshake changes ()
* use tokio's delay queue for bans

* document handles

* remove peers from address book when retrieving

* ping inbound peers during handshakes

* support receiving pings during handshakes

* add peer to anchor before reducing whit list

* clippy

* comment handshakes

* typos

* sort `use`

* use `rand::prelude::*`

* review comments

* update macro
2024-03-20 20:58:12 +00:00
159c8a3b48
levin: fragmented messages ()
* levin: fix fragmented messages & use bitflags

* levin: add a method to fragment a message

* levin: add tests for fragmented messages and fix issues

* fix docs

* tests: don't include bytes length

* levin: add support for sending fragmented
/ dummy messages

* fmt

* add fragmented handshake tests.

* fix handshake detection when fragmented
and alt (non-monero) protocol info

* add tracing logs

* remove `already_built`, this was an old way I was thinking of sending raw buckets

* clippy

* clippy 2

* Update net/levin/src/message.rs

Co-authored-by: hinto-janai <hinto.janai@protonmail.com>

* review comments

* add timeout to tests

* Update net/levin/src/header.rs

Co-authored-by: hinto-janai <hinto.janai@protonmail.com>

---------

Co-authored-by: hinto-janai <hinto.janai@protonmail.com>
2024-03-05 01:29:57 +00:00
28aa0b5552
CI: fix deny () 2024-02-29 20:29:11 +00:00
hinto-janai
354ac9c2f6
Add typos + cargo doc CI ()
* ci: add separate `typo` job

* add `typos.toml` for false positives

* fix all typos

* ci: add `cargo doc` step

* fix doc errors

* contributing.md: update passing CI steps

* fix more typos, add exception to `cryptonight/`

* ci: move `cargo doc` step within `ci` job

It needs dependencies.

* ci: add https://github.com/Cuprate/cuprate/pull/63

* test-utils: fix typo

* ci: switch `rustup update` and switch order

* ci: only update rust on unix

* ci: set `RUSTDOCFLAGS` env earlier

* ci: only run `cargo doc` on linux

* ci: remove `bash` on `cargo doc`

* ci: remove `--all-targets`

We now have the target OS's in CI, no need to compile for each.

* contributing.md: update ci steps

* ci: add `--all-targets` back to clippy, build

* update contributing.md
2024-02-15 16:03:04 +00:00
b7df133175
consensus: fix batch handling when we don't have a full list of outputs. ()
* consensus: fix batch handling when we don't have a full list of outputs.

* change `scan_chain` to new API

* clippy

* add a test for calculating multiple difficulties

* fmt

* rx_seed -> rx_vms

* consensus-rules: ring members younger than current block.

* only create rx vms when required.

* fix rx initiation when syncing

* add single block verification (no batch)

* update serai
2024-02-13 00:51:11 +00:00
hinto-janai
630faed263
ci: include macos + windows ()
* ci: install boost, include macos + windows

* cryptonight: fix `MSVC`

* cryptonight: use `flag_if_supported()`

* fix cryptonight builds

* update randomX

* fix rx builds

* add memwipe

* include memwipe.c in build

* spawn monerod in msys2 for windows

* fix last commit

* install dependencies before spawning monerod

* remove --detach

* try another way of spawning monerod

* add /I

* download and spawn monerod as a part of tests

* add download.rs

* extend time for monerod spawn

* move sleep and show monerod output

* fix clippy

* change stdin to pipped

* #[cfg(unix)] on bytes::Buf

* fix macos capitalisation

* remove tar.bz2 on macos expected dir

* remove zip on windows expected dir

* fix todo

* add docs

* fix a couple typos

---------

Co-authored-by: Boog900 <54e72d8a-345f-4599-bd90-c6b9bc7d0ec5@aleeas.com>
Co-authored-by: Boog900 <boog900@tutanota.com>
2024-02-12 13:39:15 +00:00
Boog900
ec4fe9b79d
net: fix network address parsing 2024-01-30 17:53:03 +00:00
Boog900
83b59c557c
net: use epee_encoding instead of monero-epee-bin-serde
This gives us more control than what serde provides. This
PR also moves to use `Bytes` where possible to allow
zero-copy parsing of network messages.
2024-01-30 16:09:54 +00:00
Boog900
2b65be4b18
net: add epee-encoding and fixed-bytes 2024-01-29 22:44:59 +00:00
Boog900
ed598e374e
remove empty cuprate bin and common 2024-01-22 01:56:34 +00:00
Boog900
b14e740d2d
monero-wire: fix some message decoding 2024-01-17 16:31:57 +00:00
Boog900
0cc2acc816
monero-p2p: tell client message was sent after sending message.
Otherwise, the message might not be sent
2024-01-13 15:56:22 +00:00
Boog900
f7149863ae
levin: don't error when there isn't enough capacity 2024-01-13 14:41:19 +00:00
Boog900
a0b9280801
fix message requesting in Connection 2024-01-13 13:22:34 +00:00
8557073c15
p2p changes ()
* start re-working p2p to work with change monero-wire

* start re-working p2p to work with change monero-wire

adds back some changes from 

* change the peer module to use the new API + fix a couple bugs

* remove peer set for now

* add try_from/from conversion between `Message` and
`Request`/`Response`

* Allow specifying other parameters in levin-cuprate

* add new `LevinCommand` enum and clean up monero-wire message de/encoding

* fix issues with merge

* start splitting up p2p crate into smaller crates.

* add monerod action from serai to test network code

* remove tracing in tests
2023-11-30 18:09:05 +00:00
Boog900
3a52b346e1
add tests to context sub-services + fix issues in other tests
+ fmt + clippy.
2023-10-29 00:39:58 +01:00
Boog900
2033a2d16c
add rules for blocks
TODO: the tests need re-ordering they are just all chucked in at the moment.
2023-10-24 23:02:19 +01:00
Boog900
21f1448343
add more config options for the verifier 2023-10-15 20:35:33 +01:00
Boog900
bfbafa4ed5
change epee-encoding to monero-epee-bin-serde 2023-10-09 21:10:16 +01:00
Boog900
20f6af7951
use get_blocks_by_height.bin in RPC 2023-10-05 17:54:19 +01:00
Boog900
88b646c5a3
add back monero-epee-bin-serde
I am now a maintainer of monero-rs, so I can keep this maintained and not using serde was annoying.
2023-10-05 14:24:42 +01:00
Boog900
ab3c496bbd
add difficulty calculations 2023-09-06 15:54:49 +01:00
Boog900
477d9e42f3
change monero-wire to use epee-encoding ()
* change monero-wire to use epee-encoding

* Add back unified `Message` enum

* Run clippy & fmt

* add back default val for top_version
2023-07-17 18:43:34 +01:00