Closed lispking closed 1 month ago
The primary change across the Solidity files involves updating the version pragma from a fixed version (0.8.7
) to a more flexible range (^0.8.0
). This enhancement improves compatibility with future compiler versions while ensuring stability within the 0.8.x series. Overall logic and functionality of the contracts remain unchanged, facilitating smoother upgrades and integration with newer features.
Files Grouped by Changes | Change Summary |
---|---|
contracts/evm/*.sol , contracts/prototypes/*.sol , contracts/zevm/*.sol , contracts/zevm/interfaces/*.sol , contracts/evm/interfaces/*.sol |
Updated Solidity pragma from 0.8.7 to ^0.8.0 , enhancing compatibility with future compiler versions while preserving existing functionality. |
hardhat.config.ts |
Updated dependency version from 0.8.7 to 0.8.18 , suggesting an upgrade that may include improvements or new features. |
test/fuzz/readme.md |
Updated documentation to reflect the use of Solidity compiler version 0.8.18 instead of 0.8.7 . |
testFoundry/*.t.sol |
Updated Solidity pragma from 0.8.7 to ^0.8.0 , enhancing compatibility with future compiler versions while maintaining functionality. |
sequenceDiagram
participant Developer
participant Compiler
participant Contract
Developer->>Compiler: Compile with ^0.8.0
Compiler->>Contract: Load and prepare for execution
Contract->>Compiler: Execute logic
Compiler-->>Developer: Provide output and results
🐇 In the fields, the rabbit hops,
Twisting code like candy shops.
With versions flexed, the future's bright,
Upgrades come, a joyful sight.
In Solidity's garden, we all play,
Hopping along, come what may! 🐰✨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
I may think it is in general a better practice to specify a fixed version for Solidity if these are production contracts
I don't think so, because what you have is a library that others depend on. You can't require all dependencies to use version 0.8.7. Moreover, if this version causes other users to be on a different version(like 0.8.18), it would force them to downgrade to the same version. It's not right to impose such restrictions on users.
Additionally, when integrating with your contracts, the demo requires users to initialize by depending on SystemContract. This design is also very unreasonable. For users, they only need to know the contract address.
The specific version should be resolved by the compiler, not hardcoded into the code like this. @lumtis
@lumtis These are all industry best practices.
For example, with a library like IERC20, a similar approach is taken by specifying a minimum version requirement:
https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol
@lumtis @lispking good discussion, i also had issue with hardcoded 0.8.7 when importing 3rd party contracts making it not possible for foundry to resolve sol version, so i changed to ^0.8.0 version in some contracts and version was resolved
will check these changes in more details
@lispking thanks for taking the time to look into versions of the protocol contracts! It's up to the protocol team to decide how to move forward, but if you want to contribute to ZetaChain on a more regular basis, consider the tech ambassador program: https://zetachain.deform.cc/TechAmbassadors 🙌
Hi @lispking , we are currently in the process of refactoring the environment to have v1 and v2 contracts separated and use latest Solidity version for v2 contracts.
v1 contracts are no longer in active development.
Did you want this change for some specific contracts in the codebase?
Hi @lispking , we are currently in the process of refactoring the environment to have v1 and v2 contracts separated and use latest Solidity version for v2 contracts.
v1 contracts are no longer in active development.
Did you want this change for some specific contracts in the codebase?
@lumtis Sure, no problem. Which is the codebase contract address? If needed, I can help with modifications and testing.
If there are no issues with this, it can be merged first. thx.
Hi @lispking , we are currently in the process of refactoring the environment to have v1 and v2 contracts separated and use latest Solidity version for v2 contracts. v1 contracts are no longer in active development. Did you want this change for some specific contracts in the codebase?
@lumtis Sure, no problem. Which is the codebase contract address? If needed, I can help with modifications and testing.
If there are no issues with this, it can be merged first. thx.
This is the PR for separating the two codebases: https://github.com/zeta-chain/protocol-contracts/pull/268
To reduce the overhead on conflicts, we will prioritize merging it. We can check if there is still an issue afterward.
I may think it is in general a better practice to specify a fixed version for Solidity if these are production contracts
in general every audit (I had several) recommend to use a fixed version. The main reason is to guarantee if someone else (or you on test enviroments) wants to replicate can be sure to have the same results. I have opposite feelings about this but according to audits always is fixed.
Closing as version as been updated for contracts V2
Summary by CodeRabbit
New Features
Bug Fixes
Chores