-
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
Rework providers #5994
Rework providers #5994
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
public async handle( | ||
jsonRpcRequest: JsonRpcRequest, | ||
): Promise<JsonRpcRequest | JsonRpcResponse> { | ||
const response = await this.#resolveRequest(jsonRpcRequest); |
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 handler can modify a JSON-RPC request and return a JSON-RPC response. In the v2 implementation, the execution order first handled the response logic and then processed the request modification. I have retained the same approach here. See the v2 code here
@@ -0,0 +1,271 @@ | |||
import type { HttpNetworkHDAccountsConfig } from "../../../../../src/types/config.js"; |
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.
Are these e2e tests comprehensive enough, or is there an additional scenario you believe would be worth including?
// | ||
// EDR Network handles this in a more performant way, so we don't use | ||
// the AutomaticGasPrice for it. | ||
if (networkConfig.type === "http") { |
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.
Is this the if condition that can be removed because also supported in EDR networks?
See related issues 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.
Let's remove this one, but not the one in line 92. Let's let EDR handle the signing of transactions from its own accounts.
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.
Done here
v-next/hardhat/src/internal/builtin-plugins/network-manager/hook-handlers/network.ts
Outdated
Show resolved
Hide resolved
params: [ | ||
{ | ||
to: "0x0000000000000000000000000000000000000012", | ||
maxFeePerGas: "0x99", |
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 value here confuses me a bit. Why is it 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.
It's not strictly necessary. It's more of an additional check to be sure that there is no conflict with the logic if maxFeePerGas
is present. But it can be removed, I did it here
v-next/hardhat/test/internal/builtin-plugins/network-manager/request-handlers/e2e.ts
Outdated
Show resolved
Hide resolved
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 left a few comments, but this looks good. It's now definitely simpler to reason about it.
…ok-handlers/network.ts Co-authored-by: Patricio Palladino <[email protected]>
… into rework-providers
DESCRIPTION
This PR reworks the logic for the providers.
Main Points:
QUESTIONS