Skip to content

getSlotNumber

function getSlotNumber() external view returns (uint64 slotNumber);

Gets the current block.slotnum, the consensus-layer slot number that EIP-7843 exposes through the SLOTNUM opcode.

This cheatcode is only available from the Amsterdam hardfork onwards, and reverts on earlier hardforks.

vm.rollSlot(100);
assertEq(vm.getSlotNumber(), 100);