EIP-7843: SLOT precompile
Precompile to get the current slot
Abstract
This EIP proposes to add a new precompile that returns the corresponding slot for the current block.
Motivation
It is currently possible to calculate the slot number from the block timestamp. However, this requires hardcoding the chain slot length into a smart contract. This would require the contract code to be changed in the event of a future change to slot length. A better approach is for the slot number to be calculated by the execution layer and exposed in a precompile.
Encrypted Mempools
This precompile aims to improve support for encrypted mempools. In order to be secure, the validity of encrypted mempool transactions should be tied to the inclusion of all transactions by a proposer in the correct slot. This rule can be enforced by a smart contract using this precompile.
Specification
If block.timestamp >= TBD
a new precompiled contract SLOT
shall be created at address TBD
.
SLOT
returns as output the current slot number as an 8 byte ulong in big endian encoding.
Gas Cost
The gas cost for SLOT
is a fixed fee of 2
Rationale
Gas Price
The precompile is priced to match similar opcodes in the W_base
set.
Precompile
Making the feature a precompile rather than an opcode gives L2s flexibility to decide whether to implement it.
Backwards Compatibility
No backward compatibility issues found.
Test Cases
N/A
Security Considerations
None.
Copyright
Copyright and related rights waived via CC0.