smartcontractkit / chainlink

node of the decentralized oracle network, bridging on and off-chain computation
https://chain.link
Other
6.99k stars 1.7k forks source link

[DEVEL] VRFCoordinatorV2_5Mock is too large to deploy (eip-170: 24576 kb is reached) #13618

Closed zatarx closed 4 months ago

zatarx commented 4 months ago

Description Deployment script for VRFCoordinatorV2_5Mock causes an error that the contract is too large to deploy.

I would appreciate the insight if you have any to be able to use V2.5 contract. Your Environment

Dependencies:

npm list --depth=0 --dev
├── @chainlink/contracts@1.1.1
├── @nomicfoundation/hardhat-ethers@3.0.6
├── @nomiclabs/hardhat-ethers@npm:hardhat-deploy-ethers@0.4.2
├── @nomiclabs/hardhat-etherscan@3.1.8
├── @nomiclabs/hardhat-waffle@2.0.6
├── @trufflesuite/bigint-buffer@1.1.10 extraneous
├── @types/seedrandom@3.0.1 extraneous
├── catering@2.1.1 extraneous
├── chai@5.1.1
├── dotenv@16.4.5
├── ethereum-waffle@4.0.10
├── ethers@6.13.0
├── hardhat-contract-sizer@2.10.0
├── hardhat-deploy@0.12.4
├── hardhat-gas-reporter@2.2.0
├── hardhat@2.22.5
├── is-buffer@2.0.5 extraneous
├── leveldown@6.1.0 extraneous
├── napi-macros@2.0.0 extraneous
├── prettier-plugin-solidity@1.3.1
├── prettier@3.3.1
├── solhint@5.0.1
└── solidity-coverage@0.8.12

Deploy file:


const {network, ethers} = require("hardhat");
const { developmentChains } = require("../helper-hardhat-config");

// Test values that don't impact the test workflow
const BASE_FEE = ethers.parseEther("0.25"); // Sepolia set value
const GAS_PRICE_ARG = 1e9; // Setting a value at my own discretion
const WEI_PER_UNIT_LINK = 1e9;

module.exports = async function ({getNamedAccounts, deployments}) {
    const {deploy, log} = deployments;
    const {deployer} = await getNamedAccounts();

    if (developmentChains.includes(network.name)) {
        log("Local network detected! Deploying mocks...");
        // deploy a mock vrf coordinator)
        await deploy("VRFCoordinatorV2_5Mock", {
            contract: "VRFCoordinatorV2_5Mock",
            from: deployer,
            log: true,
            args: [BASE_FEE, GAS_PRICE_ARG, WEI_PER_UNIT_LINK]
        });
        log("Mocks deployed");
        log("-----------------------");
    }
}

module.exports.tags = ["all", "mocks"];

Basic Information I tried it in my native environment with hardhat deployment and Remix IDE. Hardhat local deployment fails while in Remix Cancun I was able to forcibly (I was prompted to confirm my transaction even though my contract was too large) deploy the contract.

This is the snippet of the error that I hit when I run hh deploy

hh deploy                                                                                   
15:16:06 [383/383]
Nothing to compile                                                                                                                                               
Local network detected! Deploying mocks...                                                                                                                       
An unexpected error occurred:

Error: ERROR processing /home/boss/Projects/hh-fcc/hardhat-smartcontract-lottery-fcc/deploy/00-deploy-mocks.js:                                                  
Error: cannot estimate gas; transaction may fail or may require manual gas limit [ See: https://links.ethers.org/v5-errors-
UNPREDICTABLE_GAS_LIMIT ] (reason="Transaction reverted: trying to deploy a contract whose code is too large",method="estimateGas", transaction={"from":"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266","data":"0x60e06040526001600e556064600f553480156200001b57600080fd5b50604051620069e7380380620
zatarx commented 4 months ago

I guess for my local use case, allowUnlimitedContractSize does the job