Skip to content
This repository has been archived by the owner on Nov 5, 2023. It is now read-only.

feat: op-reth #8

Closed
wants to merge 210 commits into from
Closed
Show file tree
Hide file tree
Changes from 207 commits
Commits
Show all changes
210 commits
Select commit Hold shift + click to select a range
837618f
feat: deposit tx
rkrasiuk Feb 26, 2023
15c8c61
chainspec and forks
rkrasiuk Feb 26, 2023
a105209
feat: payload attributes op fields
rkrasiuk Feb 26, 2023
9e75a18
small fixes
refcell Feb 27, 2023
0aebf85
Small changes to the deposit tx primitive
clabby Feb 27, 2023
ef10cb0
more small fixes
refcell Feb 27, 2023
8106a48
compiles
refcell Feb 27, 2023
9ec89c2
Move feature flags below comments
clabby Feb 27, 2023
0666f4f
Doc auto link
clabby Feb 27, 2023
c206c21
WIP: OP Goerli genesis
clabby Mar 5, 2023
6b7ff04
Signature fix
clabby Mar 5, 2023
5655b2c
TEMP: Expose some CLI items
clabby Mar 19, 2023
7aa0a92
Resolve conflicts
clabby Mar 19, 2023
eb0ed7f
Allow gaslimit to be set by the EngineAPI caller on OP
clabby Mar 19, 2023
9180f2b
Add Optimism EIP1559 elasticity multiplier / max base fee change deno…
clabby Mar 19, 2023
3d28b65
feat: executor deposits
merklefruit Jun 11, 2023
28e0803
feat: receipts, l1 cost wip
merklefruit Jun 11, 2023
2945526
chore: small fixes
merklefruit Jun 11, 2023
161bc6e
wip: transact() optimism changes
merklefruit Jun 12, 2023
5bf2762
chore: minor changes related to optimism execution
merklefruit Jun 12, 2023
22d24ba
wip: removed receipts changes + improved gas handling
merklefruit Jun 17, 2023
9e19563
chore: cleanup
merklefruit Jun 18, 2023
bf5039f
chore: system_tx and is_success method
merklefruit Jun 19, 2023
6c34956
feat: refactoring: separated optimism feature + added routing fees to…
merklefruit Jun 20, 2023
ebaefba
fix: fee vault calc
merklefruit Jun 20, 2023
5a9af36
fix: increment balance via executor function
merklefruit Jun 20, 2023
c140fcc
chore: minor fixes
merklefruit Jun 21, 2023
582b56d
feat: parse l1 block info from l2 block
merklefruit Jun 28, 2023
a0e3cd9
chore: removed default trait
merklefruit Jun 28, 2023
146d3f2
chore: set deposit gas to 0 always
merklefruit Jun 29, 2023
77786a6
Start resolving conflicts
clabby Jul 8, 2023
12a0c7e
More conflict resolution / updates
clabby Jul 9, 2023
fd45b9a
Reimplement @merklefruit's changes
clabby Jul 9, 2023
591dd91
:broom:
clabby Jul 9, 2023
0590e74
chore: removed useless import
merklefruit Jul 9, 2023
c5e3af7
fix build failures with optimism feature
roberto-bayardo Jul 19, 2023
6f511da
Fix feature flag
clabby Jul 19, 2023
9fa57b7
Use TTD(0) fork condition for OP_GOERLI Paris hardfork
BrianBland Jul 17, 2023
b78e3e5
Resolve conflict
clabby Jul 9, 2023
95708a3
Fix encoding/decoding for deposit transactions
BrianBland Jul 18, 2023
88592c6
Add compact support for txs with type values >3 via variable encoding
BrianBland Jul 18, 2023
e49f078
Fix unrelated partial_cmp clippy warning
BrianBland Jul 18, 2023
c781f49
Fix optimism_goerli_forkids test with genesis and regolith conditions
BrianBland Jul 21, 2023
7096dd0
fix reth build when optimism feature flag is default
roberto-bayardo Jul 19, 2023
8bb463b
Add variable-length compact support for TxType and Transaction
BrianBland Jul 22, 2023
7833afe
Revert custom Transaction (de)serialization in favor of TxType.to/fro…
BrianBland Jul 26, 2023
7b3a8d9
Remove .vscode in gitignore
refcell Jul 26, 2023
b18dc5a
Fix cargo manifest
refcell Jul 26, 2023
080572d
Fix clippy lints in base
refcell Jul 27, 2023
942dc96
use the parameters from the optimism config in 1559 base fee computation
roberto-bayardo Jul 28, 2023
e1fcc7a
add op-node specific command line flags
roberto-bayardo Jul 29, 2023
4fb9ea5
Update bin/reth/src/args/rollup_args.rs
refcell Jul 31, 2023
ee3fc55
Update bin/reth/src/args/rollup_args.rs
refcell Jul 31, 2023
2d5fdd1
Compute Pending Block rollup arg
refcell Jul 31, 2023
bb0236a
op-reth: Fix reth-primitives signature tests
BrianBland Jul 26, 2023
daca72a
Document use of nonzero R, S values, add zero signature test
BrianBland Jul 31, 2023
8b8e9eb
Constrain use of Receipt.deposit_nonce to Deposit transactions
BrianBland Jul 31, 2023
91c30d0
Revert "chore: upstream sync"
refcell Aug 1, 2023
abae91a
Update bin/reth/src/args/rollup_args.rs
refcell Aug 1, 2023
0dc97a7
Ensure that block execution maintains L1 compatibility with optimism …
BrianBland Aug 1, 2023
920a5b4
Address review feedback
BrianBland Aug 2, 2023
05e45a8
Revert "use the parameters from the optimism config in 1559 base fee …
roberto-bayardo Aug 3, 2023
69232e3
feat: add ability to forward transactions to the sequencer
merklefruit Aug 3, 2023
7e96b43
chore: updated trait function
merklefruit Aug 3, 2023
8128b30
chore: borrow instead of cloning
merklefruit Aug 3, 2023
a2cdf1a
chore: deleted function
merklefruit Aug 3, 2023
a5d8876
feat: set sequencer http endpoint on node build
merklefruit Aug 3, 2023
d91a8fb
Make it all back in one commit
clabby Aug 12, 2023
1f20d8a
Add Optimism next base fee test to primitives
refcell Aug 13, 2023
ec43c23
Merge pull request #55 from anton-rs/refcell/optimism-basefee
clabby Aug 13, 2023
fe18b0d
♻️ remove optimism config, replace with boolean flag
N0xMare Aug 13, 2023
365524b
Merge pull request #58 from anton-rs/nox/remove-opconf
clabby Aug 13, 2023
1d19bb9
Add Optimism Goerli Bedrock Hardfork Block Number
refcell Aug 13, 2023
21efbfa
Add Base Goerli genesis
N0xMare Aug 13, 2023
ab462f1
Merge pull request #61 from anton-rs/refcell/bedrock_specs
clabby Aug 13, 2023
583beda
Configure regolith timestamp.
refcell Aug 13, 2023
743b6a0
Merge pull request #60 from anton-rs/nox/base-goerli-spec
refcell Aug 13, 2023
69dfca8
Add optional nonce to `DepositTx` for Regolith
clabby Aug 13, 2023
5508769
Merge pull request #62 from anton-rs/refcell/regolith-timestamp
clabby Aug 13, 2023
48ede00
Merge pull request #63 from anton-rs/clabby/deposit-tx-optional-nonce
clabby Aug 13, 2023
b790ee4
fix `optimism_goerli_forkids` test
clabby Aug 13, 2023
3caba32
Revert #63
clabby Aug 13, 2023
3f5ea46
Merge pull request #64 from anton-rs/clabby/fix-failing-tests
clabby Aug 13, 2023
8247f7f
Migrate Engine API + Block Building modifications
clabby Aug 13, 2023
30aca6c
Start block building modifications for payload with transactions
clabby Aug 13, 2023
7fec46c
Pull `rollup.compute_pending_block` CLI flag into `BasicPayloadJobGen…
clabby Aug 13, 2023
bf0bae8
Lift `compute_pending_block` config to `PayloadConfig` as well
clabby Aug 13, 2023
f6faf9c
`compute_pending_block` handlers
clabby Aug 13, 2023
6eb4ccb
doc lint
clabby Aug 13, 2023
94a0371
Remove effective nonce comment
clabby Aug 13, 2023
0ce8397
Review
clabby Aug 13, 2023
571b9a3
Update crates/payload/basic/src/lib.rs
clabby Aug 14, 2023
6dcb73d
Review nits
clabby Aug 14, 2023
839d2ce
Regolith deposit nonce
clabby Aug 14, 2023
8a33d5f
Merge `upstream/main` into `anton-rs/clabby/op-reth`
clabby Aug 14, 2023
974c6ae
Merge pull request #66 from anton-rs/clabby/sync-op-reth
clabby Aug 14, 2023
78b811f
Merge `clabby/op-reth` into `clabby/engine-api-and-block-building`
clabby Aug 14, 2023
4c87b7a
Revert the github workflows to use the reth runner group.
refcell Aug 14, 2023
2ffd661
Merge pull request #69 from anton-rs/refcell/revert-github-workflows
refcell Aug 14, 2023
15927b8
Fix unit github action file
refcell Aug 14, 2023
197dadd
Merge pull request #70 from anton-rs/refcell/small-github-workflow-fix
refcell Aug 14, 2023
1e82331
disable tx gossip if optimism flag set
roberto-bayardo Aug 14, 2023
3a6ccca
Update crates/net/network/src/config.rs
roberto-bayardo Aug 15, 2023
3292ed7
Update crates/net/network/src/config.rs
roberto-bayardo Aug 15, 2023
ed52310
Merge branch 'clabby/op-reth' into clabby/engine-api-and-block-building
clabby Aug 15, 2023
31ddab5
Merge pull request #71 from anton-rs/roberto/disable-gossip
clabby Aug 15, 2023
41698d2
Use generic builder
clabby Aug 15, 2023
6fa012c
Resolve some TODOs
clabby Aug 15, 2023
2ea77ef
Merge pull request #72 from anton-rs/clabby/clean
refcell Aug 15, 2023
b274c17
Rename error
clabby Aug 15, 2023
ac32a29
Fix `no_tx_pool` option
clabby Aug 15, 2023
f3daa96
Default ethereum feature flag
refcell Aug 15, 2023
d58c1c1
:broom:
clabby Aug 15, 2023
e742207
add chainspec for Base mainnet
roberto-bayardo Aug 15, 2023
9ae48d7
Merge pull request #59 from anton-rs/clabby/engine-api-and-block-buil…
clabby Aug 16, 2023
10c6113
Merge pull request #75 from anton-rs/roberto/base-chainspec
clabby Aug 16, 2023
3c2ee28
Merge pull request #74 from anton-rs/refcell/compile-error-feats
refcell Aug 16, 2023
6339a2b
Add Optimism fields to `rpc-types`
clabby Aug 16, 2023
79dcc4b
Merge pull request #76 from anton-rs/clabby/rpc-types
refcell Aug 16, 2023
2ca15c7
Upstream sync clabby/op-reth
refcell Aug 16, 2023
31f3770
Fix reth binary spawn payloader call
refcell Aug 16, 2023
e458a09
Merge pull request #78 from anton-rs/refcell/upstream-sync
refcell Aug 16, 2023
2961b0b
Tx Pool L1 Cost Function Changes
refcell Aug 13, 2023
ff1f580
Merge pull request #65 from anton-rs/refcell/tx-pool-updates
refcell Aug 17, 2023
b1dc043
fixes #1
clabby Aug 16, 2023
54129b7
Payload hex parsing hack
clabby Aug 16, 2023
6126c93
Version byte?
clabby Aug 17, 2023
7543a00
Remove `no_tx_pool` temp
clabby Aug 17, 2023
d2155cd
Fix deposit tx RLP
clabby Aug 17, 2023
08e1ea4
[temp] dbgs
clabby Aug 17, 2023
37ef33d
Rebase on `clabby/op-reth` for txpool updates
clabby Aug 17, 2023
392aee1
Mostly nit fixes and some small style changes.
refcell Aug 16, 2023
fc6bb20
Fixed internal unwrapping issue
refcell Aug 17, 2023
833da96
Merge pull request #77 from anton-rs/refcell/small-nit-fixes
refcell Aug 17, 2023
a9bf9d6
(╯°□°)╯︵ ┻━┻
refcell Aug 17, 2023
bcc19c9
Merge pull request #80 from anton-rs/refcell/nit-fixes
refcell Aug 17, 2023
748b555
Testing
clabby Aug 18, 2023
b77583d
Gas limit override txenv
clabby Aug 18, 2023
3ba5b86
Add base mainnet to arg utils
clabby Aug 18, 2023
0813119
Remove a lotta debug comments
clabby Aug 18, 2023
041ed05
Bedrock fork condition in base mainnet
clabby Aug 18, 2023
05e5622
Better hex decoding for `PayloadAttributes`; `TxDeposit` proptest fixes
clabby Aug 18, 2023
7f4108f
Disable block gas limit if pre-regolith
clabby Aug 18, 2023
c39181c
Fix conflicts
refcell Aug 18, 2023
6f822c2
Correct L1 block info calldata offsets
clabby Aug 18, 2023
99d522d
Allow miner to reorg and `no_tx_pool` round 2
clabby Aug 18, 2023
31fa610
Executor gas limit updates pre-regolith
clabby Aug 18, 2023
c36e142
executor regolith features
clabby Aug 18, 2023
faa93c2
lint
clabby Aug 18, 2023
bb8978c
Merge pull request #81 from anton-rs/refcell/more-upstream-sync
refcell Aug 18, 2023
e4afa79
Merge branch 'clabby/op-reth' into clabby/fixes
clabby Aug 18, 2023
f05e317
Executor + L1 fee fixes
clabby Aug 18, 2023
43c98e1
More fixes
clabby Aug 19, 2023
14983f1
Merge pull request #79 from anton-rs/clabby/fixes
refcell Aug 19, 2023
896c3d1
Merge branch 'main' into clabby/op-reth
clabby Aug 19, 2023
70ad7ef
Resolve conflicts
clabby Aug 20, 2023
d2094d8
Remove duplicate withdrawals presence validation
clabby Aug 20, 2023
95e0e2c
Merge pull request #82 from anton-rs/clabby/sync-upstream
refcell Aug 20, 2023
a4a6574
Start more fixes
clabby Aug 20, 2023
f8f2c4d
test
clabby Aug 20, 2023
f3463d1
wat do
clabby Aug 20, 2023
dd9712b
Not input, encoded enveloped :sweat_smile:
clabby Aug 20, 2023
3b225db
Remove debug logs
clabby Aug 20, 2023
0480cb6
Clean up optimism payload builder
clabby Aug 20, 2023
0f6201d
Add failed deposit receipts in optimism payload builder
clabby Aug 20, 2023
c62e4cd
dbg
clabby Aug 20, 2023
088e28f
lint
clabby Aug 20, 2023
190ce4f
Merge pull request #83 from anton-rs/clabby/fixes-r2
clabby Aug 20, 2023
8c2cfc9
Compatibility with L1 exec in tests
clabby Aug 20, 2023
62c55a3
Merge pull request #84 from anton-rs/clabby/fix-ex-prune-tests
clabby Aug 20, 2023
a95e2b0
Start cleaning up `no_tx_pool` impl
clabby Aug 20, 2023
5f5e290
Prevent considering pool txs in optimism payload builder if `no_tx_po…
clabby Aug 20, 2023
cacc785
Activate frontier - spurious dragon at block 0 on OP chains
clabby Aug 22, 2023
728420c
Do not activate Dao on OP
clabby Aug 22, 2023
4df55a8
Add arrow glacier and gray glacier
clabby Aug 22, 2023
cbbcbee
monkeypatch failed deposits (code dup; clean later)
clabby Aug 22, 2023
41c9de0
Clean up deposit tx failure
clabby Aug 23, 2023
254f9cd
Add `execute_transactions` to `BlockExecutor` trait
clabby Aug 23, 2023
1f842dd
Add executed tx even on EVM failure
clabby Aug 23, 2023
f5113cd
Merge pull request #85 from anton-rs/clabby/clean-up-no-tx-pool
refcell Aug 23, 2023
4c0148e
Gas diff fix
clabby Aug 24, 2023
026e590
Merge pull request #87 from anton-rs/clabby/gas-diff-fix
clabby Aug 24, 2023
a50995f
Fix receipts
clabby Aug 25, 2023
cc37eee
Try adding nonce to cfgenv
clabby Aug 25, 2023
5c9338e
Force nonce into tx env
clabby Aug 25, 2023
8f08db5
:broom:
clabby Aug 25, 2023
d9cc2be
Draft receipt hydration
clabby Aug 25, 2023
50ea8d8
Only hydrate L1 info in non-deposit receipts
clabby Aug 25, 2023
e228049
receipt hash test
refcell Aug 26, 2023
3ef39a9
receipt hash test
refcell Aug 26, 2023
5987a58
receipt hash test
refcell Aug 26, 2023
d31c04f
Add deposit receipt RLP roundtrip test
clabby Aug 26, 2023
13e6bc6
Remove deposit nonce when calculating the receipt root
clabby Aug 26, 2023
ab3438e
:broom: deposit nonce fix
clabby Aug 26, 2023
7b5934d
Merge pull request #89 from anton-rs/refcell/receipt-hash-test
clabby Aug 26, 2023
6c6e947
:broom: lint
clabby Aug 26, 2023
fb0fb11
:broom: x2
clabby Aug 26, 2023
eb21cb0
Merge pull request #88 from anton-rs/clabby/deposit-nonce-fix
refcell Aug 26, 2023
e256007
Fix gas accounting for reverting deposits
clabby Aug 27, 2023
3855777
Merge pull request #92 from anton-rs/fix/reverted-deposit-regolith-gas
refcell Aug 27, 2023
2dc300c
Fix halt
clabby Aug 27, 2023
9b1821f
Merge pull request #93 from anton-rs/fix/reverted-deposit-regolith-gas
refcell Aug 27, 2023
513bec2
Merge upstream
clabby Aug 27, 2023
de038f7
chore: lint
clabby Aug 28, 2023
7d311b8
Fix code lints
refcell Aug 28, 2023
e3f5e75
Merge branch 'clabby/merge-upstream' of github.com:anton-rs/op-reth i…
refcell Aug 28, 2023
475ccd0
Merge pull request #94 from anton-rs/clabby/merge-upstream
clabby Aug 28, 2023
7d5f543
Fix comments
refcell Aug 28, 2023
7869520
More comment fixes
refcell Aug 28, 2023
358669b
Merge pull request #95 from anton-rs/refcell/op-builder
clabby Aug 28, 2023
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
25 changes: 2 additions & 23 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,6 @@ c-kzg = { git = "https://github.com/ethereum/c-kzg-4844" }
### misc-testing
proptest = "1.0"
arbitrary = "1.1"

[patch."https://github.com/ethereum/c-kzg-4844"]
c-kzg = { git = "https://github.com/rjected/c-kzg-4844", branch = "dan/add-serde-feature" }
16 changes: 15 additions & 1 deletion bin/reth/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,28 @@ jemallocator = { version = "0.5.0", optional = true }
jemalloc-ctl = { version = "0.5.0", optional = true }

[features]
default = ["jemalloc"]
default = ["jemalloc", "ethereum"]
jemalloc = ["dep:jemallocator", "dep:jemalloc-ctl"]
jemalloc-prof = ["jemalloc", "jemallocator?/profiling"]
min-error-logs = ["tracing/release_max_level_error"]
min-warn-logs = ["tracing/release_max_level_warn"]
min-info-logs = ["tracing/release_max_level_info"]
min-debug-logs = ["tracing/release_max_level_debug"]
min-trace-logs = ["tracing/release_max_level_trace"]
optimism = [
"reth-primitives/optimism",
"reth-revm/optimism",
"reth-interfaces/optimism",
"reth-rpc/optimism",
"reth-rpc-engine-api/optimism",
"reth-transaction-pool/optimism",
"reth-provider/optimism",
"reth-beacon-consensus/optimism",
"reth-basic-payload-builder/optimism",
"reth-network/optimism",
"reth-network-api/optimism"
]
ethereum = []

[build-dependencies]
vergen = { version = "8.0.0", features = ["build", "cargo", "git", "gitcl"] }
6 changes: 6 additions & 0 deletions bin/reth/src/args/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,10 @@ pub use dev_args::DevArgs;
mod pruning_args;
pub use pruning_args::PruningArgs;

/// RollupArgs for configuring the op-reth rollup
#[cfg(feature = "optimism")]
mod rollup_args;
#[cfg(feature = "optimism")]
pub use rollup_args::RollupArgs;

pub mod utils;
21 changes: 21 additions & 0 deletions bin/reth/src/args/rollup_args.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//! clap [Args](clap::Args) for op-reth rollup configuration

/// Parameters for rollup configuration
#[derive(Debug, clap::Args)]
#[command(next_help_heading = "Rollup")]
pub struct RollupArgs {
/// HTTP endpoint for the sequencer mempool
#[arg(long = "rollup.sequencer-http", value_name = "HTTP_URL")]
pub sequencer_http: Option<String>,

/// Disable transaction pool gossip
#[arg(long = "rollup.disable-tx-pool-gossip")]
pub disable_txpool_gossip: bool,

/// By default the pending block equals the latest block
/// to save resources and not leak txs from the tx-pool,
/// this flag enables computing of the pending block
/// from the tx-pool instead.
#[arg(long = "rollup.compute-pending-block")]
pub compute_pending_block: bool,
}
11 changes: 11 additions & 0 deletions bin/reth/src/args/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ use std::{
time::Duration,
};

#[cfg(feature = "optimism")]
use reth_primitives::{BASE_GOERLI, BASE_MAINNET};

/// Helper to parse a [Duration] from seconds
pub fn parse_duration_from_secs(arg: &str) -> eyre::Result<Duration, std::num::ParseIntError> {
let seconds = arg.parse()?;
Expand All @@ -26,6 +29,10 @@ pub fn chain_spec_value_parser(s: &str) -> eyre::Result<Arc<ChainSpec>, eyre::Er
"goerli" => GOERLI.clone(),
"sepolia" => SEPOLIA.clone(),
"dev" => DEV.clone(),
#[cfg(feature = "optimism")]
"base_goerli" => BASE_GOERLI.clone(),
#[cfg(feature = "optimism")]
"base" => BASE_MAINNET.clone(),
_ => {
let raw = fs::read_to_string(PathBuf::from(shellexpand::full(s)?.into_owned()))?;
serde_json::from_str(&raw)?
Expand All @@ -41,6 +48,10 @@ pub fn genesis_value_parser(s: &str) -> eyre::Result<Arc<ChainSpec>, eyre::Error
"goerli" => GOERLI.clone(),
"sepolia" => SEPOLIA.clone(),
"dev" => DEV.clone(),
#[cfg(feature = "optimism")]
"base_goerli" => BASE_GOERLI.clone(),
#[cfg(feature = "optimism")]
"base" => BASE_MAINNET.clone(),
_ => {
let raw = fs::read_to_string(PathBuf::from(shellexpand::full(s)?.into_owned()))?;
let genesis: AllGenesisFormats = serde_json::from_str(&raw)?;
Expand Down
38 changes: 31 additions & 7 deletions bin/reth/src/cli/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,24 +76,39 @@ pub trait RethNodeCommandConfig: fmt::Debug {
pool: Pool,
executor: Tasks,
chain_spec: Arc<ChainSpec>,
#[cfg(feature = "optimism")] compute_pending_block: bool,
) -> eyre::Result<PayloadBuilderHandle>
where
Conf: PayloadBuilderConfig,
Provider: StateProviderFactory + BlockReaderIdExt + Clone + Unpin + 'static,
Pool: TransactionPool + Unpin + 'static,
Tasks: TaskSpawner + Clone + Unpin + 'static,
{
let payload_job_config = BasicPayloadJobGeneratorConfig::default()
.interval(conf.interval())
.deadline(conf.deadline())
.max_payload_tasks(conf.max_payload_tasks())
.extradata(conf.extradata_rlp_bytes())
.max_gas_limit(conf.max_gas_limit());

#[cfg(feature = "optimism")]
let payload_job_config = payload_job_config.compute_pending_block(compute_pending_block);

// The default payload builder is implemented on the unit type.
#[cfg(not(feature = "optimism"))]
let payload_builder = ();

// Optimism's payload builder is impelmented on the OptimismPayloadBuilder type.
#[cfg(feature = "optimism")]
let payload_builder = reth_basic_payload_builder::OptimismPayloadBuilder;

let payload_generator = BasicPayloadJobGenerator::new(
provider,
pool,
executor.clone(),
BasicPayloadJobGeneratorConfig::default()
.interval(conf.interval())
.deadline(conf.deadline())
.max_payload_tasks(conf.max_payload_tasks())
.extradata(conf.extradata_rlp_bytes())
.max_gas_limit(conf.max_gas_limit()),
payload_job_config,
chain_spec,
payload_builder,
);
let (payload_service, payload_builder) = PayloadBuilderService::new(payload_generator);

Expand Down Expand Up @@ -198,6 +213,7 @@ impl<T: RethNodeCommandConfig> RethNodeCommandConfig for NoArgs<T> {
pool: Pool,
executor: Tasks,
chain_spec: Arc<ChainSpec>,
#[cfg(feature = "optimism")] compute_pending_block: bool,
) -> eyre::Result<PayloadBuilderHandle>
where
Conf: PayloadBuilderConfig,
Expand All @@ -207,7 +223,15 @@ impl<T: RethNodeCommandConfig> RethNodeCommandConfig for NoArgs<T> {
{
self.inner_mut()
.ok_or_else(|| eyre::eyre!("config value must be set"))?
.spawn_payload_builder_service(conf, provider, pool, executor, chain_spec)
.spawn_payload_builder_service(
conf,
provider,
pool,
executor,
chain_spec,
#[cfg(feature = "optimism")]
compute_pending_block,
)
}
}

Expand Down
2 changes: 2 additions & 0 deletions bin/reth/src/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ mod tests {
genesis_hash: None,
paris_block_and_final_difficulty: None,
deposit_contract: None,
#[cfg(feature = "optimism")]
optimism: false,
..Default::default()
});

Expand Down
29 changes: 26 additions & 3 deletions bin/reth/src/node/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ pub struct NodeCommand<Ext: RethCliExt = ()> {
/// Additional cli arguments
#[clap(flatten)]
pub ext: Ext::Node,

/// Rollup related arguments
#[cfg(feature = "optimism")]
#[clap(flatten)]
rollup: crate::args::RollupArgs,
}

impl<Ext: RethCliExt> NodeCommand<Ext> {
Expand All @@ -175,6 +180,8 @@ impl<Ext: RethCliExt> NodeCommand<Ext> {
db,
dev,
pruning,
#[cfg(feature = "optimism")]
rollup,
..
} = self;
NodeCommand {
Expand All @@ -191,13 +198,20 @@ impl<Ext: RethCliExt> NodeCommand<Ext> {
dev,
pruning,
ext,
#[cfg(feature = "optimism")]
rollup,
}
}

/// Execute `node` command
pub async fn execute(mut self, ctx: CliContext) -> eyre::Result<()> {
info!(target: "reth::cli", "reth {} starting", SHORT_VERSION);

#[cfg(not(any(feature = "ethereum", feature = "optimism")))]
compile_error!(
"Either feature \"optimism\" or \"ethereum\" must be enabled for this crate."
);

// Raise the fd limit of the process.
// Does not do anything on windows.
raise_fd_limit();
Expand Down Expand Up @@ -331,6 +345,8 @@ impl<Ext: RethCliExt> NodeCommand<Ext> {
transaction_pool.clone(),
ctx.task_executor.clone(),
Arc::clone(&self.chain),
#[cfg(feature = "optimism")]
self.rollup.compute_pending_block,
)?;

let max_block = if let Some(block) = self.debug.max_block {
Expand Down Expand Up @@ -709,7 +725,8 @@ impl<Ext: RethCliExt> NodeCommand<Ext> {
secret_key: SecretKey,
default_peers_path: PathBuf,
) -> NetworkConfig<ProviderFactory<Arc<DatabaseEnv>>> {
self.network
let cfg_builder = self
.network
.network_config(config, self.chain.clone(), secret_key, default_peers_path)
.with_task_executor(Box::new(executor))
.set_head(head)
Expand All @@ -720,8 +737,14 @@ impl<Ext: RethCliExt> NodeCommand<Ext> {
.discovery_addr(SocketAddr::V4(SocketAddrV4::new(
Ipv4Addr::UNSPECIFIED,
self.network.discovery.port.unwrap_or(DEFAULT_DISCOVERY_PORT),
)))
.build(ProviderFactory::new(db, self.chain.clone()))
)));

#[cfg(feature = "optimism")]
let cfg_builder = cfg_builder
.sequencer_endpoint(self.rollup.sequencer_http.clone())
.disable_tx_gossip(self.rollup.disable_txpool_gossip);

cfg_builder.build(ProviderFactory::new(db, self.chain.clone()))
}

#[allow(clippy::too_many_arguments)]
Expand Down
4 changes: 3 additions & 1 deletion crates/consensus/auto-seal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ use reth_primitives::{
Header, ReceiptWithBloom, SealedBlock, SealedHeader, TransactionSigned, EMPTY_OMMER_ROOT, H256,
U256,
};
use reth_provider::{BlockReaderIdExt, CanonStateNotificationSender, PostState, StateProvider};
use reth_provider::{
BlockExecutor, BlockReaderIdExt, CanonStateNotificationSender, PostState, StateProvider,
};
use reth_revm::executor::Executor;
use reth_transaction_pool::TransactionPool;
use std::{
Expand Down
9 changes: 9 additions & 0 deletions crates/consensus/beacon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,12 @@ reth-revm = { path = "../../revm" }
reth-downloaders = { path = "../../net/downloaders" }

assert_matches = "1.5"

[features]
optimism = [
"reth-consensus-common/optimism",
"reth-primitives/optimism",
"reth-interfaces/optimism",
"reth-provider/optimism",
"reth-rpc-types/optimism",
]
Loading
Loading