Skip to content

Fix rate-limit error envelope and add contract event-coverage test suite#363

Merged
Abd-Standard merged 2 commits into
Core-Foundry:mainfrom
francisdouglas-ux:fix/rate-limit-envelope-and-event-coverage
Jun 30, 2026
Merged

Fix rate-limit error envelope and add contract event-coverage test suite#363
Abd-Standard merged 2 commits into
Core-Foundry:mainfrom
francisdouglas-ux:fix/rate-limit-envelope-and-event-coverage

Conversation

@francisdouglas-ux

Copy link
Copy Markdown

-## Overview

This Pull Request delivers critical security, stabilization, and verification layers for the Notify-Chain ecosystem. It resolves major pre-existing compilation blocks across the smart contract and listener services, addresses structural integration bugs, deploys an exhaustive contract event coverage test suite achieving full structural equality validation, and standardizes the runtime behavior and error presentation vectors of the notification rate-limiting engine.

🔑 Linked Issues


🛠️ Summary of Changes

🧪 1. Exhaustive Smart Contract Event Coverage Suite (#291)

  • Testing Infrastructure: Created contract/contracts/hello-world/src/tests/event_emission_test.rs introducing 29 granular verification tests covering 22 out of 23 protocol event types.
  • Structural Equality Validation: Assertions validate complete event shapes—cross-checking contract address, sequential topic matrices, and encoded payload data payloads against macro-generated structures.
  • Ordering & Reversion Asserts: Features dedicated multi-event sequential order tracking checks and 6 negative verification scripts proving aborted transactions emit zero side-effect telemetry logs.
  • Validation Helper Fix: Repaired a masked logging bug in notification_validation_test.rs where the parser incorrectly transposed the priority topic with the category layer.

🎛️ 2. Rate-Limiting Harmonization & Payload Mapping (#253 & #292)

  • Response Standardization: Aligned the core sliding-window rate limiting engine (listener/src/api/rate-limiter.ts) response scheme to deliver the exact requested JSON structure on saturation limits:
    {
      "error": "TooManyRequests",
      "message": "Rate limit exceeded. Please try again later."
    }

- Align the listener's 429 rate-limit response body with Issue Core-Foundry#253/Core-Foundry#292's
  spec ({error:"TooManyRequests", message:"Rate limit exceeded. Please try
  again later."}); the underlying limiter/middleware/config/tests already
  existed.
- Fix pre-existing merge corruption blocking compilation: interleaved event
  structs and an unclosed brace in the Soroban contract, a broken
  reputation_logic storage key/event-publish path, duplicate method in
  event-registry.ts, a type error in batch-validation-service.ts, and a
  missing brace in the listener's index.ts entrypoint.
- Fix a notification_validation_test.rs helper that silently misread the
  priority topic as the category once priority became a trailing topic.
- Add contract/contracts/hello-world/src/tests/event_emission_test.rs
  (Issue Core-Foundry#291): full structural event-tuple assertions (address + all
  topics + data) across 22/23 event types, multi-event ordering checks, and
  negative tests proving failed transactions emit nothing observable.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@drips-wave

drips-wave Bot commented Jun 30, 2026

Copy link
Copy Markdown

@francisdouglas-ux Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Abd-Standard

Copy link
Copy Markdown
Collaborator

pls fix Ci

Fork PRs never receive repo secrets on the pull_request trigger, so
CLOUDFLARE_API_TOKEN/CLOUDFLARE_ACCOUNT_ID are empty and wrangler hard-fails
the whole CI check for every external contributor. Skip the deploy step
when those secrets aren't present and note it in the PR comment instead of
failing the job.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Abd-Standard Abd-Standard merged commit a520500 into Core-Foundry:main Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants