-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
All code examples should use the latest released version of Solidity #3379
Comments
It will be helpful if someone with authority can say "all code with 0.4.16 can compile without warnings on 0.4.19 with no changes necessary". |
Please note those are the minimum versions required by each example. Since it uses semver, Every change is backwards compatible, fixing warnings emitted by 0.4.19 will still results in a compilable code on 0.4.0. |
Counter example: This compiles in 0.4.19 but not in 0.4.0:
|
I do not exactly follow what counter example is this? |
You stated "fixing warnings emitted by 0.4.19 will still results in a compilable code on 0.4.0." This counter example shows a contract where warnings are fixed in 0.4.19 but where the code does not compile in 0.4.0. |
That is a response to your original issue listing this task:
What I've said is that fixing warnings in the code to make the 0.4.19 compiler silent will still result in code which can be compiled with If there is a given code piece which already requires a higher version, that is for a reason, which is it uses a feature introduced in that given version. You have also mentioned that all pragmas should be updated to require the latest version:
I do not agree with this, all examples should use the minimum version they require. |
When developing documentation I subscribe to the best practices:
Currently "Improving the documentation" is the first item listed for contributors to help with. If a different set of best practices apply for code snippets in the Solidity project, then it would be helpful to spell that out in http://solidity.readthedocs.io/en/latest/contributing.html so contributors can make more useful contributions. |
I've never opposed adding state mutability modifiers (pure, view) to examples (I think somebody started doing that in a PR a while back). If we do that, of course the version requirement must bump to where it was introduced. |
Cool. So basically most things before 0.4.16 are at least in scope for an update to 0.4.16 for mutability guarantees. If I can find an important feature past 0.4.16 then that's a reason to upgrade further. But otherwise, maintain the oldest supported prama for any given code. Here's a first step: #3431 |
Add mutability declaration to example, for #3379
Fix new Solidity warnings, for #3379
Currently (v0.5.0) almost all examples in the documentation have the form |
@leonardoalt after a quick search I can't see any more now, unless you can point me to those remaining 3 (possibly 2, as one was fixed in af3e6db) |
The different ones that I found:
|
@leonardoalt I think all of these are intentional if you read the context around them. As far as I can tell, this issue is now resolved. |
The one in Furthermore, shouldn't we change all |
@chriseth I guess we should. I shall update and hope that all tests still pass. |
As per http://solidity.readthedocs.io/en/develop/installing-solidity.html?highlight=latest we see:
The latest version is 0.4.19 as per https://github.com/ethereum/solidity/releases
The Solidity code examples in the documentation, therefore, should also use version 0.4.19.
Following are the examples to update, found with
git grep --line-number 'pragma solidity'
.Work plan:
pragma solidity ^0.4.0;
pragma solidity ^0.4.0;
-- no necessary changepragma solidity ^0.4.19;
pragma solidity ^0.4.0;
pragma solidity ^0.4.12;
pragma solidity ^0.4.11;
pragma solidity ^0.4.0;
pragma solidity ^0.4.0;
pragma solidity ^0.4.11;
pragma solidity ^0.4.11;
pragma solidity ^0.4.11;
pragma solidity ^0.4.11;
pragma solidity ^0.4.16;
pragma solidity ^0.4.16;
pragma solidity ^0.4.0;
pragma solidity ^0.4.0;
pragma solidity ^0.4.0;
pragma solidity ^0.4.0;
pragma solidity ^0.4.11;
pragma solidity ^0.4.0;
pragma solidity ^0.4.16;
pragma solidity ^0.4.16;
pragma solidity ^0.4.0;
pragma solidity ^0.4.16;
pragma solidity ^0.4.16;
pragma solidity ^0.4.16;
pragma solidity ^0.4.0;
pragma solidity ^0.4.10;
pragma solidity ^0.4.16;
pragma solidity ^0.4.0;
pragma solidity ^0.4.0;
pragma solidity ^0.4.0;
pragma solidity ^0.4.0;
pragma solidity ^0.4.0;
pragma solidity ^0.4.0;
pragma solidity ^0.4.11;
pragma solidity ^0.4.16;
pragma solidity ^0.4.16;
pragma solidity ^0.4.16;
pragma solidity ^0.4.16;
pragma solidity ^0.4.16;
pragma solidity ^0.4.16;
pragma solidity ^0.4.16;
pragma solidity ^0.4.0;
pragma solidity ^0.4.0;
pragma solidity ^0.4.16;
pragma solidity ^0.4.0;
pragma solidity ^0.4.16;
pragma solidity ^0.4.16;
pragma solidity ^0.4.0;
pragma solidity ^0.4.0;
pragma solidity ^0.4.16;
pragma solidity ^0.4.0;
pragma solidity ^0.4.0;
pragma solidity ^0.4.16;
pragma solidity ^0.4.0;
pragma solidity ^0.4.0;
pragma solidity ^0.4.0;
pragma solidity ^0.4.0;
pragma solidity ^0.4.16;
pragma solidity ^0.4.0;
pragma solidity ^0.4.0;
pragma solidity ^0.4.0;
pragma solidity ^0.4.0;
pragma solidity ^0.4.0;
pragma solidity ^0.4.0;
pragma solidity ^0.4.0;
pragma solidity ^0.4.11;
pragma solidity ^0.4.11;
pragma solidity ^0.4.11;
pragma solidity ^0.4.16;
pragma solidity ^0.4.11;
pragma solidity ^0.4.11;
pragma solidity ^0.4.11;
pragma solidity ^0.4.0;
pragma solidity ^0.4.0;
pragma solidity ^0.4.11;
pragma solidity ^0.4.0;
pragma solidity ^0.4.0;
pragma solidity ^0.4.0;
pragma solidity ^0.4.16;
pragma solidity ^0.4.16;
pragma solidity ^0.4.16;
pragma solidity ^0.4.11;
pragma solidity ^0.4.0;
pragma solidity ^0.4.16;
pragma solidity ^0.4.16;
pragma solidity ^0.4.0;
pragma solidity ^0.4.16;
pragma solidity ^0.4.11;
pragma solidity ^0.4.0;
pragma solidity ^0.4.0;
Follow on work:
The text was updated successfully, but these errors were encountered: