Skip to content

Commit

Permalink
Merge branch 'main' into 0xkitsune/alloy
Browse files Browse the repository at this point in the history
  • Loading branch information
0xKitsune authored Aug 23, 2024
2 parents 2bfcbb2 + 35b36f9 commit 3e2d5fa
Show file tree
Hide file tree
Showing 14 changed files with 112 additions and 78 deletions.
97 changes: 52 additions & 45 deletions Cargo.lock

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

5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ revm = { version = "12.1", features = ["alloydb", "optimism"] }

# Kona + OP Types
superchain-registry = "0.2.6"
kona-derive = { git = "https://github.com/ethereum-optimism/kona", rev = "4e57dd35ea08b31d0baa293c7a12165f28e6cd92", features = [
"online",
] }
kona-primitives = { git = "https://github.com/ethereum-optimism/kona", version = "0.0.2", features = ["online"] }
kona-derive = { git = "https://github.com/ethereum-optimism/kona", version = "0.0.3", features = ["online"] }

# Internal
op-test-vectors = { path = "crates/op-test-vectors" }
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,32 @@ Each has it's own cli tool to generate test fixtures. [opt8n](./bin/opt8n) can b

**`op-test-vectors`**

A rust crate exposing types used to generate test fixtures in [./fixtures](./fixtures/).

`op-test-vectors` contains two primary modules:

- [`execution`](./crates/op-test-vectors/src/execution.rs): Rust types for the execution test fixtures.
- [`derivation`](./crates/op-test-vectors/src/derivation.rs): Rust types for the derivation test fixtures.

**`opt8n` Commands**
**`opt8n`**

A binary to generate execution test fixtures.

`opt8n` has two subcommands:

- `repl`: Spins up a REPL that allows the user to send transactions to and generate a test fixture from those transactions.
- `script`: Executes a forge script against an anvil instance and generates the test fixture.

**`opdn`**

A binary to generate derivation test fixtures.

`opdn` has the following subcommands:

- `from-l2`: Generates a derivation test fixture from the specified range of L2 blocks.
- `from-l1`: Generates a derivation test fixture from the specified range of L1 blocks.
- `info`: Outputs the L2 block info including the L1 origin for the given L2 block number.

## Book

The [book][book] contains an in-depth overview of the project, contributor guidelines, and tutorials for creating your own test fixtures as well as you own test runners.
Expand Down
1 change: 1 addition & 0 deletions bin/opdn/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ alloy-eips.workspace = true

# OP Types + Kona
op-test-vectors.workspace = true
kona-primitives.workspace = true
kona-derive.workspace = true
superchain-registry.workspace = true
2 changes: 1 addition & 1 deletion bin/opdn/src/cmd/blobs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use kona_derive::online::{
OnlineBeaconClient, OnlineBlobProviderWithFallback, SimpleSlotDerivation,
};
use kona_derive::traits::BlobProvider;
use kona_derive::types::{Blob, BlockInfo, IndexedBlobHash};
use kona_primitives::{Blob, BlockInfo, IndexedBlobHash};

/// Loads blobs for the given block number.
pub async fn load(
Expand Down
3 changes: 2 additions & 1 deletion bin/opdn/src/cmd/fixtures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use kona_derive::online::{
AlloyChainProvider, OnlineBeaconClient, OnlineBlobProviderWithFallback, SimpleSlotDerivation,
};
use kona_derive::traits::ChainProvider;
use kona_primitives::Blob;
use op_test_vectors::derivation::FixtureBlock;

/// Constructs [FixtureBlock]s for the given L1 blocks.
Expand All @@ -21,7 +22,7 @@ pub async fn build_fixture_blocks(
OnlineBeaconClient,
SimpleSlotDerivation,
>,
) -> Result<Vec<FixtureBlock>> {
) -> Result<Vec<FixtureBlock<Blob>>> {
let mut fixtures = Vec::with_capacity(blocks.len());
for b in blocks {
let block_info = l1_provider
Expand Down
6 changes: 2 additions & 4 deletions bin/opdn/src/cmd/from_l1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ use color_eyre::{
Result,
};
use hashbrown::HashMap;
use kona_derive::{
online::*,
types::{L2BlockInfo, StageError},
};
use kona_derive::{errors::StageError, online::*};
use kona_primitives::L2BlockInfo;
use op_test_vectors::derivation::DerivationFixture;
use reqwest::Url;
use std::path::PathBuf;
Expand Down
6 changes: 2 additions & 4 deletions bin/opdn/src/cmd/from_l2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ use color_eyre::{
Result,
};
use hashbrown::HashMap;
use kona_derive::{
online::*,
types::{L2BlockInfo, StageError},
};
use kona_derive::{errors::StageError, online::*};
use kona_primitives::L2BlockInfo;
use op_test_vectors::derivation::DerivationFixture;
use reqwest::Url;
use std::path::PathBuf;
Expand Down
2 changes: 1 addition & 1 deletion bin/opdn/src/cmd/util.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Utilities

use kona_derive::types::{L2ExecutionPayloadEnvelope, L2PayloadAttributes, RawTransaction};
use kona_primitives::{L2ExecutionPayloadEnvelope, L2PayloadAttributes, RawTransaction};

/// Converts an [L2ExecutionPayloadEnvelope] to an [L2PayloadAttributes].
pub fn to_payload_attributes(payload: L2ExecutionPayloadEnvelope) -> L2PayloadAttributes {
Expand Down
1 change: 1 addition & 0 deletions bin/range-finder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ alloy-eips.workspace = true

# OP Types + Kona
kona-derive.workspace = true
kona-primitives.workspace = true
superchain-registry.workspace = true
6 changes: 2 additions & 4 deletions bin/range-finder/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

use clap::{ArgAction, Parser};
use color_eyre::eyre::{eyre, Result};
use kona_derive::{
online::*,
types::{L2BlockInfo, StageError},
};
use kona_derive::{errors::StageError, online::*};
use kona_primitives::L2BlockInfo;
use reqwest::Url;
use std::sync::Arc;
use superchain_registry::ROLLUP_CONFIGS;
Expand Down
2 changes: 1 addition & 1 deletion crates/op-test-vectors/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ alloy-consensus.workspace = true
# OP Types
op-alloy-rpc-types.workspace = true
op-alloy-consensus.workspace = true
kona-derive.workspace = true

[dev-dependencies]
serde_json.workspace = true
kona-primitives.workspace = true
Loading

0 comments on commit 3e2d5fa

Please sign in to comment.