refactor(wallet): typed SigningCancelledException with i18n message#318
Merged
Conversation
Replace generic Exception at both empty-signature guard sites with a typed SigningCancelledException so the KYC registration page can show a localised user message instead of a raw English exception string. Closes #316
- Add `registrationFailed` i18n key (DE/EN) for the non-cancellation failure path so the snackbar is fully localised, not partially - Collapse the two empty-signature tests into a single parametrised loop over `''` and `'0x'`
TaprootFreak
added a commit
that referenced
this pull request
May 23, 2026
Tier-1 integration tests for the EIP-7702 delegation sign path. Stitches Eip712Signer.signDelegation directly against the FakeBitboxCredentials boundary (the production caller, RealUnitSellPaymentInfoService.confirmPayment, delegates the EIP-712 sign here without further mutation). Pins: * happy path on BOTH credential arms — FakeBitbox.success and a real EthPrivateKey both produce a 65-byte sig over the same payload, and the two sigs differ (no leaked default key path). Regression class: the polymorphic switch in _signTypedData wired both arms to the same key (PR #318). * cancel — FakeBitbox.cancel returns "0x" and the post-sign guard in _signTypedData converts it into a typed SigningCancelledException, instead of letting the empty signature reach the backend. * chainId-wiring — verified across [1, 11155111, 42161] that signDelegation forwards eip7702Data.domain.chainId verbatim to the BitBox sign call (both the int argument AND the chainId embedded in the json payload's domain). A wrong chainId here makes the BitBox display the wrong network — silent until the user spots it. * disconnect — BitboxNotConnectedException at the BitBox boundary surfaces verbatim through Eip712Signer; it is NOT re-wrapped as SigningCancelledException (would mask a re-pair situation as a cancel prompt). Test uses a RecordingFakeBitbox subclass to capture (chainId, jsonData) without mocking the production signer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the generic
Exception('Signature was empty …')thrown at both empty-signature guard sites with a typedSigningCancelledException, so the KYC registration page can render a localised, user-facing message instead of a raw English exception string.SigningCancelledExceptionadded underlib/packages/wallet/exceptions/Eip712Signer._signTypedData,DFXAuthService.getSignature) throw the typed exceptionsigningCancelledi18n key added tostrings_de.arbandstrings_en.arb(alphabetisch sortiert)KycRegistrationSubmitFailurenow carries the originalcause; the registration page resolves the localised message when the cause isSigningCancelledException'') and0xBitBox return casesCloses #316
Test plan
flutter analyze— clean (no new issues in touched files)flutter test— all tests pass (3 new tests ineip712_signer_test.dart)