Skip to content

Commit c9c3e62

Browse files
authored
Merge pull request #7061 from NomicFoundation/chore/remove-unneeded-network-config
chore: remove `enableRip7212` from EDR config
2 parents ca160e5 + 72cfaff commit c9c3e62

File tree

7 files changed

+14
-153
lines changed

7 files changed

+14
-153
lines changed

.changeset/three-brooms-sip.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"hardhat": patch
3+
---
4+
5+
Remove `enableRip7212` from EDR network configuration ([#6182](https://github.com/NomicFoundation/hardhat/issues/6182))
6+
Remove `enableTransientStorage` from EDR network configuration ([#6182](https://github.com/NomicFoundation/hardhat/issues/6182))

v-next/hardhat/src/internal/builtin-plugins/network-manager/config-resolution.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,18 +86,13 @@ export function resolveEdrNetwork(
8686
networkConfig.allowUnlimitedContractSize ?? false,
8787
blockGasLimit: BigInt(networkConfig.blockGasLimit ?? 30_000_000n),
8888
coinbase: resolveCoinbase(networkConfig.coinbase),
89-
enableRip7212: networkConfig.enableRip7212 ?? false,
90-
enableTransientStorage: networkConfig.enableTransientStorage ?? false,
89+
9190
forking: resolveForkingConfig(
9291
networkConfig.forking,
9392
cachePath,
9493
resolveConfigurationVariable,
9594
),
96-
hardfork: resolveHardfork(
97-
networkConfig.hardfork,
98-
networkConfig.chainType,
99-
networkConfig.enableTransientStorage,
100-
),
95+
hardfork: resolveHardfork(networkConfig.hardfork, networkConfig.chainType),
10196
initialBaseFeePerGas: resolveInitialBaseFeePerGas(
10297
networkConfig.initialBaseFeePerGas,
10398
),
@@ -276,7 +271,6 @@ export async function resolveChainDescriptors(
276271
export function resolveHardfork(
277272
hardfork: string | undefined,
278273
chainType: ChainType | undefined = GENERIC_CHAIN_TYPE,
279-
_enableTransientStorage: boolean | undefined,
280274
): string {
281275
if (hardfork !== undefined) {
282276
return hardfork;

v-next/hardhat/src/internal/builtin-plugins/network-manager/edr/edr-provider.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import {
3030
opHardforkFromString,
3131
l1GenesisState,
3232
l1HardforkFromString,
33-
precompileP256Verify,
3433
} from "@ignored/edr-optimism";
3534
import {
3635
assertHardhatInvariant,
@@ -491,8 +490,6 @@ async function getProviderConfig(
491490
codeCoverage: coverageConfig,
492491
},
493492
ownedAccounts: ownedAccounts.map((account) => account.secretKey),
494-
precompileOverrides: networkConfig.enableRip7212
495-
? [precompileP256Verify()]
496-
: [],
493+
precompileOverrides: [],
497494
};
498495
}

v-next/hardhat/src/internal/builtin-plugins/network-manager/type-extensions/config.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ declare module "../../../../types/config.js" {
108108
allowUnlimitedContractSize?: boolean;
109109
blockGasLimit?: number | bigint;
110110
coinbase?: string;
111-
enableRip7212?: boolean;
112-
enableTransientStorage?: boolean;
113111
forking?: EdrNetworkForkingUserConfig;
114112
hardfork?: string;
115113
initialBaseFeePerGas?: number | bigint;
@@ -249,8 +247,6 @@ declare module "../../../../types/config.js" {
249247
allowUnlimitedContractSize: boolean;
250248
blockGasLimit: bigint;
251249
coinbase: Uint8Array;
252-
enableRip7212: boolean;
253-
enableTransientStorage: boolean;
254250
forking?: EdrNetworkForkingConfig;
255251
hardfork: string;
256252
initialBaseFeePerGas?: bigint;

v-next/hardhat/src/internal/builtin-plugins/network-manager/type-validation.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,6 @@ const edrNetworkUserConfigSchema = z.object({
304304
allowUnlimitedContractSize: z.optional(z.boolean()),
305305
blockGasLimit: z.optional(gasUnitUserConfigSchema),
306306
coinbase: z.optional(z.string()),
307-
enableRip7212: z.optional(z.boolean()),
308-
enableTransientStorage: z.optional(z.boolean()),
309307
forking: z.optional(edrNetworkForkingUserConfigSchema),
310308
hardfork: z.optional(z.string()),
311309
initialBaseFeePerGas: z.optional(gasUnitUserConfigSchema),
@@ -335,7 +333,6 @@ function refineEdrNetworkUserConfig(
335333
hardfork,
336334
minGasPrice,
337335
initialBaseFeePerGas,
338-
enableTransientStorage,
339336
} = networkConfig;
340337

341338
if (hardfork !== undefined && !isValidHardforkName(hardfork, chainType)) {
@@ -367,25 +364,6 @@ function refineEdrNetworkUserConfig(
367364
});
368365
}
369366
}
370-
371-
if (
372-
!hardforkGte(resolvedHardfork, L1HardforkName.CANCUN, chainType) &&
373-
enableTransientStorage === true
374-
) {
375-
ctx.addIssue({
376-
code: z.ZodIssueCode.custom,
377-
message: `'enableTransientStorage' is not supported for hardforks before 'cancun'. Please use a hardfork from 'cancun' onwards to enable this feature.`,
378-
});
379-
}
380-
if (
381-
hardforkGte(resolvedHardfork, L1HardforkName.CANCUN, chainType) &&
382-
enableTransientStorage === false
383-
) {
384-
ctx.addIssue({
385-
code: z.ZodIssueCode.custom,
386-
message: `'enableTransientStorage' must be enabled for hardforks 'cancun' or later. To disable this feature, use a hardfork before 'cancun'.`,
387-
});
388-
}
389367
}
390368

391369
if (

v-next/hardhat/test/internal/builtin-plugins/network-manager/config-resolution.ts

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,6 @@ describe("config-resolution", () => {
123123
allowBlocksWithSameTimestamp: true,
124124
allowUnlimitedContractSize: true,
125125
blockGasLimit: 20_000_000,
126-
enableRip7212: true,
127-
enableTransientStorage: true,
128126
initialDate: new Date(),
129127
loggingEnabled: true,
130128
minGasPrice: 10,
@@ -158,11 +156,6 @@ describe("config-resolution", () => {
158156
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- cast for testing
159157
BigInt(userConfig.blockGasLimit as number),
160158
);
161-
assert.equal(edrNetworkConfig.enableRip7212, userConfig.enableRip7212);
162-
assert.equal(
163-
edrNetworkConfig.enableTransientStorage,
164-
userConfig.enableTransientStorage,
165-
);
166159
assert.equal(edrNetworkConfig.initialDate, userConfig.initialDate);
167160
assert.equal(edrNetworkConfig.loggingEnabled, userConfig.loggingEnabled);
168161
assert.equal(
@@ -202,8 +195,6 @@ describe("config-resolution", () => {
202195
assert.equal(edrNetworkConfig.allowBlocksWithSameTimestamp, false);
203196
assert.equal(edrNetworkConfig.allowUnlimitedContractSize, false);
204197
assert.equal(edrNetworkConfig.blockGasLimit, 30_000_000n);
205-
assert.equal(edrNetworkConfig.enableRip7212, false);
206-
assert.equal(edrNetworkConfig.enableTransientStorage, false);
207198
const initialDate = new Date(edrNetworkConfig.initialDate);
208199
assert.ok(
209200
Math.abs(initialDate.getTime() - now.getTime()) < 1000,
@@ -773,25 +764,21 @@ describe("config-resolution", () => {
773764

774765
describe("resolveHardfork", () => {
775766
it("should return the hardfork if it is provided", () => {
776-
let hardfork = resolveHardfork(
777-
L1HardforkName.LONDON,
778-
L1_CHAIN_TYPE,
779-
true,
780-
);
767+
let hardfork = resolveHardfork(L1HardforkName.LONDON, L1_CHAIN_TYPE);
781768
assert.equal(hardfork, L1HardforkName.LONDON);
782769

783-
hardfork = resolveHardfork(L1HardforkName.LONDON, L1_CHAIN_TYPE, false);
770+
hardfork = resolveHardfork(L1HardforkName.LONDON, L1_CHAIN_TYPE);
784771
assert.equal(hardfork, L1HardforkName.LONDON);
785772
});
786773

787774
it("should return the current hardfork if no hardfork is provided", () => {
788-
let hardfork = resolveHardfork(undefined, L1_CHAIN_TYPE, true);
775+
let hardfork = resolveHardfork(undefined, L1_CHAIN_TYPE);
789776
assert.equal(hardfork, getCurrentHardfork(L1_CHAIN_TYPE));
790777

791-
hardfork = resolveHardfork(undefined, undefined, true);
778+
hardfork = resolveHardfork(undefined, undefined);
792779
assert.equal(hardfork, getCurrentHardfork(L1_CHAIN_TYPE));
793780

794-
hardfork = resolveHardfork(undefined, OPTIMISM_CHAIN_TYPE, true);
781+
hardfork = resolveHardfork(undefined, OPTIMISM_CHAIN_TYPE);
795782
assert.equal(hardfork, getCurrentHardfork(OPTIMISM_CHAIN_TYPE));
796783
});
797784
});

v-next/hardhat/test/internal/builtin-plugins/network-manager/network-manager.ts

Lines changed: 0 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1878,103 +1878,6 @@ describe("NetworkManagerImplementation", () => {
18781878
});
18791879
});
18801880

1881-
describe("enableRip7212", () => {
1882-
describe("edr config", () => {
1883-
it("should validate a valid network config", async () => {
1884-
let validationErrors = await validateNetworkUserConfig(
1885-
edrConfig({ enableRip7212: true }),
1886-
);
1887-
1888-
assertValidationErrors(validationErrors, []);
1889-
1890-
validationErrors = await validateNetworkUserConfig(
1891-
edrConfig({ enableRip7212: false }),
1892-
);
1893-
1894-
assertValidationErrors(validationErrors, []);
1895-
});
1896-
1897-
it("should not validate an invalid network config", async () => {
1898-
const validationErrors = await validateNetworkUserConfig(
1899-
edrConfig({ enableRip7212: "incorrect" }),
1900-
);
1901-
1902-
assertValidationErrors(validationErrors, [
1903-
{
1904-
path: ["networks", "hardhat", "enableRip7212"],
1905-
message: "Expected boolean, received string",
1906-
},
1907-
]);
1908-
});
1909-
});
1910-
});
1911-
1912-
describe("enableTransientStorage", () => {
1913-
describe("edr config", () => {
1914-
it("should validate a valid network config", async () => {
1915-
let validationErrors = await validateNetworkUserConfig(
1916-
edrConfig({ enableTransientStorage: true }),
1917-
);
1918-
1919-
assertValidationErrors(validationErrors, []);
1920-
1921-
validationErrors = await validateNetworkUserConfig(
1922-
edrConfig({ enableTransientStorage: false, hardfork: "berlin" }),
1923-
);
1924-
1925-
assertValidationErrors(validationErrors, []);
1926-
});
1927-
1928-
it("should not validate an invalid network config", async () => {
1929-
let validationErrors = await validateNetworkUserConfig(
1930-
edrConfig({ enableTransientStorage: true, hardfork: "berlin" }),
1931-
);
1932-
1933-
assertValidationErrors(validationErrors, [
1934-
{
1935-
path: ["networks", "hardhat"],
1936-
message:
1937-
"'enableTransientStorage' is not supported for hardforks before 'cancun'. Please use a hardfork from 'cancun' onwards to enable this feature.",
1938-
},
1939-
]);
1940-
1941-
validationErrors = await validateNetworkUserConfig(
1942-
edrConfig({ enableTransientStorage: false, hardfork: "cancun" }),
1943-
);
1944-
1945-
assertValidationErrors(validationErrors, [
1946-
{
1947-
path: ["networks", "hardhat"],
1948-
message:
1949-
"'enableTransientStorage' must be enabled for hardforks 'cancun' or later. To disable this feature, use a hardfork before 'cancun'.",
1950-
},
1951-
]);
1952-
1953-
validationErrors = await validateNetworkUserConfig(
1954-
edrConfig({ enableTransientStorage: "incorrect" }),
1955-
);
1956-
1957-
assertValidationErrors(validationErrors, [
1958-
{
1959-
path: ["networks", "hardhat", "enableTransientStorage"],
1960-
message: "Expected boolean, received string",
1961-
},
1962-
]);
1963-
1964-
validationErrors = await validateNetworkUserConfig(
1965-
edrConfig({ enableTransientStorage: "incorrect" }),
1966-
);
1967-
1968-
assertValidationErrors(validationErrors, [
1969-
{
1970-
path: ["networks", "hardhat", "enableTransientStorage"],
1971-
message: "Expected boolean, received string",
1972-
},
1973-
]);
1974-
});
1975-
});
1976-
});
1977-
19781881
describe("forking", () => {
19791882
describe("edr config", () => {
19801883
it("should validate a valid network config", async () => {

0 commit comments

Comments
 (0)