-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move db and protobuf related code to separate crates
Move `crates/p2p/src/db` to `crates/db`, `crates/p2p/src/wire` to `crates/wire` and then `crates/wire/proto/` out of `wire` to top level `proto`. Also some minor refactor stuff and fixes to make CI happy were applied.
- Loading branch information
1 parent
af5a5da
commit 476bfda
Showing
28 changed files
with
589 additions
and
517 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,42 @@ | ||
[workspace] | ||
members = ["crates/p2p"] | ||
members = ["crates/db", "crates/p2p", "crates/wire"] | ||
|
||
default-members = ["crates/p2p"] | ||
|
||
resolver = "2" | ||
|
||
[workspace.dependencies] | ||
async-trait = "0.1.83" | ||
bitcoin = { version = "0.32.5", features = ["serde"] } | ||
futures = "0.3.31" | ||
libp2p = { version = "0.54.1", features = [ | ||
"noise", | ||
"gossipsub", | ||
"tcp", | ||
"request-response", | ||
"tokio", | ||
"secp256k1", | ||
"macros", | ||
"ping", | ||
"yamux", | ||
"identify", | ||
] } | ||
libp2p-identity = { version = "0.2.10", default-features = false, features = [ | ||
"secp256k1", | ||
"peerid", | ||
"rand", | ||
] } | ||
musig2 = { version = "0.1.0", features = ["serde"] } | ||
prost = "0.13.4" | ||
serde = { version = "1.0.217", features = ["derive"] } | ||
snafu = { version = "0.8.5", default-features = false, features = [ | ||
"rust_1_81", | ||
"backtrace", | ||
"std", | ||
] } | ||
tokio = { version = "1.42.0", default-features = false, features = [ | ||
"macros", | ||
"time", | ||
] } | ||
tokio-util = { version = "0.7.13", default-features = false } | ||
tracing = { version = "0.1.41", default-features = false } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
[package] | ||
name = "strata-p2p-db" | ||
version = "0.1.0" | ||
edition = "2024" | ||
|
||
[dependencies] | ||
async-trait.workspace = true | ||
bitcoin.workspace = true | ||
libp2p-identity.workspace = true | ||
musig2.workspace = true | ||
prost.workspace = true | ||
serde.workspace = true | ||
snafu.workspace = true | ||
|
||
# make this implementation optional | ||
sled = "0.34.7" | ||
# temporaty solution for DB serialization. `ciborium` crate is not working, unfortunatly. | ||
serde_json = "1.0.135" | ||
|
||
[dev-dependencies] | ||
tokio = { version = "1.42.0", features = ["rt", "macros"] } | ||
rand = "0.8.5" | ||
secp256k1 = { version = "0.29.0", features = ["rand"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use serde::{Deserialize, Deserializer, Serializer, de::Error}; | ||
|
||
pub fn serialize<T, S>(value: &T, serializer: S) -> Result<S::Ok, S::Error> | ||
where | ||
T: prost::Message, | ||
S: Serializer, | ||
{ | ||
serializer.serialize_bytes(&value.encode_to_vec()) | ||
} | ||
|
||
pub fn deserialize<'de, T, D>(deserializer: D) -> Result<T, D::Error> | ||
where | ||
D: Deserializer<'de>, | ||
T: prost::Message + Default, | ||
{ | ||
let bytes = Vec::<u8>::deserialize(deserializer)?; | ||
let msg = T::decode(bytes.as_slice()).map_err(Error::custom)?; | ||
|
||
Ok(msg) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,4 @@ | ||
pub mod commands; | ||
pub(crate) mod db; | ||
pub mod events; | ||
pub(crate) mod states; | ||
pub mod swarm; | ||
pub(crate) mod timeouts; | ||
pub mod wire; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.