-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Split node task in subtasks #874
Conversation
I think the only missing thing is creating a new provider if the network is not Can you take a look at this @wighawag? Thanks! Also, it would be great to give the users a way to stop the node, but I'm not sure how we can do it. Any ideas? |
I thought the same thing. One (not very elegant) solution is for the server to check all requests before delegating them to the handler and, if the request is |
Yes, that's the best I can come up with TBH. Maybe just make it super explicit, like |
7bbcfa0
to
3a9ece5
Compare
@alcuadrado this should be ready for review |
@@ -118,7 +257,7 @@ task(TASK_NODE, "Starts a JSON-RPC server on top of Hardhat Network") | |||
console.log(); |
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 these console.log calls should be placed in TASK_NODE_SERVER_READY
@@ -137,6 +276,8 @@ task(TASK_NODE, "Starts a JSON-RPC server on top of Hardhat Network") | |||
const networkConfig = config.networks[HARDHAT_NETWORK_NAME]; | |||
logHardhatNetworkAccounts(networkConfig); |
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.
Also, this should be in TASK_NODE_SERVER_READY
import { EIP1193Provider } from "../provider"; | ||
|
||
export interface JsonRpcServer { | ||
getProvider(name: string): EIP1193Provider; |
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.
This is only for testing purposes, so I don't think it should be placed here.
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.
Fixed 👍 close
isn't used in the task either, but I guess it makes sense to have it in the interface anyway, wdyt?
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.
Yes, I think that can be really useful for people overriding the tasks.
@@ -137,6 +276,8 @@ task(TASK_NODE, "Starts a JSON-RPC server on top of Hardhat Network") | |||
const networkConfig = config.networks[HARDHAT_NETWORK_NAME]; | |||
logHardhatNetworkAccounts(networkConfig); | |||
|
|||
await run(TASK_NODE_SERVER_READY, { provider, server }); |
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.
This task should receive the hostname and actual port.
|
||
const server = new JsonRpcServer(serverConfig); | ||
await run(TASK_NODE_SERVER_CREATED, { provider, server }); |
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.
This plugin should receive the hostname and port
I had a quick look, but this looks great! is the log enabled when the server start or on when the provider is created ? |
Thanks for your comments, @wighawag. Right now, you should override the get provider task, disable logging, do your things, and re enable logging. BTW, i think we should add the new method to this array, @fvictorio https://github.com/nomiclabs/buidler/blob/2.0/packages/hardhat-core/src/internal/hardhat-network/provider/provider.ts#L45 -- Otherwise the |
Co-authored-by: Patricio Palladino <[email protected]>
const { verbose = false, configPath } = event.extra ?? {}; | ||
const extra: { verbose?: boolean; configPath?: string } = | ||
event.extra ?? {}; | ||
const { verbose = false, configPath } = extra; |
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'm not sure why this stopped compiling, maybe the sentry dependency was updated for some reason?
Anyway, it seems like event.extra
values are unknown
now, so this is necessary.
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've seen this before. I think sentry is a bit sloppy with semver
No description provided.