Skip to content

Add negative test coverage for memo ID scientific notation and trailing decimal zero#940

Merged
sagpatil merged 2 commits intofix/tx-immutability-and-memo-id-validationfrom
copilot/sub-pr-939
Mar 17, 2026
Merged

Add negative test coverage for memo ID scientific notation and trailing decimal zero#940
sagpatil merged 2 commits intofix/tx-immutability-and-memo-id-validationfrom
copilot/sub-pr-939

Conversation

Copy link

Copilot AI commented Mar 17, 2026

The Memo.id() validation fix (rejecting non-plain-decimal strings via /^\d+$/) lacked explicit regression tests for the two formats that motivated the fix: scientific notation and trailing decimal zeros — both accepted by BigNumber but fatal to BigInt()/UnsignedHyper.fromString().

Changes

  • test/unit/memo_test.js — Added two negative assertions to the existing Memo.id() invalid-argument test block:
    • "1e18" (scientific notation) — silently accepted by BigNumber, crashes UnsignedHyper
    • "1.0" (trailing decimal zero) — same failure path
// trailing decimal zero (BigNumber accepts but must be rejected)
expect(() => StellarBase.Memo.id('1.0')).to.throw(/Expects a uint64/);
// scientific notation (BigNumber accepts but BigInt()/UnsignedHyper crashes)
expect(() => StellarBase.Memo.id('1e18')).to.throw(/Expects a uint64/);

📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

…decimal zero

Co-authored-by: sagpatil <1414227+sagpatil@users.noreply.github.com>
Copilot AI changed the title [WIP] [WIP] Address feedback on mutable tx handle and memo ID validation fix Add negative test coverage for memo ID scientific notation and trailing decimal zero Mar 17, 2026
Copilot AI requested a review from sagpatil March 17, 2026 20:42
@github-actions
Copy link

github-actions bot commented Mar 17, 2026

Size Change: 0 B

Total Size: 3.53 MB

ℹ️ View Unchanged
Filename Size
dist/stellar-base.js 2.6 MB
dist/stellar-base.min.js 921 kB

compressed-size-action

@sagpatil sagpatil marked this pull request as ready for review March 17, 2026 21:53
@sagpatil sagpatil merged commit def1370 into fix/tx-immutability-and-memo-id-validation Mar 17, 2026
6 checks passed
@sagpatil sagpatil deleted the copilot/sub-pr-939 branch March 17, 2026 21:53
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.

2 participants