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

console: use default APIs when server doesn't have rpc_modules #26267

Merged
merged 2 commits into from
Nov 28, 2022

Conversation

fjl
Copy link
Contributor

@fjl fjl commented Nov 28, 2022

This change was already proposed in #25148, but that PR got closed for some reason. I recently needed this functionality myself, so here we go again.

Copy link
Member

@MariusVanDerWijden MariusVanDerWijden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM, -32601 is the MethodNotFound error right? Could you document that, so it's easier to understand?

@s1na
Copy link
Contributor

s1na commented Nov 28, 2022

Just out of curiosity in what situation do you need this? i.e. when is rpc_modules not exposed?

@fjl
Copy link
Contributor Author

fjl commented Nov 28, 2022

The error happens with geth attach https://cloudflare-eth.com.

@@ -198,13 +199,22 @@ func (c *Console) initWeb3(bridge *bridge) error {
return err
}

var defaultAPIs = map[string]string{"eth": "1.0", "net": "1.0", "debug": "1.0"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd remove debug since it's not exposed by default.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd leave as much as possible -- even if it's not enabled. If we don't know whether it's enabled or not, at least we can leave it up to the user to figure out. Otherwise we'll basically deny access, with no way to enable it, and no way for the end-user to test if it works or not.

Copy link
Contributor

@s1na s1na left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fjl fjl merged commit 1b8a392 into ethereum:master Nov 28, 2022
@fjl fjl added this to the 1.11.0 milestone Nov 28, 2022
shekhirin pushed a commit to shekhirin/go-ethereum that referenced this pull request Jun 6, 2023
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.

4 participants