Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ff5086b
p2p: tor module
ardocrat Oct 17, 2026
b5d78cc
config: remove unused function
ardocrat Oct 17, 2026
67ab9ae
config: optional timeouts, min circuit timeout
ardocrat Oct 23, 2026
8f57c3d
config: use data dir
ardocrat Oct 27, 2026
a9e2b97
tor: single entry point for process and integrated
ardocrat Oct 27, 2026
f736060
tor: do not store service keys at state
ardocrat Oct 28, 2026
086fc57
tor: remove arti version mention
ardocrat Oct 28, 2026
b85eb30
tor: fix socks comment
ardocrat Oct 28, 2026
fd40f18
build: optional tor module
ardocrat Oct 28, 2026
2c6ba61
tor: warn when use proxy and integrated
ardocrat Oct 28, 2026
43c01e9
tor: do not panic at process on bad path provided
ardocrat Oct 28, 2026
8f37408
tor: pass body and headers to post request
ardocrat Oct 28, 2026
1970729
tor: return status code and body on possiblesent error
ardocrat Oct 28, 2026
6760535
arti: do not use Ephemeral key storage
ardocrat Oct 30, 2026
605673d
tor: optimize process struct
ardocrat Oct 30, 2026
384b41b
tor: service status and logging
ardocrat Oct 31, 2026
77656de
fix: set actual status for running arti service
ardocrat Oct 31, 2026
7083f42
fix: do not spam with status log
ardocrat Oct 31, 2026
8d0a01f
tor: provide service status
ardocrat Oct 31, 2026
b8c3e5a
tor: http client
ardocrat Nov 3, 2026
0284f75
build: fix clippy warnings
ardocrat Nov 3, 2026
3087043
tor: do not expand tor process
ardocrat Nov 4, 2026
3336742
fix: start tor dir check
ardocrat Nov 4, 2026
0e4c3a7
fix: client proxy scheme
ardocrat Nov 4, 2026
fafd72d
fix: tor process struct visibility, remove unused fields
ardocrat Nov 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4,428 changes: 4,284 additions & 144 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions config/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ impl From<io::Error> for ConfigError {
}
}

/// Going to hold all of the various configuration types
/// Going to hold all the various configuration types
/// separately for now, then put them together as a single
/// ServerConfig object afterwards. This is to flatten
/// ServerConfig object afterward. This is to flatten
/// out the configuration file into logical sections,
/// as they tend to be quite nested in the code
/// Most structs optional, as they may or may not
Expand All @@ -85,7 +85,7 @@ pub struct GlobalConfig {
/// Keeping an 'inner' structure here, as the top
/// level GlobalConfigContainer options might want to keep
/// internal state that we don't necessarily
/// want serialised or deserialised
/// want serialized or deserialized
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
pub struct ConfigMembers {
/// Config file version (None == version 1)
Expand Down
4 changes: 1 addition & 3 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ byteorder = "1"
croaring = "1.0.1"
enum_primitive = "0.1"
lazy_static = "1"
lru-cache = "0.1"
num = "0.2"
num-bigint = "0.2"
rand = "0.6"
serde = "1"
serde_derive = "1"
Expand All @@ -25,7 +23,7 @@ thiserror = "1"
log = "0.4"
chrono = { version = "0.4.11", features = ["serde"] }
zeroize = { version = "1.1", features =["zeroize_derive"] }
bytes = "0.5"
bytes = "1"

keychain = { package = "grin_keychain", path = "../keychain", version = "5.5.2" }
util = { package = "grin_util", path = "../util", version = "5.5.2" }
Expand Down
39 changes: 35 additions & 4 deletions p2p/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,46 @@ serde_derive = "1"
tempfile = "3.1"
log = "0.4"
chrono = { version = "0.4.11", features = ["serde"] }
bytes = "0.5"
bytes = "1"

# Tor related deps
arti-client = { version = "0.43.0", features = ["static", "pt-client", "onion-service-service", "onion-service-client", "ephemeral-keystore"], optional = true }
tor-rtcompat = { version = "0.43.0", features = ["static"], optional = true }
fs-mistrust = { version = "0.14.2", optional = true }
fslock-guard = { version = "0.8", optional = true }
tor-hsservice = { version = "0.43.0", optional = true }
tor-hsrproxy = { version = "0.43.0", optional = true }
tor-keymgr = { version = "0.43.0", optional = true }
tor-llcrypto = { version = "0.43.0", optional = true }
tor-hscrypto = { version = "0.43.0", optional = true }
sha2 = { version = "0.10.8", optional = true }
hyper = { version = "1.10.1", features = ["http1", "client"], optional = true }
hyper-util = { version = "0.1.20", features = ["tokio", "http1", "client-legacy"], optional = true }
hyper-socks2 = { version = "0.9.1", features = ["tls"], optional = true }
hyper-tls = { version = "0.6.0", optional = true }
http-body-util = { version = "0.1.3", optional = true }
ed25519-dalek = { version = "2", optional = true }
regex = { version = "1.12.4", optional = true }
sysinfo = { version = "0.29", optional = true }
timer = { version = "0.2", optional = true }
thiserror = { version = "2", optional = true }
data-encoding = { version = "2", optional = true }
sha3 = { version = "0.8", optional = true }
lazy_static = { version = "1.5.0", optional = true }
base64 = { version = "0.12.0", optional = true }
url = { version = "2.1", optional = true }
serde_json = { version = "1", optional = true }
futures = { version = "0.3", optional = true }
tokio = { version = "1.52.3", features = ["full"], optional = true }
tracing = { version = "0.1", features = ["log"], optional = true }

grin_core = { path = "../core", version = "5.5.2" }
grin_store = { path = "../store", version = "5.5.2" }
grin_util = { path = "../util", version = "5.5.2" }
grin_chain = { path = "../chain", version = "5.5.2" }

[dev-dependencies]
grin_pool = { path = "../pool", version = "5.5.2" }

[build-dependencies]
built = { version = "0.8.0", features = ["git2"]}

[features]
tor = ["arti-client", "tor-rtcompat", "fs-mistrust", "fslock-guard", "tor-hsservice", "tor-hsrproxy", "tor-keymgr", "tor-llcrypto", "tor-hscrypto", "sha2", "hyper", "hyper-util", "hyper-socks2", "hyper-tls", "http-body-util", "ed25519-dalek", "regex", "sysinfo", "timer", "thiserror", "data-encoding", "sha3", "lazy_static", "base64", "url", "serde_json", "futures", "tokio", "tracing"]
9 changes: 5 additions & 4 deletions p2p/src/codec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,17 @@
//! forces us to go through some additional gymnastic to loop over the async
//! stream and make sure we get the right number of bytes out.

use crate::core::global::header_size_bytes;
use crate::core::ser::{BufReader, ProtocolVersion, Readable};
use crate::grin::global::header_size_bytes;
use crate::grin::ser::{BufReader, ProtocolVersion, Readable};
use crate::msg::{Message, MsgHeader, MsgHeaderWrapper, Type};
use crate::types::{AttachmentMeta, AttachmentUpdate, Error};
use crate::{
core::core::block::{BlockHeader, UntrustedBlockHeader},
grin::core::block::{BlockHeader, UntrustedBlockHeader},
msg::HeadersData,
};

use crate::grin::ser::Reader;
use bytes::{Buf, BufMut, Bytes, BytesMut};
use core::ser::Reader;
use std::cmp::min;
use std::io::Read;
use std::mem;
Expand Down
2 changes: 1 addition & 1 deletion p2p/src/conn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
//! stream and make sure we get the right number of bytes out.

use crate::codec::{Codec, BODY_IO_TIMEOUT};
use crate::core::ser::ProtocolVersion;
use crate::grin::ser::ProtocolVersion;
use crate::msg::{write_message, Consumed, Message, Msg};
use crate::types::Error;
use crate::util::{RateCounter, RwLock};
Expand Down
6 changes: 3 additions & 3 deletions p2p/src/handshake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
// limitations under the License.

use crate::conn::Tracker;
use crate::core::core::hash::Hash;
use crate::core::pow::Difficulty;
use crate::core::ser::ProtocolVersion;
use crate::grin::core::hash::Hash;
use crate::grin::pow::Difficulty;
use crate::grin::ser::ProtocolVersion;
use crate::msg::{read_message, user_agent, write_message, Hand, Msg, Shake, Type};
use crate::peer::Peer;
use crate::types::{
Expand Down
4 changes: 3 additions & 1 deletion p2p/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ extern crate bitflags;
extern crate enum_primitive;

#[macro_use]
extern crate grin_core as core;
extern crate grin_core as grin;
use grin_chain as chain;
use grin_util as util;

Expand All @@ -45,6 +45,8 @@ mod peers;
mod protocol;
mod serv;
pub mod store;
#[cfg(feature = "tor")]
pub mod tor;
pub mod types;

pub use crate::conn::SEND_CHANNEL_CAP;
Expand Down
12 changes: 6 additions & 6 deletions p2p/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@

use crate::chain::txhashset::BitmapSegment;
use crate::conn::Tracker;
use crate::core::core::hash::Hash;
use crate::core::core::transaction::{OutputIdentifier, TxKernel};
use crate::core::core::{
use crate::grin::core::hash::Hash;
use crate::grin::core::transaction::{OutputIdentifier, TxKernel};
use crate::grin::core::{
BlockHeader, Segment, SegmentIdentifier, Transaction, UntrustedBlock, UntrustedBlockHeader,
UntrustedCompactBlock,
};
use crate::core::pow::Difficulty;
use crate::core::ser::{
use crate::grin::pow::Difficulty;
use crate::grin::ser::{
self, DeserializationMode, ProtocolVersion, Readable, Reader, StreamingReader, Writeable,
Writer,
};
use crate::core::{consensus, global};
use crate::grin::{consensus, global};
use crate::types::{
AttachmentMeta, AttachmentUpdate, Capabilities, Error, PeerAddr, ReasonForBan,
MAX_BLOCK_HEADERS, MAX_LOCATORS, MAX_PEER_ADDRS,
Expand Down
10 changes: 5 additions & 5 deletions p2p/src/peer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ use std::sync::Arc;
use crate::chain;
use crate::chain::txhashset::BitmapChunk;
use crate::conn;
use crate::core::core::hash::{Hash, Hashed};
use crate::core::core::{OutputIdentifier, Segment, SegmentIdentifier, TxKernel};
use crate::core::pow::Difficulty;
use crate::core::ser::Writeable;
use crate::core::{core, global};
use crate::grin::core::hash::{Hash, Hashed};
use crate::grin::core::{OutputIdentifier, Segment, SegmentIdentifier, TxKernel};
use crate::grin::pow::Difficulty;
use crate::grin::ser::Writeable;
use crate::grin::{core, global};
use crate::handshake::Handshake;
use crate::msg::{
self, BanReason, GetPeerAddrs, Locator, Msg, Ping, SegmentRequest, TxHashSetRequest, Type,
Expand Down
10 changes: 5 additions & 5 deletions p2p/src/peers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ use rand::prelude::*;

use crate::chain;
use crate::chain::txhashset::BitmapChunk;
use crate::core::core;
use crate::core::core::hash::{Hash, Hashed};
use crate::core::core::{OutputIdentifier, Segment, SegmentIdentifier, TxKernel};
use crate::core::global;
use crate::core::pow::Difficulty;
use crate::grin::core;
use crate::grin::core::hash::{Hash, Hashed};
use crate::grin::core::{OutputIdentifier, Segment, SegmentIdentifier, TxKernel};
use crate::grin::global;
use crate::grin::pow::Difficulty;
use crate::peer::Peer;
use crate::store::{PeerData, PeerStore, State};
use crate::types::{
Expand Down
10 changes: 5 additions & 5 deletions p2p/src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

use crate::chain;
use crate::conn::MessageHandler;
use crate::core::core::{hash::Hashed, CompactBlock};
use crate::grin::core::{hash::Hashed, CompactBlock};

use crate::msg::{
Consumed, HeaderSegment, Headers, Message, Msg, OutputBitmapSegmentResponse,
Expand Down Expand Up @@ -468,10 +468,10 @@ impl MessageHandler for Protocol {
mod tests {
use super::*;
use crate::conn::Tracker;
use crate::core::core::SegmentIdentifier;
use crate::core::global;
use crate::core::pow::Difficulty;
use crate::core::ser::ProtocolVersion;
use crate::grin::core::SegmentIdentifier;
use crate::grin::global;
use crate::grin::pow::Difficulty;
use crate::grin::ser::ProtocolVersion;
use crate::msg::{read_message, write_message};
use crate::serv::DummyAdapter;
use crate::types::{
Expand Down
10 changes: 5 additions & 5 deletions p2p/src/serv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ use std::time::Duration;

use crate::chain;
use crate::chain::txhashset::BitmapChunk;
use crate::core::core;
use crate::core::core::hash::Hash;
use crate::core::core::{OutputIdentifier, Segment, SegmentIdentifier, TxKernel};
use crate::core::global;
use crate::core::pow::Difficulty;
use crate::grin::core;
use crate::grin::core::hash::Hash;
use crate::grin::core::{OutputIdentifier, Segment, SegmentIdentifier, TxKernel};
use crate::grin::global;
use crate::grin::pow::Difficulty;
use crate::handshake::Handshake;
use crate::msg::PeerAddrs;
use crate::peer::Peer;
Expand Down
2 changes: 1 addition & 1 deletion p2p/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use chrono::Utc;
use num::FromPrimitive;
use rand::prelude::*;

use crate::core::ser::{self, DeserializationMode, Readable, Reader, Writeable, Writer};
use crate::grin::ser::{self, DeserializationMode, Readable, Reader, Writeable, Writer};
use crate::types::{is_private_ip, Capabilities, PeerAddr, ReasonForBan};
use grin_store::{self, option_to_not_found, Error};

Expand Down
Loading