Skip to content
Open
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
13 changes: 11 additions & 2 deletions examples/custom-bundle-type.rs → examples/custom-platform.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//! Example of extending an existing platform with a custom bundle type.
//! Example of a custom platform extending an existing platform (`Optimism`)
//! with a custom bundle type.
//!
//! In this example, we define a new platform type that inherits all properties
//! and behaviors of the `Optimism` platform but uses a custom bundle type that
Expand All @@ -22,7 +23,7 @@ use {
revm::db::BundleState,
},
serde::{Deserialize, Serialize},
std::sync::Arc,
std::sync::{Arc, LazyLock},
};

#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
Expand Down Expand Up @@ -62,6 +63,14 @@ impl Platform for CustomPlatform {
}
}

impl PlatformWithTestnet for CustomPlatform {
fn dev_chainspec() -> Arc<types::ChainSpec<Self>> {
LazyLock::force(&crate::reth::optimism::chainspec::OP_DEV)
.clone()
.with_funded_accounts()
}
}

fn main() -> eyre::Result<()> {
// Construct a mock build context for the custom platform.
let block = BlockContext::<CustomPlatform>::mocked();
Expand Down
Loading
Loading