Page MenuHomePhabricator

[ecash-herald] Count noisy app txs above a shared display limit
ClosedPublic

Authored by bytesofman on Thu, Aug 6, 08:33.

Details

Summary

In block Telegram summaries, group parsed app txs by type and
show a count when a type exceeds APP_TX_INDIVIDUAL_DISPLAY_LIMIT (3),
otherwise list individually. This covers Proof of Writing noise and
removes always-batch special casing for PayButton, Blitzchips, and
Cashtab Msg.

Test Plan
  • cd apps/ecash-herald && pnpm test
  • Confirm getBlockTgMessage / renderAppTxGroups cases for POW at and above the limit pass

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Build Bitcoin ABC Diffs / Diff Testing (ai-review) passed.
CodeRabbit Review

Diff : committed changes only
Compare : HEAD → master
Directory : work
────────────────────────────────────────

(\(\
(• .•) You used any like it's a life jacket. Spoiler: it's a pool noodle.

────────────────────────────────────────────────────────────────────────

minor [Functional Correctness]
→ ]8;;vscode://file//work/apps/ecash-herald/src/parse.ts:1780apps/ecash-herald/src/parse.ts:1780]8;;

Count unique application transaction IDs in the section header.

One EMPP transaction can contain multiple DICE or ROLL pushes. Lines
1973-2001 add one group line per push. totalAppTxs then reports actions
as app txs.

Track transaction IDs in a Set. Use its size for the header. Keep
group.lines.length for each action count. Add a test with one EMPP
transaction that contains multiple Blitzchips pushes.


Proposed fix

-    const appTxGroups = new Map<string, AppTxGroup>();
+    const appTxGroups = new Map<string, AppTxGroup>();
+    const appTxIds = new Set<string>();

     if (opReturnInfo) {
+        appTxIds.add(txid);
         let { app, msg } = opReturnInfo;

-    let totalAppTxs = 0;
-    for (const group of appTxGroups.values()) {
-        totalAppTxs += group.lines.length;
-    }
+    const totalAppTxs = appTxIds.size;

Also applies to: 1942-2001, 2579-2583

────────────────────────────────────────
Review complete
1 finding ✔

Minor 1

4 files reviewed:

  • apps/ecash-herald/constants/op_return.ts
  • apps/ecash-herald/src/parse.ts
  • apps/ecash-herald/test/mocks/block.ts
  • apps/ecash-herald/test/parse.test.ts

────────────────────────────────────────

Print all AI prompts: coderabbit review --show-prompts

bytesofman published this revision for review.Thu, Aug 6, 09:29
This revision is now accepted and ready to land.Thu, Aug 6, 14:10