EIP-8484: SLOTDURATION Opcode

Hello,

I’ve opened a PR for a new opcode, SLOTDURATION. It pushes the duration of the current slot, in milliseconds, onto the stack.

PR: Add EIP: SLOTDURATION Opcode by Amxx · Pull Request #12619 · ethereum/EIPs · GitHub

Open questions:

  1. Current duration or historical lookup? The draft returns the current duration. The Rationale describes an alternative where the opcode takes a slot number and returns the duration in effect at that slot, or 0 for future slots. That would let contracts like Lido’s compute correct timestamps across duration changes. The cost is that the execution layer would have to keep the duration schedule. Which is more useful?
  2. Milliseconds. I chose ms to match SLOT_DURATION_MS and to support L2s with 100–250 ms block times. Any objections?
  3. 0 for “no regular interval.” Is this the right sentinel for on-demand chains, and should L1 execution clients still reject 0?
  4. Execution-layer decoupling. EIP-8198 deliberately keeps the execution layer unaware of the slot duration. The draft keeps the EL config-free, but it does add a header field. Is that acceptable to the EIP-8198 authors and to client teams?
1 Like

Thanks @Amxx for putting this together. Some thoughts on the open questions from the OpenZeppelin Contracts side:

Current duration or historical lookup?

I think the current duration covers most cases if contracts anchor on TIMESTAMP instead of genesis. On L1, block.timestamp is the start of slot SLOTNUM, so:

ts(s) = TIMESTAMP + (s - SLOTNUM) * SLOTDURATION / 1000

That’s exact for any slot since the last duration change, and it’s what I’d put in a library helper. A contract can also detect that a stored (t0, s0) observation crossed a change, since TIMESTAMP - t0 won’t match (SLOTNUM - s0) * SLOTDURATION / 1000. It just can’t tell where the change happened.

The Lido case (timestamps for arbitrary past slots) does need history though. Instead of a full EL schedule, what about one extra header field with the first slot where the current duration took effect? Contracts would know exactly how far back the formula above is valid, and the EL still just copies a value from the CL.

Milliseconds.

Agree. I’d add a test case with a duration that isn’t a multiple of 1000 (e.g. 250). That’s where mixing it with TIMESTAMP gets lossy: several blocks share a timestamp and SLOTDURATION / 1000 rounds down to 0. Worth a line in Security Considerations recommending to do the math in ms.

0 for “no regular interval.”

My main concern is “MUST return 0” for on-demand chains. Anvil and Hardhat are where most contracts get tested, so test suites would only ever hit the 0 branch and the real path would run for the first time on mainnet. I’d keep 0 as the meaning of “no regular interval”, but let dev chains return a configured value (they already support interval mining). A SHOULD instead of a MUST would be enough.

L1 already can’t produce 0 since the CL rejects any value other than the scheduled duration, so I don’t think the EL needs an extra check.

Also, an L1 Core EIP can’t really make L2s do anything (“Chains without a beacon chain … MUST”). Some rollups don’t have a fixed interval either, so it’s not obvious whether they should return their target, their max, or 0. I’d frame that part as guidance, or leave it to an RIP.

Execution-layer decoupling.

Seems consistent with how EIP-7843 handles slotNumber. One detail: 7843 already defines ExecutionPayloadV4, PayloadAttributesV4, engine_newPayloadV5, engine_getPayloadV6 and engine_forkchoiceUpdatedV4. If both ship in the same fork, 8484 should extend those instead of adding new versions. Probably worth saying explicitly.

Another use case: governance

Governors that count time in blocks (ERC-6372 mode=blocknumber) are also affected. Lots of DAOs set votingDelay and votingPeriod in blocks assuming 12s (e.g. 50400 blocks for ~1 week). A shorter slot duration silently shortens every voting window, and fixing it usually requires a proposal that runs under the shortened periods. Could be a good second example next to Lido in the Motivation.

Timing

Agree on activating before any duration change (EIP-8198). Since 7843 already changes the header and Engine API, shipping 8484 in the same fork seems cheap.

I think the draft should stay minimal and current-slot only.

Current vs historical:

I’d keep SLOTDURATION to the current slot, not arbitrary historical lookups.

Historical lookups are useful in some cases, but they effectively require a schedule or a historical state model, which makes the opcode much heavier and less elegant.

If someone really wants historical duration, that should be a separate feature or a different API, not baked into this opcode.

Units:

Milliseconds is the right default.

It avoids rounding issues, supports shorter durations, and matches the practical needs of L2s and future chains with sub-second or very short slot assumptions.

I don’t see a strong argument for seconds here.

0 sentinel:

Returning 0 for no regular interval is the right sentinel.

It is explicit, easy for contracts to handle, and consistent with the idea that a chain may not have a fixed slot duration at all.

The EIP should just be explicit that 0 means “undefined / no regular slot interval, not a legal duration of zero.

EL decoupling:

This is the most important design constraint.

The execution layer should not become responsible for slot-duration policy or historical schedule tracking.

The opcode should be a simple read-only query exposing protocol context, not a new execution-layer scheduling primitive.

If a header field is needed, it should be a minimal context signal, not a mechanism that forces the EL to maintain schedule logic.

So my preference is: a minimal SLOTDURATION opcode that returns the current slot duration in milliseconds, returns 0 for irregular chains, and does not require the EL to track historical slot-duration schedules.

That keeps the interface simple, future-proof, and easier to accept across clients.