Skip to content

fix: deterministic portfolio pricing, config reinit, registry cleanup - #611

Open
dunnidev wants to merge 1 commit into
Heliobond:mainfrom
dunnidev:fix/portfolio-deterministic-pricing
Open

fix: deterministic portfolio pricing, config reinit, registry cleanup#611
dunnidev wants to merge 1 commit into
Heliobond:mainfrom
dunnidev:fix/portfolio-deterministic-pricing

Conversation

@dunnidev

@dunnidev dunnidev commented Sep 2, 2026

Copy link
Copy Markdown
  • Replace Math.random() portfolio pricing with hour-seeded deterministic pricing via FNV-1a address hash and seededRandom (matches IoT pattern)
  • Refactor config to buildConfig() so initEnv() returns a fresh snapshot instead of the module-level singleton captured at import time
  • Move RpcDegradedError to registry.ts, remove dead isSimulationError guard
  • Fix duplicate simulateTransaction call and add missing metric tracks in getTotalProjects
  • Make MAX_PROJECT_ID configurable via env var (default 1M, was 100k)
  • Move cronTasks/scheduleCron declarations before first use
  • Harden batch score-update validation with explicit type checks
  • Update tests to align with new config/error shapes

Closes #496

- Replace Math.random() portfolio pricing with hour-seeded deterministic
  pricing via FNV-1a address hash and seededRandom (matches IoT pattern)
- Refactor config to buildConfig() so initEnv() returns a fresh snapshot
  instead of the module-level singleton captured at import time
- Move RpcDegradedError to registry.ts, remove dead isSimulationError guard
- Fix duplicate simulateTransaction call and add missing metric tracks
  in getTotalProjects
- Make MAX_PROJECT_ID configurable via env var (default 1M, was 100k)
- Move cronTasks/scheduleCron declarations before first use
- Harden batch score-update validation with explicit type checks
- Update tests to align with new config/error shapes

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@drips-wave

drips-wave Bot commented Sep 2, 2026

Copy link
Copy Markdown

@dunnidev 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

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.

GET /v1/portfolio/:address returns a different current_value on every call — pricePerShare uses raw Math.random()

1 participant