Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adopt new version of @metamask/signature-controller to add signature operation logs #21207

Merged
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

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
diff --git a/dist/SignatureController.js b/dist/SignatureController.js
index 8ac1b2158ff4564fe2f942ca955bd337d78a94ef..c6552d874d830e610fcff791eb0f87f51fae1770 100644
--- a/dist/SignatureController.js
+++ b/dist/SignatureController.js
@@ -278,6 +278,9 @@ _SignatureController_isEthSignEnabled = new WeakMap(), _SignatureController_getA
const messageParamsWithId = Object.assign(Object.assign(Object.assign({}, messageParams), { metamaskId: messageId }), (version && { version }));
const signaturePromise = messageManager.waitForFinishStatus(messageParamsWithId, messageName);
try {
+ signaturePromise.catch(() => {
+ // Expecting reject error but throwing manually rather than waiting
+ });
// Signature request is proposed to the user
__classPrivateFieldGet(this, _SignatureController_instances, "m", _SignatureController_addLog).call(this, signTypeForLogger, logging_controller_1.SigningStage.Proposed, messageParamsWithId);
const acceptResult = yield __classPrivateFieldGet(this, _SignatureController_instances, "m", _SignatureController_requestApproval).call(this, messageParamsWithId, approvalType);
@@ -287,7 +290,7 @@ _SignatureController_isEthSignEnabled = new WeakMap(), _SignatureController_getA
// User rejected the signature request
__classPrivateFieldGet(this, _SignatureController_instances, "m", _SignatureController_addLog).call(this, signTypeForLogger, logging_controller_1.SigningStage.Rejected, messageParamsWithId);
__classPrivateFieldGet(this, _SignatureController_instances, "m", _SignatureController_cancelAbstractMessage).call(this, messageManager, messageId);
- throw eth_rpc_errors_1.ethErrors.provider.userRejectedRequest('User rejected the request.');
+ throw eth_rpc_errors_1.ethErrors.provider.userRejectedRequest(`MetaMask ${messageName} Signature: User denied message signature.`);
}
yield signMessage(messageParamsWithId, signingOpts);
const signatureResult = yield signaturePromise;
1 change: 1 addition & 0 deletions app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -1475,6 +1475,7 @@ export default class MetamaskController extends EventEmitter {
`${this.keyringController.name}:signMessage`,
`${this.keyringController.name}:signPersonalMessage`,
`${this.keyringController.name}:signTypedMessage`,
`${this.loggingController.name}:add`,
],
}),
isEthSignEnabled: () =>
Expand Down
33 changes: 32 additions & 1 deletion lavamoat/browserify/beta/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -2053,15 +2053,46 @@
},
"packages": {
"@metamask/base-controller": true,
"@metamask/controller-utils": true,
"@metamask/logging-controller": true,
"@metamask/message-manager": true,
"@metamask/signature-controller>@metamask/controller-utils": true,
"browserify>buffer": true,
"eth-rpc-errors": true,
"ethereumjs-util": true,
"lodash": true,
"webpack>events": true
}
},
"@metamask/signature-controller>@metamask/controller-utils": {
"globals": {
"URL": true,
"console.error": true,
"fetch": true,
"setTimeout": true
},
"packages": {
"@metamask/controller-utils>@spruceid/siwe-parser": true,
"@metamask/signature-controller>@metamask/utils": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true
}
},
"@metamask/signature-controller>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
"superstruct": true
}
},
"@metamask/smart-transactions-controller": {
"globals": {
"URLSearchParams": true,
Expand Down
33 changes: 32 additions & 1 deletion lavamoat/browserify/desktop/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -2219,15 +2219,46 @@
},
"packages": {
"@metamask/base-controller": true,
"@metamask/controller-utils": true,
"@metamask/logging-controller": true,
"@metamask/message-manager": true,
"@metamask/signature-controller>@metamask/controller-utils": true,
"browserify>buffer": true,
"eth-rpc-errors": true,
"ethereumjs-util": true,
"lodash": true,
"webpack>events": true
}
},
"@metamask/signature-controller>@metamask/controller-utils": {
"globals": {
"URL": true,
"console.error": true,
"fetch": true,
"setTimeout": true
},
"packages": {
"@metamask/controller-utils>@spruceid/siwe-parser": true,
"@metamask/signature-controller>@metamask/utils": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true
}
},
"@metamask/signature-controller>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
"superstruct": true
}
},
"@metamask/smart-transactions-controller": {
"globals": {
"URLSearchParams": true,
Expand Down
33 changes: 32 additions & 1 deletion lavamoat/browserify/flask/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -2235,15 +2235,46 @@
},
"packages": {
"@metamask/base-controller": true,
"@metamask/controller-utils": true,
"@metamask/logging-controller": true,
"@metamask/message-manager": true,
"@metamask/signature-controller>@metamask/controller-utils": true,
"browserify>buffer": true,
"eth-rpc-errors": true,
"ethereumjs-util": true,
"lodash": true,
"webpack>events": true
}
},
"@metamask/signature-controller>@metamask/controller-utils": {
"globals": {
"URL": true,
"console.error": true,
"fetch": true,
"setTimeout": true
},
"packages": {
"@metamask/controller-utils>@spruceid/siwe-parser": true,
"@metamask/signature-controller>@metamask/utils": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true
}
},
"@metamask/signature-controller>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
"superstruct": true
}
},
"@metamask/smart-transactions-controller": {
"globals": {
"URLSearchParams": true,
Expand Down
33 changes: 32 additions & 1 deletion lavamoat/browserify/main/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -2148,15 +2148,46 @@
},
"packages": {
"@metamask/base-controller": true,
"@metamask/controller-utils": true,
"@metamask/logging-controller": true,
"@metamask/message-manager": true,
"@metamask/signature-controller>@metamask/controller-utils": true,
"browserify>buffer": true,
"eth-rpc-errors": true,
"ethereumjs-util": true,
"lodash": true,
"webpack>events": true
}
},
"@metamask/signature-controller>@metamask/controller-utils": {
"globals": {
"URL": true,
"console.error": true,
"fetch": true,
"setTimeout": true
},
"packages": {
"@metamask/controller-utils>@spruceid/siwe-parser": true,
"@metamask/signature-controller>@metamask/utils": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true
}
},
"@metamask/signature-controller>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
"superstruct": true
}
},
"@metamask/smart-transactions-controller": {
"globals": {
"URLSearchParams": true,
Expand Down
33 changes: 32 additions & 1 deletion lavamoat/browserify/mmi/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -2219,15 +2219,46 @@
},
"packages": {
"@metamask/base-controller": true,
"@metamask/controller-utils": true,
"@metamask/logging-controller": true,
"@metamask/message-manager": true,
"@metamask/signature-controller>@metamask/controller-utils": true,
"browserify>buffer": true,
"eth-rpc-errors": true,
"ethereumjs-util": true,
"lodash": true,
"webpack>events": true
}
},
"@metamask/signature-controller>@metamask/controller-utils": {
"globals": {
"URL": true,
"console.error": true,
"fetch": true,
"setTimeout": true
},
"packages": {
"@metamask/controller-utils>@spruceid/siwe-parser": true,
"@metamask/signature-controller>@metamask/utils": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true
}
},
"@metamask/signature-controller>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
"superstruct": true
}
},
"@metamask/smart-transactions-controller": {
"globals": {
"URLSearchParams": true,
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@
"request@^2.88.2": "patch:request@npm%3A2.88.2#./.yarn/patches/request-npm-2.88.2-f4a57c72c4.patch",
"request@^2.85.0": "patch:request@npm%3A2.88.2#./.yarn/patches/request-npm-2.88.2-f4a57c72c4.patch",
"lavamoat-core@npm:^14.4.1": "patch:lavamoat-core@npm%3A14.4.1#~/.yarn/patches/lavamoat-core-npm-14.4.1-c4e8bbb016.patch",
"@metamask/signature-controller@^6.0.0": "patch:@metamask/signature-controller@npm%3A6.0.0#~/.yarn/patches/@metamask-signature-controller-npm-6.0.0-90e8e479a9.patch",
"@metamask/signature-controller@^6.1.2": "patch:@metamask/signature-controller@npm%3A6.1.2#~/.yarn/patches/@metamask-signature-controller-npm-6.1.2-f60d8a4960.patch",
"[email protected]": "^7.5.4",
"[email protected]": "^7.5.4",
"@metamask/eth-keyring-controller@npm:^13.0.1": "patch:@metamask/eth-keyring-controller@npm%3A13.0.1#~/.yarn/patches/@metamask-eth-keyring-controller-npm-13.0.1-06ff83faad.patch"
Expand Down Expand Up @@ -276,7 +276,7 @@
"@metamask/safe-event-emitter": "^2.0.0",
"@metamask/scure-bip39": "^2.0.3",
"@metamask/selected-network-controller": "^1.0.0",
"@metamask/signature-controller": "^6.0.0",
"@metamask/signature-controller": "^6.1.2",
"@metamask/slip44": "^3.1.0",
"@metamask/smart-transactions-controller": "^4.0.0",
"@metamask/snaps-controllers": "^3.0.0",
Expand Down
Loading
Loading