-
Notifications
You must be signed in to change notification settings - Fork 166
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(sol!
): make #[sol(rpc)]
default if rpc
feat enabled
#852
base: main
Are you sure you want to change the base?
Conversation
sol-macro-expander
): make #[sol(rpc)]
defaultsol!
): make #[sol(rpc)]
default
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.
If the user has the contract
feature turned off, or if they haven't installed alloy-contract
, let's error / warning to prompt the user to do so
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.
Sorry but I disagree with this, just like with adding derives by default, this makes compilation a lot slower and it's counterintuitive to how the rest of the ecosystem works: derives are opt-in for extra functionality
The default codegen requires the minimum dependencies. RPC codegen is straight up not possible in many contexts like no_std, so this is also a breaking change.
sol!
): make #[sol(rpc)]
defaultsol!
): make #[sol(rpc)]
default if rpc
feat enabled
Motivation
Currently when expanding contracts in the
sol!
therpc
attribute is not enabled by default. Users must explicitly enable using#[sol(rpc)]
.Solution
Introduces
"rpc"
feature that is propagated fromalloy-core
toalloy-sol-macro-expander
.Enabling this feature expands the contract with RPC-related code.
Now, one can make use of
ContractInstance::new(addr, provider)
without having to specify#[sol(rpc)]
.RPC-related methods can be disabled using
#[sol(rpc = false)]
.Note: Enabling this by default requires the user to install
alloy-contract
.PR Checklist