1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Merge pull request #11171 from MetaMask/Version-v9.5.5

Version v9.5.5 RC
This commit is contained in:
ryanml 2021-05-25 12:10:25 -07:00 committed by GitHub
commit d73a93a6da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 111 additions and 10 deletions

View File

@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [9.5.5]
### Fixed
- [#11159](https://github.com/MetaMask/metamask-extension/pull/11159): Fixes crash after entering invalid data in to the Hex Data field when sending a transaction
## [9.5.4]
### Fixed
- [#11153](https://github.com/MetaMask/metamask-extension/pull/11153): Prevent UI crash when the transaction being retried or canceled is missing.
@ -2239,7 +2243,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Uncategorized
- Added the ability to restore accounts from seed words.
[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v9.5.4...HEAD
[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v9.5.5...HEAD
[9.5.5]: https://github.com/MetaMask/metamask-extension/compare/v9.5.4...v9.5.5
[9.5.4]: https://github.com/MetaMask/metamask-extension/compare/v9.5.3...v9.5.4
[9.5.3]: https://github.com/MetaMask/metamask-extension/compare/v9.5.2...v9.5.3
[9.5.2]: https://github.com/MetaMask/metamask-extension/compare/v9.5.1...v9.5.2

View File

@ -71,6 +71,6 @@
"notifications"
],
"short_name": "__MSG_appName__",
"version": "9.5.4",
"version": "9.5.5",
"web_accessible_resources": ["inpage.js", "phishing.html"]
}

View File

@ -330,7 +330,17 @@ export default class MetaMetricsController {
async trackEvent(payload, options) {
// event and category are required fields for all payloads
if (!payload.event || !payload.category) {
throw new Error('Must specify event and category.');
throw new Error(
`Must specify event and category. Event was: ${
payload.event
}. Category was: ${payload.category}. Payload keys were: ${Object.keys(
payload,
)}. ${
typeof payload.properties === 'object'
? `Payload property keys were: ${Object.keys(payload.properties)}`
: ''
}`,
);
}
if (!this.state.participateInMetaMetrics && !options?.isOptIn) {

View File

@ -347,6 +347,7 @@ export default class MetamaskController extends EventEmitter {
if (txReceipt && txReceipt.status === '0x0') {
this.metaMetricsController.trackEvent(
{
event: 'Tx Status Update: On-Chain Failure',
category: 'Background',
properties: {
action: 'Transactions',

View File

@ -75,6 +75,7 @@
"**/xmlhttprequest-ssl": "^1.6.2",
"3box/ipfs/ipld-zcash/zcash-bitcore-lib/lodash": "^4.17.21",
"3box/ipfs/ipld-zcash/zcash-bitcore-lib/elliptic": "^6.5.4",
"3box/ipfs/libp2p-mdns/multicast-dns/dns-packet": "^5.2.2",
"3box/**/libp2p-crypto/node-forge": "^0.10.0",
"3box/**/libp2p-keychain/node-forge": "^0.10.0",
"analytics-node/axios": "^0.21.1",

View File

@ -0,0 +1,16 @@
import { toBuffer as ethUtilToBuffer, isHexString } from 'ethereumjs-util';
/**
* Returns a buffer from the provided input, via ethereumjs-util.toBuffer but
* additionally handling non hex strings. This is a failsafe as in most cases
* we should be primarily dealing with hex prefixed strings with this utility
* but we do not want to break the extension for users.
* @param {import('ethereumjs-util').ToBufferInputTypes | string} input
* @returns {Buffer}
*/
export function toBuffer(input) {
if (typeof input === 'string' && isHexString(input) === false) {
return Buffer.from(input);
}
return ethUtilToBuffer(input);
}

View File

@ -0,0 +1,69 @@
import { strict as assert } from 'assert';
import BN from 'bn.js';
import { toBuffer } from './buffer-utils';
describe('buffer utils', function () {
describe('toBuffer', function () {
it('should work with prefixed hex strings', function () {
const result = toBuffer('0xe');
assert.equal(result.length, 1);
});
it('should work with non prefixed hex strings', function () {
const result = toBuffer('e');
assert.equal(result.length, 1);
});
it('should work with weirdly 0x prefixed non-hex strings', function () {
const result = toBuffer('0xtest');
assert.equal(result.length, 6);
});
it('should work with regular strings', function () {
const result = toBuffer('test');
assert.equal(result.length, 4);
});
it('should work with BN', function () {
const result = toBuffer(new BN(100));
assert.equal(result.length, 1);
});
it('should work with Buffer', function () {
const result = toBuffer(Buffer.from('test'));
assert.equal(result.length, 4);
});
it('should work with a number', function () {
const result = toBuffer(100);
assert.equal(result.length, 1);
});
it('should work with null or undefined', function () {
const result = toBuffer(null);
const result2 = toBuffer(undefined);
assert.equal(result.length, 0);
assert.equal(result2.length, 0);
});
it('should work with UInt8Array', function () {
const uint8 = new Uint8Array(2);
const result = toBuffer(uint8);
assert.equal(result.length, 2);
});
it('should work with objects that have a toBuffer property', function () {
const result = toBuffer({
toBuffer: () => Buffer.from('hi'),
});
assert.equal(result.length, 2);
});
it('should work with objects that have a toArray property', function () {
const result = toBuffer({
toArray: () => ['hi'],
});
assert.equal(result.length, 1);
});
});
});

View File

@ -1,7 +1,7 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { toBuffer } from 'ethereumjs-util';
import ConfirmTransactionBase from '../confirm-transaction-base';
import { toBuffer } from '../../../../shared/modules/buffer-utils';
export default class ConfirmDeployContract extends Component {
static contextTypes = {

View File

@ -1,4 +1,3 @@
import { toBuffer } from 'ethereumjs-util';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { ENVIRONMENT_TYPE_NOTIFICATION } from '../../../../shared/constants/app';
@ -23,6 +22,7 @@ import {
TRANSACTION_STATUSES,
} from '../../../../shared/constants/transaction';
import { getTransactionTypeTitle } from '../../helpers/utils/transactions.util';
import { toBuffer } from '../../../../shared/modules/buffer-utils';
export default class ConfirmTransactionBase extends Component {
static contextTypes = {

View File

@ -9267,13 +9267,12 @@ dnd-core@^7.4.4:
invariant "^2.2.4"
redux "^4.0.1"
dns-packet@^4.0.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/dns-packet/-/dns-packet-4.2.0.tgz#3fd6f5ff5a4ec3194ed0b15312693ffe8776b343"
integrity sha512-bn1AKpfkFbm0MIioOMHZ5qJzl2uypdBwI4nYNsqvhjsegBhcKJUlCrMPWLx6JEezRjxZmxhtIz/FkBEur2l8Cw==
dns-packet@^4.0.0, dns-packet@^5.2.2:
version "5.2.2"
resolved "https://registry.yarnpkg.com/dns-packet/-/dns-packet-5.2.2.tgz#e4c7d12974cc320b0c0d4b9bbbf68ac151cfe81e"
integrity sha512-sQN+vLwC3PvOXiCH/oHcdzML2opFeIdVh8gjjMZrM45n4dR80QF6o3AzInQy6F9Eoc0VJYog4JpQTilt4RFLYQ==
dependencies:
ip "^1.1.5"
safe-buffer "^5.1.1"
doctrine@1.5.0:
version "1.5.0"