Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
507c3cc
Integrate Phylax Credible Layer (Circuit Breaker) into the L2 sequencer
avilagaston9 Apr 15, 2026
2df4846
Rename Circuit Breaker to Credible Layer for consistency with Phylax …
avilagaston9 Apr 15, 2026
c8d011e
Replace ASCII architecture diagram with SVG in Credible Layer docs
avilagaston9 Apr 15, 2026
6b1628e
Add note about expected L1 dev mode payload_id errors on startup
avilagaston9 Apr 15, 2026
ecce9b7
Use pre-built binary for L2 contract deployment to avoid recompilation
avilagaston9 Apr 15, 2026
94ae063
Skip tx evaluation when sidecar stream is disconnected to avoid blocking
avilagaston9 Apr 15, 2026
f5da723
Strip ANSI color codes from docker logs grep commands in the guide
avilagaston9 Apr 15, 2026
488406c
Refine Credible Layer integration: boolean gate flag, log levels, and…
avilagaston9 Apr 15, 2026
423ab4d
Replace cast send --create with rex deploy --contract-path in the guide
avilagaston9 Apr 15, 2026
5d8a1dd
Prefer pcl build over forge build for assertion compilation
avilagaston9 Apr 15, 2026
7356d5b
Remove Aeges mempool pre-filter integration (no public server or docu…
avilagaston9 Apr 16, 2026
9d8569b
Move eth_subscribe/eth_unsubscribe WebSocket subscription support fro…
avilagaston9 Apr 16, 2026
4d7f11c
Apply cargo fmt formatting fixes after rebase onto feat/l1/ws-subscri…
avilagaston9 Apr 16, 2026
72f969b
Merge feat/l1/ws-subscriptions into feat/l2/circuit-breaker-integration.
avilagaston9 Apr 17, 2026
c6e68f8
Remove unused mock-sidecar binary and disable server codegen in tonic…
avilagaston9 Apr 17, 2026
f194988
Remove eip-8025 proof_coordinator from L1 RPC context — it was incorr…
avilagaston9 Apr 17, 2026
f5c4573
Merge branch 'feat/l1/prestate-tracer' into feat/l2/circuit-breaker-i…
avilagaston9 Apr 17, 2026
5ab6c45
Refactor Credible Layer integration: rewrite client as a GenServer ac…
avilagaston9 Apr 20, 2026
7810bf5
Simplify Credible Layer CLI to a single --credible-layer-url flag (pa…
avilagaston9 Apr 20, 2026
b128f0c
Replace raw tokio::spawn in CredibleLayerClient with proper spawned_c…
avilagaston9 Apr 20, 2026
9a2cac6
Rename event_sender to stream_tx (it feeds the gRPC StreamEvents stream,
avilagaston9 Apr 20, 2026
b4777c4
Remove redundant channel field from CredibleLayerClient — the grpc_cl…
avilagaston9 Apr 20, 2026
12e6b0e
Rename fields and methods for clarity: stream_tx -> sidecar_tx (write…
avilagaston9 Apr 20, 2026
320e93d
Move TransactionEnv conversion to From<(Transaction, Address)> impl i…
avilagaston9 Apr 20, 2026
271cbb3
Fix module doc redundancy, use short type paths in From impl, make
avilagaston9 Apr 20, 2026
d84231e
Remove redundant module doc title line
avilagaston9 Apr 20, 2026
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
19 changes: 19 additions & 0 deletions Cargo.lock

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

19 changes: 18 additions & 1 deletion cmd/ethrex/l2/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use ethrex_l2::sequencer::utils::resolve_aligned_network;
use ethrex_l2::{
BasedConfig, BlockFetcherConfig, BlockProducerConfig, CommitterConfig, EthConfig,
L1WatcherConfig, ProofCoordinatorConfig, SequencerConfig, StateUpdaterConfig,
sequencer::configs::{AdminConfig, AlignedConfig, MonitorConfig},
sequencer::configs::{AdminConfig, AlignedConfig, CredibleLayerConfig, MonitorConfig},
};
use ethrex_l2_prover::{backend::BackendType, config::ProverConfig};
use ethrex_l2_rpc::signer::{LocalSigner, RemoteSigner, Signer};
Expand Down Expand Up @@ -92,6 +92,8 @@ pub struct SequencerOptions {
pub admin_opts: AdminOptions,
#[clap(flatten)]
pub state_updater_opts: StateUpdaterOptions,
#[clap(flatten)]
pub credible_layer_opts: CredibleLayerOptions,
#[arg(
long = "validium",
default_value = "false",
Expand Down Expand Up @@ -263,6 +265,9 @@ impl TryFrom<SequencerOptions> for SequencerConfig {
start_at: opts.state_updater_opts.start_at,
l2_head_check_rpc_url: opts.state_updater_opts.l2_head_check_rpc_url,
},
credible_layer: CredibleLayerConfig {
sidecar_url: opts.credible_layer_opts.credible_layer_url,
},
})
}
}
Expand Down Expand Up @@ -1066,6 +1071,18 @@ impl Default for AdminOptions {
}
}

#[derive(Parser, Default, Debug)]
pub struct CredibleLayerOptions {
#[arg(
long = "credible-layer-url",
value_name = "URL",
env = "ETHREX_CREDIBLE_LAYER_URL",
help = "gRPC endpoint for the Credible Layer Assertion Enforcer sidecar (e.g. http://localhost:50051). Passing this flag enables the integration.",
help_heading = "Credible Layer options"
)]
pub credible_layer_url: Option<String>,
}

#[derive(Parser)]
pub struct ProverClientOptions {
#[arg(
Expand Down
5 changes: 5 additions & 0 deletions crates/l2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,18 @@ crossterm = { version = "0.29.0", features = ["event-stream"] }
ratatui = "0.29.0"
tui-logger.workspace = true
axum.workspace = true
tonic = "0.12"
prost = "0.13"
tokio-stream = "0.1"
ethrex-guest-program = { path = "../guest-program", optional = true }

[build-dependencies]
vergen-git2 = { version = "1.0.7" }
tonic-build = "0.12"

[dev-dependencies]
anyhow = "1.0.86"
hex = { workspace = true }

[lib]
path = "./l2.rs"
Expand Down
11 changes: 8 additions & 3 deletions crates/l2/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@ fn main() -> Result<(), Box<dyn Error>> {
// When building tdx image with nix the commit version is stored as an env var
if let Ok(sha) = std::env::var("VERGEN_GIT_SHA") {
println!("cargo:rustc-env=VERGEN_GIT_SHA={}", sha.trim());
return Ok(());
} else {
let git2 = Git2Builder::default().sha(true).build()?;
Emitter::default().add_instructions(&git2)?.emit()?;
}
let git2 = Git2Builder::default().sha(true).build()?;

Emitter::default().add_instructions(&git2)?.emit()?;
// Compile Credible Layer protobuf definitions (client only)
tonic_build::configure()
.build_server(false)
.compile_protos(&["proto/sidecar.proto"], &["proto/"])?;

Ok(())
}
33 changes: 33 additions & 0 deletions crates/l2/contracts/src/credible_layer/OwnableTarget.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.27;

/// @title OwnableTarget
/// @notice A simple Ownable contract used as a target for Credible Layer testing.
/// The TestOwnershipAssertion protects this contract by preventing ownership transfers.
contract OwnableTarget {
address public owner;

event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

constructor() {
owner = msg.sender;
}

modifier onlyOwner() {
require(msg.sender == owner, "OwnableTarget: caller is not the owner");
_;
}

/// @notice Transfer ownership to a new address.
/// When protected by the TestOwnershipAssertion, this call will be dropped by the sidecar.
function transferOwnership(address newOwner) external onlyOwner {
require(newOwner != address(0), "OwnableTarget: new owner is the zero address");
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}

/// @notice A harmless function that does not trigger any assertion.
function doSomething() external pure returns (uint256) {
return 42;
}
}
19 changes: 19 additions & 0 deletions crates/l2/contracts/src/credible_layer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Credible Layer Contracts

This directory contains example/demo contracts for the Credible Layer integration:

- `OwnableTarget.sol` — a simple Ownable contract used as a demonstration target
- `TestOwnershipAssertion.sol` — a test assertion that asserts ownership of `OwnableTarget` cannot change

## State Oracle

The **State Oracle** is the on-chain registry that maps protected contracts to their active
assertions. It is maintained by Phylax Systems and must be deployed separately using the
Phylax toolchain before starting the Credible Layer sidecar.

See the [Credible Layer docs](../../../../docs/l2/credible_layer.md) for deployment instructions.

### References

- [Credible Layer Introduction](https://docs.phylax.systems/credible/credible-introduction)
- [credible-layer-contracts](https://github.com/phylaxsystems/credible-layer-contracts)
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.27;

import {Assertion} from "credible-std/Assertion.sol";

interface IOwnableTarget {
function owner() external view returns (address);
function transferOwnership(address newOwner) external;
}

/// @title TestOwnershipAssertion
/// @notice Protects OwnableTarget by asserting that ownership cannot change.
/// @dev Compile with `pcl build` (requires credible-std as a dependency).
/// See docs/l2/credible_layer.md for the full deployment workflow.
contract TestOwnershipAssertion is Assertion {
function triggers() external view override {
registerCallTrigger(
this.assertOwnerUnchanged.selector,
IOwnableTarget.transferOwnership.selector
);
}

function assertOwnerUnchanged() external {
IOwnableTarget target = IOwnableTarget(ph.getAssertionAdopter());
ph.forkPreTx();
address ownerBefore = target.owner();
ph.forkPostTx();
address ownerAfter = target.owner();
require(ownerBefore == ownerAfter, "ownership changed");
}
}
4 changes: 2 additions & 2 deletions crates/l2/l2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pub mod utils;

pub use based::block_fetcher::BlockFetcher;
pub use sequencer::configs::{
BasedConfig, BlockFetcherConfig, BlockProducerConfig, CommitterConfig, EthConfig,
L1WatcherConfig, ProofCoordinatorConfig, SequencerConfig, StateUpdaterConfig,
BasedConfig, BlockFetcherConfig, BlockProducerConfig, CommitterConfig, CredibleLayerConfig,
EthConfig, L1WatcherConfig, ProofCoordinatorConfig, SequencerConfig, StateUpdaterConfig,
};
pub use sequencer::start_l2;
3 changes: 1 addition & 2 deletions crates/l2/networking/rpc/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ use ethrex_common::Address;
use ethrex_storage_rollup::StoreRollup;
use secp256k1::SecretKey;

#[derive(Debug, Clone)]
#[derive(Clone, Debug)]
pub struct RpcApiContext {
pub l1_ctx: ethrex_rpc::RpcApiContext,
pub valid_delegation_addresses: Vec<Address>,
Expand Down Expand Up @@ -72,7 +72,6 @@ pub const FILTER_DURATION: Duration = {
}
};

#[expect(clippy::too_many_arguments)]
pub async fn start_api(
http_addr: SocketAddr,
ws: Option<WebSocketConfig>,
Expand Down
Loading
Loading