Use hardhat-exposed to reduce the need for mocks (#3666)

Co-authored-by: Francisco <fg@frang.io>
This commit is contained in:
Hadrien Croubois
2023-01-03 15:38:13 +01:00
committed by GitHub
parent a81b0d0b21
commit c1d9da4052
190 changed files with 2297 additions and 4311 deletions

View File

@ -2,6 +2,7 @@ const { expectRevert } = require('@openzeppelin/test-helpers');
const { BridgeHelper } = require('../helpers/crosschain');
const {
DEFAULT_ADMIN_ROLE,
shouldBehaveLikeAccessControl,
} = require('./AccessControl.behavior.js');
@ -10,7 +11,7 @@ const crossChainRoleAlias = (role) => web3.utils.leftPad(
64,
);
const AccessControlCrossChainMock = artifacts.require('AccessControlCrossChainMock');
const AccessControlCrossChainMock = artifacts.require('$AccessControlCrossChainMock');
const ROLE = web3.utils.soliditySha3('ROLE');
@ -21,6 +22,7 @@ contract('AccessControl', function (accounts) {
beforeEach(async function () {
this.accessControl = await AccessControlCrossChainMock.new({ from: accounts[0] });
await this.accessControl.$_grantRole(DEFAULT_ADMIN_ROLE, accounts[0]);
});
shouldBehaveLikeAccessControl('AccessControl', ...accounts);
@ -32,7 +34,7 @@ contract('AccessControl', function (accounts) {
});
it('check alliassing', async function () {
expect(await this.accessControl.crossChainRoleAlias(ROLE)).to.be.bignumber.equal(crossChainRoleAlias(ROLE));
expect(await this.accessControl.$_crossChainRoleAlias(ROLE)).to.be.bignumber.equal(crossChainRoleAlias(ROLE));
});
it('Crosschain calls not authorized to non-aliased addresses', async function () {
@ -40,7 +42,7 @@ contract('AccessControl', function (accounts) {
this.bridge.call(
accounts[0],
this.accessControl,
'senderProtected',
'$_checkRole(bytes32)',
[ ROLE ],
),
`AccessControl: account ${accounts[0].toLowerCase()} is missing role ${crossChainRoleAlias(ROLE)}`,
@ -51,7 +53,7 @@ contract('AccessControl', function (accounts) {
await this.bridge.call(
accounts[1],
this.accessControl,
'senderProtected',
'$_checkRole(bytes32)',
[ ROLE ],
);
});