Skip to content
This repository was archived by the owner on May 11, 2026. It is now read-only.

feat: add expiration column to aliases table#631

Closed
wa0x6e wants to merge 2 commits into
fix/alias-single-addressfrom
feat/alias-expiration-column
Closed

feat: add expiration column to aliases table#631
wa0x6e wants to merge 2 commits into
fix/alias-single-addressfrom
feat/alias-expiration-column

Conversation

@wa0x6e

@wa0x6e wa0x6e commented Mar 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Replaces the hardcoded 30-day expiry calculation with an explicit expiration timestamp column stored per-alias. Instead of computing expiry from created + 30 days at query time, the expiration is now set at creation time and checked directly. This enables future support for custom expiration periods and alias revocation (by setting expiration to a past value).

Changes

  • ✨ Added expiration INT(11) NOT NULL column to aliases table schema
  • ✨ Writer sets expiration = created + 30 days on alias creation
  • ♻️ isExistingAlias() now checks expiration > NOW() instead of computing from created
  • ♻️ Exported DEFAULT_ALIAS_EXPIRY_DAYS constant for reuse
  • 🧪 Updated test fixtures with expiration field

Test plan

  • Run yarn test:setup to recreate the test DB with new schema
  • Verify all alias integration tests pass
  • Verify expired aliases are still correctly rejected

Depends on #630

🤖 Generated with Claude Code

Adds a check that rejects alias creation if the alias address is
already associated with a different parent address, preventing
one alias from acting on behalf of multiple addresses.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds explicit per-alias expiration tracking by introducing an expiration timestamp column and updating alias validation logic to check it directly, replacing the previous “created + 30 days” query-time calculation.

Changes:

  • Add expiration INT(11) NOT NULL (plus index) to the aliases table in the test schema.
  • Set expiration at alias creation time (created + DEFAULT_ALIAS_EXPIRY_DAYS).
  • Update isExistingAlias() to validate aliases via expiration > now, and export DEFAULT_ALIAS_EXPIRY_DAYS for reuse.
  • Update alias SQL fixtures to include expiration.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
test/schema.sql Adds expiration column and index to aliases table for the test DB schema.
test/fixtures/alias.ts Updates fixtures to include expiration values.
src/writer/alias.ts Sets expiration during alias creation using the shared default expiry constant.
src/helpers/alias.ts Exports DEFAULT_ALIAS_EXPIRY_DAYS and updates isExistingAlias() to use expiration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread src/writer/alias.ts
Comment thread test/schema.sql Outdated
Comment thread test/fixtures/alias.ts Outdated
Replaces the hardcoded 30-day expiry calculation with an explicit
expiration timestamp stored per-alias. This enables future support
for custom expiration periods and alias revocation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@wa0x6e
wa0x6e force-pushed the feat/alias-expiration-column branch from 30a1b7f to 219d95a Compare March 16, 2026 12:21
@wa0x6e
wa0x6e force-pushed the fix/alias-single-address branch from 86030c7 to b9e5ff4 Compare March 17, 2026 08:22
@wa0x6e wa0x6e closed this Mar 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants