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

simulators/portal/beacon/rpc-compat: add portal network beacon rpc-compat simulator #990

Merged
merged 1 commit into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
Empty file modified .circleci/rust-simulators.sh
100644 → 100755
Empty file.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ workspace
.idea/
# build output
/hive

# build output for rust simulators files
simulators/**/Cargo.lock
simulators/**/target
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.