diff --git a/packages/dev-utils/CHANGELOG.json b/packages/dev-utils/CHANGELOG.json index 7fbd44eb87..c9aa9a2ac1 100644 --- a/packages/dev-utils/CHANGELOG.json +++ b/packages/dev-utils/CHANGELOG.json @@ -7,7 +7,11 @@ "pr": 2031 }, { - "note": "Set `allowUnlimitedContractSize` option when creating a ganache provider", + "note": "Add `shouldAllowUnlimitedContractSize` to `Web3Config`.", + "pr": 2075 + }, + { + "note": "Add `UNLIMITED_CONTRACT_SIZE` to `EnvVars`.", "pr": 2075 } ] diff --git a/packages/dev-utils/src/env.ts b/packages/dev-utils/src/env.ts index 29e144be5e..50597c7495 100644 --- a/packages/dev-utils/src/env.ts +++ b/packages/dev-utils/src/env.ts @@ -6,6 +6,7 @@ export enum EnvVars { SolidityProfiler = 'SOLIDITY_PROFILER', SolidityRevertTrace = 'SOLIDITY_REVERT_TRACE', VerboseGanache = 'VERBOSE_GANACHE', + UnlimitedContractSize = 'UNLIMITED_CONTRACT_SIZE', } export const env = { diff --git a/packages/dev-utils/src/web3_factory.ts b/packages/dev-utils/src/web3_factory.ts index 9034a81476..943f20d3f3 100644 --- a/packages/dev-utils/src/web3_factory.ts +++ b/packages/dev-utils/src/web3_factory.ts @@ -19,6 +19,7 @@ export interface Web3Config { rpcUrl?: string; // default: localhost:8545 shouldUseFakeGasEstimate?: boolean; // default: true ganacheDatabasePath?: string; // default: undefined, creates a tmp dir + shouldAllowUnlimitedContractSize?: boolean; } export const web3Factory = { @@ -58,9 +59,7 @@ export const web3Factory = { new GanacheSubprovider({ vmErrorsOnRPCResponse: shouldThrowErrorsOnGanacheRPCResponse, db_path: config.ganacheDatabasePath, - // HACK(dorothy-zbornak): Mainnet gas limit is 8M, but ganache won't - // go beyond 7M, which means we can't deploy certain large contracts. - allowUnlimitedContractSize: true, + allowUnlimitedContractSize: config.shouldAllowUnlimitedContractSize, gasLimit: constants.GAS_LIMIT, logger, verbose: env.parseBoolean(EnvVars.VerboseGanache),