@@ -7,7 +7,8 @@ for (const variant of ['', 'Transient']) {
77 async function fixture ( ) {
88 const name = `Reentrancy${ variant } Mock` ;
99 const mock = await ethers . deployContract ( name ) ;
10- return { name, mock } ;
10+ const attacker = await ethers . deployContract ( 'ReentrancyAttack' ) ;
11+ return { name, mock, attacker } ;
1112 }
1213
1314 beforeEach ( async function ( ) {
@@ -20,9 +21,16 @@ for (const variant of ['', 'Transient']) {
2021 expect ( await this . mock . counter ( ) ) . to . equal ( 1n ) ;
2122 } ) ;
2223
23- it ( 'does not allow remote callback' , async function ( ) {
24- const attacker = await ethers . deployContract ( 'ReentrancyAttack' ) ;
25- await expect ( this . mock . countAndCall ( attacker ) ) . to . be . revertedWith ( 'ReentrancyAttack: failed call' ) ;
24+ it ( 'nonReentrantView function can be called' , async function ( ) {
25+ await this . mock . viewCallback ( ) ;
26+ } ) ;
27+
28+ it ( 'does not allow remote callback to nonReentrant function' , async function ( ) {
29+ await expect ( this . mock . countAndCall ( this . attacker ) ) . to . be . revertedWith ( 'ReentrancyAttack: failed call' ) ;
30+ } ) ;
31+
32+ it ( 'does not allow remote callback to nonReentrantView function' , async function ( ) {
33+ await expect ( this . mock . countAndCallView ( this . attacker ) ) . to . be . revertedWith ( 'ReentrancyAttack: failed call' ) ;
2634 } ) ;
2735
2836 it ( '_reentrancyGuardEntered should be true when guarded' , async function ( ) {
0 commit comments