-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(permit): report wrong permit to sentry for limit and swap flows (#…
…3565) * feat: add utils fn reportPermitWithDefaultSigner * fix: report to sentry incorrect permit for both swap and limit orders * fix: remove signer address `0x` prefix which is not included in the calldata
- Loading branch information
1 parent
53402e8
commit 7067919
Showing
5 changed files
with
33 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
11 changes: 11 additions & 0 deletions
11
apps/cowswap-frontend/src/modules/permit/utils/appDataContainsPermitSigner.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { PERMIT_SIGNER } from '@cowprotocol/permit-utils' | ||
|
||
export function appDataContainsPermitSigner(fullAppData: string | undefined): boolean { | ||
if (!fullAppData) { | ||
return false | ||
} | ||
|
||
const signerAddressWithoutPrefix = PERMIT_SIGNER.address.slice(2).toLowerCase() | ||
|
||
return fullAppData.toLowerCase().includes(signerAddressWithoutPrefix) | ||
} |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import * as Sentry from '@sentry/browser' | ||
|
||
export function reportPermitWithDefaultSigner(params: Record<any, any>): void { | ||
// report this to sentry if we ever use the default signer in the permit | ||
Sentry.captureException('User signed the permit using PERMIT_SIGNER instead of their account', { | ||
tags: { errorType: 'permitWithDefaultSigner' }, | ||
contexts: { params }, | ||
}) | ||
} |