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

Disallow modifier declarations and definitions in interfaces #11577

Merged
merged 1 commit into from Aug 31, 2021

Conversation

cameel
Copy link
Member

@cameel cameel commented Jun 25, 2021

Fixes #11557.

@cameel cameel self-assigned this Jun 25, 2021
@cameel cameel force-pushed the disallow-modifiers-in-interfaces branch from c164491 to 9c34d20 Compare June 25, 2021 13:40
@hrkrshnn
Copy link
Member

Shouldn't this be breaking?

@cameel
Copy link
Member Author

cameel commented Jun 28, 2021

We discussed it on the chat and @chriseth's opinion was that it should not.

@chriseth
Copy link
Contributor

Strictly it is breaking. @axic what do you think?

@@ -1114,7 +1114,6 @@ BOOST_AUTO_TEST_CASE(interfaces_and_abstract_contracts)
unique_ptr<CompilerStack> compilerStack = parseAndAnalyzeContracts(R"(
interface I {
event Ev(uint);
modifier m() virtual;
Copy link
Member

Choose a reason for hiding this comment

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

Damn, we even had a test for it?!

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, though when working on the FunctionCallGraph I just tried everything that compiled so it's not like it was by design.

@axic
Copy link
Member

axic commented Jul 13, 2021

It is a though question. Since we never intended this to happen and rather started out with a very restricted feature set for interfaces (recall #3420 and many other related issues), it is easy to see that this is an oversight and a bug.

However given this likely existed for 2 years and that some forms worked, makes me wonder if anyone relies on it?

And if they do, what does that mean? Likely only that they are locked in to the last version if they insist on this feature. If we want to be careful, we could ask others from the ecosystem (like the tooling channel). If we are more confident that this is something nobody ever should have used, then we should go ahead in a non-breaking release and create a blog post to spread the word.

I'm leaning towards not making this a breaking change.

@chriseth
Copy link
Contributor

I'm also fine with calling it a bugfix.

@chriseth
Copy link
Contributor

The documentation does not mention modifiers, but it says that functions cannot be implemented, so I hope nobody thought that modifiers can be implemented... https://docs.soliditylang.org/en/v0.8.6/contracts.html#interfaces

Can you also update the documentation? It also seems that the bullet list somehow does not render properly.

@axic
Copy link
Member

axic commented Jul 14, 2021

It also seems that the bullet list somehow does not render properly.

I mentioned this on matrix two weeks ago, none of the bullet points render anywhere.

@cameel cameel force-pushed the disallow-modifiers-in-interfaces branch 2 times, most recently from 5fc8e50 to 8ce0dd3 Compare July 14, 2021 10:40
@cameel
Copy link
Member Author

cameel commented Jul 14, 2021

Rebased to resolve the changelog conflict and update docs.

Can you also update the documentation? It also seems that the bullet list somehow does not render properly.

I updated the page to mention modifiers.

The bullet list issue seems to be a general issue with the docs now so I'm going to work on it in a separate PR. No need to hold back this one because of it.

@@ -6,12 +6,14 @@
Interfaces
**********

Interfaces are similar to abstract contracts, but they cannot have any functions implemented. There are further restrictions:
Interfaces are similar to abstract contracts, but they cannot have any functions or modifiers implemented.
Copy link
Contributor

Choose a reason for hiding this comment

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

If you say "modifiers implemented" here, it looks like it is OK to declare them.

Copy link
Member Author

Choose a reason for hiding this comment

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

There's They cannot declare modifiers below. I wanted to emphasize that they cannot be defined either.

Copy link
Member Author

Choose a reason for hiding this comment

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

I reworded it. How about now?

@cameel cameel force-pushed the disallow-modifiers-in-interfaces branch from 8ce0dd3 to 239e324 Compare July 14, 2021 19:59
@chriseth
Copy link
Contributor

Now it's inconsistent with e.g. constructors, because there you only write "declare".

@cameel cameel force-pushed the disallow-modifiers-in-interfaces branch from 239e324 to ec60673 Compare July 15, 2021 12:44
@cameel
Copy link
Member Author

cameel commented Jul 15, 2021

Changed to just "declare".

@cameel cameel requested a review from chriseth July 15, 2021 12:45
Marenz
Marenz previously approved these changes Aug 31, 2021
@Marenz Marenz dismissed their stale review August 31, 2021 13:22

Needs a rebase and the changelog needs to add it to the latest unreleased

Copy link
Contributor

@Marenz Marenz left a comment

Choose a reason for hiding this comment

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

LGTM, only needs a rebase and an update to the changelog to add them under the right version.

@Marenz Marenz force-pushed the disallow-modifiers-in-interfaces branch from ec60673 to d07b796 Compare August 31, 2021 13:25
@Marenz
Copy link
Contributor

Marenz commented Aug 31, 2021

Rebased & fixed changelog entry position.

@chriseth chriseth merged commit 3780e5a into develop Aug 31, 2021
@chriseth chriseth deleted the disallow-modifiers-in-interfaces branch August 31, 2021 14:08
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.

Modifiers are not disallowed in interfaces
5 participants