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
32 changes: 28 additions & 4 deletions .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,18 @@ jobs:

# https://github.com/swatinem/rust-cache
- name: Run Swatinem/rust-cache@v2
if: ${{ !env.ACT }}
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true

# https://github.com/Mozilla-Actions/sccache-action
- name: Run sccache-action
if: ${{ !env.ACT }}
uses: mozilla-actions/sccache-action@v0.0.9

- name: Set sccache env vars
if: ${{ !env.ACT }}
run: |
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
Expand All @@ -55,7 +58,18 @@ jobs:
version: nightly

- name: Install native dependencies
run: sudo apt-get update && sudo apt-get install -y libsqlite3-dev
run: sudo apt-get update && sudo apt-get install -y libsqlite3-dev clang libclang-dev llvm build-essential pkg-config

- name: Compile tester
run: make tester

- name: Compile op-rbuilder
run: cargo build -p op-rbuilder --bin op-rbuilder

- name: Download op-reth
run: |
./scripts/ci/download-op-reth.sh
echo "$(pwd)" >> $GITHUB_PATH

- name: Lint
run: make lint
Expand Down Expand Up @@ -84,15 +98,18 @@ jobs:

# https://github.com/swatinem/rust-cache
- name: Run Swatinem/rust-cache@v2
if: ${{ !env.ACT }}
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true

# https://github.com/Mozilla-Actions/sccache-action
- name: Run sccache-action
if: ${{ !env.ACT }}
uses: mozilla-actions/sccache-action@v0.0.9

- name: Set sccache env vars
if: ${{ !env.ACT }}
run: |
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
Expand All @@ -102,20 +119,27 @@ jobs:
./scripts/ci/download-op-reth.sh
echo "$(pwd)" >> $GITHUB_PATH

- name: Install native dependencies
if: ${{ env.ACT }}
run: sudo apt-get update && sudo apt-get install -y libsqlite3-dev clang libclang-dev llvm build-essential pkg-config

- name: Compile tester
run: make tester

- name: Build the rbuilder
run: cargo build -p op-rbuilder --bin op-rbuilder

- name: Generate test genesis file
run: cargo run -p op-rbuilder --bin tester -- genesis --output genesis.json
run: cargo run -p op-rbuilder --bin tester --features=testing -- genesis --output genesis.json

- name: Run integration tests
run: cargo test --package op-rbuilder --lib --features integration -- integration::integration_test::tests
run: cargo test --package op-rbuilder --lib

- name: Build flashblocks rbuilder
run: cargo build -p op-rbuilder --bin op-rbuilder --features flashblocks

- name: Run flashblocks builder integration tests
run: cargo test --package op-rbuilder --lib --features integration,flashblocks -- integration::integration_test::tests
run: cargo test --package op-rbuilder --lib --features flashblocks

- name: Aggregate playground logs
# This steps fails if the test fails early and the playground logs dir has not been created
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

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

8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ clean: ## Clean up
build: ## Build (debug version)
cargo build --features "$(FEATURES)"

.PHONY: op-rbuilder
op-rbuilder: ## Build op-rbuilder (debug version)
cargo build -p op-rbuilder --bin op-rbuilder --features "$(FEATURES)"

.PHONY: tester
tester: ## Build tester (debug version)
cargo build -p op-rbuilder --bin tester --features "testing,$(FEATURES)"

.PHONY: docker-image-rbuilder
docker-image-rbuilder: ## Build a rbuilder Docker image
docker build --platform linux/amd64 --target rbuilder-runtime --build-arg FEATURES="$(FEATURES)" . -t rbuilder
Expand Down
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,18 @@ This will automatically try to detect all settings and ports from the currently
```
rm -rf ~/.local/share/reth
sudo rm -rf ~/.playground
```
```

## Running GitHub actions locally

To verify that CI will allow your PR to be merged before sending it please make sure that our GitHub `checks.yaml` action passes locall by calling:

```
act -W .github/workflows/checks.yaml
```

More instructions on installing and configuring `act` can be found on [their website](https://nektosact.com).

### Known issues
- Running actions locally require a Github Token. You can generate one by following instructions on [Github Docs](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens). After generating a token you will need to pass it to `act` either through the command line using `-s GITHUB_TOKEN=<your token>` or by adding it to the `~/.config/act/actrc` file.
- You might get an error about missing or incompatible `warp-ubuntu-latest-x64-32x` platform. This can be mitigated by adding `-P warp-ubuntu-latest-x64-32x=ghcr.io/catthehacker/ubuntu:act-latest` on the command line when calling `act` or appending this flag to `~/.config/act/actrc`
9 changes: 5 additions & 4 deletions crates/op-rbuilder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ revm.workspace = true
op-revm.workspace = true

tracing.workspace = true
futures-util = "0.3.31"
eyre.workspace = true
tower = "0.4"
serde_with.workspace = true
serde.workspace = true
secp256k1.workspace = true
Expand All @@ -86,6 +84,9 @@ thiserror.workspace = true
parking_lot.workspace = true
url.workspace = true

tower = "0.4"
futures = "0.3"
futures-util = "0.3.31"
time = { version = "0.3.36", features = ["macros", "formatting", "parsing"] }
chrono = "0.4"
uuid = { version = "1.6.1", features = ["serde", "v5", "v4"] }
Expand Down Expand Up @@ -127,7 +128,7 @@ min-info-logs = ["tracing/release_max_level_info"]
min-debug-logs = ["tracing/release_max_level_debug"]
min-trace-logs = ["tracing/release_max_level_trace"]

integration = []
testing = []
flashblocks = []

[[bin]]
Expand All @@ -136,4 +137,4 @@ path = "src/main.rs"

[[bin]]
name = "tester"
path = "src/tester/main.rs"
required-features = ["testing"]
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use alloy_primitives::Address;
use clap::Parser;
use op_rbuilder::tester::*;
use op_rbuilder::tests::*;

/// CLI Commands
#[derive(Parser, Debug)]
Expand Down Expand Up @@ -77,3 +77,38 @@ async fn main() -> eyre::Result<()> {
}
}
}

#[allow(dead_code)]
pub async fn run_system(
validation: bool,
no_tx_pool: bool,
block_time_secs: u64,
flashblocks_endpoint: Option<String>,
no_sleep: bool,
) -> eyre::Result<()> {
println!("Validation: {validation}");

let engine_api = EngineApi::new("http://localhost:4444").unwrap();
let validation_api = if validation {
Some(EngineApi::new("http://localhost:5555").unwrap())
} else {
None
};

let mut generator = BlockGenerator::new(
engine_api,
validation_api,
no_tx_pool,
block_time_secs,
flashblocks_endpoint,
);

generator.init().await?;

// Infinite loop generating blocks
loop {
println!("Generating new block...");
let block_hash = generator.submit_payload(None, 0, no_sleep).await?;
println!("Generated block: {block_hash}");
}
}
4 changes: 2 additions & 2 deletions crates/op-rbuilder/src/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ mod tests {
use super::*;
use alloy_eips::eip7685::Requests;
use alloy_primitives::U256;
use rand::thread_rng;
use rand::rng;
use reth::tasks::TokioTaskExecutor;
use reth_chain_state::ExecutedBlockWithTrieUpdates;
use reth_node_api::NodePrimitives;
Expand Down Expand Up @@ -624,7 +624,7 @@ mod tests {

#[tokio::test]
async fn test_payload_generator() -> eyre::Result<()> {
let mut rng = thread_rng();
let mut rng = rng();

let client = MockEthProvider::default();
let executor = TokioTaskExecutor::default();
Expand Down
Loading
Loading