Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Bytecode is not a valid hex string using OZ upgrades deployProxy #872

Closed
karacurt opened this issue Mar 6, 2024 · 4 comments
Closed

Comments

@karacurt
Copy link

karacurt commented Mar 6, 2024

I am facing the following error:

Error: Bytecode is not a valid hex string

The error happens when we run npx hardhat compile and then runs npx hardhat coverage

The line in the code is trying to call upgrades.deployProxy to deploy an upgradeable contract

Hardhat version: "hardhat": "^2.12.6"
Solidity Coverage version: "solidity-coverage": "^0.8.2",

@cgewecke
Copy link
Member

cgewecke commented Mar 6, 2024

@karacurt Could you try upgrading to the latest version of solidity-coverage (0.8.10) and also make sure your hardhat version is newer, e.g 2.20.0 or higher?

If the problem persists could you provide the full stack trace of the error?

@karacurt
Copy link
Author

karacurt commented Mar 7, 2024

@cgewecke Just upgraded both packages and the error keeps happening. Here is the stack error:

` Error: Bytecode is not a valid hex string

  at hashBytecode (node_modules/@openzeppelin/upgrades-core/src/version.ts:31:11)
  
  at hashBytecodeWithoutMetadata (node_modules/@openzeppelin/upgrades-core/src/version.ts:47:10)
  
  at getVersion (node_modules/@openzeppelin/upgrades-core/src/version.ts:14:24)
  
  at getUnlinkedBytecode (node_modules/@openzeppelin/upgrades-core/src/validate/query.ts:130:33)
  
  at getDeployData (node_modules/@openzeppelin/hardhat-upgrades/src/utils/deploy-impl.ts:48:47)
  
  at async deployProxyImpl (node_modules/@openzeppelin/hardhat-upgrades/src/utils/deploy-impl.ts:72:22)
  
  at async Proxy.deployProxy (node_modules/@openzeppelin/hardhat-upgrades/src/deploy-proxy.ts:35:28)
  
  at async deploySftMarketplaceContracts (test/fixtures/OriumSftMarketplaceFixture.ts:17:32)
  
  at async loadFixture (node_modules/@nomicfoundation/hardhat-network-helpers/src/loadFixture.ts:59:18)
  
  at async Context.<anonymous> (test/OriumSftMarketplace.test.ts:43:101)

`

@cgewecke
Copy link
Member

cgewecke commented Mar 7, 2024

@karacurt Sorry could you also update the zeppelin plugin packages - their latest is two major versions higher. It would be good to see all the relevant packages current before debugging since that's where the error originates.

https://github.com/OriumNetwork/orium-rental-marketplace-contracts/blob/e8dbe2bbe5978bb09177e1cbb83f14c97208c545/package.json#L32-L33

@cgewecke cgewecke changed the title Error using coverage after hardhat compile Error: Bytecode is not a valid hex string using OZ upgrades deployProxy Mar 7, 2024
@cgewecke
Copy link
Member

cgewecke commented Mar 8, 2024

Am going close because in #870 the project is using deployProxy without problems and they're on the latest version. Issue is likely that deps are a couple years out of date in your project but if you continue to see this after bumping everything please ping and I'll re-open.

@cgewecke cgewecke closed this as completed Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants