Skip to content

Commit

Permalink
Merge pull request #5971 from NomicFoundation/readonly-network-config
Browse files Browse the repository at this point in the history
chore: prevent network configuration properties from being modified
  • Loading branch information
galargh authored Nov 30, 2024
2 parents fd3b0cc + 484f1ca commit 8becb03
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class HardhatEthersProvider implements HardhatEthersProviderI {

readonly #hardhatProvider: EthereumProvider;
readonly #networkName: string;
readonly #networkConfig: NetworkConfig;
readonly #networkConfig: Readonly<NetworkConfig>;

// event-emitter related fields
#latestBlockNumberPolled: number | undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ interface Link {
export class HardhatHelpers {
readonly #provider: HardhatEthersProvider;
readonly #networkName: string;
readonly #networkConfig: NetworkConfig;
readonly #networkConfig: Readonly<NetworkConfig>;
readonly #artifactManager: ArtifactsManager;

constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import { isHttpNetworkConfig } from "./utils.js";
*/
export class JsonRpcRequestModifier {
readonly #provider: EthereumProvider;
readonly #networkConfig: NetworkConfig;
readonly #networkConfig: Readonly<NetworkConfig>;

// accounts
#localAccounts: LocalAccounts | undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class NetworkConnectionImplementation<
{
public readonly id: number;
public readonly networkName: string;
public readonly networkConfig: NetworkConfig;
public readonly networkConfig: Readonly<NetworkConfig>;
public readonly chainType: ChainTypeT;

#provider!: EthereumProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { isNetworkConfig, validateNetworkConfig } from "./type-validation.js";
export class NetworkManagerImplementation {
readonly #defaultNetwork: string;
readonly #defaultChainType: DefaultChainType;
readonly #networkConfigs: Record<string, NetworkConfig>;
readonly #networkConfigs: Readonly<Record<string, Readonly<NetworkConfig>>>;
readonly #hookManager: HookManager;

#nextConnectionId = 0;
Expand Down
2 changes: 1 addition & 1 deletion v-next/hardhat/src/types/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export interface NetworkConnection<
> {
readonly id: number;
readonly networkName: string;
readonly networkConfig: NetworkConfig;
readonly networkConfig: Readonly<NetworkConfig>;
readonly chainType: ChainTypeT;
readonly provider: EthereumProvider;

Expand Down

0 comments on commit 8becb03

Please sign in to comment.