Commit 03b8147
Fix: Facilitator: Missing validation for facilitatorFee <= value causes failed transactions (#201)
* Fix: Facilitator: Missing validation for facilitatorFee <= value causes failed transactions
* Apply changes from Holon
* Apply changes from Holon
* Fix: Complete fee validation test fixes for Issue #200
Fixed failing tests in PR #201 by addressing mock infrastructure issues:
**Test Infrastructure Fixes:**
- Fixed mock export name: `parseSettlementExtra` instead of `parseSettlementExtraCore`
- Added mocks for `@x402x/extensions` functions:
- `toCanonicalNetworkKey` for v1→CAIP-2 conversion
- `getNetworkAlias` for CAIP-2→v1 conversion
- Added direct mock for `network-utils.ts` module functions
- Fixed signature format in all test cases (hex string in payload.signature)
**Test Data Fixes:**
- Fixed `createMockSettlementRouterPaymentRequirements` to deep merge extra object
- Updated all fee validation test cases to use correct signature format
**Logging Improvements:**
- Added debug logging for fee validation checks
- Enhanced error logging with structured error messages
**Test Results:**
- All 360 unit tests passing ✓
- All 7 fee validation tests passing ✓
The fee validation implementation was already correct - tests were failing due to incomplete mocking.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
---------
Co-authored-by: holonbot[bot] <250454749+holonbot[bot]@users.noreply.github.com>
Co-authored-by: jolestar <[email protected]>
Co-authored-by: Claude Sonnet 4.5 <[email protected]>1 parent deaf29c commit 03b8147
File tree
4 files changed
+552
-25
lines changed- facilitator
- src
- test
- mocks
- unit
- utils
4 files changed
+552
-25
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
323 | 323 | | |
324 | 324 | | |
325 | 325 | | |
326 | | - | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
327 | 389 | | |
328 | 390 | | |
329 | 391 | | |
| |||
602 | 664 | | |
603 | 665 | | |
604 | 666 | | |
605 | | - | |
| 667 | + | |
606 | 668 | | |
607 | 669 | | |
| 670 | + | |
608 | 671 | | |
609 | 672 | | |
610 | 673 | | |
| |||
632 | 695 | | |
633 | 696 | | |
634 | 697 | | |
635 | | - | |
636 | | - | |
637 | | - | |
638 | | - | |
639 | | - | |
640 | | - | |
641 | | - | |
642 | | - | |
643 | | - | |
644 | | - | |
645 | | - | |
646 | 698 | | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
647 | 714 | | |
| 715 | + | |
648 | 716 | | |
649 | 717 | | |
650 | 718 | | |
651 | 719 | | |
652 | 720 | | |
653 | 721 | | |
654 | | - | |
| 722 | + | |
655 | 723 | | |
656 | | - | |
657 | | - | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
658 | 732 | | |
659 | 733 | | |
660 | 734 | | |
| |||
764 | 838 | | |
765 | 839 | | |
766 | 840 | | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
767 | 844 | | |
768 | 845 | | |
769 | | - | |
| 846 | + | |
| 847 | + | |
770 | 848 | | |
771 | 849 | | |
| 850 | + | |
772 | 851 | | |
773 | 852 | | |
774 | 853 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
54 | 59 | | |
55 | 60 | | |
56 | 61 | | |
| |||
61 | 66 | | |
62 | 67 | | |
63 | 68 | | |
| 69 | + | |
64 | 70 | | |
65 | 71 | | |
0 commit comments