diff --git a/app/scripts/lib/createRPCMethodTrackingMiddleware.js b/app/scripts/lib/createRPCMethodTrackingMiddleware.js index 0c052aedeb16..825994c391ec 100644 --- a/app/scripts/lib/createRPCMethodTrackingMiddleware.js +++ b/app/scripts/lib/createRPCMethodTrackingMiddleware.js @@ -199,16 +199,6 @@ export default function createRPCMethodTrackingMiddleware({ const paramsExamplePassword = req?.params?.[2]; ///: BEGIN:ONLY_INCLUDE_IN(blockaid) - if (req.securityAlertResponse?.providerRequestsCount) { - Object.keys(req.securityAlertResponse.providerRequestsCount).forEach( - (key) => { - const metricKey = `ppom_${key}_count`; - eventProperties[metricKey] = - req.securityAlertResponse.providerRequestsCount[key]; - }, - ); - } - eventProperties.security_alert_response = req.securityAlertResponse?.result_type ?? BlockaidResultType.NotApplicable; diff --git a/app/scripts/lib/createRPCMethodTrackingMiddleware.test.js b/app/scripts/lib/createRPCMethodTrackingMiddleware.test.js index 17c745e741d6..16c83c31f2b2 100644 --- a/app/scripts/lib/createRPCMethodTrackingMiddleware.test.js +++ b/app/scripts/lib/createRPCMethodTrackingMiddleware.test.js @@ -143,47 +143,6 @@ describe('createRPCMethodTrackingMiddleware', () => { }); }); - it(`should track an event with correct blockaid parameters when providerRequestsCount is provided`, async () => { - const req = { - method: MESSAGE_TYPE.ETH_SIGN, - origin: 'some.dapp', - securityAlertResponse: { - result_type: BlockaidResultType.Malicious, - reason: BlockaidReason.maliciousDomain, - providerRequestsCount: { - eth_call: 5, - eth_getCode: 3, - }, - }, - }; - - const res = { - error: null, - }; - const { next } = getNext(); - await handler(req, res, next); - expect(trackEvent).toHaveBeenCalledTimes(1); - /** - * TODO: - * toMatchObject matches even if the the matched object does not contain some of the properties of the expected object - * I'm not sure why toMatchObject is used but we should probably check the other tests in this file for correctness in - * another PR. - * - */ - expect(trackEvent.mock.calls[0][0]).toStrictEqual({ - category: 'inpage_provider', - event: MetaMetricsEventName.SignatureRequested, - properties: { - signature_type: MESSAGE_TYPE.ETH_SIGN, - security_alert_response: BlockaidResultType.Malicious, - security_alert_reason: BlockaidReason.maliciousDomain, - ppom_eth_call_count: 5, - ppom_eth_getCode_count: 3, - }, - referrer: { url: 'some.dapp' }, - }); - }); - it(`should track a ${MetaMetricsEventName.SignatureApproved} event if the user approves`, async () => { const req = { method: MESSAGE_TYPE.ETH_SIGN_TYPED_DATA_V4, diff --git a/app/scripts/lib/transaction-metrics.test.ts b/app/scripts/lib/transaction-metrics.test.ts index dd922699cb26..8634e3201465 100644 --- a/app/scripts/lib/transaction-metrics.test.ts +++ b/app/scripts/lib/transaction-metrics.test.ts @@ -67,9 +67,6 @@ describe('Transaction metrics', () => { mockChainId, mockNetworkId, mockTransactionMeta, - mockTransactionMetaWithBlockaid, - expectedProperties, - expectedSensitiveProperties, mockActionId; beforeEach(() => { @@ -101,51 +98,6 @@ describe('Transaction metrics', () => { }, }; - // copy mockTransactionMeta and add blockaid data - mockTransactionMetaWithBlockaid = { - ...JSON.parse(JSON.stringify(mockTransactionMeta)), - securityProviderResponse: { - flagAsDangerous: 1, - providerRequestsCount: { - eth_call: 5, - eth_getCode: 3, - }, - }, - }; - - expectedProperties = { - account_snap_type: 'snaptype', - account_snap_version: 'snapversion', - account_type: undefined, - asset_type: AssetType.native, - chain_id: mockChainId, - device_model: undefined, - eip_1559_version: '0', - gas_edit_attempted: 'none', - gas_edit_type: 'none', - network: mockNetworkId, - referrer: ORIGIN_METAMASK, - security_alert_reason: BlockaidReason.notApplicable, - security_alert_response: BlockaidReason.notApplicable, - source: MetaMetricsTransactionEventSource.User, - status: 'unapproved', - token_standard: TokenStandard.none, - transaction_speed_up: false, - transaction_type: TransactionType.simpleSend, - ui_customizations: null, - }; - - expectedSensitiveProperties = { - default_gas: '0.000031501', - default_gas_price: '2', - first_seen: 1624408066355, - gas_limit: '0x7b0d', - gas_price: '2', - transaction_contract_method: undefined, - transaction_envelope_type: TRANSACTION_ENVELOPE_TYPE_NAMES.LEGACY, - transaction_replaced: undefined, - }; - jest.clearAllMocks(); }); @@ -163,28 +115,6 @@ describe('Transaction metrics', () => { actionId: mockActionId, }); - expect(mockTransactionMetricsRequest.createEventFragment).toBeCalledTimes( - 1, - ); - expect(mockTransactionMetricsRequest.createEventFragment).toBeCalledWith({ - actionId: mockActionId, - category: MetaMetricsEventCategory.Transactions, - failureEvent: TransactionMetaMetricsEvent.rejected, - initialEvent: TransactionMetaMetricsEvent.added, - successEvent: TransactionMetaMetricsEvent.approved, - uniqueIdentifier: 'transaction-added-1', - persist: true, - properties: expectedProperties, - sensitiveProperties: expectedSensitiveProperties, - }); - }); - - it('should create event fragment with blockaid', async () => { - await handleTransactionAdded(mockTransactionMetricsRequest, { - transactionMeta: mockTransactionMetaWithBlockaid as any, - actionId: mockActionId, - }); - expect(mockTransactionMetricsRequest.createEventFragment).toBeCalledTimes( 1, ); @@ -197,12 +127,36 @@ describe('Transaction metrics', () => { uniqueIdentifier: 'transaction-added-1', persist: true, properties: { - ...expectedProperties, - ui_customizations: ['flagged_as_malicious'], - ppom_eth_call_count: 5, - ppom_eth_getCode_count: 3, + account_snap_type: 'snaptype', + account_snap_version: 'snapversion', + account_type: undefined, + asset_type: AssetType.native, + chain_id: mockChainId, + device_model: undefined, + eip_1559_version: '0', + gas_edit_attempted: 'none', + gas_edit_type: 'none', + network: mockNetworkId, + referrer: ORIGIN_METAMASK, + security_alert_reason: BlockaidReason.notApplicable, + security_alert_response: BlockaidReason.notApplicable, + source: MetaMetricsTransactionEventSource.User, + status: 'unapproved', + token_standard: TokenStandard.none, + transaction_speed_up: false, + transaction_type: TransactionType.simpleSend, + ui_customizations: null, + }, + sensitiveProperties: { + default_gas: '0.000031501', + default_gas_price: '2', + first_seen: 1624408066355, + gas_limit: '0x7b0d', + gas_price: '2', + transaction_contract_method: undefined, + transaction_envelope_type: TRANSACTION_ENVELOPE_TYPE_NAMES.LEGACY, + transaction_replaced: undefined, }, - sensitiveProperties: expectedSensitiveProperties, }); }); }); @@ -228,6 +182,38 @@ describe('Transaction metrics', () => { }); const expectedUniqueId = 'transaction-added-1'; + const expectedProperties = { + account_snap_type: 'snaptype', + account_snap_version: 'snapversion', + account_type: undefined, + asset_type: AssetType.native, + chain_id: mockChainId, + device_model: undefined, + eip_1559_version: '0', + gas_edit_attempted: 'none', + gas_edit_type: 'none', + network: mockNetworkId, + referrer: ORIGIN_METAMASK, + security_alert_reason: BlockaidReason.notApplicable, + security_alert_response: BlockaidReason.notApplicable, + source: MetaMetricsTransactionEventSource.User, + status: 'unapproved', + token_standard: TokenStandard.none, + transaction_speed_up: false, + transaction_type: TransactionType.simpleSend, + ui_customizations: null, + }; + + const expectedSensitiveProperties = { + default_gas: '0.000031501', + default_gas_price: '2', + first_seen: 1624408066355, + gas_limit: '0x7b0d', + gas_price: '2', + transaction_contract_method: undefined, + transaction_envelope_type: TRANSACTION_ENVELOPE_TYPE_NAMES.LEGACY, + transaction_replaced: undefined, + }; expect(mockTransactionMetricsRequest.createEventFragment).toBeCalledTimes( 1, @@ -261,57 +247,6 @@ describe('Transaction metrics', () => { mockTransactionMetricsRequest.finalizeEventFragment, ).toBeCalledWith(expectedUniqueId); }); - - it('should create, update, finalize event fragment with blockaid', async () => { - await handleTransactionApproved(mockTransactionMetricsRequest, { - transactionMeta: mockTransactionMetaWithBlockaid as any, - actionId: mockActionId, - }); - - const expectedUniqueId = 'transaction-added-1'; - - expect(mockTransactionMetricsRequest.createEventFragment).toBeCalledTimes( - 1, - ); - expect(mockTransactionMetricsRequest.createEventFragment).toBeCalledWith({ - actionId: mockActionId, - category: MetaMetricsEventCategory.Transactions, - successEvent: TransactionMetaMetricsEvent.approved, - failureEvent: TransactionMetaMetricsEvent.rejected, - uniqueIdentifier: expectedUniqueId, - persist: true, - properties: { - ...expectedProperties, - ui_customizations: ['flagged_as_malicious'], - ppom_eth_call_count: 5, - ppom_eth_getCode_count: 3, - }, - sensitiveProperties: expectedSensitiveProperties, - }); - - expect(mockTransactionMetricsRequest.updateEventFragment).toBeCalledTimes( - 1, - ); - expect(mockTransactionMetricsRequest.updateEventFragment).toBeCalledWith( - expectedUniqueId, - { - properties: { - ...expectedProperties, - ui_customizations: ['flagged_as_malicious'], - ppom_eth_call_count: 5, - ppom_eth_getCode_count: 3, - }, - sensitiveProperties: expectedSensitiveProperties, - }, - ); - - expect( - mockTransactionMetricsRequest.finalizeEventFragment, - ).toBeCalledTimes(1); - expect( - mockTransactionMetricsRequest.finalizeEventFragment, - ).toBeCalledWith(expectedUniqueId); - }); }); describe('handleTransactionFinalized', () => { @@ -344,62 +279,41 @@ describe('Transaction metrics', () => { } as any); const expectedUniqueId = 'transaction-submitted-1'; - - expect(mockTransactionMetricsRequest.createEventFragment).toBeCalledTimes( - 1, - ); - expect(mockTransactionMetricsRequest.createEventFragment).toBeCalledWith({ - actionId: mockActionId, - category: MetaMetricsEventCategory.Transactions, - successEvent: TransactionMetaMetricsEvent.finalized, - uniqueIdentifier: expectedUniqueId, - persist: true, - properties: expectedProperties, - sensitiveProperties: { - ...expectedSensitiveProperties, - completion_time: expect.any(String), - gas_used: '0.000000291', - status: METRICS_STATUS_FAILED, - }, - }); - - expect(mockTransactionMetricsRequest.updateEventFragment).toBeCalledTimes( - 1, - ); - expect(mockTransactionMetricsRequest.updateEventFragment).toBeCalledWith( - expectedUniqueId, - { - properties: expectedProperties, - sensitiveProperties: { - ...expectedSensitiveProperties, - completion_time: expect.any(String), - gas_used: '0.000000291', - status: METRICS_STATUS_FAILED, - }, - }, - ); - - expect( - mockTransactionMetricsRequest.finalizeEventFragment, - ).toBeCalledTimes(1); - expect( - mockTransactionMetricsRequest.finalizeEventFragment, - ).toBeCalledWith(expectedUniqueId); - }); - - it('should create, update, finalize event fragment with blockaid', async () => { - mockTransactionMetaWithBlockaid.txReceipt = { - gasUsed: '0x123', - status: '0x0', + const expectedProperties = { + account_snap_type: 'snaptype', + account_snap_version: 'snapversion', + account_type: undefined, + asset_type: AssetType.native, + chain_id: mockChainId, + device_model: undefined, + eip_1559_version: '0', + gas_edit_attempted: 'none', + gas_edit_type: 'none', + network: mockNetworkId, + referrer: ORIGIN_METAMASK, + security_alert_reason: BlockaidReason.notApplicable, + security_alert_response: BlockaidReason.notApplicable, + source: MetaMetricsTransactionEventSource.User, + status: 'unapproved', + token_standard: TokenStandard.none, + transaction_speed_up: false, + transaction_type: TransactionType.simpleSend, + ui_customizations: null, }; - mockTransactionMetaWithBlockaid.submittedTime = 123; - - await handleTransactionFinalized(mockTransactionMetricsRequest, { - transactionMeta: mockTransactionMetaWithBlockaid, - actionId: mockActionId, - } as any); - const expectedUniqueId = 'transaction-submitted-1'; + const expectedSensitiveProperties = { + completion_time: expect.any(String), + default_gas: '0.000031501', + default_gas_price: '2', + first_seen: 1624408066355, + gas_limit: '0x7b0d', + gas_price: '2', + gas_used: '0.000000291', + transaction_contract_method: undefined, + transaction_envelope_type: TRANSACTION_ENVELOPE_TYPE_NAMES.LEGACY, + transaction_replaced: undefined, + status: METRICS_STATUS_FAILED, + }; expect(mockTransactionMetricsRequest.createEventFragment).toBeCalledTimes( 1, @@ -410,18 +324,8 @@ describe('Transaction metrics', () => { successEvent: TransactionMetaMetricsEvent.finalized, uniqueIdentifier: expectedUniqueId, persist: true, - properties: { - ...expectedProperties, - ui_customizations: ['flagged_as_malicious'], - ppom_eth_call_count: 5, - ppom_eth_getCode_count: 3, - }, - sensitiveProperties: { - ...expectedSensitiveProperties, - completion_time: expect.any(String), - gas_used: '0.000000291', - status: METRICS_STATUS_FAILED, - }, + properties: expectedProperties, + sensitiveProperties: expectedSensitiveProperties, }); expect(mockTransactionMetricsRequest.updateEventFragment).toBeCalledTimes( @@ -430,18 +334,8 @@ describe('Transaction metrics', () => { expect(mockTransactionMetricsRequest.updateEventFragment).toBeCalledWith( expectedUniqueId, { - properties: { - ...expectedProperties, - ui_customizations: ['flagged_as_malicious'], - ppom_eth_call_count: 5, - ppom_eth_getCode_count: 3, - }, - sensitiveProperties: { - ...expectedSensitiveProperties, - completion_time: expect.any(String), - gas_used: '0.000000291', - status: METRICS_STATUS_FAILED, - }, + properties: expectedProperties, + sensitiveProperties: expectedSensitiveProperties, }, ); @@ -463,6 +357,39 @@ describe('Transaction metrics', () => { } as any); const expectedUniqueId = 'transaction-submitted-1'; + const expectedProperties = { + account_snap_type: 'snaptype', + account_snap_version: 'snapversion', + account_type: undefined, + asset_type: AssetType.native, + chain_id: mockChainId, + device_model: undefined, + eip_1559_version: '0', + gas_edit_attempted: 'none', + gas_edit_type: 'none', + network: mockNetworkId, + referrer: ORIGIN_METAMASK, + security_alert_reason: BlockaidReason.notApplicable, + security_alert_response: BlockaidReason.notApplicable, + source: MetaMetricsTransactionEventSource.User, + status: 'unapproved', + token_standard: TokenStandard.none, + transaction_speed_up: false, + transaction_type: TransactionType.simpleSend, + ui_customizations: null, + }; + + const expectedSensitiveProperties = { + default_gas: '0.000031501', + default_gas_price: '2', + error: mockErrorMessage, + first_seen: 1624408066355, + gas_limit: '0x7b0d', + gas_price: '2', + transaction_contract_method: undefined, + transaction_envelope_type: TRANSACTION_ENVELOPE_TYPE_NAMES.LEGACY, + transaction_replaced: undefined, + }; expect(mockTransactionMetricsRequest.createEventFragment).toBeCalledTimes( 1, @@ -474,10 +401,7 @@ describe('Transaction metrics', () => { uniqueIdentifier: expectedUniqueId, persist: true, properties: expectedProperties, - sensitiveProperties: { - ...expectedSensitiveProperties, - error: mockErrorMessage, - }, + sensitiveProperties: expectedSensitiveProperties, }); expect(mockTransactionMetricsRequest.updateEventFragment).toBeCalledTimes( @@ -487,10 +411,7 @@ describe('Transaction metrics', () => { expectedUniqueId, { properties: expectedProperties, - sensitiveProperties: { - ...expectedSensitiveProperties, - error: mockErrorMessage, - }, + sensitiveProperties: expectedSensitiveProperties, }, ); @@ -524,6 +445,39 @@ describe('Transaction metrics', () => { } as any); const expectedUniqueId = 'transaction-submitted-1'; + const expectedProperties = { + account_snap_type: 'snaptype', + account_snap_version: 'snapversion', + account_type: undefined, + asset_type: AssetType.native, + chain_id: mockChainId, + device_model: undefined, + eip_1559_version: '0', + gas_edit_attempted: 'none', + gas_edit_type: 'none', + network: mockNetworkId, + referrer: ORIGIN_METAMASK, + security_alert_reason: BlockaidReason.notApplicable, + security_alert_response: BlockaidReason.notApplicable, + source: MetaMetricsTransactionEventSource.User, + status: 'unapproved', + token_standard: TokenStandard.none, + transaction_speed_up: false, + transaction_type: TransactionType.simpleSend, + ui_customizations: null, + }; + + const expectedSensitiveProperties = { + default_gas: '0.000031501', + default_gas_price: '2', + dropped: true, + first_seen: 1624408066355, + gas_limit: '0x7b0d', + gas_price: '2', + transaction_contract_method: undefined, + transaction_envelope_type: TRANSACTION_ENVELOPE_TYPE_NAMES.LEGACY, + transaction_replaced: 'other', + }; expect(mockTransactionMetricsRequest.createEventFragment).toBeCalledTimes( 1, @@ -535,11 +489,7 @@ describe('Transaction metrics', () => { uniqueIdentifier: expectedUniqueId, persist: true, properties: expectedProperties, - sensitiveProperties: { - ...expectedSensitiveProperties, - dropped: true, - transaction_replaced: 'other', - }, + sensitiveProperties: expectedSensitiveProperties, }); expect(mockTransactionMetricsRequest.updateEventFragment).toBeCalledTimes( @@ -549,69 +499,7 @@ describe('Transaction metrics', () => { expectedUniqueId, { properties: expectedProperties, - sensitiveProperties: { - ...expectedSensitiveProperties, - dropped: true, - transaction_replaced: 'other', - }, - }, - ); - - expect( - mockTransactionMetricsRequest.finalizeEventFragment, - ).toBeCalledTimes(1); - expect( - mockTransactionMetricsRequest.finalizeEventFragment, - ).toBeCalledWith(expectedUniqueId); - }); - - it('should create, update, finalize event fragment with blockaid', async () => { - await handleTransactionDropped(mockTransactionMetricsRequest, { - transactionMeta: mockTransactionMetaWithBlockaid, - actionId: mockActionId, - } as any); - - const expectedUniqueId = 'transaction-submitted-1'; - - expect(mockTransactionMetricsRequest.createEventFragment).toBeCalledTimes( - 1, - ); - expect(mockTransactionMetricsRequest.createEventFragment).toBeCalledWith({ - actionId: mockActionId, - category: MetaMetricsEventCategory.Transactions, - successEvent: TransactionMetaMetricsEvent.finalized, - uniqueIdentifier: expectedUniqueId, - persist: true, - properties: { - ...expectedProperties, - ui_customizations: ['flagged_as_malicious'], - ppom_eth_call_count: 5, - ppom_eth_getCode_count: 3, - }, - sensitiveProperties: { - ...expectedSensitiveProperties, - dropped: true, - transaction_replaced: 'other', - }, - }); - - expect(mockTransactionMetricsRequest.updateEventFragment).toBeCalledTimes( - 1, - ); - expect(mockTransactionMetricsRequest.updateEventFragment).toBeCalledWith( - expectedUniqueId, - { - properties: { - ...expectedProperties, - ui_customizations: ['flagged_as_malicious'], - ppom_eth_call_count: 5, - ppom_eth_getCode_count: 3, - }, - sensitiveProperties: { - ...expectedSensitiveProperties, - dropped: true, - transaction_replaced: 'other', - }, + sensitiveProperties: expectedSensitiveProperties, }, ); @@ -645,6 +533,38 @@ describe('Transaction metrics', () => { } as any); const expectedUniqueId = 'transaction-added-1'; + const expectedProperties = { + account_snap_type: 'snaptype', + account_snap_version: 'snapversion', + account_type: undefined, + asset_type: AssetType.native, + chain_id: mockChainId, + device_model: undefined, + eip_1559_version: '0', + gas_edit_attempted: 'none', + gas_edit_type: 'none', + network: mockNetworkId, + referrer: ORIGIN_METAMASK, + security_alert_reason: BlockaidReason.notApplicable, + security_alert_response: BlockaidReason.notApplicable, + source: MetaMetricsTransactionEventSource.User, + status: 'unapproved', + token_standard: TokenStandard.none, + transaction_speed_up: false, + transaction_type: TransactionType.simpleSend, + ui_customizations: null, + }; + + const expectedSensitiveProperties = { + default_gas: '0.000031501', + default_gas_price: '2', + first_seen: 1624408066355, + gas_limit: '0x7b0d', + gas_price: '2', + transaction_contract_method: undefined, + transaction_envelope_type: TRANSACTION_ENVELOPE_TYPE_NAMES.LEGACY, + transaction_replaced: undefined, + }; expect(mockTransactionMetricsRequest.createEventFragment).toBeCalledTimes( 1, @@ -680,59 +600,6 @@ describe('Transaction metrics', () => { abandoned: true, }); }); - - it('should create, update, finalize event fragment with blockaid', async () => { - await handleTransactionRejected(mockTransactionMetricsRequest, { - transactionMeta: mockTransactionMetaWithBlockaid, - actionId: mockActionId, - } as any); - - const expectedUniqueId = 'transaction-added-1'; - - expect(mockTransactionMetricsRequest.createEventFragment).toBeCalledTimes( - 1, - ); - expect(mockTransactionMetricsRequest.createEventFragment).toBeCalledWith({ - actionId: mockActionId, - category: MetaMetricsEventCategory.Transactions, - successEvent: TransactionMetaMetricsEvent.approved, - failureEvent: TransactionMetaMetricsEvent.rejected, - uniqueIdentifier: expectedUniqueId, - persist: true, - properties: { - ...expectedProperties, - ui_customizations: ['flagged_as_malicious'], - ppom_eth_call_count: 5, - ppom_eth_getCode_count: 3, - }, - sensitiveProperties: expectedSensitiveProperties, - }); - - expect(mockTransactionMetricsRequest.updateEventFragment).toBeCalledTimes( - 1, - ); - expect(mockTransactionMetricsRequest.updateEventFragment).toBeCalledWith( - expectedUniqueId, - { - properties: { - ...expectedProperties, - ui_customizations: ['flagged_as_malicious'], - ppom_eth_call_count: 5, - ppom_eth_getCode_count: 3, - }, - sensitiveProperties: expectedSensitiveProperties, - }, - ); - - expect( - mockTransactionMetricsRequest.finalizeEventFragment, - ).toBeCalledTimes(1); - expect( - mockTransactionMetricsRequest.finalizeEventFragment, - ).toBeCalledWith(expectedUniqueId, { - abandoned: true, - }); - }); }); describe('handleTransactionSubmitted', () => { @@ -762,8 +629,37 @@ describe('Transaction metrics', () => { successEvent: TransactionMetaMetricsEvent.finalized, uniqueIdentifier: 'transaction-submitted-1', persist: true, - properties: expectedProperties, - sensitiveProperties: expectedSensitiveProperties, + properties: { + account_snap_type: 'snaptype', + account_snap_version: 'snapversion', + account_type: undefined, + asset_type: AssetType.native, + chain_id: mockChainId, + device_model: undefined, + eip_1559_version: '0', + gas_edit_attempted: 'none', + gas_edit_type: 'none', + network: mockNetworkId, + referrer: ORIGIN_METAMASK, + security_alert_reason: BlockaidReason.notApplicable, + security_alert_response: BlockaidReason.notApplicable, + source: MetaMetricsTransactionEventSource.User, + status: 'unapproved', + token_standard: TokenStandard.none, + transaction_speed_up: false, + transaction_type: TransactionType.simpleSend, + ui_customizations: null, + }, + sensitiveProperties: { + default_gas: '0.000031501', + default_gas_price: '2', + first_seen: 1624408066355, + gas_limit: '0x7b0d', + gas_price: '2', + transaction_contract_method: undefined, + transaction_envelope_type: TRANSACTION_ENVELOPE_TYPE_NAMES.LEGACY, + transaction_replaced: undefined, + }, }); expect( diff --git a/app/scripts/lib/transaction-metrics.ts b/app/scripts/lib/transaction-metrics.ts index 93968d6d2062..01e149bc45a6 100644 --- a/app/scripts/lib/transaction-metrics.ts +++ b/app/scripts/lib/transaction-metrics.ts @@ -773,20 +773,6 @@ async function buildEventFragmentProperties({ } ///: END:ONLY_INCLUDE_IN - ///: BEGIN:ONLY_INCLUDE_IN(blockaid) - const additionalBlockaidParams = {} as Record; - - if (securityProviderResponse?.providerRequestsCount) { - Object.keys(securityProviderResponse.providerRequestsCount).forEach( - (key) => { - const metricKey = `ppom_${key}_count`; - additionalBlockaidParams[metricKey] = - securityProviderResponse.providerRequestsCount[key]; - }, - ); - } - ///: END:ONLY_INCLUDE_IN - /** The transaction status property is not considered sensitive and is now included in the non-anonymous event */ let properties = { chain_id: chainId, @@ -813,7 +799,6 @@ async function buildEventFragmentProperties({ securityAlertResponse?.result_type ?? BlockaidResultType.NotApplicable, security_alert_reason: securityAlertResponse?.reason ?? BlockaidReason.notApplicable, - ...additionalBlockaidParams, ///: END:ONLY_INCLUDE_IN } as Record;