Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/snaps-controllers/coverage.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"branches": 93.34,
"functions": 97.37,
"lines": 98.33,
"statements": 98.07
"statements": 98.06
}
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,6 @@ describe('SnapInterfaceController', () => {

expect(rootMessenger.call).toHaveBeenNthCalledWith(
2,
'PhishingController:maybeUpdateState',
);

expect(rootMessenger.call).toHaveBeenNthCalledWith(
3,
'PhishingController:testOrigin',
'https://foo.bar/',
);
Expand Down Expand Up @@ -187,7 +182,7 @@ describe('SnapInterfaceController', () => {
);

expect(rootMessenger.call).toHaveBeenNthCalledWith(
4,
3,
'MultichainAssetsController:getState',
);

Expand Down Expand Up @@ -243,11 +238,6 @@ describe('SnapInterfaceController', () => {

expect(rootMessenger.call).toHaveBeenNthCalledWith(
2,
'PhishingController:maybeUpdateState',
);

expect(rootMessenger.call).toHaveBeenNthCalledWith(
3,
'PhishingController:testOrigin',
'https://foo.bar/',
);
Expand Down Expand Up @@ -366,11 +356,6 @@ describe('SnapInterfaceController', () => {
false,
);

rootMessenger.registerActionHandler(
'PhishingController:maybeUpdateState',
jest.fn(),
);

rootMessenger.registerActionHandler(
'PhishingController:testOrigin',
() => ({ result: true, type: 'all' }),
Expand Down Expand Up @@ -399,11 +384,6 @@ describe('SnapInterfaceController', () => {

expect(rootMessenger.call).toHaveBeenNthCalledWith(
2,
'PhishingController:maybeUpdateState',
);

expect(rootMessenger.call).toHaveBeenNthCalledWith(
3,
'PhishingController:testOrigin',
'https://foo.bar/',
);
Expand All @@ -416,11 +396,6 @@ describe('SnapInterfaceController', () => {
false,
);

rootMessenger.registerActionHandler(
'PhishingController:maybeUpdateState',
jest.fn(),
);

rootMessenger.registerActionHandler(
'PhishingController:testOrigin',
() => ({ result: true, type: 'all' }),
Expand Down Expand Up @@ -449,11 +424,6 @@ describe('SnapInterfaceController', () => {

expect(rootMessenger.call).toHaveBeenNthCalledWith(
2,
'PhishingController:maybeUpdateState',
);

expect(rootMessenger.call).toHaveBeenNthCalledWith(
3,
'PhishingController:testOrigin',
'https://foo.bar/',
);
Expand All @@ -466,11 +436,6 @@ describe('SnapInterfaceController', () => {
false,
);

rootMessenger.registerActionHandler(
'PhishingController:maybeUpdateState',
jest.fn(),
);

rootMessenger.registerActionHandler(
'SnapController:get',
() => undefined,
Expand Down Expand Up @@ -500,7 +465,7 @@ describe('SnapInterfaceController', () => {
);

expect(rootMessenger.call).toHaveBeenNthCalledWith(
3,
2,
'SnapController:get',
MOCK_SNAP_ID,
);
Expand All @@ -513,11 +478,6 @@ describe('SnapInterfaceController', () => {
false,
);

rootMessenger.registerActionHandler(
'PhishingController:maybeUpdateState',
jest.fn(),
);

rootMessenger.registerActionHandler(
'PhishingController:testOrigin',
() => ({ result: true, type: 'all' }),
Expand Down Expand Up @@ -563,7 +523,7 @@ describe('SnapInterfaceController', () => {
);

expect(rootMessenger.call).toHaveBeenNthCalledWith(
3,
2,
'AccountsController:getAccountByAddress',
'7S3P4HxJpyyigGzodYwHtCxZyUQe9JiBMHyRWXArAaKv',
);
Expand Down Expand Up @@ -933,11 +893,6 @@ describe('SnapInterfaceController', () => {
false,
);

rootMessenger.registerActionHandler(
'PhishingController:maybeUpdateState',
jest.fn(),
);

rootMessenger.registerActionHandler(
'PhishingController:testOrigin',
() => ({ result: true, type: 'all' }),
Expand Down Expand Up @@ -977,12 +932,7 @@ describe('SnapInterfaceController', () => {
).rejects.toThrow('Invalid URL: The specified URL is not allowed.');

expect(rootMessenger.call).toHaveBeenNthCalledWith(
4,
'PhishingController:maybeUpdateState',
);

expect(rootMessenger.call).toHaveBeenNthCalledWith(
5,
3,
'PhishingController:testOrigin',
'https://foo.bar/',
);
Expand All @@ -995,11 +945,6 @@ describe('SnapInterfaceController', () => {
false,
);

rootMessenger.registerActionHandler(
'PhishingController:maybeUpdateState',
jest.fn(),
);

rootMessenger.registerActionHandler(
'PhishingController:testOrigin',
() => ({ result: true, type: 'all' }),
Expand Down Expand Up @@ -1043,12 +988,7 @@ describe('SnapInterfaceController', () => {
).rejects.toThrow('Invalid URL: The specified URL is not allowed.');

expect(rootMessenger.call).toHaveBeenNthCalledWith(
4,
'PhishingController:maybeUpdateState',
);

expect(rootMessenger.call).toHaveBeenNthCalledWith(
5,
3,
'PhishingController:testOrigin',
'https://foo.bar/',
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ import type {
ControllerStateChangeEvent,
} from '@metamask/base-controller';
import { BaseController } from '@metamask/base-controller';
import type {
MaybeUpdateState,
TestOrigin,
} from '@metamask/phishing-controller';
import type { TestOrigin } from '@metamask/phishing-controller';
import type {
InterfaceState,
SnapId,
Expand Down Expand Up @@ -91,7 +88,6 @@ type MultichainAssetsControllerGetStateAction = ControllerGetStateAction<

export type SnapInterfaceControllerAllowedActions =
| TestOrigin
| MaybeUpdateState
| HasApprovalRequest
| AcceptRequest
| GetSnap
Expand Down Expand Up @@ -406,13 +402,6 @@ export class SnapInterfaceController extends BaseController<
);
}

/**
* Trigger a Phishing list update if needed.
*/
async #triggerPhishingListUpdate() {
await this.messagingSystem.call('PhishingController:maybeUpdateState');
}

/**
* Check an origin against the phishing list.
*
Expand Down Expand Up @@ -500,8 +489,6 @@ export class SnapInterfaceController extends BaseController<
`A Snap UI may not be larger than ${MAX_UI_CONTENT_SIZE / 1000000} MB.`,
);

await this.#triggerPhishingListUpdate();

validateJsxElements(element, {
isOnPhishingList: this.#checkPhishingList.bind(this),
getSnap: this.#getSnap.bind(this),
Expand Down
7 changes: 0 additions & 7 deletions packages/snaps-controllers/src/test-utils/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,6 @@ export const getSnapControllerMessenger = (
'PermissionController:revokePermissionForAllSubjects',
'PermissionController:updateCaveat',
'PermissionController:getSubjectNames',
'PhishingController:maybeUpdateState',
'PhishingController:testOrigin',
'SnapController:get',
'SnapController:handleRequest',
Expand Down Expand Up @@ -781,7 +780,6 @@ export const getRestrictedSnapInterfaceControllerMessenger = (
name: 'SnapInterfaceController',
allowedActions: [
'PhishingController:testOrigin',
'PhishingController:maybeUpdateState',
'ApprovalController:hasRequest',
'ApprovalController:acceptRequest',
'MultichainAssetsController:getState',
Expand All @@ -795,11 +793,6 @@ export const getRestrictedSnapInterfaceControllerMessenger = (
});

if (mocked) {
messenger.registerActionHandler(
'PhishingController:maybeUpdateState',
async () => Promise.resolve(),
);

messenger.registerActionHandler('PhishingController:testOrigin', () => ({
result: false,
type: 'all',
Expand Down
6 changes: 0 additions & 6 deletions packages/snaps-jest/src/test-utils/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ export const getRootControllerMessenger = (mocked = true) => {
>();

if (mocked) {
messenger.registerActionHandler(
'PhishingController:maybeUpdateState',
async () => Promise.resolve(),
);

messenger.registerActionHandler('PhishingController:testOrigin', () => ({
result: false,
type: 'all',
Expand Down Expand Up @@ -51,7 +46,6 @@ export const getRestrictedSnapInterfaceControllerMessenger = (
name: 'SnapInterfaceController',
allowedActions: [
'PhishingController:testOrigin',
'PhishingController:maybeUpdateState',
'ApprovalController:hasRequest',
'ApprovalController:acceptRequest',
],
Expand Down
1 change: 0 additions & 1 deletion packages/snaps-simulation/src/controllers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ export function getControllers(options: GetControllersOptions): Controllers {
messenger: controllerMessenger.getRestricted({
name: 'SnapInterfaceController',
allowedActions: [
'PhishingController:maybeUpdateState',
'PhishingController:testOrigin',
'ApprovalController:hasRequest',
'ApprovalController:acceptRequest',
Expand Down
10 changes: 5 additions & 5 deletions packages/snaps-simulation/src/request.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ describe('getInterfaceApi', () => {
await snapInterface.clickElement('foo');

expect(controllerMessenger.call).toHaveBeenNthCalledWith(
5,
4,
'ExecutionService:handleRpcRequest',
MOCK_SNAP_ID,
{
Expand Down Expand Up @@ -466,7 +466,7 @@ describe('getInterfaceApi', () => {
await snapInterface.typeInField('foo', 'bar');

expect(controllerMessenger.call).toHaveBeenNthCalledWith(
6,
5,
'ExecutionService:handleRpcRequest',
MOCK_SNAP_ID,
{
Expand Down Expand Up @@ -519,7 +519,7 @@ describe('getInterfaceApi', () => {
await snapInterface.selectInDropdown('foo', 'option2');

expect(controllerMessenger.call).toHaveBeenNthCalledWith(
6,
5,
'ExecutionService:handleRpcRequest',
MOCK_SNAP_ID,
{
Expand Down Expand Up @@ -572,7 +572,7 @@ describe('getInterfaceApi', () => {
await snapInterface.selectFromRadioGroup('foo', 'option2');

expect(controllerMessenger.call).toHaveBeenNthCalledWith(
6,
5,
'ExecutionService:handleRpcRequest',
MOCK_SNAP_ID,
{
Expand Down Expand Up @@ -629,7 +629,7 @@ describe('getInterfaceApi', () => {
await snapInterface.selectFromSelector('foo', 'option2');

expect(controllerMessenger.call).toHaveBeenNthCalledWith(
6,
5,
'ExecutionService:handleRpcRequest',
MOCK_SNAP_ID,
{
Expand Down
16 changes: 4 additions & 12 deletions packages/snaps-simulation/src/simulation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ describe('getPermittedHooks', () => {
await updateInterface(id, content);

expect(controllerMessenger.call).toHaveBeenNthCalledWith(
3,
2,
'SnapInterfaceController:updateInterface',
snapId,
id,
Expand Down Expand Up @@ -532,7 +532,7 @@ describe('getPermittedHooks', () => {
const result = getInterfaceState(id);

expect(controllerMessenger.call).toHaveBeenNthCalledWith(
3,
2,
'SnapInterfaceController:getInterface',
snapId,
id,
Expand Down Expand Up @@ -573,7 +573,7 @@ describe('getPermittedHooks', () => {
const result = getInterfaceContext(id);

expect(controllerMessenger.call).toHaveBeenNthCalledWith(
3,
2,
'SnapInterfaceController:getInterface',
snapId,
id,
Expand Down Expand Up @@ -616,7 +616,7 @@ describe('getPermittedHooks', () => {
await resolveInterface(id, 'foobar');

expect(controllerMessenger.call).toHaveBeenNthCalledWith(
2,
1,
'SnapInterfaceController:resolveInterface',
snapId,
id,
Expand All @@ -631,14 +631,6 @@ describe('registerActions', () => {
const { runSaga, store } = createStore(getMockOptions());
const controllerMessenger = getRootControllerMessenger(false);

it('registers `PhishingController:maybeUpdateState`', async () => {
registerActions(controllerMessenger, runSaga);

expect(
await controllerMessenger.call('PhishingController:maybeUpdateState'),
).toBeUndefined();
});

it('registers `PhishingController:testOrigin`', async () => {
registerActions(controllerMessenger, runSaga);

Expand Down
5 changes: 0 additions & 5 deletions packages/snaps-simulation/src/simulation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -470,11 +470,6 @@ export function registerActions(
controllerMessenger: RootControllerMessenger,
runSaga: RunSagaFunction,
) {
controllerMessenger.registerActionHandler(
'PhishingController:maybeUpdateState',
async () => Promise.resolve(),
);

controllerMessenger.registerActionHandler(
'PhishingController:testOrigin',
() => ({ result: false, type: PhishingDetectorResultType.All }),
Expand Down
Loading
Loading