Skip to content

Commit

Permalink
Network refactor (#98)
Browse files Browse the repository at this point in the history
* Apply code review suggestions from #97
* Transport refactor
* Feature flags for different actors
* Add peer_id to WorkerLogs, update rust version
* Ensure message signing
* Make libp2p metrics static
* Worker adjustments
* Fix logs_collected and dockerfile
* Revert keypair encoding change (not backwards compatible)
* Fix Wrapped::poll() + some trace logs
* Fix backwards compatibility issues
* Fix legacy messages
* Fix handling legacy workers in scheduler
* Add missing function in gateway
* Legacy gateway logs handling
* Observer actor
  • Loading branch information
Wiezzel authored May 8, 2024
1 parent 3075211 commit 16acbbf
Show file tree
Hide file tree
Showing 38 changed files with 4,168 additions and 1,372 deletions.
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

0 comments on commit 16acbbf

Please sign in to comment.