-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: integrate EngineArgs into NodeCommand #13748
Merged
+99
−124
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2c51f38
feat: integrate EngineArgs into NodeCommand
htiennv 150a7e0
fix reviews
htiennv acae08f
Merge branch 'main' into node-command
mattsse ff26a99
add back arg
mattsse a5b91ad
rm conflicts with
mattsse 262ccdd
update ref
mattsse File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
//! clap [Args](clap::Args) for engine purposes | ||
|
||
use clap::Args; | ||
|
||
use crate::node_config::{DEFAULT_MEMORY_BLOCK_BUFFER_TARGET, DEFAULT_PERSISTENCE_THRESHOLD}; | ||
|
||
/// Parameters for configuring the engine | ||
#[derive(Debug, Clone, Args, PartialEq, Eq)] | ||
#[command(next_help_heading = "Engine")] | ||
pub struct EngineArgs { | ||
/// Configure persistence threshold for engine experimental. | ||
#[arg(long = "engine.persistence-threshold", conflicts_with = "legacy", default_value_t = DEFAULT_PERSISTENCE_THRESHOLD)] | ||
pub persistence_threshold: u64, | ||
|
||
/// Configure the target number of blocks to keep in memory. | ||
#[arg(long = "engine.memory-block-buffer-target", conflicts_with = "legacy", default_value_t = DEFAULT_MEMORY_BLOCK_BUFFER_TARGET)] | ||
pub memory_block_buffer_target: u64, | ||
|
||
/// Enable state root task | ||
#[arg(long = "engine.state-root-task", conflicts_with = "legacy")] | ||
pub state_root_task_enabled: bool, | ||
} | ||
|
||
impl Default for EngineArgs { | ||
fn default() -> Self { | ||
Self { | ||
persistence_threshold: DEFAULT_PERSISTENCE_THRESHOLD, | ||
memory_block_buffer_target: DEFAULT_MEMORY_BLOCK_BUFFER_TARGET, | ||
state_root_task_enabled: false, | ||
} | ||
} | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
use clap::Parser; | ||
|
||
/// A helper type to parse Args more easily | ||
#[derive(Parser)] | ||
struct CommandParser<T: Args> { | ||
#[command(flatten)] | ||
args: T, | ||
} | ||
|
||
#[test] | ||
fn test_parse_engine_args() { | ||
let default_args = EngineArgs::default(); | ||
let args = CommandParser::<EngineArgs>::parse_from(["reth"]).args; | ||
assert_eq!(args, default_args); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can probably make this a function of builder or config?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, specifically it'd be nice if in the Optimism config we could instantiate
TreeConfig
fromRollupArgs
somehow, so that we don't need this: https://github.com/paradigmxyz/reth/blob/main/crates/optimism/bin/src/main.rs#L26-L41Ideally this https://github.com/paradigmxyz/reth/blob/main/crates/optimism/bin/src/main.rs#L26C12-L39 becomes
builder.node(OpNode::new(rollup_args))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for review