-
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
Hardhat-keystore #5654
Hardhat-keystore #5654
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
74935e5
to
9c1b9fa
Compare
9c1b9fa
to
9257d82
Compare
…ndation/hardhat into features/keystore-first-version
…ures/keystore-first-version
…ndation/hardhat into features/keystore-first-version
The user interactions and user interruptions abstractions have been replaced. There is now a static class of user messages (gathering the messages in one place. In each of the tasks, the messages are written to cli via console.log (with a layer of indirection).
@@ -0,0 +1,53 @@ | |||
import { HardhatError } from "@ignored/hardhat-vnext-errors"; | |||
|
|||
export async function requestSecretInput( |
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.
For a follow-up PR: I think we should move this to utils, we have similar things in a few places, including one implementation that uses enquirer.
…ures/keystore-first-version
Task description
This PR implements the main logic for the the Hardhat keystore. The encryption part will be added in a separate PR.
The technical design doc can be found here.
Manual Testing
The keystore plugin has been added to the example project.
You can run the following command from there:
Implementation considerations
The plugin is modeled as:
The configuration variable hooks read from a keystore if present, and defer to the next config variable hook otherwise. The configuration variables cache the keystore between runs with shared state in the hook. The loader is shared, which itself has caching capabilities.
The tasks have no task level caching, the intention being to run as isolated tasks.
We are setting the
process.exitCode
within tasks where there is a failure (e.g. getting a non-existant key). This leads to some ugliness in tests were the process exit code has to be reset.The file read from disk by the loader is validated with zod based on the format specified in the types file.
In CI environments a "empty" keystore plugin is returned from the
./index.ts
file. It has not hooks or tasks, which effectively turns off the plugin in CI. A test has been added that asserts different results between local development and CI to test this case.TODO
configuration-variables.ts
, are we missing a test or do we reconsider logicgetConfigDir
to hh-utils (@ChristopherDedominici) - depends on this PRsetupPassword
(@ChristopherDedominici)