File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
host-contracts/test/hcuLimit Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -176,24 +176,29 @@ contract HCULimitInvariantTest is StdInvariant, Test {
176176 }
177177
178178 function invariant_blockMeterMatchesCurrentBlock () public view {
179+ // Invariant: getBlockMeter must always report the current block number.
179180 (uint64 blockNumber ,) = hcuLimit.getBlockMeter ();
180181 assertEq (blockNumber, uint64 (block .number ));
181182 }
182183
183184 function invariant_blockMeterUsesCastGranularity () public view {
185+ // Invariant: accounted block HCU is made of Uint8 cast ops (32 HCU each), so it stays a multiple of 32.
184186 (, uint192 usedHCU ) = hcuLimit.getBlockMeter ();
185187 assertEq (uint256 (usedHCU) % 32 , 0 );
186188 }
187189
188190 function invariant_whitelistedCallsDoNotConsumePublicMeter () public view {
191+ // Invariant: calls from whitelisted callers must never increase the public block meter.
189192 assertFalse (handler.whitelistViolation ());
190193 }
191194
192195 function invariant_nonWhitelistedAccountingIsConsistent () public view {
196+ // Invariant: for non-whitelisted callers, meter growth equals successful op count times cast-op cost.
193197 assertFalse (handler.nonWhitelistedAccountingViolation ());
194198 }
195199
196200 function invariant_meterResetsAfterMinedBlocks () public view {
201+ // Invariant: once the block number advances, observed usedHCU for the new block is zero until a new op succeeds.
197202 assertFalse (handler.resetViolation ());
198203 }
199204
You can’t perform that action at this time.
0 commit comments