@@ -137,6 +137,8 @@ describe('EncryptedERC20:HCU', function () {
137137 } ) ;
138138
139139 afterEach ( async function ( ) {
140+ // Restore both automine and 1-second interval mining (Anvil --block-time 1)
141+ await ethers . provider . send ( 'evm_setIntervalMining' , [ 1 ] ) ;
140142 await ethers . provider . send ( 'evm_setAutomine' , [ true ] ) ;
141143 } ) ;
142144
@@ -155,11 +157,14 @@ describe('EncryptedERC20:HCU', function () {
155157 expect ( meter1 ) . to . be . greaterThan ( meter0 ) ;
156158
157159 // Two txs batched in same block — meter must exceed the single-tx reading
160+ // Disable both automine and interval mining (Anvil --block-time 1)
161+ await ethers . provider . send ( 'evm_setIntervalMining' , [ 0 ] ) ;
158162 await ethers . provider . send ( 'evm_setAutomine' , [ false ] ) ;
159163 const txA = await sendEncryptedTransfer ( this , 'alice' , this . signers . bob . address , 100 ) ;
160164 const txB = await sendEncryptedTransfer ( this , 'bob' , this . signers . alice . address , 100 ) ;
161165 await ethers . provider . send ( 'evm_mine' ) ;
162166 await ethers . provider . send ( 'evm_setAutomine' , [ true ] ) ;
167+ await ethers . provider . send ( 'evm_setIntervalMining' , [ 1 ] ) ;
163168 const [ receiptA , receiptB ] = await Promise . all ( [ txA . wait ( ) , txB . wait ( ) ] ) ;
164169 expect ( receiptA ?. status ) . to . eq ( 1 ) ;
165170 expect ( receiptB ?. status ) . to . eq ( 1 ) ;
@@ -210,6 +215,7 @@ describe('EncryptedERC20:HCU', function () {
210215 await mintAndDistribute ( this ) ;
211216
212217 await mineNBlocks ( 1 ) ;
218+ await ethers . provider . send ( 'evm_setIntervalMining' , [ 0 ] ) ;
213219 await ethers . provider . send ( 'evm_setAutomine' , [ false ] ) ;
214220
215221 // Alice fills the cap, Bob would push block total over — use fixed gasLimit
@@ -219,6 +225,7 @@ describe('EncryptedERC20:HCU', function () {
219225
220226 await ethers . provider . send ( 'evm_mine' ) ;
221227 await ethers . provider . send ( 'evm_setAutomine' , [ true ] ) ;
228+ await ethers . provider . send ( 'evm_setIntervalMining' , [ 1 ] ) ;
222229
223230 const receipt1 = await tx1 . wait ( ) ;
224231 expect ( receipt1 ?. status ) . to . eq ( 1 , 'First transfer should succeed' ) ;
@@ -234,13 +241,15 @@ describe('EncryptedERC20:HCU', function () {
234241
235242 // Block N: alice fills the cap, bob gets blocked
236243 await mineNBlocks ( 1 ) ;
244+ await ethers . provider . send ( 'evm_setIntervalMining' , [ 0 ] ) ;
237245 await ethers . provider . send ( 'evm_setAutomine' , [ false ] ) ;
238246
239247 const txAlice = await sendEncryptedTransfer ( this , 'alice' , this . signers . carol . address , 100 ) ;
240248 const txBob = await sendEncryptedTransfer ( this , 'bob' , this . signers . carol . address , 100 , { gasLimit : 1_000_000 } ) ;
241249
242250 await ethers . provider . send ( 'evm_mine' ) ;
243251 await ethers . provider . send ( 'evm_setAutomine' , [ true ] ) ;
252+ await ethers . provider . send ( 'evm_setIntervalMining' , [ 1 ] ) ;
244253
245254 const receiptAlice = await txAlice . wait ( ) ;
246255 expect ( receiptAlice ?. status ) . to . eq ( 1 , 'Alice should succeed' ) ;
0 commit comments