-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[Investigation] Config overrides should be based on merging the user config, not the resolved #6490
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
v-next/hardhat/src/internal/builtin-plugins/network-manager/hook-handlers/hre.ts
Outdated
Show resolved
Hide resolved
v-next/hardhat/src/internal/builtin-plugins/network-manager/config-resolution.ts
Outdated
Show resolved
Hide resolved
v-next/hardhat/src/internal/builtin-plugins/network-manager/network-manager.ts
Outdated
Show resolved
Hide resolved
* @param resolveConfigurationVariable A function to resolve configuration variables. | ||
* @returns A Partial<NetworkConfig> containing the resolved values from the override. | ||
*/ | ||
export function resolveNetworkConfigOverride( |
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 method was removed as the validation logic has been simplified.
The user config is now merged with the Hardhat config and fully re-validated (so pickResolvedFromOverrides
can be deleted too). Instead of selectively resolving overrides, it's sufficient to use resolveHttpNetwork
or resolveEdrNetwork
.
|
||
export default async (): Promise<Partial<HardhatRuntimeEnvironmentHooks>> => ({ | ||
created: async (context, hre) => { | ||
let networkManager: NetworkManager | undefined; | ||
|
||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- although `userConfig` is present on the hre, it isn’t typed in the official definition | ||
const userConfigNetworks = (hre as HardhatRuntimeEnvironmentImplementation) |
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 it expected to have userConfig
in hre
, or is this an error? Is it expected but intentionally left untyped to discourage users from accessing it?
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.
@alcuadrado can you clarify this?
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.
oh, this was clarified on slack. This should be properly declared in the HRE type.
…lify-user-config-override
networkConfigOverride, | ||
this.#networkConfigs[resolvedNetworkName], | ||
); | ||
const newConfig = mergeConfigOverride( |
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 this logic, mergeConfigOverride
is probably now outdated. What do you think, @schaable ?
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 how we could do with a deep merge, without anything fancy.
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 doesn't seem like we have a deep merge in hh-utils
. Should I add one?
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 would say go for it, but keep it simple. You can probably reuse the mergeConfigOverride
code. I'd leave functions, symbols, and classes out, since we probably don't want to merge those.
…lify-user-config-override
No description provided.