[BREAKING] Drop constant and payable from ABI.#4090
Conversation
|
One of the reasons to create this was to see how the tests behave and start a discussion about that. |
|
@ekpyron can we merge the |
|
@axic That's true - I have them in separate commits here, so I'll extract them into a separate PR shortly! |
|
Once #4093 is merged to develop and develop is merged into 050, I'll rebase this PR. |
|
The ViewPureChecker must be updated to be turned on for |
|
Of course, since this last change ( |
5ff0e91 to
ebd020d
Compare
|
Rebased and removed the commit that updates |
f4f8f1f to
2d43635
Compare
| for (ContractDefinition const* c: source->filteredNodes<ContractDefinition>(source->nodes())) | ||
| contracts[c] = enforceView; | ||
| auto const& sourceContracts = source->filteredNodes<ContractDefinition>(source->nodes()); | ||
| contracts.insert(contracts.end(), sourceContracts.begin(), sourceContracts.end()); |
There was a problem hiding this comment.
Can you use contracts += source->filteredNodes<ContractDefinition>(source->nodes())?
There was a problem hiding this comment.
Didn't know that that is defined for std::vector in libdevcore - I'll change it.
|
|
||
| ;; ---------------------------------------------------------------------- | ||
| ;; Getter for the name of the token. | ||
| ;; @abi name() constant returns (string) |
There was a problem hiding this comment.
This is lll, do we really want to change it?
test/libsolidity/ASTLegacyJSON.cpp
Outdated
| BOOST_CHECK_EQUAL(argument["attributes"]["name"], "x"); | ||
| BOOST_CHECK_EQUAL(argument["attributes"]["type"], "function () payable external returns (uint256)"); | ||
| Json::Value funType = argument["children"][0]; | ||
| BOOST_CHECK_EQUAL(funType["attributes"]["constant"], false); |
There was a problem hiding this comment.
Can you add the corresponding check about stateMutability?
58e64a3 to
7c0f44f
Compare
7c0f44f to
09e0816
Compare
|
@chriseth Should we maybe disable the compilation tests on 050 already? |
8e04dd3 to
fb6f033
Compare
docs/abi-spec.rst
Outdated
|
|
||
| .. warning:: | ||
| Prior to version 0.5.0 there was an additional field ``constant``. In 0.5.0 this field has been removed. | ||
| Instead you can check whether ``stateMutability`` is ``pure`` or ``view``. |
There was a problem hiding this comment.
We should create a PR adding a deprecation warning for both constant and payable.
|
This PR changes both the AST JSON and the ABI output. I think we can merge the AST JSON change, but as agreed the ABI should remain a little bit longer. |
|
We should also submit a PR to go-ethereum's abigen and potentially parity's abigen. Truffle 5.x was updated and they plan to backport the changes 4.x. @frozeman made web3 releases. @yann300 @iurimatias is remix / embark making use of |
fb6f033 to
fb73042
Compare
|
@ekpyron can you create a PR with the AST changes only? |
|
@axic I will. |
docs/abi-spec.rst
Outdated
| - ``constant``: ``true`` if function is either ``pure`` or ``view``, ``false`` otherwise. | ||
|
|
||
| ``type`` can be omitted, defaulting to ``"function"``, likewise ``payable`` and ``constant`` can be omitted, both defaulting to ``false``. | ||
| .. warning:: |
There was a problem hiding this comment.
See the warning below, which has the same content.
fb73042 to
5ebfcd4
Compare
Codecov Report
@@ Coverage Diff @@
## develop #4090 +/- ##
==========================================
Coverage ? 28.31%
==========================================
Files ? 313
Lines ? 30650
Branches ? 3662
==========================================
Hits ? 8678
Misses ? 21301
Partials ? 671
|
|
@axic we do and it's a breaking change for us, we'll need to update |
5ebfcd4 to
6805900
Compare
|
@axic Yes, I think we were pretty much heading towards postponing this anyways and classifying this as |
|
Removed from 0.5.0. |
6805900 to
4415541
Compare
Rebased. The question is whether we consider this a "breaking change" for 0.6.0 or an "ecosystem/interface change" the we can do before that.
|
It is missing a changelog entry and all the tests are failing. |
4415541 to
9a6adf8
Compare
9a6adf8 to
6e5de3b
Compare
6e5de3b to
361d1b9
Compare
|
Easy to recreate and unclear when we'll actually do this, so I'm closing this PR for now and added the issue to the backlog. |
Closes #4755.
Part of #3656.
To be discussed:
test/compilationTests/?050branch at this point?