Skip to content

Commit

Permalink
simulators/portal/beacon/rpc-compat: add portal network beacon rpc-co…
Browse files Browse the repository at this point in the history
…mpat simulator (#990)
  • Loading branch information
KolbyML authored Feb 5, 2024
1 parent 7417cdf commit 1f76b2d
Show file tree
Hide file tree
Showing 4 changed files with 677 additions and 0 deletions.
14 changes: 14 additions & 0 deletions simulators/portal/beacon/rpc-compat/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[package]
name = "rpc-compat"
version = "0.1.0"
authors = ["Ognyan Genev <[email protected]>", "Kolby ML (Moroz Liebl) <[email protected]>"]
edition = "2021"

[dependencies]
ethportal-api = { git = "https://github.com/ethereum/trin", rev = "1829841efca273844be93adf53ab84c2d1a020ed" }
hivesim = { git = "https://github.com/ethereum/portal-hive", rev = "8ff1e3d3c941dd00d56dacd777a5dfb71edf402f" }
futures = "0.3.25"
serde_json = "1.0.87"
tracing = "0.1.37"
tracing-subscriber = "0.3.16"
tokio = { version = "1", features = ["full"] }
26 changes: 26 additions & 0 deletions simulators/portal/beacon/rpc-compat/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM rust:1.71.1 AS builder

# create a new empty shell project
RUN USER=root cargo new --bin rpc-compat
WORKDIR /rpc-compat

RUN apt-get update && apt-get install clang -y

# copy over manifests and source to build image
COPY Cargo.toml ./Cargo.toml
COPY src ./src

# build for release
RUN cargo build --release

# final base
FROM ubuntu:22.04

RUN apt update && apt install wget -y

# copy build artifacts from build stage
COPY --from=builder /rpc-compat/target/release/rpc-compat .

ENV RUST_LOG=debug

ENTRYPOINT ["./rpc-compat"]
2 changes: 2 additions & 0 deletions simulators/portal/beacon/rpc-compat/src/constants.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub const HIVE_PORTAL_NETWORKS_SELECTED: &str = "HIVE_PORTAL_NETWORKS_SELECTED";
pub const BEACON_STRING: &str = "beacon";
635 changes: 635 additions & 0 deletions simulators/portal/beacon/rpc-compat/src/main.rs

Large diffs are not rendered by default.

0 comments on commit 1f76b2d

Please sign in to comment.