Merge branch 'master' into next-v5.0
This commit is contained in:
@ -171,7 +171,7 @@ Dynamic role allocation is often a desirable property, for example in systems wh
|
|||||||
[[querying-privileged-accounts]]
|
[[querying-privileged-accounts]]
|
||||||
=== Querying Privileged Accounts
|
=== Querying Privileged Accounts
|
||||||
|
|
||||||
Because accounts might <<granting-and-revoking, grant and revoke roles>> dynamically, it is not always possible to determine which accounts hold a particular role. This is important as it allows to prove certain properties about a system, such as that an administrative account is a multisig or a DAO, or that a certain role has been removed from all users, effectively disabling any associated functionality.
|
Because accounts might <<granting-and-revoking, grant and revoke roles>> dynamically, it is not always possible to determine which accounts hold a particular role. This is important as it allows proving certain properties about a system, such as that an administrative account is a multisig or a DAO, or that a certain role has been removed from all users, effectively disabling any associated functionality.
|
||||||
|
|
||||||
Under the hood, `AccessControl` uses `EnumerableSet`, a more powerful variant of Solidity's `mapping` type, which allows for key enumeration. `getRoleMemberCount` can be used to retrieve the number of accounts that have a particular role, and `getRoleMember` can then be called to get the address of each of these accounts.
|
Under the hood, `AccessControl` uses `EnumerableSet`, a more powerful variant of Solidity's `mapping` type, which allows for key enumeration. `getRoleMemberCount` can be used to retrieve the number of accounts that have a particular role, and `getRoleMember` can then be called to get the address of each of these accounts.
|
||||||
|
|
||||||
|
|||||||
@ -3,33 +3,23 @@ const { TASK_TEST_GET_TEST_FILES } = require('hardhat/builtin-tasks/task-names')
|
|||||||
|
|
||||||
// Modifies `hardhat test` to skip the proxy tests after proxies are removed by the transpiler for upgradeability.
|
// Modifies `hardhat test` to skip the proxy tests after proxies are removed by the transpiler for upgradeability.
|
||||||
|
|
||||||
internalTask(TASK_TEST_GET_TEST_FILES).setAction(async ({ testFiles }, { config }) => {
|
internalTask(TASK_TEST_GET_TEST_FILES).setAction(async (args, hre, runSuper) => {
|
||||||
if (testFiles.length !== 0) {
|
|
||||||
return testFiles;
|
|
||||||
}
|
|
||||||
|
|
||||||
const globAsync = require('glob');
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const { promises: fs } = require('fs');
|
const { promises: fs } = require('fs');
|
||||||
const { promisify } = require('util');
|
|
||||||
|
|
||||||
const glob = promisify(globAsync);
|
|
||||||
|
|
||||||
const hasProxies = await fs
|
const hasProxies = await fs
|
||||||
.access(path.join(config.paths.sources, 'proxy/Proxy.sol'))
|
.access(path.join(hre.config.paths.sources, 'proxy/Proxy.sol'))
|
||||||
.then(() => true)
|
.then(() => true)
|
||||||
.catch(() => false);
|
.catch(() => false);
|
||||||
|
|
||||||
return await glob(path.join(config.paths.tests, '**/*.js'), {
|
const ignoredIfProxy = [
|
||||||
ignore: hasProxies
|
'proxy/beacon/BeaconProxy.test.js',
|
||||||
? []
|
'proxy/beacon/UpgradeableBeacon.test.js',
|
||||||
: [
|
'proxy/ERC1967/ERC1967Proxy.test.js',
|
||||||
'proxy/beacon/BeaconProxy.test.js',
|
'proxy/transparent/ProxyAdmin.test.js',
|
||||||
'proxy/beacon/UpgradeableBeacon.test.js',
|
'proxy/transparent/TransparentUpgradeableProxy.test.js',
|
||||||
'proxy/ERC1967/ERC1967Proxy.test.js',
|
'proxy/utils/UUPSUpgradeable.test.js',
|
||||||
'proxy/transparent/ProxyAdmin.test.js',
|
].map(p => path.join(hre.config.paths.tests, p));
|
||||||
'proxy/transparent/TransparentUpgradeableProxy.test.js',
|
|
||||||
'proxy/utils/UUPSUpgradeable.test.js',
|
return (await runSuper(args)).filter(file => hasProxies || !ignoredIfProxy.includes(file));
|
||||||
].map(p => path.join(config.paths.tests, p)),
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user