Uniswap / hardhat-v3-deploy

Hardhat plugin for Uniswap V3 deployment
MIT License
78 stars 93 forks source link

Error: invalid bytecode (argument="bytecode", value="0x60c0604052...") #5

Closed amintalebi closed 1 year ago

amintalebi commented 2 years ago

Hi I'm getting following error when I'm trying deploy the contracts.

 at Logger.makeError (/Users/amin/Development/uniswapv3-develop/node_modules/@ethersproject/logger/src.ts/index.ts:225:28)
    at Logger.throwError (/Users/amin/Development/uniswapv3-develop/node_modules/@ethersproject/logger/src.ts/index.ts:237:20)
    at Logger.throwArgumentError (/Users/amin/Development/uniswapv3-develop/node_modules/@ethersproject/logger/src.ts/index.ts:241:21)
    at new ContractFactory (/Users/amin/Development/uniswapv3-develop/node_modules/@ethersproject/contracts/src.ts/index.ts:1162:20)
    at UniswapV3Deployer.deployContract (/Users/amin/Development/uniswapv3-develop/node_modules/uniswap-v3-deploy-plugin/src/deployer/UniswapV3Deployer.ts:139:21)
    at UniswapV3Deployer.deployPositionDescriptor (/Users/amin/Development/uniswapv3-develop/node_modules/uniswap-v3-deploy-plugin/src/deployer/UniswapV3Deployer.ts:112:24)
    at Function.deploy (/Users/amin/Development/uniswapv3-develop/node_modules/uniswap-v3-deploy-plugin/src/deployer/UniswapV3Deployer.ts:27:47)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at runNextTicks (node:internal/process/task_queues:65:3)
    at listOnTimeout (node:internal/timers:526:9) {
  reason: 'invalid bytecode',
  code: 'INVALID_ARGUMENT',
  argument: 'bytecode',

Thanks

elhaix commented 2 years ago

I'm experiencing the exact same issue. Initially I was using Node v17.2.0 which rendered the following error:

C:\DEV\uniswap-example>npx hardhat deploy-uniswap
An unexpected error occurred:

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:67:19)
    at Object.createHash (node:crypto:130:10)
    at hash160 (C:\DEV\uniswap-example\node_modules\ethereum-cryptography\vendor\hdkey-without-crypto.js:249:21)
    at HDKey.set (C:\DEV\uniswap-example\node_modules\ethereum-cryptography\vendor\hdkey-without-crypto.js:50:24)
    at Function.HDKey.fromMasterSeed (C:\DEV\uniswap-example\node_modules\ethereum-cryptography\vendor\hdkey-without-crypto.js:194:20)
    at deriveKeyFromMnemonicAndPath (C:\DEV\uniswap-example\node_modules\hardhat\src\internal\util\keys-derivation.ts:21:27)
    at derivePrivateKeys (C:\DEV\uniswap-example\node_modules\hardhat\src\internal\core\providers\util.ts:29:52)
    at normalizeHardhatNetworkAccountsConfig (C:\DEV\uniswap-example\node_modules\hardhat\src\internal\core\providers\util.ts:56:10)
    at createProvider (C:\DEV\uniswap-example\node_modules\hardhat\src\internal\core\providers\construction.ts:78:59)
    at C:\DEV\uniswap-example\node_modules\hardhat\src\internal\core\runtime-environment.ts:80:28 {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

I downgraded to node v16.13.1 and that's when I got the same error:

image

And adds the following info:

...164736f6c6343000706000a", code=INVALID_ARGUMENT, version=contracts/5.5.0)
    at Logger.makeError (C:\DEV\uniswap-example\node_modules\@ethersproject\logger\src.ts\index.ts:225:28)
    at Logger.throwError (C:\DEV\uniswap-example\node_modules\@ethersproject\logger\src.ts\index.ts:237:20)
    at Logger.throwArgumentError (C:\DEV\uniswap-example\node_modules\@ethersproject\logger\src.ts\index.ts:241:21)
    at new ContractFactory (C:\DEV\uniswap-example\node_modules\@ethersproject\contracts\src.ts\index.ts:1162:20)
    at UniswapV3Deployer.deployContract (C:\DEV\uniswap-example\node_modules\uniswap-v3-deploy-plugin\src\deployer\UniswapV3Deployer.ts:139:21)
    at UniswapV3Deployer.deployPositionDescriptor (C:\DEV\uniswap-example\node_modules\uniswap-v3-deploy-plugin\src\deployer\UniswapV3Deployer.ts:112:24)
    at Function.deploy (C:\DEV\uniswap-example\node_modules\uniswap-v3-deploy-plugin\src\deployer\UniswapV3Deployer.ts:27:47)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at runNextTicks (node:internal/process/task_queues:65:3)
    at listOnTimeout (node:internal/timers:526:9) {
  reason: 'invalid bytecode',
  code: 'INVALID_ARGUMENT',
  argument: 'bytecode',
  value: '0x60c060405234801561001057600080fd5b5060405161158038038061158083398101604081905261002f9161004a565b60609190911b6001600160601b0319...

I recompiled, same thing.

npx hardhat: "deploy-uniswap" appears in the tasks.

Mubashir-ali-baig commented 2 years ago

I'm also facing the exact same problem, can anybody please guide as my unit tests are fully depended on this one.

5hanth commented 2 years ago

+1

nimcon commented 2 years ago

+1

pengjichen commented 2 years ago

There's a push request for modify constructor function to add a parameter: https://github.com/Uniswap/v3-periphery/commit/de4e437ae97ba21d71a856167968ea05a05853fe#diff-b3b935014f582f4d5c57708462aded987557ad530fecb876901a395eb84bc2f4. The code that deploys the contract NonfungibleTokenPositionDescriptor.sol needs to be updated.

gravity-link commented 2 years ago

There's a push request for modify constructor function to add a parameter: Uniswap/v3-periphery@de4e437#diff-b3b935014f582f4d5c57708462aded987557ad530fecb876901a395eb84bc2f4. The code that deploys the contract NonfungibleTokenPositionDescriptor.sol needs to be updated.

still 'invalid bytecode', seems not work.

gillestasse commented 2 years ago

Had the same issue.

My dependencies looked like : "dependencies": { "@openzeppelin/contracts": "^4.4.2", "@openzeppelin/contracts-upgradeable": "^4.4.2", "@uniswap/v3-periphery": "^1.4.0", "bignumber.js": "^9.0.2", "dotenv": "^11.0.0", "uniswap-v3-deploy-plugin": "^0.1.0" }

I downgraded and installed to :

"dependencies": { "@openzeppelin/contracts": "^4.4.2", "@openzeppelin/contracts-upgradeable": "^4.4.2", "@uniswap/v3-core": "^1.0.0", "@uniswap/v3-periphery": "^1.0.1", "bignumber.js": "^9.0.2", "dotenv": "^11.0.0", "uniswap-v3-deploy-plugin": "^0.1.0" }

And now it works

bradj00 commented 2 years ago

Had the same issue.

My dependencies looked like : "dependencies": { "@openzeppelin/contracts": "^4.4.2", "@openzeppelin/contracts-upgradeable": "^4.4.2", "@uniswap/v3-periphery": "^1.4.0", "bignumber.js": "^9.0.2", "dotenv": "^11.0.0", "uniswap-v3-deploy-plugin": "^0.1.0" }

I downgraded and installed to :

"dependencies": { "@openzeppelin/contracts": "^4.4.2", "@openzeppelin/contracts-upgradeable": "^4.4.2", "@uniswap/v3-core": "^1.0.0", "@uniswap/v3-periphery": "^1.0.1", "bignumber.js": "^9.0.2", "dotenv": "^11.0.0", "uniswap-v3-deploy-plugin": "^0.1.0" }

And now it works

What did you downgrade, your node version? I have the same problem and modified my package.json to your suggested versions but I still get the same complaint:

/Hardhat$ npx hardhat deploy-uniswap
An unexpected error occurred:

Error: invalid bytecode...

Node v16.13.1 nvm v0.35.1

package.json

{
  "devDependencies": {
    "@nomiclabs/hardhat-ethers": "^2.0.5",
    "@nomiclabs/hardhat-waffle": "^2.0.3",
    "chai": "^4.3.6",
    "ethereum-waffle": "^3.4.0",
    "ethers": "^5.6.1",
    "hardhat": "^2.9.1"
  },
  "dependencies": {
    "@openzeppelin/contracts": "^4.4.2",
    "@openzeppelin/contracts-upgradeable": "^4.4.2",
    "@uniswap/v3-core": "^1.0.0",
    "@uniswap/v3-periphery": "^1.0.1",
    "bignumber.js": "^9.0.2",
    "dotenv": "^11.0.0",
    "uniswap-v3-deploy-plugin": "^0.1.0"
    }
}
zed-wong commented 2 years ago

image

Had the same issue.

hotdogchain commented 2 years ago

+1

beihaili commented 2 years ago

same

cryptoshan12 commented 2 years ago

same here

FracaShaw-Alk commented 2 years ago

same here

baotao2006 commented 1 year ago

change two points: $ vi src/deployer/UniswapV3Deployer.ts

async deployPositionDescriptor(
    nftDescriptorLibraryAddress: string,
    weth9Address: string
  ) {
    const linkedBytecode = linkLibraries(
      {
        bytecode: artifacts.NonfungibleTokenPositionDescriptor.bytecode,
        linkReferences: {
          "NFTDescriptor.sol": {
            NFTDescriptor: [
              {
                length: 20,
                start: 1681,  // old value is 1261
              },
            ],
          },
        },
      },
      {
        NFTDescriptor: nftDescriptorLibraryAddress,
      }
    );

    return (await this.deployContract(
      artifacts.NonfungibleTokenPositionDescriptor.abi,
      linkedBytecode,
      // 'ETH' as a bytes32 string
      [weth9Address, '0x4554480000000000000000000000000000000000000000000000000000000000'],
      this.deployer
    )) as Contract;
  }
vladimir-trifonov commented 1 year ago

Try with:

"dependencies": {
"@openzeppelin/contracts": "4.4.2",
"@openzeppelin/contracts-upgradeable": "4.4.2",
"@uniswap/v3-core": "1.0.0",
"@uniswap/v3-periphery": "1.0.1",
"bignumber.js": "9.0.2",
"dotenv": "11.0.0",
"uniswap-v3-deploy-plugin": "0.1.0"
}
StrawberryChocolateFudge commented 1 year ago

change two points: $ vi src/deployer/UniswapV3Deployer.ts

async deployPositionDescriptor(
    nftDescriptorLibraryAddress: string,
    weth9Address: string
  ) {
    const linkedBytecode = linkLibraries(
      {
        bytecode: artifacts.NonfungibleTokenPositionDescriptor.bytecode,
        linkReferences: {
          "NFTDescriptor.sol": {
            NFTDescriptor: [
              {
                length: 20,
                start: 1681,  // old value is 1261
              },
            ],
          },
        },
      },
      {
        NFTDescriptor: nftDescriptorLibraryAddress,
      }
    );

    return (await this.deployContract(
      artifacts.NonfungibleTokenPositionDescriptor.abi,
      linkedBytecode,
      // 'ETH' as a bytes32 string
      [weth9Address, '0x4554480000000000000000000000000000000000000000000000000000000000'],
      this.deployer
    )) as Contract;
  }

This was the correct solution! Thank you so much!

vspaxo commented 1 year ago

change two points: $ vi src/deployer/UniswapV3Deployer.ts

async deployPositionDescriptor(
    nftDescriptorLibraryAddress: string,
    weth9Address: string
  ) {
    const linkedBytecode = linkLibraries(
      {
        bytecode: artifacts.NonfungibleTokenPositionDescriptor.bytecode,
        linkReferences: {
          "NFTDescriptor.sol": {
            NFTDescriptor: [
              {
                length: 20,
                start: 1681,  // old value is 1261
              },
            ],
          },
        },
      },
      {
        NFTDescriptor: nftDescriptorLibraryAddress,
      }
    );

    return (await this.deployContract(
      artifacts.NonfungibleTokenPositionDescriptor.abi,
      linkedBytecode,
      // 'ETH' as a bytes32 string
      [weth9Address, '0x4554480000000000000000000000000000000000000000000000000000000000'],
      this.deployer
    )) as Contract;
  }

works

SabeloMkhwanzi commented 1 year ago
      "dependencies": {
        "@openzeppelin/contracts": "4.4.2",
        "@openzeppelin/contracts-upgradeable": "4.4.2",
        "@uniswap/v3-core": "1.0.0",
        "@uniswap/v3-periphery": "1.0.1",
        "bignumber.js": "9.0.2",
        "dotenv": "11.0.0",
        "uniswap-v3-deploy-plugin": "0.1.0"
      },

This work for me after - I pasted this dependencies inside node_modules/@uniswap/hardhat-v3-deploy/package.json

y0unghe commented 1 year ago
      "dependencies": {
        "@openzeppelin/contracts": "4.4.2",
        "@openzeppelin/contracts-upgradeable": "4.4.2",
        "@uniswap/v3-core": "1.0.0",
        "@uniswap/v3-periphery": "1.0.1",
        "bignumber.js": "9.0.2",
        "dotenv": "11.0.0",
        "uniswap-v3-deploy-plugin": "0.1.0"
      },

This work for me after - I pasted this dependencies inside node_modules/@uniswap/hardhat-v3-deploy/package.json

Worked.

ibrahim1023 commented 2 months ago

Is anyone still facing the issue despite the above suggestions? I did everything suggested above but no luck!