Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
38 changes: 34 additions & 4 deletions Cargo.lock

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

7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ codegen-units = 1
[workspace.dependencies]
# local
base-bundles = { path = "crates/bundles" }
base-fbal = { path = "crates/fbal" }
base-access-lists = { path = "crates/access-lists" }
base-reth-cli = { path = "crates/cli" }
base-reth-rpc = { path = "crates/rpc" }
base-reth-rpc-types = { path = "crates/reth-rpc-types" }
Expand Down Expand Up @@ -97,9 +97,11 @@ revm = { version = "31.0.2", default-features = false }
revm-bytecode = { version = "7.1.1", default-features = false }

# alloy
alloy-rlp = "0.3.10"
alloy-trie = "0.9.1"
alloy-eips = "1.0.41"
alloy-serde = "1.0.41"
alloy-eip7928 = "0.3.0"
alloy-genesis = "1.0.41"
alloy-signer-local = "1.0.41"
alloy-hardforks = "0.4.4"
Expand All @@ -123,6 +125,9 @@ op-alloy-rpc-jsonrpsee = "0.22.0"
op-alloy-rpc-types-engine = "0.22.0"
alloy-op-evm = { version = "0.23.3", default-features = false }

# op-revm
op-revm = { version = "12.0.2", default-features = false }

# tokio
tokio = "1.48.0"
tokio-stream = "0.1.17"
Expand Down
36 changes: 36 additions & 0 deletions crates/access-lists/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[package]
name = "base-access-lists"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
homepage.workspace = true
repository.workspace = true
description = "FBAL library crate"

[lints]
workspace = true

[dependencies]
alloy-primitives.workspace = true
alloy-eip7928 = {workspace = true, features = ["serde", "rlp"]}
alloy-rlp = {workspace = true, features = ["derive"]}
tracing.workspace = true
revm.workspace = true
serde.workspace = true

[dev-dependencies]
op-revm.workspace = true
eyre.workspace = true
reth-optimism-chainspec.workspace = true
reth-optimism-evm.workspace = true
alloy-consensus.workspace = true
alloy-contract.workspace = true
alloy-sol-macro = { workspace = true, features = ["json"] }
alloy-sol-types.workspace = true
reth-evm.workspace = true
serde_json.workspace = true

[[test]]
name = "builder"
path = "tests/builder/main.rs"
42 changes: 42 additions & 0 deletions crates/access-lists/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# `base-fbal`

A library to build and process Flashblock-level Access Lists (FBALs).

## Overview

This crate provides types and utilities for tracking account and storage changes during EVM transaction execution, producing access lists that can be used by downstream consumers to understand exactly what state was read or modified.

- `FBALBuilderDb<DB>` - A database wrapper that tracks reads and writes during transaction execution.
- `FlashblockAccessListBuilder` - A builder pattern for constructing access lists from tracked changes.
- `FlashblockAccessList` - The final access list containing all account changes, storage changes, and metadata.

## Usage

Wrap your database with `FBALBuilderDb`, execute transactions, then call `finish()` to retrieve the builder:

```rust,ignore
use base_fbal::{FBALBuilderDb, FlashblockAccessList};
use revm::database::InMemoryDB;

// Create a wrapped database
let db = InMemoryDB::default();
let mut fbal_db = FBALBuilderDb::new(db);

// Execute transactions, calling set_index() before each one
for (i, tx) in transactions.into_iter().enumerate() {
fbal_db.set_index(i as u64);
// ... execute transaction with fbal_db ...
fbal_db.commit(state_changes);
}

// Build the access list
let builder = fbal_db.finish()?;
let access_list = builder.build(0, max_tx_index);
```

## Features

- Tracks balance, nonce, and code changes per account
- Tracks storage slot reads and writes
- Associates each change with its transaction index
- Produces RLP-encodable access lists with a commitment hash
Loading