Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Network refactor #98

Merged
merged 16 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
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
174 changes: 167 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[workspace]
members = ["transport"]
members = ["messages", "transport"]
resolver = "2"
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
FROM --platform=$BUILDPLATFORM lukemathwalker/cargo-chef:0.1.62-rust-1.75-slim-bookworm AS chef
FROM --platform=$BUILDPLATFORM lukemathwalker/cargo-chef:0.1.66-rust-1.78-slim-bookworm AS chef
WORKDIR /app

FROM --platform=$BUILDPLATFORM chef AS planner

COPY Cargo.toml .
COPY Cargo.lock .
COPY messages ./messages
COPY transport ./transport

RUN cargo chef prepare --recipe-path recipe.json
Expand Down
20 changes: 20 additions & 0 deletions messages/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[package]
name = "subsquid-messages"
version = "0.2.0"
edition = "2021"

[features]
signatures = ["libp2p"]

[dependencies]
anyhow = "1"
hex = { version = "0.4", features = ["serde"] }
prost = "0.12"
semver = { version = "1", optional = true }
serde = { version = "1", features = ["derive"] }
sha3 = "0.10"

libp2p = { git = "https://github.com/Wiezzel/rust-libp2p.git", rev = "299b66e4", optional = true }

[build-dependencies]
prost-build = "0.12"
18 changes: 18 additions & 0 deletions messages/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#[rustfmt::skip]
fn main() -> std::io::Result<()> {
println!("cargo:rerun-if-changed=proto/messages.proto");
prost_build::Config::new()
.type_attribute(".", "#[derive(Eq, serde::Serialize, serde::Deserialize)]")
.type_attribute("messages.Range", "#[derive(Copy, Ord, PartialOrd)]")
.skip_debug(["messages.OkResult"])
.field_attribute("messages.SizeAndHash.sha3_256", "#[serde(with = \"hex\")]")
.field_attribute("messages.QueryExecuted.query_hash","#[serde(with = \"hex\")]")
.field_attribute("messages.QuerySubmitted.query_hash","#[serde(with = \"hex\")]")
.field_attribute("messages.Pong.ping_hash", "#[serde(with = \"hex\")]")
.field_attribute("messages.Ping.signature","#[serde(with = \"hex\")]")
.field_attribute("messages.Query.signature", "#[serde(with = \"hex\")]")
.field_attribute("messages.QueryExecuted.signature", "#[serde(with = \"hex\")]")
.protoc_arg("--experimental_allow_proto3_optional")
.compile_protos(&["proto/messages.proto"], &["proto/"])?;
Ok(())
}
Loading