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

cast is slow on OSX #6204

Closed
1 of 2 tasks
drortirosh opened this issue Nov 3, 2023 · 3 comments · Fixed by #6350
Closed
1 of 2 tasks

cast is slow on OSX #6204

drortirosh opened this issue Nov 3, 2023 · 3 comments · Fixed by #6350
Labels
C-cast Command: cast good first issue Good for newcomers T-bug Type: bug

Comments

@drortirosh
Copy link

Component

Cast

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

cast 0.2.0 (34f684d 2023-11-01T22:19:24.957042000Z)

What command(s) is the bug in?

time cast bn

Operating System

macOS (Apple Silicon)

Describe the bug

For some reason, network commands of cast are slow.
(all measures are against a local geth or anvil)

  • time cast to-hex takes ~25ms, but
  • time cast bn takes ~200 ms.
    In comparison, the equivalent curl takes ~15 ms
    time curl -H 'content-type: application/json' -d '{"id":1,"jsonrpc":"2.0","method":"eth_blockNumber"}' http://localhost:8545

I verified that it works better on a linux (google cloud) - 10ms for "to-hex" and 15 ms for "bn"

(note: I verified I use native "arm64" executables.

@drortirosh drortirosh added the T-bug Type: bug label Nov 3, 2023
@mattsse
Copy link
Member

mattsse commented Nov 3, 2023

I see, the issue here is that we're trying to resolve foundry config because the bn command also supports chain aliases.

we can make this a bit smarter though

instead of resolving the config:

let config = Config::from(&rpc);

we should check if URL argument is none (or a valid URL and no alias) and return localhost or that URL parameter, or the flashbots URL if --flashbots and don't resolve the config

@mattsse mattsse added good first issue Good for newcomers C-cast Command: cast labels Nov 3, 2023
@drortirosh
Copy link
Author

I still don't understand why this hurts OSx build, and don't the Linux version.
I also tried to add an alias

[rpc_endpoints]
local = "http://localhost:8545"

And all variants:

Take roughly the same.

@DaniPopes
Copy link
Member

Can reproduce as well. Profiling shows that 80% of the time is spent in rustls_native_certs::load_native_certs: https://share.firefox.dev/463tYIx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cast Command: cast good first issue Good for newcomers T-bug Type: bug
Projects
Archived in project
3 participants