Skip to content

NatSpec: Disallow @return tag on events.#16666

Merged
nikola-matic merged 2 commits intoargotorg:developfrom
cuiweixie:fix/natspec-disallow-return-on-events
May 5, 2026
Merged

NatSpec: Disallow @return tag on events.#16666
nikola-matic merged 2 commits intoargotorg:developfrom
cuiweixie:fix/natspec-disallow-return-on-events

Conversation

@cuiweixie
Copy link
Copy Markdown
Contributor

@cuiweixie cuiweixie commented May 3, 2026

Description

Ethereum events do not declare return parameters, unlike functions. The event branch of callable documentation incorrectly accepted the same tag set as functions, allowing misleading @return markup. Restrict event validation to dev, notice, and param, consistent with errors.

Checklist

AI Disclosure

  • No AI tools were used
  • AI tools were used (details below)

Copy link
Copy Markdown
Contributor

@nikola-matic nikola-matic left a comment

Choose a reason for hiding this comment

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

Before merging, this will need a few additions:

  1. a natspecJSON isoltest, something like:
  contract C {
      /// @return foo
      event E(uint x);
  }
  1. Same as above, but for inherited events (in general, see test/libsolidity/natspecJSON/invalid/* for examples)
  2. It will also need a changelog entry (see previous Natspec changelog entries for inspiration).

@cuiweixie cuiweixie force-pushed the fix/natspec-disallow-return-on-events branch from cca2782 to 3975408 Compare May 4, 2026 15:52
@cuiweixie cuiweixie requested a review from nikola-matic May 4, 2026 15:54
Copy link
Copy Markdown
Contributor

@nikola-matic nikola-matic left a comment

Choose a reason for hiding this comment

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

This is the last set of changes - otherwise looks good. Please make the changes so we can merge.

Comment thread Changelog.md Outdated
Copy link
Copy Markdown
Contributor

@nikola-matic nikola-matic left a comment

Choose a reason for hiding this comment

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

cuiweixie and others added 2 commits May 5, 2026 17:20
Ethereum events do not declare return parameters, unlike functions. The event branch of callable documentation incorrectly accepted the same tag set as functions, allowing misleading `@return` markup. Restrict event validation to `dev`, `notice`, and `param`, consistent with errors.
Co-authored-by: Nikola Matić <nikola@argot.org>
@cuiweixie cuiweixie force-pushed the fix/natspec-disallow-return-on-events branch from b095244 to f3cc13d Compare May 5, 2026 09:20
@nikola-matic nikola-matic merged commit 1473ed4 into argotorg:develop May 5, 2026
83 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants