Skip to content

Refactoring eip-4844 #2752

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
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Refactoring eip-4844 #2752

wants to merge 9 commits into from

Conversation

anvacaru
Copy link
Contributor

@anvacaru anvacaru commented Apr 29, 2025

EIP-4844 Blob Validation Implementation

This PR implements missing blob gas validation for EIP-4844 and adds some checks for transaction and block validity:

Transaction Validation

  • Added #isValidTransaction to check blob transaction validity, included missing checks as defined in ethereum/execution-specs
  • Implemented blob fee deduction with new #deductBlobGas operation
  • Added versioned hash validation via #checkTxVersionedHashes

Block Validation

  • Added #validateBlockBlobs to verify total blob count and excess blob gas
  • Added state transitions via #finalizeBlockBlobs for block-level validation
  • Tracks blob gas values between blocks with previousExcessBlobGas and previousBlobGasUsed cells

Gas Calculations

  • Moved blob gas calculation functions from evm.md to gas.md:
    • Ctotalblob - calculates gas used per blob
    • Cbasefeeperblob - computes blob base fee
    • Cblobfee - calculates total blob fee
    • Cexcessblob - maintains excess blob gas between blocks

Error Handling

  • Added EVMC_INVALID_BLOCK status code for blob validation failures

This implementation ensures that KEVM correctly rejects blocks with invalid blob gas parameters, matching Ethereum consensus rules.

@anvacaru anvacaru marked this pull request as ready for review April 30, 2025 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant