diff --git a/v-next/hardhat-keystore/src/internal/tasks/set.ts b/v-next/hardhat-keystore/src/internal/tasks/set.ts index 20c8bbf397..2e082b5a46 100644 --- a/v-next/hardhat-keystore/src/internal/tasks/set.ts +++ b/v-next/hardhat-keystore/src/internal/tasks/set.ts @@ -2,6 +2,8 @@ import type { KeystoreLoader } from "../types.js"; import type { HardhatRuntimeEnvironment } from "@ignored/hardhat-vnext/types/hre"; import type { NewTaskActionFunction } from "@ignored/hardhat-vnext/types/tasks"; +import chalk from "chalk"; + import { requestSecretInput } from "../ui/request-secret-input.js"; import { UserDisplayMessages } from "../ui/user-display-messages.js"; import { setupKeystoreLoaderFrom } from "../utils/setup-keystore-loader-from.js"; @@ -21,6 +23,8 @@ const taskSet: NewTaskActionFunction = async ( await set(setArgs, keystoreLoader); }; +export const PRINT_UNENCRYPTED_KEYSTORE_FILE_MESSAGE = true; + export const set = async ( { key, force }: TaskGetArguments, keystoreLoader: KeystoreLoader, @@ -45,6 +49,16 @@ export const set = async ( return; } + if (PRINT_UNENCRYPTED_KEYSTORE_FILE_MESSAGE) { + consoleLog( + chalk.red.bold(`***WARNING*** + + During the alpha of Hardhat v3 this plugin doesn't encrypt the keystore file. + + DO NO STORE SENSITIVE INFORMATION OR PRIVATE KEYS`), + ); + } + const secret = await requestSecretFromUser( UserDisplayMessages.enterSecretMessage(), ); diff --git a/v-next/hardhat-keystore/test/integration/tasks.ts b/v-next/hardhat-keystore/test/integration/tasks.ts index 5d6342e55d..86c92fd9e5 100644 --- a/v-next/hardhat-keystore/test/integration/tasks.ts +++ b/v-next/hardhat-keystore/test/integration/tasks.ts @@ -12,6 +12,7 @@ import { remove, writeJsonFile } from "@ignored/hardhat-vnext-utils/fs"; import hardhatKeystorePlugin from "../../src/index.js"; import { UnencryptedKeystore } from "../../src/internal/keystores/unencrypted-keystore.js"; +import { PRINT_UNENCRYPTED_KEYSTORE_FILE_MESSAGE } from "../../src/internal/tasks/set.js"; import { setupKeystoreFileLocationOverrideAt } from "../helpers/setup-keystore-file-location-override-at.js"; const keystoreFilePath = path.join( @@ -73,13 +74,16 @@ describe("integration tests for the keystore tasks", () => { ); }); - it("should display the setting of the key on `npx hardhat keystore set myNewKey`", async () => { - await _assertConsoleOutputMatchesFor( - () => hre.tasks.getTask(["keystore", "set"]).run({ key: "myNewKey" }), - "Enter secret to store: " + 'Key "myNewKey" set\n', - ["myNewValue\n"], - ); - }); + // Skipping as it doesn't pass because of a message + if (PRINT_UNENCRYPTED_KEYSTORE_FILE_MESSAGE !== true) { + it("should display the setting of the key on `npx hardhat keystore set myNewKey`", async () => { + await _assertConsoleOutputMatchesFor( + () => hre.tasks.getTask(["keystore", "set"]).run({ key: "myNewKey" }), + "Enter secret to store: " + 'Key "myNewKey" set\n', + ["myNewValue\n"], + ); + }); + } }); async function _overwriteKeystoreFileWith( diff --git a/v-next/hardhat/.prettierignore b/v-next/hardhat/.prettierignore index a0c7f3f8aa..b51ea5fc9d 100644 --- a/v-next/hardhat/.prettierignore +++ b/v-next/hardhat/.prettierignore @@ -1,4 +1,7 @@ /node_modules /dist -CHANGELOG.md +/CHANGELOG.md /templates/*/artifacts +/templates/*/cache +/test/fixture-projects/*/artifacts +/test/fixture-projects/*/cache diff --git a/v-next/hardhat/src/internal/builtin-plugins/network-manager/json-rpc-request-modifiers/accounts/local-accounts.ts b/v-next/hardhat/src/internal/builtin-plugins/network-manager/json-rpc-request-modifiers/accounts/local-accounts.ts index 79c0cc286b..28325b94c7 100644 --- a/v-next/hardhat/src/internal/builtin-plugins/network-manager/json-rpc-request-modifiers/accounts/local-accounts.ts +++ b/v-next/hardhat/src/internal/builtin-plugins/network-manager/json-rpc-request-modifiers/accounts/local-accounts.ts @@ -260,10 +260,14 @@ export class LocalAccounts extends ChainId { }; }); + // TODO: Fix after the alpha release + assertHardhatInvariant( + txData.to !== undefined, + "The alpha version doesn't support deploying contracts with local accounts yet", + ); + const checksummedAddress = addr.addChecksum( - txData.to !== undefined - ? bytesToHexString(txData.to).toLowerCase() - : "0x0", + bytesToHexString(txData.to).toLowerCase(), ); assertHardhatInvariant( diff --git a/v-next/hardhat/src/types/network.ts b/v-next/hardhat/src/types/network.ts index fa4233fec0..bc1ccbdce6 100644 --- a/v-next/hardhat/src/types/network.ts +++ b/v-next/hardhat/src/types/network.ts @@ -21,7 +21,7 @@ export type GenericChainType = "generic"; * `ChainTypeConfig` interface with a valid `ChainType` value. * For example: * ```ts - * declare module "@ignored/hardhat-vnext/types/config" { + * declare module "@ignored/hardhat-vnext/types/network" { * export interface ChainTypeConfig { * defaultChainType: "l1"; * }