Skip to content

SIG-746: rename SignalsPositionStorage zombies to OZ pattern#76

Merged
worjs merged 1 commit into
mainfrom
refactor/SIG-746-rename-position-storage-zombies
May 10, 2026
Merged

SIG-746: rename SignalsPositionStorage zombies to OZ pattern#76
worjs merged 1 commit into
mainfrom
refactor/SIG-746-rename-position-storage-zombies

Conversation

@worjs
Copy link
Copy Markdown
Contributor

@worjs worjs commented May 10, 2026

Context

SIG-746. SignalsPositionStorage.sol keeps four legacy mappings as zombies on slots 3-6 to preserve UUPS proxy storage layout. Their previous form used freeform // @deprecated line comments and retained semantic names (_marketTokenList, _positionMarketIndex, _ownerTokenList, _positionOwnerIndex), which is not the OpenZeppelin upgrade-safe pattern that auditors and the OZ upgrades plugin recognize for an intentional rename.

This change converts those four declarations to the OZ-standard rename pattern and regenerates the committed storage snapshot.

Decisions

  • Renamed each retained zombie mapping to __deprecated_slot_<N> matching its current slot index, and added a /// @custom:oz-renamed-from <oldName> NatSpec line directly above each declaration. Slot index, mapping type, internal visibility, declaration order, and the trailing uint256[48] __gap are unchanged.
  • Used one NatSpec annotation per variable on the line immediately above the declaration. The repo's storage diff tooling matches @custom:oz-renamed-from against the renamed variable's AST documentation node, so co-locating the annotation with the variable is what the tool actually consumes.
  • Old names are preserved only inside the annotation. The new label encodes the slot number, which is the invariant that matters for a label-only rename of an unused mapping.
  • Did not modify any test files. SIG-743 already provides the storage layout diff harness used to validate this rename, and the PM plan for SIG-746 explicitly excluded test changes. Verification is via the existing storage-diff path (STORAGE_STRICT_BASE=1 yarn storage:check against origin/main) plus forge inspect ... storageLayout.
  • Regenerated storage-snapshots/SignalsPosition.json because the snapshot is committed and the four label fields move with the rename. AST IDs and the compiler-generated t_struct(Position)<id>_storage type identifier also shift, since the snapshot is produced from a fresh build of the full contract tree.

Risk Areas

  • contracts/position/SignalsPositionStorage.sol is the storage parent of the live SignalsPosition UUPS proxy. Any change to slot index, type, offset, or order on slots 0-6 or to __gap[48] would corrupt every existing position. Reviewers should confirm slots 3-6 still hold the same mapping types and that slot 0 (core), slot 1 (_nextId), slot 2 (_positions), and slot 7 onward (__gap) are untouched.
  • storage-snapshots/SignalsPosition.json is the artifact compared by yarn storage:check. The diff includes label changes on slots 3-6 plus AST ID and t_struct(Position)<id>_storage identifier renumbering. Reviewers should confirm slot, offset, and storage-type semantics on every entry are preserved and that no entry was added or removed.
  • The @custom:oz-renamed-from annotation is what the OZ upgrades plugin and the in-repo storage diff tool use to authorize a label-only rename. Each annotation must point to the exact prior identifier, since a typo there would cause future upgrade-safety checks to flag the slot as a removed variable.

Copy link
Copy Markdown

@signals-reviewer signals-reviewer Bot left a comment

Choose a reason for hiding this comment

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

Summary

Renames four zombie storage mappings in SignalsPositionStorage.sol (slots 3-6) from their legacy semantic names to __deprecated_slot_<N>, replacing freeform // @deprecated comments with /// @custom:oz-renamed-from <oldName> NatSpec annotations. Regenerates the committed SignalsPosition.json snapshot to reflect the new labels.

Cross-PR Context

Recent Review Patterns

  • PR#75 (SIG-743, storage layout CI tooling): the reviewed tooling is the infrastructure that validates this rename. That PR's comparator is what consumes the @custom:oz-renamed-from annotations added here. No issues from PR#75 carry over.

Sibling PRs (SIG-746)

  • Only this PR. No cross-repo impact: the change is limited to storage variable labels with no ABI, event, or function signature modifications. Impact map confirms no downstream updates needed in v1-subgraph, v1-sdk, v1-server, or signals-app.

Issues

No issues found.

Verification performed:

  • Slot integrity: Confirmed slots 0-7 preserve identical slot index, offset, and storage type between base and PR snapshots. Only the label field changed on slots 3-6.
  • Mapping types preserved: uint256 => uint256[], uint256 => uint256, address => uint256[], uint256 => uint256 match exactly.
  • Annotation correctness: Each @custom:oz-renamed-from references the exact prior identifier (_marketTokenList, _positionMarketIndex, _ownerTokenList, _positionOwnerIndex). The annotations are placed as /// NatSpec directly above each declaration, which compiles into the AST documentation field that BuildInfoAnnotationResolver.hasRenameAnnotation() reads.
  • No stale references: Grepped the full codebase for the old variable names; they appear only in the base branch declarations (not called or accessed anywhere in contract logic).
  • __gap[48] unchanged: Gap array at slot 7 is untouched in both size and position.
  • Snapshot diff semantics: AST IDs and t_struct(Position)NNNN_storage type identifiers changed (expected from fresh build output). No entries added or removed. Slot, offset, and type semantics are preserved across all 8 storage entries and all 5 struct members.
  • No other zombies: SignalsCoreStorage.sol and SignalsLPShare.sol have no deprecated mappings requiring similar treatment.
  • Test coverage: The existing storage layout comparator tests (23 tests in storage-layout.test.ts) cover rename annotation validation, including positive and negative cases for @custom:oz-renamed-from.

Suggestions

None.

Verdict

APPROVE

@worjs worjs merged commit 1bbd0a4 into main May 10, 2026
16 checks passed
@worjs worjs deleted the refactor/SIG-746-rename-position-storage-zombies branch May 10, 2026 01:21
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.

1 participant