Skip to content

test: integration tests for NIP-22 created_at timestamp limits #505

@phoenix-server

Description

@phoenix-server

Summary

The relay enforces createdAt.maxPositiveDelta (default 900s) and createdAt.maxNegativeDelta (default 0 = unlimited) from settings to reject events with implausible timestamps. There are no integration tests covering this enforcement.

What to test

  • Event with created_at exactly at the current time → accepted
  • Event with created_at 900 seconds in the future (at the limit) → accepted
  • Event with created_at 901 seconds in the future (over the limit) → rejected with invalid:
  • When maxNegativeDelta is configured, events older than the limit → rejected
  • Events within the negative delta limit → accepted

Relevant code

  • resources/default-settings.yamllimits.event.createdAt
  • src/@types/settings.ts
  • src/handlers/event-message-handler.ts

Suggested location

test/integration/features/nip-22/nip-22.feature

Metadata

Metadata

Labels

testUnit or integration test improvements

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions