Skip to content
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 #852

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

yash-atreya
Copy link
Member

@yash-atreya yash-atreya commented Jan 9, 2025

Motivation

Currently when expanding contracts in the sol! the rpc attribute is not enabled by default. Users must explicitly enable using #[sol(rpc)].

Solution

Make rpc attribute set to true by default. This enables using 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

  • Added Tests
  • Added Documentation
  • Breaking changes

@yash-atreya yash-atreya changed the title feat(sol-macro-expander): make #[sol(rpc)] default feat(sol!): make #[sol(rpc)] default Jan 9, 2025
@yash-atreya yash-atreya marked this pull request as draft January 9, 2025 09:14
@yash-atreya yash-atreya marked this pull request as ready for review January 9, 2025 09:38
Copy link
Member

@gakonst gakonst left a 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

Copy link
Member

@DaniPopes DaniPopes left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants