How to check which compiler version the CLI uses?

Hello… I was just trying to follow the oz docs for GSN : https://docs.openzeppelin.com/learn/sending-gasless-transactions

What happened is I went through some compilation errors everytime I checked with a different version in pragma… It’d neither work with the given compiler version [0.5] in docs… nor for ^0.6.0 or for ^0.7.0. as:

$ npx oz deploy

    Could not find a compiler that matches required versions (^0.5.0 ^0.6.0 >=0.4.24 <0.7.0)

OR

Compilation errors: 
contracts/Counter.sol:6:21: DeclarationError: Identifier not found or not unique.
contract Counter is GSNRecipient {
                ^----------^

OR

Could not find a compiler that matches required versions (^0.7.0 ^0.6.0 >=0.4.24 <0.7.0)

Thus I wanted to find out how to check which version my cli is using or rather change it…

1 Like

Hi @asmeedhungana,

The issue is that you have contracts requiring different compiler versions and there is no compiler which can match all of these.

  • ^0.5.0
  • ^0.6.0
  • >=0.4.24
  • <0.7.0

The solc version being used is stored in .openzeppelin\project.json solcVersion.
We can also set the version using --solc-version, see: https://docs.openzeppelin.com/cli/2.8/compiling#picking_a_compiler_version


The guide: https://docs.openzeppelin.com/learn/sending-gasless-transactions uses Solidity 0.5, so we would need to install @openzeppelin/contracts-ethereum-package@2.5.0 to make it work or update the contracts being used, see the response to: Upgradeable GSN enabled Counter.sol has DeclarationError: Identifier not found or not unique

Please note, there are two versions of the GSN:

GSNv1 : Use in production now (though you may want to run your own relayer on mainnet to ensure availability).

We are no longer actively developing new features for this project, and the maintenance period has ended.

GSNv2 : In development at OpenGSN.org.

See Doubling down on security for more details.

Assuming you are just getting started and depending on your development roadmap, you could look at the upcoming improvements in GSNv2.

I suggest joining the OpenGSN telegram to get the latest news on GSNv2 development and timescales.

1 Like

Hmm… That was as elaborate as can get…
Thanks @abcoathup! :smiley:

1 Like

We now have Solidity 0.7 so you could add a contract which only uses that :smile:

1 Like

hmm…alright! will try that…

1 Like