Skip to content

fix: critical bugs in consolidation.js and demo files (#87, #88)#105

Open
Valisthea wants to merge 2 commits intoasterdex:masterfrom
Valisthea:fix/critical-bugs-87-88
Open

fix: critical bugs in consolidation.js and demo files (#87, #88)#105
Valisthea wants to merge 2 commits intoasterdex:masterfrom
Valisthea:fix/critical-bugs-87-88

Conversation

@Valisthea
Copy link
Copy Markdown

@Valisthea Valisthea commented Apr 5, 2026

Bug Fixes

#87consolidation.js: Assignment instead of comparison (CRITICAL)

Line 198 (before):

if(sendToMainAddressRes['status'] = 'SUCCESS'){

Line 198 (after):

if(sendToMainAddressRes && sendToMainAddressRes['status'] === 'SUCCESS'){

Impact: The = operator assigns 'SUCCESS' to status instead of comparing it. The condition always evaluates to true, silently masking failed consolidation transfers. Users copying this demo code would never know their transfers failed.

Additional fixes in same file:

  • Add null checks on sendToMainAddressRes and spotWithdraw API responses (prevent TypeError: Cannot read properties of undefined)
  • Fix typo: withdraw_ignaturewithdraw_signature
  • Replace all implicit globals (content, headers, key, secret, signature, path, method, wallet, i, message, userSignature, sendToMainAddressRes, estimateFee, fee, spotWithdraw) with proper let/const declarations
  • Replace all loose == with strict ===

#88aster-code.py & sol_agent.py: Hardcoded wallet addresses

Before: Real developer ETH/SOL addresses hardcoded in demo files:

  • 0x014c85ffb0fF2F2972237AA950B452f92C69Ae1D (ETH)
  • 0xC98Fd64eBc39E28b92849d9cCef9495663439014 (ETH)
  • 0x71949710270163F096A8Bd342b266183Ae742e5E (ETH)
  • 6mSp4BuWCNgRSwv8JopQwCma26hmBT8jrcgJNadq23Gt (SOL)

After: Replaced with YOUR_* placeholder values + warning comments.

Impact: Users copying demo code could accidentally send funds/approve agents for the wrong wallet address.

Files Changed

File Changes
consolidation.js 25 lines changed
demo/aster-code.py 7 lines changed
demo/sol_agent.py 6 lines changed

Verification

  • Zero hardcoded addresses remaining
  • Zero loose == operators
  • Zero implicit globals
  • Typo fixed
  • No new dependencies, no breaking changes

Submitted by Kairos Lab

Valisthea added 2 commits April 5, 2026 13:02
…sterdex#87)

- Line 198: `status = 'SUCCESS'` (assignment) → `status === 'SUCCESS'` (comparison)
  This bug causes the if-condition to ALWAYS evaluate to true,
  silently masking failed consolidation transfers
- Add null checks on sendToMainAddressRes and spotWithdraw API responses
- Fix typo: `withdraw_ignature` → `withdraw_signature`
- Replace all implicit globals with `let`/`const` declarations
- Replace all loose `==` with strict `===`
…rdex#88)

- aster-code.py: replace real ETH addresses (0x014c85ff..., 0xC98Fd64e...)
  with YOUR_* placeholder values + warning comment
- sol_agent.py: replace real SOL address (6mSp4BuW...) and ETH addresses
  (0x71949710..., 0x014c85ff...) with YOUR_* placeholders + warning comment
- Prevents users from accidentally sending funds to developer wallets
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