Skip to content

[Backend] sorobanService.simulateContractCall: extract STALE_THRESHOLD_MS / fee / placeholder source magic #640

Description

@ogazboiz

Join the discussion on Telegram

Why this matters

Issue #505 covered the named-constants pass in this file but only enumerated the simulated-tx flow magic literals. There is still a small set of unexplained magic in the file that the previous PR didn't itemize:

backend/src/services/sorobanService.ts:

  • Line 8: const STALE_THRESHOLD_MS = 30_000; — explained as 30s with no rationale comment
  • Line 56: new Account('GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN', '0') — placeholder source account inlined twice (once here)
  • Line 60: fee: '100' — for simulation calls
  • Line 91: fee: '1000' — for real submit calls
  • Lines 68, 98: .setTimeout(30) — explained as seconds but not labeled

Acceptance criteria

  • Add module-level constants with short doc comments for each: SIMULATION_FEE, SUBMIT_FEE, TX_TIMEOUT_SECONDS, SIMULATION_PLACEHOLDER_ACCOUNT
  • Reference the constants in simulateContractCall and submitContractCall
  • Add a one-line comment explaining why STALE_THRESHOLD_MS is 30s (= avg ledger close × N)

Files to touch

  • backend/src/services/sorobanService.ts (lines 8, 56, 60, 68, 91, 98)

Out of scope

  • Rewriting the dual-mode (simulate vs submit) abstraction itself

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programbackendBackend related tasksgood first issueGood for newcomersrefactorRefactoring existing code

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions