ශ්‍රී ලංකාවේ නවතම තාක්ෂණික පුවත් 2026-07-25, Saturday
💻 ක්‍රමලේඛනය · 🕒 කියවීමට විනාඩි 2 · 👁 1

Midnight Node හි Fork නිසා Transaction Watcher එකේ වැරදි Exit Code සහ නව විසඳුම

Midnight Node හි Fork නිසා Transaction Watcher එකේ වැරදි Exit Code සහ නව විසඳුම

Midnight Node (Substrate‑පදනම් කරන blockchain node) එකේ transaction watcher එකක්, fork එකක් සිදු වූ විට exit code එක වැරදි ලෙස පෙන්වා, CI පද්ධතියේ job එක රතු වීමට හේතු වුණා. මේ නිසා developers ලා transaction එක සාර්ථකව finalize වුනාදැයි සැකයට පත් වුණා.

Midnight Node එක AURA consensus සමඟ සෑම 6 තත්පරයකට block එකක් නිර්මාණය කරන අතර, GRANDPA සමඟ ඒ block එකන් කිහිපයක් පසු finality ලැබේ. Fork එකක් ඇති වීමේදී, දෙදෙනා validator එකක් එකම height එකේ වෙනස් block දෙකක් නිර්මාණය කරයි; එකක් පසුකාලීනව winning branch එකට පත් වේ. අසාර්ථක branch එකේ ඇතුළත් transaction එක pool එකට ආපසු යාමෙන් පසු, winning branch එකේ නැවත ඇතුළත් වේ. මේ ක්‍රියාව blockchain එකේ සාමාන්‍ය housekeeping වුවද, watcher tool එකට බරපතළ වැලමිණුමක් වුණා.

watcher එක subxt library එකේ watch stream එක භාවිතා කරයි. stream එක InBestBlock, NoLongerInBestBlock, InFinalizedBlock වැනි events නිකුත් කරනවා. මුල් logic එකේ, transaction එක best block එකට ඇතුළත් වීම පසු, timeout එකක් දී InFinalizedBlock event එක බලා, එය නොලැබුනහොත් FAILED_TO_FINALIZE කියලා non‑zero exit code එකක් දෙනවා.

fork එකේ සිදුවූ sequence එක මෙසේය:

  • t+0s – transaction එක submit කර InBestBlock (block A) ලැබේ.
  • t+6s – fork නිසා block A retract වෙයි, NoLongerInBestBlock event එක නිකුත් වේ (log එකේ පෙන්වීම නොවීය).
  • t+8s – transaction එක winning branch එකේ block B තුළ නැවත ඇතුළත් වේ.
  • t+22s – block B finalize වෙයි, transaction එක chain එකේ ස්ථාවරයි.
  • t+60s – watcher එකේ timeout ඉවරයි, FAILED_TO_FINALIZE exit code එක නිකුත් වේ.

මෙම වැරදි exit code එක, dashboard එකේ අඩු ප්‍රභාවයක් පමණක් නොව, wrapper scripts මගින් retry logic ක්‍රියාත්මක වීමේදී duplicate transaction සම්පාදනයට හේතු විය. reward‑claim වැනි at‑most‑once operations වල මේවා ගැටළුවක්.

ශ්‍රී ලංකාවට ඇති වැදගත්කම

ශ්‍රී ලංකාවේ developers, startups සහ blockchain‑based ව්‍යාපාර සඳහා මෙම අලුත් fix එක ඉතා ප්‍රයෝජනවත්. එයින්:

  • CI/CD pipelines වල false negative errors අඩුවෙයි, development velocity වැඩිවේ.
  • transaction reliability වැඩිවීමෙන් financial apps, gaming, supply‑chain solutions වැනි sectors වල trust වර්ධනය වේ.
  • open‑source Substrate ecosystem එකේ Sri Lankan contributors ලට නිවැරදි debugging pattern එකක් ලබා දේ.

ඉදිරියේදී, blockchain tooling වල exit code, API response වැනි outputs සම්බන්ධයෙන් වැඩි සත්‍යතාවයක් අවශ්‍ය බව මේ කතාබහ තහවුරු කරයි.

අවසන් වශයෙන්, fix එක PR #1927 (issue #1854) ලෙස main codebase එකට merge කර ඇත. දැන් timeout සිදු වුවද, tool එක finalized chain එකේ RPC query කර transaction hash එක සොයා, නිවැරදි exit code එක ලබා දේ. මෙය blockchain development වල “source of truth” සැලකීමේ නව මාර්ගයක්.

💡 ඔබේ blockchain development workflow එකට නව fix එක අදම එක් කරන්න!
මූලාශ්‍රය මෙම ලිපිය AI මගින් රචිත මුල් සාරාංශයකි. සම්පූර්ණ වාර්තාව කියවන්න:
Dev.to ↗
#MidnightNode #Fork #Transaction #Debugging #Blockchain