Skip to content
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

[BREAKING] Drop constant and payable from ABI. #4090

Closed
wants to merge 3 commits into from

Conversation

ekpyron
Copy link
Member

@ekpyron ekpyron commented May 8, 2018

Closes #4755.

Part of #3656.

To be discussed:

  • How to deal with breaking changes and the contracts in test/compilationTests/?
  • Does it make sense to merge changes like this to the 050 branch at this point?

@ekpyron ekpyron self-assigned this May 8, 2018
@ekpyron
Copy link
Member Author

ekpyron commented May 8, 2018

One of the reasons to create this was to see how the tests behave and start a discussion about that.
As expected, the tests involve external contracts, e.g. from truffle and the DAO, that are not yet forward compatible with changes like this, so we have to decide how to deal with this.

@axic
Copy link
Member

axic commented May 8, 2018

@ekpyron can we merge the constant -> view changes (docs, styleguide, std, test) separately on develop? That it not breaking.

@ekpyron
Copy link
Member Author

ekpyron commented May 8, 2018

@axic That's true - I have them in separate commits here, so I'll extract them into a separate PR shortly!

@ekpyron
Copy link
Member Author

ekpyron commented May 8, 2018

Once #4093 is merged to develop and develop is merged into 050, I'll rebase this PR.

@axic
Copy link
Member

axic commented May 9, 2018

The ViewPureChecker must be updated to be turned on for view (there's a 0.5.0 check there).

@ekpyron
Copy link
Member Author

ekpyron commented May 11, 2018

@axic The two last commits now enable enforcing view in ViewPureChecker. The last commit merely adjusts some end-to-end-tests and I extracted it to #4093 as well.
Actually I would have considered enabling these errors to be separate from this PR, but I guess it makes sense to add it in here.

@ekpyron
Copy link
Member Author

ekpyron commented May 11, 2018

Of course, since this last change (ViewPureChecker reports errors for view), the tests will fail again and are much more involved to update. Since we decided to disable the compilation tests for 0.5.0 I will not update them any further.

@ekpyron ekpyron force-pushed the dropConstantKeyword branch 2 times, most recently from 5ff0e91 to ebd020d Compare May 14, 2018 12:28
@ekpyron
Copy link
Member Author

ekpyron commented May 14, 2018

Rebased and removed the commit that updates test/compilationTests (since we decided to disable those tests for 0.5.0).

@ekpyron ekpyron force-pushed the dropConstantKeyword branch 5 times, most recently from f4f8f1f to 2d43635 Compare May 14, 2018 18:44
docs/abi-spec.rst Outdated Show resolved Hide resolved
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());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use contracts = source->filteredNodes<ContractDefinition>(source->nodes())?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't know that that is defined for std::vector in libdevcore - I'll change it.

@@ -216,39 216,39 @@ static char const* erc20Code = R"DELIMITER(

;; ----------------------------------------------------------------------
;; Getter for the name of the token.
;; @abi name() constant returns (string)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is lll, do we really want to change it?

@@ -266,15 266,13 @@ BOOST_AUTO_TEST_CASE(function_type)
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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add the corresponding check about stateMutability?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@ekpyron ekpyron force-pushed the dropConstantKeyword branch 3 times, most recently from 58e64a3 to 7c0f44f Compare May 15, 2018 12:48
@ekpyron ekpyron force-pushed the dropConstantKeyword branch from 7c0f44f to 09e0816 Compare May 15, 2018 13:15
@ekpyron ekpyron changed the title [WIP, BREAKING] Drop constant keyword. [BREAKING] Drop constant keyword. May 15, 2018
@ekpyron ekpyron force-pushed the dropConstantKeyword branch from fb6f033 to fb73042 Compare August 1, 2018 08:47
@axic
Copy link
Member

axic commented Aug 1, 2018

@ekpyron can you create a PR with the AST changes only?

@ekpyron
Copy link
Member Author

ekpyron commented Aug 1, 2018

@axic I will.

- ``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::
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the warning below, which has the same content.

@ekpyron ekpyron force-pushed the dropConstantKeyword branch from fb73042 to 5ebfcd4 Compare August 2, 2018 16:36
@codecov
Copy link

codecov bot commented Aug 2, 2018

Codecov Report

❗ No coverage uploaded for pull request base (develop@b0a2e41). Click here to learn what that means.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##             develop    #4090    /-   ##
==========================================
  Coverage           ?   28.31%           
==========================================
  Files              ?      313           
  Lines              ?    30650           
  Branches           ?     3662           
==========================================
  Hits               ?     8678           
  Misses             ?    21301           
  Partials           ?      671
Flag Coverage Δ
#syntax 28.31% <0%> (?)

@iurimatias
Copy link
Member

@axic we do and it's a breaking change for us, we'll need to update

@ekpyron ekpyron force-pushed the dropConstantKeyword branch from 5ebfcd4 to 6805900 Compare August 8, 2018 11:30
@ekpyron ekpyron changed the title [BREAKING] Drop constant from ABI. [BREAKING] Drop constant and payable from ABI. Aug 8, 2018
@axic
Copy link
Member

axic commented Aug 8, 2018

@chriseth @ekpyron I think we can close this now postpone this now. Since I consider this a "protocol change", it doesn't necessarily needs to be aligned with breaking releases. Just the time has to be right for the ecosystem to adapt.

@ekpyron
Copy link
Member Author

ekpyron commented Aug 8, 2018

@axic Yes, I think we were pretty much heading towards postponing this anyways and classifying this as protocol change and decoupling those from breaking releases makes sense.

@chriseth
Copy link
Contributor

Removed from 0.5.0.

@ekpyron ekpyron removed their assignment Sep 14, 2018
axic
axic previously requested changes Nov 14, 2018
Copy link
Member

@axic axic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to be rebased.

@ekpyron ekpyron force-pushed the dropConstantKeyword branch from 6805900 to 4415541 Compare November 14, 2018 12:02
@ekpyron ekpyron dismissed axic’s stale review November 14, 2018 12:03

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.

@axic
Copy link
Member

axic commented Nov 14, 2018

It is missing a changelog entry and all the tests are failing.

@ekpyron ekpyron force-pushed the dropConstantKeyword branch from 4415541 to 9a6adf8 Compare November 14, 2018 12:50
@ekpyron ekpyron force-pushed the dropConstantKeyword branch from 9a6adf8 to 6e5de3b Compare November 14, 2018 13:00
@ekpyron ekpyron force-pushed the dropConstantKeyword branch from 6e5de3b to 361d1b9 Compare November 14, 2018 13:25
@ekpyron
Copy link
Member Author

ekpyron commented Dec 13, 2018

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.

@ekpyron ekpyron closed this Dec 13, 2018
@ekpyron ekpyron deleted the dropConstantKeyword branch May 8, 2019 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants