Skip to content

EIP-2935: Save historical block hashes in state #69

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
3 tasks
OlivierBBB opened this issue Jan 22, 2025 · 0 comments
Open
3 tasks

EIP-2935: Save historical block hashes in state #69

OlivierBBB opened this issue Jan 22, 2025 · 0 comments
Labels
hardfork prague EIP's for the Pectra hardfork London to Prague London to Pectra system transaction will implement For those EIP's that will be implemented on Linea
Milestone

Comments

@OlivierBBB
Copy link
Collaborator

OlivierBBB commented Jan 22, 2025

EIP-2935: Save historical block hashes in state

Progress

  • spec
  • constraints
  • tracer

Impact

  • if dealt with, deal with it the same way as with Beacon root hash EIP-4788 (Cancun)

Impact on BLOCKHASH opcode

We could add

  • a miscellaneous-row when unexceptional i.e. when
    • XAHOY ≡ false
  • a storage-row when unexceptional and in range i.e. when
    • XAHOY ≡ false
    • CHECK_BLOCKHASH_AGAINST_STATE ≡ true

to the instruction processing of BLOCKHASH opcodes. This would have the following benefit: the output of BLOCKHASH would provably be the same from one conflation to another

We would add a OOB_INST_BLOCKHASH instruction along the misc row which does the following:

// OOB_INST_BLOCKHASH description

// HUB inputs
trusted:
    REL_BLOCK
    BLOCK_HASH_ARGUMENT_HI
    BLOCK_HASH_ARGUMENT_LO // together: ARG

prediction:
    NUMBER
    ARGUMENT_IN_RANGE
    CHECK_BLOCKHASH_AGAINST_STATE
    STORAGE_SLOT

// lookup to BLOCK_DATA module

[oob/REL_BLOCK, oob/NUMBER] --> [blc/REL_BLOCK, blc/NUMBER] // confirms NUMBER

// computations

tiny_block_number ≡ [256 > NUMBER]
argument_in_range ≡
    if tiny_block_number ≡ true  : [ARG < NUMBER]
    if tiny_block_number ≡ false : [ARG < NUMBER][NUMBER - 256ARG]ARGUMENT_IN_RANGE  ←  argument_in_range
storage_slot ≡
    if argument_in_range ≡ true  : ARG % 8191
    if argument_in_range ≡ false : <undefined>
    ∴ STORAGE_SLOT  ←  storage_slot
requested_block_is_prague_or_later ≡ [ARG ≥ constants/LINEA_PRAGUE_HARDFORK_BLOCK_NUMBER]
check_blockhash_against_state ≡ argument_in_range ∧ requested_block_is_prague_or_later
    ∴ CHECK_BLOCKHASH_AGAINST_STATE  ←  check_blockhash_against_state

We would still use the BLOCKHASH module as we do today to retrieve the output of the BLOCKHASH opcode. We may (optionally) make the lookup conditional to ARGUMENT_IN_RANGE ≡ true and simplify the BLOCKHASH module. But tbh there is no reason to do so.

Test vectors

@OlivierBBB OlivierBBB added London to Prague London to Pectra hardfork prague EIP's for the Pectra hardfork labels Jan 22, 2025
@OlivierBBB OlivierBBB changed the title EIP-2935 EIP-2935: Save historical block hashes in state Jan 22, 2025
@OlivierBBB OlivierBBB added the will implement For those EIP's that will be implemented on Linea label Feb 7, 2025
@OlivierBBB OlivierBBB added this to the London to Pectra milestone Mar 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hardfork prague EIP's for the Pectra hardfork London to Prague London to Pectra system transaction will implement For those EIP's that will be implemented on Linea
Projects
None yet
Development

No branches or pull requests

1 participant