Skip to content

Add audit logging system spec - #1

Open
vicajohn wants to merge 157 commits into
mainfrom
docs/audit-logging-system-spec
Open

Add audit logging system spec#1
vicajohn wants to merge 157 commits into
mainfrom
docs/audit-logging-system-spec

Conversation

@vicajohn

Copy link
Copy Markdown
Owner

Jess and others added 30 commits June 26, 2026 22:33
- Remove _nextAddress parameter from useWalletAccountSync callbacks in
  EventExplorerPage and ActivityFeed. Neither caller uses the address
  value. Updates hook signature to () => void to match.
- Replace WALLET_ADDRESS_KEY references in regression tests with the
  inline string 'notify-chain:wallet-address'. The constant was never
  declared in this version of the test file, causing TS2552 in
  tsc --noEmit.
- Migrate hot config keys (Admin, IsPaused, UsageFee, SupportedTokens)
  from persistent → instance storage; instance reads are cheaper since
  the instance ledger entry is already loaded on every invocation

- Eliminate duplicate DataKey::GroupMembers storage key; members are
  embedded in AutoShareDetails.members and were being written twice on
  every update_members / add_group_member call (halves persistent writes
  for those operations)

- Remove dead DataKey variants: IsPaused and GroupMembers are no longer
  needed as persistent keys

- Remove double-publish and redundant persistent write in pause/unpause

- Optimize XDR struct field ordering (narrow → wide scalar grouping):
  AutoShareDetails, ScheduledNotification, PaymentHistory (AutoShare);
  Task, Submission, Dispute (TaskBounty)

- Expand storage_optimization_test.rs with benchmark table covering all
  7 impacted operations and document all four optimization categories

Closes Core-Foundry#371
…oundry#370)

- Add PayloadTooLargeError domain error and validatePayloadSize() utility
  (listener/src/utils/payload-size-validator.ts)
- Default limit: 64 KB (65 536 bytes), configurable via MAX_PAYLOAD_SIZE_BYTES
- Validate payload size in NotificationAPI.scheduleNotification() before
  any storage or heavy processing operations
- Return HTTP 413 from POST /api/schedule when the payload is oversized
- Add maxPayloadSizeBytes to Config interface and loadConfig()
- Document the limit in API.md and .env.example
- Add 29 tests: 11 unit (validator), 11 unit (NotificationAPI), 7 integration
- Fix TS2741 regression in event-subscriber test fixtures
…oundry#367)

Implements a secure Ownable2Step-style ownership handover for the
AutoShare Soroban contract.

Changes:
- errors.rs: add ZeroAddressTransfer (29), NoPendingOwnershipTransfer (30),
  NotPendingOwner (31) error variants
- events.rs: add OwnershipTransferInitiated and OwnershipTransferred events
  with indexed previous_owner / pending_owner topics matching the
  ERC-173 / OpenZeppelin OwnershipTransferred signature
- autoshare_logic.rs:
  - add INSTANCE_PENDING_OWNER storage key
  - harden existing transfer_admin to reject self-transfers
    (ZeroAddressTransfer)
  - add get_pending_owner() helper
  - add initiate_ownership_transfer(): only current owner may call;
    rejects self-transfer; stores pending owner; emits
    OwnershipTransferInitiated
  - add accept_ownership(): only pending owner may call; installs new
    owner; clears pending slot; emits OwnershipTransferred
- lib.rs: expose get_pending_owner, initiate_ownership_transfer,
  accept_ownership as public contract entry points; fix impl block
  structure; register ownership_transfer_test module
- tests/ownership_transfer_test.rs: 14 tests covering successful
  two-step transfer, event emission, pending-owner queries, non-owner
  rejection, self-transfer rejection, wrong-address accept rejection,
  accept-with-no-pending rejection, re-initiation/override, and
  transfer_admin regression guards
- Add API_SEQUENCE_DIAGRAMS.md with five Mermaid sequence diagrams:
  1. Notification Request Flow (webhook verify + scheduled delivery)
  2. Event Processing Lifecycle (on-chain event → dedup → Discord)
  3. Scheduled Notification Delivery (POST /api/schedule → states)
  4. Retry & Failure Recovery (in-memory vs DB-backed retry paths)
  5. Dashboard Data Fetch (React polling /api/events, /health, /analytics)

- All diagrams reference actual source files, function names, and
  HTTP endpoints as implemented in the codebase

- Update ARCHITECTURE_OVERVIEW.md §9 with a navigation table linking
  to each diagram by anchor

- Update README.md Architecture Overview block and Event Flow section
  with prominent cross-links to API_SEQUENCE_DIAGRAMS.md

Closes Core-Foundry#354
Cover ThemeToggle, PaginationControls, Modal, useTheme, and SubscriptionForm rendering/behavior, and repair merge artifacts so the dashboard builds cleanly.

Closes 405

Co-authored-by: Cursor <cursoragent@cursor.com>
Restore App.tsx and Event Explorer components that were left in a merged-conflict state on main so the dashboard TypeScript build succeeds.
…y#392)

Allow Notification Search to filter by channel type, delivery status, and date range, wired through the listener search API. Also repair corrupted dashboard files so the preview build succeeds.
…dry#384)

Include SQLite database status in GET /health alongside Stellar RPC, Discord, and the event registry. Document the updated response shape and default the health-check script to port 8787.
Restore App.tsx and Event Explorer components that were left in a merged-conflict state on main so the dashboard TypeScript build succeeds.
Fork PRs cannot access CLOUDFLARE_API_TOKEN. Keep the dashboard build as the real gate and only deploy when the PR head is in the same repo.
Fork PRs cannot access CLOUDFLARE_API_TOKEN. Keep the dashboard build as the real gate and only deploy when the PR head is in the same repo.
Fork PRs cannot access CLOUDFLARE_API_TOKEN. Keep the dashboard build as the real gate and only deploy when the PR head is in the same repo.
Fork PRs cannot access CLOUDFLARE_API_TOKEN. Keep the dashboard build as the real gate and only deploy when the PR head is in the same repo.
…h persistent DLQ storage, retry/requeue support, and health-monitor visibility for DLQ growth
…ion cancellation

- Add SubscriptionCancelled contractevent struct to base/events.rs
  Topics: group_id, subscriber, category (Group), priority (Medium)
  Data:   cancelled_at (ledger timestamp)

- Add cancel_subscription() to autoshare_logic.rs
  Validates: auth, paused, group exists, caller is creator/member,
  group is currently active. Deactivates group and zeroes usage count.

- Expose cancel_subscription() as a public contract method in lib.rs
  under the Subscription Management section.

- Add subscription_cancellation_test.rs with 8 tests covering:
  event emission, topic shape, cancelled_at data, group deactivation,
  non-member rejection, double-cancel rejection, paused-contract
  rejection, member (non-creator) cancellation, unknown-group panic.

Closes Core-Foundry#375
, Core-Foundry#436

Core-Foundry#425 - Add GLOSSARY.md with 31 alphabetically ordered terms covering
NotifyChain architecture, Soroban/Stellar concepts, and notification
system terminology.

Core-Foundry#427 - Expand LOCAL_DEVELOPMENT.md with VS Code IDE setup section and
7 new troubleshooting entries (Rust version, stellar-cli mismatch,
ts-node ESM errors, CORS config, SQLite WAL contention, simulation
failures, Freighter testnet detection).

Core-Foundry#428 - Add EVENT_PAYLOAD_EXAMPLES.md with realistic decoded JSON
payloads for all 29 contract events across AutoShare, Notification
Lifecycle, Audit Log, Access Log, Schema Version, Reputation, and
TaskBounty event groups.

Core-Foundry#436 - Add dedicated transaction hash search field to the dashboard.
- EventFilters: add txHash field
- eventStore: add txHash initial state and setTxHashFilter action
- filterEvents: add independent txHash filter parameter
- NotificationSearchBar: add debounced tx hash input with clear support
- Tests: 6 new tests added, all 23 pass
Co-authored-by: Odung Aniekan <orunganiekan@users.noreply.github.com>
Abd-Standard and others added 30 commits July 31, 2026 07:40
…ed-formatting-checks

Feat/416 automated formatting checks
…ation-queue-visibility

Add pending jobs queue endpoint and verify queue visibility (Core-Foundry#490)
…rs-app-search-wallet

Fix/ci lint errors app search wallet
- Add centralized error handler (error-handler.ts) with ApiError class and handleApiError utility
- Replace all raw res.writeHead/res.end error responses with sendErr/handleApiError
- Replace all raw res.writeHead success responses with sendOk
- Fix duplicate/broken route handlers in events-server.ts
- Update rate-limiter.ts to use sendErr for 429 responses
- Ensure all endpoints return consistent error response format
feat(contract): enforce notification category validation
…rror-handling

centralize API error handling across all backend services
…83-webhook-retry-queue

feat(webhook): implement webhook retry queue and delivery service (Core-Foundry#383)
security: remove hardcoded secrets, migrate to environment variables
Add channel subscriptions, counts, creators, and DB query indexes
feat: channel metadata, notification versioning, validation, and archive
…code-review-guidelines

docs: Create Code Review Guidelines (Core-Foundry#517)
…environment-setup

docs: Document Environment Setup for Contributors (Core-Foundry#515)
…release-checklist

docs: add release checklist for maintainers
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.

Replace Revert Strings with Custom Errors