Skip to content

Commit

Permalink
chore: Blockaid remove unfair_trade reason type (#21386)
Browse files Browse the repository at this point in the history
## **Description**
Blockaid code updates:
- remove unused unfair_trade reason type (see [Internal
Thread](https://consensys.slack.com/archives/C04D224QTLM/p1696953183067779))

## **Manual testing steps**

1. go to test-dapp
2. test PPOM buttons
3. observe no changes

## **Screenshots/Recordings**

## **Related issues**

Fixes MetaMask/MetaMask-planning#1484
Mobile update: MetaMask/metamask-mobile#7505

## **Pre-merge author checklist**

- [ ] I’ve followed [MetaMask Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've clearly explained:
  - [ ] What problem this PR is solving.
  - [ ] How this problem was solved.
  - [ ] How reviewers can test my changes.
- [ ] I’ve indicated what issue this PR is linked to: Fixes #???
- [ ] I’ve included tests if applicable.
- [ ] I’ve documented any added code.
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).
- [ ] I’ve properly set the pull request status:
  - [ ] In case it's not yet "ready for review", I've set it to "draft".
- [ ] In case it's "ready for review", I've changed it from "draft" to
"non-draft".

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
  • Loading branch information
digiwand authored Oct 17, 2023
1 parent c90c274 commit 4af7578
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
7 changes: 3 additions & 4 deletions shared/constants/security-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,10 @@ export enum BlockaidReason {
transferFarming = 'transfer_farming',
/** Direct theft of assets using transferFrom */
transferFromFarming = 'transfer_from_farming',
/** Malicious trade that results in the victim being drained */
unfairTrade = 'unfair_trade',

other = 'other',

// Locally defined
// MetaMask defined reasons
failed = 'Failed',
notApplicable = 'NotApplicable',
}
Expand All @@ -57,7 +55,8 @@ export enum BlockaidResultType {
Malicious = 'Malicious',
Warning = 'Warning',
Benign = 'Benign',
// Locally defined

// MetaMask defined result types
Failed = 'Failed',
NotApplicable = 'NotApplicable',
}
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/flask/ppom-blockaid-alert.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ describe('Confirmation Security Alert - Blockaid', function () {

/**
* Disclaimer: This test does not test all reason types. e.g. 'blur_farming',
* 'malicious_domain', 'unfair_trade'. Some other tests are found in other files:
* 'malicious_domain'. Some other tests are found in other files:
* e.g. test/e2e/flask/ppom-blockaid-alert-<name>.spec.js
*/
it('should show security alerts for malicious requests', async function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ const REASON_TO_DESCRIPTION_TKEY = Object.freeze({

[BlockaidReason.rawSignatureFarming]: 'blockaidDescriptionMightLoseAssets',
[BlockaidReason.tradeOrderFarming]: 'blockaidDescriptionMightLoseAssets',
[BlockaidReason.unfairTrade]: 'blockaidDescriptionMightLoseAssets',

[BlockaidReason.rawNativeTokenTransfer]: 'blockaidDescriptionTransferFarming',
[BlockaidReason.transferFarming]: 'blockaidDescriptionTransferFarming',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,6 @@ describe('Blockaid Banner Alert', () => {
'If you approve this request, a third party known for scams will take all your assets.',
[BlockaidReason.transferFarming]:
'If you approve this request, a third party known for scams will take all your assets.',
[BlockaidReason.unfairTrade]:
'If you approve this request, you might lose your assets.',
}).forEach(([reason, expectedDescription]) => {
it(`should render for '${reason}' correctly`, () => {
const { getByText } = renderWithLocalization(
Expand Down

0 comments on commit 4af7578

Please sign in to comment.