Skip to content

fix: add missing break in DAI permit switch in getTypedData_ (BB3402573)#63

Merged
MaximusHaximus merged 1 commit into
mainfrom
fix/bb3402573-dai-permit-fallthrough
Apr 21, 2026
Merged

fix: add missing break in DAI permit switch in getTypedData_ (BB3402573)#63
MaximusHaximus merged 1 commit into
mainfrom
fix/bb3402573-dai-permit-fallthrough

Conversation

@MaximusHaximus

Copy link
Copy Markdown
Contributor

Bug

getTypedData_ in src/lxly/erc20.ts contains a switch (permitType) statement where the case Permit.DAI: block was missing a break statement. This caused fall-through into case Permit.EIP_2612:, which overwrites typedData.types.Permit and typedData.message with the EIP-2612 schema after the DAI-specific values had already been set.

Impact

Any call path that signs a DAI permit (e.g. bridgeAssetWithPermit for DAI tokens) would silently use the EIP-2612 typed data schema instead of the DAI schema. The resulting signature would be invalid against DAI's on-chain permit() implementation, causing the transaction to revert. DAI permits have been effectively broken since this code path was introduced.

Fix

Added a single break; after the closing brace of the typedData.message assignment in case Permit.DAI:, before case Permit.EIP_2612:. This ensures DAI permit typed data is returned as-is without overwriting.

// Before (fall-through bug)
case Permit.DAI:
    typedData.types.Permit = [ /* DAI fields */ ];
    typedData.message = { /* DAI message */ };
case Permit.EIP_2612:  // ← DAI falls through here and overwrites above

// After (fixed)
case Permit.DAI:
    typedData.types.Permit = [ /* DAI fields */ ];
    typedData.message = { /* DAI message */ };
    break;             // ← stops fall-through
case Permit.EIP_2612:

Fixes BB3402573.

@sonarqubecloud

Copy link
Copy Markdown

@MaximusHaximus MaximusHaximus requested a review from py-zoid April 15, 2026 20:34
@MaximusHaximus MaximusHaximus marked this pull request as ready for review April 15, 2026 20:35
@MaximusHaximus MaximusHaximus merged commit 435887a into main Apr 21, 2026
7 checks passed
@MaximusHaximus MaximusHaximus deleted the fix/bb3402573-dai-permit-fallthrough branch April 21, 2026 23:35
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