Skip to content

Flashtestations flag #165

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

Merged
merged 2 commits into from
Jun 17, 2025
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
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,11 @@ test: ## Run the tests for rbuilder and op-rbuilder
.PHONY: lt
lt: lint test ## Run "lint" and "test"

## TODO: use all features when tdx dependency is compatible with macOS
.PHONY: fmt
fmt: ## Format the code
cargo +nightly fmt
cargo +nightly clippy --all-features --fix --allow-staged --allow-dirty
cargo +nightly clippy --features ci-features --fix --allow-staged --allow-dirty
cargo +nightly fix --allow-staged --allow-dirty

.PHONY: bench
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ cargo run -p op-rbuilder --bin op-rbuilder -- node \
To run op-rbuilder with flashtestations:

```bash
cargo run -p op-rbuilder --bin op-rbuilder -- node \
cargo run -p op-rbuilder --bin op-rbuilder --features=flashtestations -- node \
--chain /path/to/chain-config.json \
--http \
--authrpc.port 9551 \
Expand Down
22 changes: 18 additions & 4 deletions crates/op-rbuilder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ hex = "0.4"
ureq = "2.10"

rollup-boost = { git = "http://github.com/flashbots/rollup-boost", branch = "main" }
tdx = { git = "https://github.com/automata-network/tdx-attestation-sdk.git"}
dcap-rs = { git = "https://github.com/automata-network/dcap-rs.git" }
tdx = { git = "https://github.com/automata-network/tdx-attestation-sdk.git", optional = true }
dcap-rs = { git = "https://github.com/automata-network/dcap-rs.git", optional = true }

dashmap = { version = "6.1", optional = true }
nanoid = { version = "0.4", optional = true }
Expand Down Expand Up @@ -175,7 +175,6 @@ min-info-logs = ["tracing/release_max_level_info"]
min-debug-logs = ["tracing/release_max_level_debug"]
min-trace-logs = ["tracing/release_max_level_trace"]


testing = [
"dashmap",
"nanoid",
Expand All @@ -187,13 +186,28 @@ testing = [
"rlimit",
]


interop = []

flashtestations = ["dcap-rs", "tdx"]

telemetry = ["reth-tracing-otlp", "opentelemetry"]

custom-engine-api = []

ci-features = [
"default",
"jemalloc-prof",
"min-error-logs",
"min-warn-logs",
"min-info-logs",
"min-debug-logs",
"min-trace-logs",
"testing",
"interop",
"telemetry",
"custom-engine-api",
]

[[bin]]
name = "op-rbuilder"
path = "src/bin/op-rbuilder/main.rs"
Expand Down
17 changes: 16 additions & 1 deletion crates/op-rbuilder/src/flashtestations/attestation.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::io::Read;
#[cfg(feature = "flashtestations")]
use tdx::{device::DeviceOptions, Tdx};
use tracing::info;
use ureq;
Expand All @@ -20,22 +21,26 @@ pub trait AttestationProvider {
}

/// Real TDX hardware attestation provider
#[cfg(feature = "flashtestations")]
pub struct TdxAttestationProvider {
tdx: Tdx,
}

#[cfg(feature = "flashtestations")]
impl Default for TdxAttestationProvider {
fn default() -> Self {
Self::new()
}
}

#[cfg(feature = "flashtestations")]
impl TdxAttestationProvider {
pub fn new() -> Self {
Self { tdx: Tdx::new() }
}
}

#[cfg(feature = "flashtestations")]
impl AttestationProvider for TdxAttestationProvider {
fn get_attestation(&self, report_data: [u8; 64]) -> eyre::Result<Vec<u8>> {
self.tdx
Expand Down Expand Up @@ -85,6 +90,16 @@ pub fn get_attestation_provider(
.unwrap_or(DEBUG_QUOTE_SERVICE_URL.to_string()),
))
} else {
Box::new(TdxAttestationProvider::new())
#[cfg(feature = "flashtestations")]
{
Box::new(TdxAttestationProvider::new())
}
#[cfg(not(feature = "flashtestations"))]
{
info!("Using debug attestation provider as flashtestations feature is disabled");
Box::new(DebugAttestationProvider::new(
DEBUG_QUOTE_SERVICE_URL.to_string(),
))
}
}
}
Loading