Conversation
Greptile SummaryThis release (v1.2.3) ships a batch of correctness fixes and UX improvements: fee tracking migrated from float NOCK to whole nicks to eliminate floating-point rounding errors at broadcast time, Nockblocks history sync converted from fire-and-forget to awaited to prevent MV3 service-worker termination before history is ingested, and a bridge fee breakdown row added to the Swap screen.
Confidence Score: 5/5Safe to merge — the core changes are well-scoped bug fixes with no identified correctness regressions. All changed paths have clear intent and are internally consistent. The fee-nicks migration correctly propagates through estimation, manual edit, save, and broadcast. The Nockblocks sync change from fire-and-forget to awaited is the right fix for MV3 service-worker lifetime. No broken contracts, no dropped state, no auth changes. No files require special attention. The only findings are minor style observations in currency.ts and SwapScreen.tsx.
|
| Filename | Overview |
|---|---|
| extension/shared/vault.ts | Nockblocks history sync converted from fire-and-forget to awaited; bridge tx now correctly sets trackingTxId; walletTxSharesAnyIdentifier replaces duplicated identity-matching inline code. |
| extension/popup/store.ts | Added balanceFetchGeneration counter to prevent stale isBalanceFetching; fetchBalance now calls fetchWalletTransactions after UTXO sync. |
| extension/popup/screens/SendScreen.tsx | Fee tracking migrated from float NOCK to whole nicks; debounced fee estimations use a sequence counter to discard stale results. |
| extension/popup/screens/SendReviewScreen.tsx | Fee handling now uses whole nicks from lastTransaction when available; isSending overlay replaced by button-level feedback; redundant fetchWalletTransactions call remains. |
| extension/shared/currency.ts | Added truncateNockToDecimals, FormatNockOptions, and rewriteInsufficientFeeErrorToDecimalNock; formatNock extended with truncate mode. |
| extension/popup/screens/SwapScreen.tsx | Shows receive amount after bridge protocol fee deduction and fee row with percentage label. |
| extension/shared/nockblocks-client.ts | Fixed normalizeTransaction to keep tx.transaction.spends/outputs in sync with top-level arrays. |
| extension/shared/types.ts | Added optional feeNicks field to TransactionDetails. |
| extension/popup/screens/HomeScreen.tsx | Account-switch handler reads fresh store state; fetchBalance awaited in switch path; swap icon updated to theme-aware SVG pair. |
Prompt To Fix All With AI
Fix the following 3 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 3
extension/shared/currency.ts:176
`rem` is constructed via `BigInt(m[2])` where `m[2]` is always a `\d+` match, so it can never be negative. The `rem < 0n` branch is unreachable dead code and may give a false sense of safety to future readers.
```suggestion
if (rem >= 65536n) return null;
```
### Issue 2 of 3
extension/popup/screens/SendReviewScreen.tsx:91-92
Redundant `fetchWalletTransactions` call after `fetchBalance`
`fetchBalance` in the store now internally calls `fetchWalletTransactions` after the UTXO sync completes (added in this PR). The explicit `fetchWalletTransactions()` call here fires immediately — before the UTXO sync — so it transiently writes a pre-sync transaction list to the store, which `fetchBalance` will then overwrite once the sync finishes. It's harmless but adds an unnecessary extra round-trip to the background service worker on every successful send.
### Issue 3 of 3
extension/popup/screens/SwapScreen.tsx:30-33
The bridge fee display amount uses raw `.toLocaleString` while every other amount in this PR uses `formatNock`. The two formatters can diverge (e.g., grouping separators, trailing zeros) and produce a visually inconsistent fee line. Using `formatNock` here keeps all amounts uniform.
```suggestion
const bridgeProtocolFeeAmountDisplay = formatNock(bridgeProtocolFeeNock, 4);
```
Reviews (2): Last reviewed commit: "Update extension/popup/styles.css" | Re-trigger Greptile
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
No description provided.