Skip to content

fix: harden bridge platform sdk calls#21

Merged
PastaPastaPasta merged 3 commits intomainfrom
codex/fix-platform-address-timeout
Apr 16, 2026
Merged

fix: harden bridge platform sdk calls#21
PastaPastaPasta merged 3 commits intomainfrom
codex/fix-platform-address-timeout

Conversation

@PastaPastaPasta
Copy link
Copy Markdown
Owner

@PastaPastaPasta PastaPastaPasta commented Apr 16, 2026

Summary

  • force bridge Platform SDK calls onto trusted/discovered masternodes as a temporary workaround for stale untrusted testnet seeds
  • add explicit request and wait deadlines around Platform transitions so bridge operations fail back to the UI instead of hanging indefinitely
  • align Platform request timeouts with the server-side state transition wait window

Testing

  • npm run build

This pull request was created by Codex.

Summary by CodeRabbit

  • Refactor
    • Improved platform SDK configuration management and consistency for network operations.
    • Enhanced timeout and retry behavior for identity-related operations (creation, updates, funding) across testnet and mainnet environments.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 16, 2026

📝 Walkthrough

Walkthrough

Refactored src/platform/identity.ts to centralize platform SDK configuration by introducing shared, typed settings objects (PLATFORM_REQUEST_SETTINGS and PLATFORM_PUT_SETTINGS) and a createPlatformSdk factory function. Updated four identity-related functions to use this new factory and pass configuration settings to SDK mutating operations.

Changes

Cohort / File(s) Summary
SDK Configuration & Centralization
src/platform/identity.ts
Introduced PLATFORM_REQUEST_SETTINGS and PLATFORM_PUT_SETTINGS configuration objects defining timeouts, retries, and wait behavior. Added createPlatformSdk(network) factory function for consistent EvoSDK instance creation. Updated registerIdentity, topUpIdentity, updateIdentity, and sendToPlatformAddress to use the factory and pass settings to SDK mutating calls (identities.create, identities.topUp, identities.update, addresses.fundFromAssetLock).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Settings shared, config refined,
SDK paths now aligned,
Factory fresh, calls retried,
Platform SDK unified! 🎯

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: harden bridge platform sdk calls' directly aligns with the PR's main objective to harden Platform SDK calls by adding explicit request and wait deadlines, improving timeout handling, and forcing trusted masternode routing.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-platform-address-timeout

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/platform/identity.ts (1)

60-68: Export createPlatformSdk to enforce consistent SDK configuration across the codebase.

This factory function applies hardened timeout and retry settings (PLATFORM_REQUEST_SETTINGS), but other files instantiate SDK instances directly without these settings:

  • src/platform/dpns.ts line 13: EvoSDK.mainnetTrusted() / EvoSDK.testnetTrusted()
  • src/platform/contract.ts lines 23-25: same pattern
  • src/main.ts line 1108: same pattern

Exporting createPlatformSdk (or extracting it to src/platform/sdk.ts) would ensure all Platform SDK calls use consistent timeout and retry settings across the codebase.

♻️ Proposed change
-function createPlatformSdk(network: 'testnet' | 'mainnet'): EvoSDK {
+export function createPlatformSdk(network: 'testnet' | 'mainnet'): EvoSDK {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/platform/identity.ts` around lines 60 - 68, Export the createPlatformSdk
factory so all consumers use the hardened PLATFORM_REQUEST_SETTINGS: mark the
function createPlatformSdk as exported (or move it into a shared module like
sdk.ts and export it) and replace direct
EvoSDK.mainnetTrusted()/EvoSDK.testnetTrusted() usages with calls to
createPlatformSdk(network). Update callers (e.g., any code currently calling
EvoSDK.mainnetTrusted or EvoSDK.testnetTrusted) to import and use
createPlatformSdk to ensure consistent timeout/retry settings across the
codebase.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/platform/identity.ts`:
- Around line 60-68: Export the createPlatformSdk factory so all consumers use
the hardened PLATFORM_REQUEST_SETTINGS: mark the function createPlatformSdk as
exported (or move it into a shared module like sdk.ts and export it) and replace
direct EvoSDK.mainnetTrusted()/EvoSDK.testnetTrusted() usages with calls to
createPlatformSdk(network). Update callers (e.g., any code currently calling
EvoSDK.mainnetTrusted or EvoSDK.testnetTrusted) to import and use
createPlatformSdk to ensure consistent timeout/retry settings across the
codebase.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1122151b-a90a-465a-bf49-39037ad7a2c2

📥 Commits

Reviewing files that changed from the base of the PR and between 522373d and 837694f.

📒 Files selected for processing (1)
  • src/platform/identity.ts

@PastaPastaPasta PastaPastaPasta merged commit b1d6645 into main Apr 16, 2026
3 checks passed
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.

1 participant