Reader Findings?

English · Italiano · 中文 · 한국어

Good questions make open code better. Here every question a reader raised about the Lab gets an answer with proof: a test that anyone can run with npm test. We keep the original design when it is how Solana works, say its limits plainly, and fix what was wrong.

How this page works

  • One question, one accepted answer. The answer cites the exact test that proves it.
  • Status is honest: Fixed, Known limit or Not an issue, with the reason.
  • Credit goes to the reader who found it (by name only if they agree).
  • Nothing is deleted. Old answers stay, with the date they changed.

Does Model 3 compute the Token-2022 transfer fee the same way the program does?

Short answer: No, it did not. Token-2022 rounds the fee up; our expectedFee rounded down. Fixed on November 9, 2026.

Token-2022 computes the fee as ceil(amount × basis points ÷ 10,000), capped at the maximum fee, and TransferCheckedWithFee rejects any other value. Our expectedFee used integer division. For 401 base units at 25 bps the program expects 2; we passed 1, and the payment failed with "Calculated fee does not match expected fee". Our earlier test paid exactly 1,000 units, where both formulas agree, so it did not catch this.

Proof: M3 fee rounds up like Token-2022 (401 base units: fee 2, not 1) and the payment goes through and M3 expectedFee equals the Token-2022 fee formula on edge amounts (ten amounts, compared with calculateFee from @solana/spl-token).

Status: Fixed · Found by a reader (report 1) · Model 3 · see the model page · code: lab/code/src/03-b2b-invoice.ts

Does the Required Memo rule check that the invoice number is correct?

Short answer: No. Token-2022 checks that a memo exists, not what it says. Match the invoice number off-chain, at reconciliation.

The receiving account in Model 3 has the Required Memo extension. It rejects a transfer that has no memo instruction right before it, but it never reads the text. A payment with invoice:INV-WRONG-999, or even invoice:hello, passes on-chain. This is how Token-2022 is designed, so the architecture stays as it is; what changes is how we describe it and what we add next to it.

The model now has matchInvoicePayment: it reads the memo from the transaction logs and accepts a payment for an invoice only if there is exactly one invoice memo and it is the expected one.

Proof: M3 a WRONG invoice number still passes the on-chain memo rule (known limit: reconcile off-chain) and M3 reconciliation accepts the right invoice and rejects the wrong one.

Status: Known limit, now documented and tested · Found by a reader (report 2) · Model 3 · see the model page · code: lab/code/src/03-b2b-invoice.ts

Why we work this way, and the seven safety checkpoints that came out of these findings: Proof before trust.

Written up for developers and for everyone: Two Token-2022 edges our tests missed on dev.to and Proof before trust: seven safety checkpoints on Hashnode, both linked on the sources page.

Ask a question

Found something odd in the code or the walkthroughs? Open an issue in the repository (the GitHub link is in the site footer and on the sources page). If it holds up, it lands here with a test.

Example code, not audited. Devnet only, with a new empty wallet. Educational content, not financial advice.