From 484f1ca1b3c74d03590ca5afb62bdb8dcc1ac21f Mon Sep 17 00:00:00 2001 From: galargh Date: Fri, 22 Nov 2024 11:37:43 +0100 Subject: [PATCH] chore: prevent network configuration properties from being modified --- .../internal/hardhat-ethers-provider/hardhat-ethers-provider.ts | 2 +- .../src/internal/hardhat-helpers/hardhat-helpers.ts | 2 +- .../json-rpc-request-modifiers/json-rpc-request-modifier.ts | 2 +- .../builtin-plugins/network-manager/network-connection.ts | 2 +- .../internal/builtin-plugins/network-manager/network-manager.ts | 2 +- v-next/hardhat/src/types/network.ts | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/v-next/hardhat-ethers/src/internal/hardhat-ethers-provider/hardhat-ethers-provider.ts b/v-next/hardhat-ethers/src/internal/hardhat-ethers-provider/hardhat-ethers-provider.ts index 39a736b2ba..5c84348fc1 100644 --- a/v-next/hardhat-ethers/src/internal/hardhat-ethers-provider/hardhat-ethers-provider.ts +++ b/v-next/hardhat-ethers/src/internal/hardhat-ethers-provider/hardhat-ethers-provider.ts @@ -85,7 +85,7 @@ export class HardhatEthersProvider implements HardhatEthersProviderI { readonly #hardhatProvider: EthereumProvider; readonly #networkName: string; - readonly #networkConfig: NetworkConfig; + readonly #networkConfig: Readonly; // event-emitter related fields #latestBlockNumberPolled: number | undefined; diff --git a/v-next/hardhat-ethers/src/internal/hardhat-helpers/hardhat-helpers.ts b/v-next/hardhat-ethers/src/internal/hardhat-helpers/hardhat-helpers.ts index 3f519c75f1..197f176852 100644 --- a/v-next/hardhat-ethers/src/internal/hardhat-helpers/hardhat-helpers.ts +++ b/v-next/hardhat-ethers/src/internal/hardhat-helpers/hardhat-helpers.ts @@ -27,7 +27,7 @@ interface Link { export class HardhatHelpers { readonly #provider: HardhatEthersProvider; readonly #networkName: string; - readonly #networkConfig: NetworkConfig; + readonly #networkConfig: Readonly; readonly #artifactManager: ArtifactsManager; constructor( diff --git a/v-next/hardhat/src/internal/builtin-plugins/network-manager/json-rpc-request-modifiers/json-rpc-request-modifier.ts b/v-next/hardhat/src/internal/builtin-plugins/network-manager/json-rpc-request-modifiers/json-rpc-request-modifier.ts index f44baaacb5..28d552a761 100644 --- a/v-next/hardhat/src/internal/builtin-plugins/network-manager/json-rpc-request-modifiers/json-rpc-request-modifier.ts +++ b/v-next/hardhat/src/internal/builtin-plugins/network-manager/json-rpc-request-modifiers/json-rpc-request-modifier.ts @@ -35,7 +35,7 @@ import { isHttpNetworkConfig } from "./utils.js"; */ export class JsonRpcRequestModifier { readonly #provider: EthereumProvider; - readonly #networkConfig: NetworkConfig; + readonly #networkConfig: Readonly; // accounts #localAccounts: LocalAccounts | undefined; diff --git a/v-next/hardhat/src/internal/builtin-plugins/network-manager/network-connection.ts b/v-next/hardhat/src/internal/builtin-plugins/network-manager/network-connection.ts index 2bd92a87f5..26d301f0f6 100644 --- a/v-next/hardhat/src/internal/builtin-plugins/network-manager/network-connection.ts +++ b/v-next/hardhat/src/internal/builtin-plugins/network-manager/network-connection.ts @@ -12,7 +12,7 @@ export class NetworkConnectionImplementation< { public readonly id: number; public readonly networkName: string; - public readonly networkConfig: NetworkConfig; + public readonly networkConfig: Readonly; public readonly chainType: ChainTypeT; #provider!: EthereumProvider; diff --git a/v-next/hardhat/src/internal/builtin-plugins/network-manager/network-manager.ts b/v-next/hardhat/src/internal/builtin-plugins/network-manager/network-manager.ts index 0210facf89..f70ba7c2d4 100644 --- a/v-next/hardhat/src/internal/builtin-plugins/network-manager/network-manager.ts +++ b/v-next/hardhat/src/internal/builtin-plugins/network-manager/network-manager.ts @@ -20,7 +20,7 @@ import { isNetworkConfig, validateNetworkConfig } from "./type-validation.js"; export class NetworkManagerImplementation { readonly #defaultNetwork: string; readonly #defaultChainType: DefaultChainType; - readonly #networkConfigs: Record; + readonly #networkConfigs: Readonly>>; readonly #hookManager: HookManager; #nextConnectionId = 0; diff --git a/v-next/hardhat/src/types/network.ts b/v-next/hardhat/src/types/network.ts index bc1ccbdce6..22bff2a815 100644 --- a/v-next/hardhat/src/types/network.ts +++ b/v-next/hardhat/src/types/network.ts @@ -53,7 +53,7 @@ export interface NetworkConnection< > { readonly id: number; readonly networkName: string; - readonly networkConfig: NetworkConfig; + readonly networkConfig: Readonly; readonly chainType: ChainTypeT; readonly provider: EthereumProvider;