Skip to content

Conversation

@david30907d
Copy link
Member

No description provided.

  - Remove experimental balanceCache.enhanced.js and PriceCache.enhanced.js
  - Remove associated test files (109 tests removed)
  - Files were only used for test coverage experiments
  - Production uses standard versions without .enhanced suffix
  - No production code affected, all remaining tests pass
…d their auxiliary type from src/utils/tokenUtils.ts:31-147, leaving only the utilities that ship in production.

  - Pruned the corresponding Vitest coverage and imports in tests/unit/utils/tokenUtils.test.ts:6-35 and dropped the now-obsolete suites so the tests mirror the slimmer API.
…tryWithBackoff in test/balance.integration.test.js:13 so the integration suite still exercises the retry logic but loops synchronously without

  waiting between attempts, while keeping the rest of the helper exports intac
…s (you can see it used directly in lines 536, 564, 592)

The chain string was just a lookup key that ultimately resolved to the same chainId
Simpler caching with consistent keys
Less cognitive overhead when reading the code
…der()

Simplified the lookup logic - now it just searches by chainId directly
Cleaned up the cache key - now just uses chainId (which was already the preferred key)
Updated the call site in _getRpcProviderInstance() to only pass chainId
The benefits:
Less redundancy: No need to pass two parameters that represent the same thing
Clearer intent: chainId is the canonical identifier (it's what Pendle API uses throughout)
Simpler code: No fallback logic needed since we always have chainId
Better caching: Cache key is now consistent (always chainId)
@openzeppelin-code
Copy link

openzeppelin-code bot commented Oct 14, 2025

Feat/zap in

Generated at commit: 021eb12ac59a2a41d137a6f4a6a992fddd0e9700

🚨 Report Summary

Severity Level Results
Contracts Critical
High
Medium
Low
Note
Total
0
0
0
0
0
0
Dependencies Critical
High
Medium
Low
Note
Total
0
0
0
0
0
0

For more details view the full report in OpenZeppelin Code Inspector

…iddleware:

  - Rewrote the request guards in src/middleware/requestValidator.js:1-166 so both intent payloads and balance routes use local helpers, lowercase addresses, and return the same error payloads as before.
  - Replaced the validator arrays in src/utils/validation.js:1-220 with bespoke middleware for swap quotes, provider-specific data, and bulk price queries; routes (src/routes/swap.js:1-215) now call these
    functions directly and reuse the sanitized values.
  - Rebuilt the balance validator module as a pure utility (src/validators/balanceValidator.js:1-186) and updated its test suite accordingly (test/validators/balanceValidator.test.js:1-194) to exercise the
    new helpers and middleware integration.

  Swagger is now served from the prebuilt spec:

  - src/config/swaggerConfig.js:1-58 loads docs/swagger.json when present and falls back to the base definition without pulling in swagger-jsdoc.
  - Added scripts/ensureSwaggerSpec.js:1-17, and npm run docs:generate now just makes sure the spec file exists. Generating OpenAPI definitions from comments is manual going forward—edit docs/swagger.json or
    bolt in another generator if you need automation later.

  Housekeeping and verifications:

  - Dropped express-validator (and the validator override) from package.json:6-45, refreshed the lockfile, and tweaked the README to mention the custom middleware.
  - npm run lint, npm run test:coverage, and npm audit --audit-level=moderate all pass locally.
@david30907d david30907d merged commit e9ad74e into main Oct 14, 2025
8 checks passed
@david30907d david30907d deleted the feat/zapIn branch October 14, 2025 14:04
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.

2 participants