Skip to content
Closed
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
24 changes: 24 additions & 0 deletions app/scripts/controllers/permissions/specifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,29 @@ function validateCaveatAccounts(accounts, getIdentities) {
});
}

// Environment variable injection does not work with destructuring
// eslint-disable-next-line prefer-destructuring
const IN_TEST = process.env.IN_TEST;

/**
* These are methods supported by Ganache, for use in e2e tests.
*
* @see {@link https://ganache.dev/}
*/
const ganacheMethods = [
'evm_addAccount',
'evm_increaseTime',
'evm_mine',
'evm_removeAccount',
'evm_revert',
'evm_setAccountBalance',
'evm_setAccountCode',
'evm_setAccountNonce',
'evm_setAccountStorageAt',
'evm_setTime',
'evm_snapshot',
];

/**
* All unrestricted methods recognized by the PermissionController.
* Unrestricted methods are ignored by the permission system, but every
Expand Down Expand Up @@ -276,4 +299,5 @@ export const unrestrictedMethods = Object.freeze([
'wallet_watchAsset',
'web3_clientVersion',
'web3_sha3',
...(IN_TEST ? ganacheMethods : []),
]);