Skip to content

docs(Memo): incorrect comment claims post-increment is pre-increment #483

Open

Description

@forumevi

Description

In contracts/src/memo/Memo.sol, line 41:

uint256 currentMemoIndex = memoIndex++;
The comment above says "Pre-increment ensures unique indices under reentrancy", but the code uses post-increment (memoIndex++). Pre-increment would be ++memoIndex.

The behaviour is correct (the index is already incremented before the subcall), but the comment is misleading and could cause future developers to misunderstand the reentrancy guarantee.

Suggested fix
Change the comment to accurately describe post-increment semantics.

Activity

  1. A5Infinity commented on Oct 9, 2026

    @A5Infinity

    Hi, could I take this one? I'd reword the comment above uint256 currentMemoIndex = memoIndex++; in contracts/src/memo/Memo.sol: the index is incremented in storage before the subcall, so each call (including a reentrant one) keeps the previous value as its own unique index. No code change, comment only.

  2. kutluhaneth46 commented on Oct 26, 2026

    @kutluhaneth46
    Contributor

    Happy to take a one-line docs fix here if assigned — update the Memo.sol comment so it matches post-increment (memoIndex++) instead of claiming pre-increment. Will wait for assignment before opening a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions