-
Notifications
You must be signed in to change notification settings - Fork 2.2k
refactor: unify RpcOpts and EvmArgs common fields #11964
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
base: master
Are you sure you want to change the base?
refactor: unify RpcOpts and EvmArgs common fields #11964
Conversation
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.
Nice!
I didn’t expect someone else to propose a PR on this ahead of me. 😅
I’ve added a remark about the scope. This was the initial topic of discussion I wanted to open with #11962.
#[arg(long, value_name = "NO_RATE_LIMITS", visible_alias = "no-rate-limit")] | ||
#[serde(skip)] | ||
pub no_rpc_rate_limit: bool, | ||
} |
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.
While we do want url
, accept_invalid_certs
and rpc_timeout
in EvmArgs
, I'm not sure the other fields are needed/relevant ...
@mablr thanks for your review, really appreciate it! I've made changes, did you mean something like this? |
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.
Well, yes for the new struct you added. Then deduplicate...
Don't forget that you added new fields to EvmArgs
, they must be applied to the provider config spawned when using a command with evm args like forge script
(this may help: #11960 (review))
|
||
/// Limited RPC options for EVM-related commands that only need basic RPC functionality. | ||
#[derive(Clone, Debug, Default, Serialize, Parser)] | ||
pub struct EvmRpcOpts { |
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.
I think this should actually be what you called RpcCommonOpts
.
Then you could integrate this 3-field struct to both RpcOpts
/EvmArgs
.
|
||
/// Common RPC-related options that can be shared across different CLI commands. | ||
#[derive(Clone, Debug, Default, Serialize, Parser)] | ||
pub struct RpcCommonOpts { |
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.
You may remove this
Create RpcCommonOpts to share RPC-related fields between RpcOpts and EvmArgs,
resolving serialization conflicts and making the structures compatible.
Fixes #11962