Skip to content
This repository has been archived by the owner on Jan 4, 2024. It is now read-only.

verifying smart contract fails when using viaIR is true in truffle config #181

Closed
payamsafaei opened this issue Sep 19, 2022 · 8 comments
Closed
Labels
bug Something isn't working waiting Waiting for response from reporter

Comments

@payamsafaei
Copy link

payamsafaei commented Sep 19, 2022

Describe the bug

verifying smart contract fails when viaIR is true in truffle config

Steps To Reproduce
verifying smart contract fails when viaIR is true in truffle config

compilers: {
     solc: {
       version: "0.8.16",    // Fetch exact version from solc-bin (default: truffle's version)
       //docker: true,        // Use "0.5.1" you've installed locally with docker (default: false)
       settings: {          // See the solidity docs for advice about optimization and evmVersion
         optimizer: {
           enabled: true,
           runs:200
         },
         evmVersion: "london",
           viaIR: true
       }
     }

https://github.com/rkalis/truffle-plugin-verify/
Environment information

Please provide environment information as complete as possible. Before submitting a bug report, please make sure that you're running an LTS version of Node and the latest versions of Truffle and truffle-plugin-verify.

  • Operating System: win11
  • Node version: v16.15.1
  • Truffle version: v5.5.28
  • truffle-plugin-verify version: v0.5.28

Debug output

Fail - Unable to verify
Failed to verify 1 contract(s): NFTGame

@payamsafaei payamsafaei added the bug Something isn't working label Sep 19, 2022
@rkalis
Copy link
Owner

rkalis commented Oct 8, 2022

Hmm interesting. Could you provide a minimal repo where I can reproduce this issue?

@rkalis rkalis added the waiting Waiting for response from reporter label Oct 8, 2022
@ekn1012
Copy link

ekn1012 commented Nov 7, 2022

is your evm version correct? isn't byzantium the default for viaIR?

@heisendevs
Copy link

heisendevs commented Nov 9, 2022

Hi all, I modified these lines and was able to verify the contract

File: node_modules/truffle-plugin-verify/verify.js

  const inputJSON = {
    language: metadata.language,
    sources,
    settings: {
      remappings: metadata.settings.remappings,
      metadata: metadata.settings.metadata,
      viaIR: true,
      optimizer: metadata.settings.optimizer,
      evmVersion: metadata.settings.evmVersion,
      libraries
    }
  }

@mtfuji25
Copy link

mtfuji25 commented Dec 8, 2022

Hi @heisendevs where do you see inputJSON variable defined? I can't see it

@ivalenzuela
Copy link

ivalenzuela commented Dec 9, 2022

Hi @heisendevs where do you see inputJSON variable defined? I can't see it

Maybe you are in a new version, try looking at node_modules/truffle-plugin-verify/dist/types.d.ts
node_modules/truffle-plugin-verify/dist/util.d.ts

@mtfuji25
Copy link

mtfuji25 commented Dec 9, 2022

Hi all, I modified these lines and was able to verify the contract

File: node_modules/truffle-plugin-verify/verify.js

  const inputJSON = {
    language: metadata.language,
    sources,
    settings: {
      remappings: metadata.settings.remappings,
      metadata: metadata.settings.metadata,
      viaIR: true,
      optimizer: metadata.settings.optimizer,
      evmVersion: metadata.settings.evmVersion,
      libraries
    }
  }

I tried this, but didn't work. (I tried with 0.6.0 and 0.6.1 versions)

@sebastian-baier
Copy link
Contributor

sebastian-baier commented Dec 17, 2022

I have the same problem with version 5.32.
I added viaIR: true
to inputJSON in verify.js to fix it

the fix works for 6.1. as well

@rkalis
Copy link
Owner

rkalis commented Oct 26, 2023

Truffle is being sunset, so I expect people to move away from Truffle and therefore truffle-plugin-verify. When I tried in the past I haven't been able to figure out a generalised fix that works both with and without viaIR. So with those things in mind I think the workaround mentioned in this thread is good enough and I'll close this issue.

@rkalis rkalis closed this as not planned Won't fix, can't repro, duplicate, stale Oct 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working waiting Waiting for response from reporter
Projects
None yet
Development

No branches or pull requests

7 participants