Skip to content
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
14 changes: 14 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,19 @@ jobs:
- name: Run cargo build
run: |
cargo build

docker-build:
name: Build Docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
load: true # Important for building without pushing


9 changes: 5 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
[workspace]
members = [
"ethereum_rust",
"crates/consensus",
"crates/core",
"crates/evm",
"crates/net",
"crates/rpc",
"crates/storage",
"ethereum_rust",
]
resolver = "2"


[workspace.package]
name = "ethereum_rust"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[workspace.dependencies]
rpc = { path = "./crates/rpc" }

tracing = "0.1"
tracing-subscriber = "0.3.0"
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM rust:1.76 as builder

WORKDIR /usr/src/ethereum_rust

COPY . .

RUN cargo build --release

FROM ubuntu:22.04

RUN apt-get update && apt-get install -y \
build-essential \
libc6 \
libssl-dev \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /usr/local/bin

COPY --from=builder /usr/src/ethereum_rust/target/release/ethereum_rust .
8 changes: 5 additions & 3 deletions crates/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use eth::{
client::{chain_id, syncing},
};
use serde_json::Value;
use tracing::info;
use utils::{RpcErr, RpcErrorResponse, RpcRequest, RpcSuccessResponse};

mod engine;
Expand All @@ -13,11 +14,12 @@ mod utils;

#[tokio::main]
pub async fn start_api() {
tracing_subscriber::fmt::init();

let app = Router::new().route("/", post(handle_request));

let listener = tokio::net::TcpListener::bind("0.0.0.0:8551").await.unwrap();
let url = "0.0.0.0:8551";
let listener = tokio::net::TcpListener::bind(url).await.unwrap();
info!("RPC server listening on: {}", url);

axum::serve(listener, app).await.unwrap();
}

Expand Down
4 changes: 3 additions & 1 deletion ethereum_rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
rpc = { path = "../crates/rpc" }
tracing.workspace = true
tracing-subscriber.workspace = true
rpc.workspace = true
10 changes: 10 additions & 0 deletions ethereum_rust/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
use tracing::{info, Level};
use tracing_subscriber::FmtSubscriber;
fn main() {
let subscriber = FmtSubscriber::builder()
.with_max_level(Level::DEBUG)
.finish();

tracing::subscriber::set_global_default(subscriber).expect("setting default subscriber failed");

info!("Starting Ethereum Rust application");

rpc::start_api();
}