From b4449310590e01c43042e995e1d19352034c31b2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 Jan 2025 10:01:44 +0000 Subject: [PATCH 1/5] chore(deps): bump @metamask/post-message-stream from 8.1.1 to 9.0.0 (#3003) --- packages/snaps-controllers/package.json | 2 +- .../snaps-execution-environments/package.json | 2 +- packages/snaps-utils/package.json | 2 +- yarn.lock | 16 ++++++++-------- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/snaps-controllers/package.json b/packages/snaps-controllers/package.json index 6207569b95..2dbdfb302e 100644 --- a/packages/snaps-controllers/package.json +++ b/packages/snaps-controllers/package.json @@ -87,7 +87,7 @@ "@metamask/object-multiplex": "^2.0.0", "@metamask/permission-controller": "^11.0.3", "@metamask/phishing-controller": "^12.3.1", - "@metamask/post-message-stream": "^8.1.1", + "@metamask/post-message-stream": "^9.0.0", "@metamask/rpc-errors": "^7.0.2", "@metamask/snaps-registry": "^3.2.2", "@metamask/snaps-rpc-methods": "workspace:^", diff --git a/packages/snaps-execution-environments/package.json b/packages/snaps-execution-environments/package.json index 567c7200c8..7872c56d10 100644 --- a/packages/snaps-execution-environments/package.json +++ b/packages/snaps-execution-environments/package.json @@ -66,7 +66,7 @@ "dependencies": { "@metamask/json-rpc-engine": "^10.0.1", "@metamask/object-multiplex": "^2.0.0", - "@metamask/post-message-stream": "^8.1.1", + "@metamask/post-message-stream": "^9.0.0", "@metamask/providers": "^18.1.1", "@metamask/rpc-errors": "^7.0.2", "@metamask/snaps-sdk": "workspace:^", diff --git a/packages/snaps-utils/package.json b/packages/snaps-utils/package.json index 56201aad14..a51b8f2cba 100644 --- a/packages/snaps-utils/package.json +++ b/packages/snaps-utils/package.json @@ -110,7 +110,7 @@ "@metamask/eslint-config-jest": "^12.1.0", "@metamask/eslint-config-nodejs": "^12.1.0", "@metamask/eslint-config-typescript": "^12.1.0", - "@metamask/post-message-stream": "^8.1.1", + "@metamask/post-message-stream": "^9.0.0", "@swc/core": "1.3.78", "@swc/jest": "^0.2.26", "@ts-bridge/cli": "^0.6.1", diff --git a/yarn.lock b/yarn.lock index 7337bb7e9e..a06518ae2e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5337,13 +5337,13 @@ __metadata: languageName: node linkType: hard -"@metamask/post-message-stream@npm:^8.1.1": - version: 8.1.1 - resolution: "@metamask/post-message-stream@npm:8.1.1" +"@metamask/post-message-stream@npm:^9.0.0": + version: 9.0.0 + resolution: "@metamask/post-message-stream@npm:9.0.0" dependencies: - "@metamask/utils": "npm:^9.0.0" + "@metamask/utils": "npm:^11.0.1" readable-stream: "npm:3.6.2" - checksum: 10/8218d321abe734522aefaf6b44e4203966c3feaf83e2de6e68eef9dbe92b7fb47fe7fd82eae362147b1d741cc58d78bcc95d8bf02058e260ad2fb978104c96cf + checksum: 10/5da711d3274e724452322939a5a77c60ed1d7ed73cdaa62e95c16debc443804d5a16de116dce742e05b3fbfa962e009dfeafc3a12a66f20e163617567f2cace5 languageName: node linkType: hard @@ -5722,7 +5722,7 @@ __metadata: "@metamask/object-multiplex": "npm:^2.0.0" "@metamask/permission-controller": "npm:^11.0.3" "@metamask/phishing-controller": "npm:^12.3.1" - "@metamask/post-message-stream": "npm:^8.1.1" + "@metamask/post-message-stream": "npm:^9.0.0" "@metamask/rpc-errors": "npm:^7.0.2" "@metamask/snaps-registry": "npm:^3.2.2" "@metamask/snaps-rpc-methods": "workspace:^" @@ -5819,7 +5819,7 @@ __metadata: "@metamask/eslint-config-typescript": "npm:^12.1.0" "@metamask/json-rpc-engine": "npm:^10.0.1" "@metamask/object-multiplex": "npm:^2.0.0" - "@metamask/post-message-stream": "npm:^8.1.1" + "@metamask/post-message-stream": "npm:^9.0.0" "@metamask/providers": "npm:^18.1.1" "@metamask/rpc-errors": "npm:^7.0.2" "@metamask/snaps-sdk": "workspace:^" @@ -6255,7 +6255,7 @@ __metadata: "@metamask/eslint-config-typescript": "npm:^12.1.0" "@metamask/key-tree": "npm:^10.0.1" "@metamask/permission-controller": "npm:^11.0.3" - "@metamask/post-message-stream": "npm:^8.1.1" + "@metamask/post-message-stream": "npm:^9.0.0" "@metamask/rpc-errors": "npm:^7.0.2" "@metamask/slip44": "npm:^4.1.0" "@metamask/snaps-registry": "npm:^3.2.2" From 497b10ffa99931444ac928c8e2c703336096cd73 Mon Sep 17 00:00:00 2001 From: Maarten Zuidhoorn Date: Fri, 10 Jan 2025 11:37:17 +0100 Subject: [PATCH 2/5] Don't rerun workflows for Dependabot (#3004) Seems like GitHub is struggling with all the Dependabot PRs right now, so we should at least temporarily disable rerunning failed workflows for Dependabot. --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 86538e5ba5..f873494c4d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -96,7 +96,7 @@ jobs: re-run: name: Re-run failed jobs needs: lint-build-test - if: failure() && fromJSON(github.run_attempt) < 3 + if: failure() && fromJSON(github.run_attempt) < 3 && github.event.pull_request.user.login != 'dependabot[bot]' runs-on: ubuntu-latest permissions: actions: write From 71ab7c3f389478b70c23e2d9e8f01f1876dfbeca Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 Jan 2025 10:50:09 +0000 Subject: [PATCH 3/5] chore(deps): bump @metamask/permission-controller from 11.0.3 to 11.0.4 (#2999) --- packages/snaps-controllers/package.json | 2 +- packages/snaps-rpc-methods/package.json | 2 +- packages/snaps-simulation/package.json | 2 +- packages/snaps-simulator/package.json | 2 +- packages/snaps-utils/package.json | 2 +- yarn.lock | 22 +++++++++++----------- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/packages/snaps-controllers/package.json b/packages/snaps-controllers/package.json index 2dbdfb302e..ec3fd6f31d 100644 --- a/packages/snaps-controllers/package.json +++ b/packages/snaps-controllers/package.json @@ -85,7 +85,7 @@ "@metamask/json-rpc-middleware-stream": "^8.0.5", "@metamask/key-tree": "^10.0.1", "@metamask/object-multiplex": "^2.0.0", - "@metamask/permission-controller": "^11.0.3", + "@metamask/permission-controller": "^11.0.4", "@metamask/phishing-controller": "^12.3.1", "@metamask/post-message-stream": "^9.0.0", "@metamask/rpc-errors": "^7.0.2", diff --git a/packages/snaps-rpc-methods/package.json b/packages/snaps-rpc-methods/package.json index 93d4eb2ec3..dca4ad8a05 100644 --- a/packages/snaps-rpc-methods/package.json +++ b/packages/snaps-rpc-methods/package.json @@ -56,7 +56,7 @@ }, "dependencies": { "@metamask/key-tree": "^10.0.1", - "@metamask/permission-controller": "^11.0.3", + "@metamask/permission-controller": "^11.0.4", "@metamask/rpc-errors": "^7.0.2", "@metamask/snaps-sdk": "workspace:^", "@metamask/snaps-utils": "workspace:^", diff --git a/packages/snaps-simulation/package.json b/packages/snaps-simulation/package.json index 8326066f21..6b571c2606 100644 --- a/packages/snaps-simulation/package.json +++ b/packages/snaps-simulation/package.json @@ -60,7 +60,7 @@ "@metamask/json-rpc-engine": "^10.0.1", "@metamask/json-rpc-middleware-stream": "^8.0.5", "@metamask/key-tree": "^10.0.1", - "@metamask/permission-controller": "^11.0.3", + "@metamask/permission-controller": "^11.0.4", "@metamask/phishing-controller": "^12.3.1", "@metamask/snaps-controllers": "workspace:^", "@metamask/snaps-execution-environments": "workspace:^", diff --git a/packages/snaps-simulator/package.json b/packages/snaps-simulator/package.json index e3ecd0c943..e243a65e3b 100644 --- a/packages/snaps-simulator/package.json +++ b/packages/snaps-simulator/package.json @@ -51,7 +51,7 @@ "@metamask/json-rpc-engine": "^10.0.1", "@metamask/json-rpc-middleware-stream": "^8.0.5", "@metamask/key-tree": "^10.0.1", - "@metamask/permission-controller": "^11.0.3", + "@metamask/permission-controller": "^11.0.4", "@metamask/snaps-controllers": "workspace:^", "@metamask/snaps-execution-environments": "workspace:^", "@metamask/snaps-rpc-methods": "workspace:^", diff --git a/packages/snaps-utils/package.json b/packages/snaps-utils/package.json index a51b8f2cba..442d27174e 100644 --- a/packages/snaps-utils/package.json +++ b/packages/snaps-utils/package.json @@ -81,7 +81,7 @@ "@babel/types": "^7.23.0", "@metamask/base-controller": "^7.0.2", "@metamask/key-tree": "^10.0.1", - "@metamask/permission-controller": "^11.0.3", + "@metamask/permission-controller": "^11.0.4", "@metamask/rpc-errors": "^7.0.2", "@metamask/slip44": "^4.1.0", "@metamask/snaps-registry": "^3.2.2", diff --git a/yarn.lock b/yarn.lock index a06518ae2e..7451b63e19 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4162,7 +4162,7 @@ __metadata: languageName: unknown linkType: soft -"@metamask/controller-utils@npm:^11.4.1, @metamask/controller-utils@npm:^11.4.4": +"@metamask/controller-utils@npm:^11.4.4": version: 11.4.4 resolution: "@metamask/controller-utils@npm:11.4.4" dependencies: @@ -5303,12 +5303,12 @@ __metadata: languageName: node linkType: hard -"@metamask/permission-controller@npm:^11.0.3": - version: 11.0.3 - resolution: "@metamask/permission-controller@npm:11.0.3" +"@metamask/permission-controller@npm:^11.0.4": + version: 11.0.4 + resolution: "@metamask/permission-controller@npm:11.0.4" dependencies: "@metamask/base-controller": "npm:^7.0.2" - "@metamask/controller-utils": "npm:^11.4.1" + "@metamask/controller-utils": "npm:^11.4.4" "@metamask/json-rpc-engine": "npm:^10.0.1" "@metamask/rpc-errors": "npm:^7.0.1" "@metamask/utils": "npm:^10.0.0" @@ -5318,7 +5318,7 @@ __metadata: nanoid: "npm:^3.1.31" peerDependencies: "@metamask/approval-controller": ^7.0.0 - checksum: 10/e90411ae34410176945e79c8e863ff2d78a12c01e98837a7298dc94d4815c65fec2cd338d4ae0026f91899acfe21bfe8b857a3b2f12c3d96719e5afb68df0e68 + checksum: 10/89bc5c3ffbcddca8cd3a8fa1e73d4196544223b59f69ece549f7459198960e8068fd96412ee3b28353b2a53ea38d8c370bd14df937aebddceed6a87cb5652f8c languageName: node linkType: hard @@ -5720,7 +5720,7 @@ __metadata: "@metamask/json-rpc-middleware-stream": "npm:^8.0.5" "@metamask/key-tree": "npm:^10.0.1" "@metamask/object-multiplex": "npm:^2.0.0" - "@metamask/permission-controller": "npm:^11.0.3" + "@metamask/permission-controller": "npm:^11.0.4" "@metamask/phishing-controller": "npm:^12.3.1" "@metamask/post-message-stream": "npm:^9.0.0" "@metamask/rpc-errors": "npm:^7.0.2" @@ -5996,7 +5996,7 @@ __metadata: "@metamask/eslint-config-typescript": "npm:^12.1.0" "@metamask/json-rpc-engine": "npm:^10.0.1" "@metamask/key-tree": "npm:^10.0.1" - "@metamask/permission-controller": "npm:^11.0.3" + "@metamask/permission-controller": "npm:^11.0.4" "@metamask/rpc-errors": "npm:^7.0.2" "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" @@ -6086,7 +6086,7 @@ __metadata: "@metamask/json-rpc-engine": "npm:^10.0.1" "@metamask/json-rpc-middleware-stream": "npm:^8.0.5" "@metamask/key-tree": "npm:^10.0.1" - "@metamask/permission-controller": "npm:^11.0.3" + "@metamask/permission-controller": "npm:^11.0.4" "@metamask/phishing-controller": "npm:^12.3.1" "@metamask/snaps-controllers": "workspace:^" "@metamask/snaps-execution-environments": "workspace:^" @@ -6148,7 +6148,7 @@ __metadata: "@metamask/json-rpc-engine": "npm:^10.0.1" "@metamask/json-rpc-middleware-stream": "npm:^8.0.5" "@metamask/key-tree": "npm:^10.0.1" - "@metamask/permission-controller": "npm:^11.0.3" + "@metamask/permission-controller": "npm:^11.0.4" "@metamask/snaps-controllers": "workspace:^" "@metamask/snaps-execution-environments": "workspace:^" "@metamask/snaps-rpc-methods": "workspace:^" @@ -6254,7 +6254,7 @@ __metadata: "@metamask/eslint-config-nodejs": "npm:^12.1.0" "@metamask/eslint-config-typescript": "npm:^12.1.0" "@metamask/key-tree": "npm:^10.0.1" - "@metamask/permission-controller": "npm:^11.0.3" + "@metamask/permission-controller": "npm:^11.0.4" "@metamask/post-message-stream": "npm:^9.0.0" "@metamask/rpc-errors": "npm:^7.0.2" "@metamask/slip44": "npm:^4.1.0" From 399dbee925f570a0d62142e124da2d893f101e93 Mon Sep 17 00:00:00 2001 From: Frederik Bolding Date: Fri, 10 Jan 2025 14:38:50 +0100 Subject: [PATCH 4/5] fix: Make `jobs` property fully optional in the cronjob endowment (#3005) Make the `jobs` property fully optional in the cronjob endowment since it is also allowed to be empty. We accounted for and discussed this in #2941, but must have forgotten to allow `endowment:cronjob: {}`. --- packages/snaps-sdk/src/types/permissions.ts | 2 +- packages/snaps-utils/src/manifest/validation.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/snaps-sdk/src/types/permissions.ts b/packages/snaps-sdk/src/types/permissions.ts index 76fc232dcd..a591ee3957 100644 --- a/packages/snaps-sdk/src/types/permissions.ts +++ b/packages/snaps-sdk/src/types/permissions.ts @@ -37,7 +37,7 @@ export type RequestedSnap = { export type InitialPermissions = Partial<{ 'endowment:cronjob': { - jobs: Cronjob[]; + jobs?: Cronjob[]; maxRequestTime?: number; }; 'endowment:ethereum-provider': EmptyObject; diff --git a/packages/snaps-utils/src/manifest/validation.ts b/packages/snaps-utils/src/manifest/validation.ts index dd65132a10..ad14afc916 100644 --- a/packages/snaps-utils/src/manifest/validation.ts +++ b/packages/snaps-utils/src/manifest/validation.ts @@ -191,7 +191,7 @@ export const PermissionsStruct: Describe = type({ 'endowment:cronjob': optional( mergeStructs( HandlerCaveatsStruct, - object({ jobs: CronjobSpecificationArrayStruct }), + object({ jobs: optional(CronjobSpecificationArrayStruct) }), ), ), 'endowment:ethereum-provider': optional(EmptyObjectStruct), From f21e859ef70eca24a47788a8010fde518e9be4d7 Mon Sep 17 00:00:00 2001 From: Frederik Bolding Date: Fri, 10 Jan 2025 14:52:45 +0100 Subject: [PATCH 5/5] fix: Stop storing messenger manually in `CronjobController` (#3006) For unknown reasons we were storing our own instance of the messenger in the `CronjobController`, we don't need to do that since the `BaseController` provides this functionality already. --- .../snaps-controllers/src/cronjob/CronjobController.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/snaps-controllers/src/cronjob/CronjobController.ts b/packages/snaps-controllers/src/cronjob/CronjobController.ts index f93995c9c2..403b3c6e19 100644 --- a/packages/snaps-controllers/src/cronjob/CronjobController.ts +++ b/packages/snaps-controllers/src/cronjob/CronjobController.ts @@ -122,8 +122,6 @@ export class CronjobController extends BaseController< CronjobControllerState, CronjobControllerMessenger > { - #messenger: CronjobControllerMessenger; - #dailyTimer!: Timer; #timers: Map; @@ -147,7 +145,6 @@ export class CronjobController extends BaseController< }); this.#timers = new Map(); this.#snapIds = new Map(); - this.#messenger = messenger; this._handleSnapRegisterEvent = this._handleSnapRegisterEvent.bind(this); this._handleSnapUnregisterEvent = @@ -227,7 +224,7 @@ export class CronjobController extends BaseController< * @returns Array of Cronjob specifications. */ #getSnapJobs(snapId: SnapId): Cronjob[] | undefined { - const permissions = this.#messenger.call( + const permissions = this.messagingSystem.call( 'PermissionController:getPermissions', snapId, ); @@ -303,7 +300,7 @@ export class CronjobController extends BaseController< */ async #executeCronjob(job: Cronjob) { this.#updateJobLastRunState(job.id, Date.now()); - await this.#messenger.call('SnapController:handleRequest', { + await this.messagingSystem.call('SnapController:handleRequest', { snapId: job.snapId, origin: '', handler: HandlerType.OnCronjob, @@ -387,7 +384,7 @@ export class CronjobController extends BaseController< const timer = new Timer(ms); timer.start(() => { - this.#messenger + this.messagingSystem .call('SnapController:handleRequest', { snapId: event.snapId, origin: '',