Skip to content

Conversation

@dankrad
Copy link
Contributor

@dankrad dankrad commented Jun 24, 2024

This is an alternative version of #3800 where in addition to specifying the blob gas limit in CL, it lifts the whole basefee computation into the CL.

Potential advantages are:

  • it makes it easy to change the max and target independently
  • it allows to adapt gas computation, e.g. correctly computing the excess gas at the boundary when changing the max and target

ralexstokes and others added 22 commits June 12, 2024 14:35
Introducing new fields in the middle of an existing `Container`
pointlessly breaks merkleization of all subsequent fields.
In the case of `committee_bits`, it is also misleading, as
`signature` only covers `data` inside `Attestation`.
Co-authored-by: Hsiao-Wei Wang <[email protected]>
Co-authored-by: Hsiao-Wei Wang <[email protected]>
pending_consolidations: List[PendingConsolidation, PENDING_CONSOLIDATIONS_LIMIT] # [New in Electra:EIP7251]
# [New in Electra: compute blob gas in CL]
excess_blob_gas: uint64
base_fee_per_blob_gas: uint64
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to keep this parameter to be in the state as it can be easily computed given the state?

get_base_fee_per_blob_gas(state)):
return False

state.excess_blob_gas += execution_payload.blob_gas_used
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this like should be a part of the process_execution_payload. The other thing is that there is no excess blob gas computation, I believe it should be computed as follows:

def compute_excess_blob_gas(excess_blob_gas: uint64, blob_gas_used: uint64) -> uint64:
    if blob_gas_used > TARGET_BLOB_GAS_PER_BLOCK:
        return excess_blob_gas + blob_gas_used - TARGET_BLOB_GAS_PER_BLOCK
    else:
        if excess_blob_gas < TARGET_BLOB_GAS_PER_BLOCK - blob_gas_used
            return uint64(0)
        else:
            return excess_blob_gas - (TARGET_BLOB_GAS_PER_BLOCK - blob_gas_used)

withdrawals: List[Withdrawal, MAX_WITHDRAWALS_PER_PAYLOAD]
blob_gas_used: uint64
excess_blob_gas: uint64
excess_blob_gas: uint64 # [Deprecated in Electra: compute blob gas in CL]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this field can be repurposed and renamed to base_fee_per_blob_gas, this is to make EL block self-contained in terms of execution which is required for optimistic sync (in an edge case but still). Then, this parameter must be verified in the process_execution_payload:

assert payload.base_fee_per_blob_gas == get_base_fee_per_blob_gas(state)

@dankrad dankrad closed this Oct 14, 2024
@jtraglia jtraglia deleted the dankrad-blobgas-in-cl branch January 22, 2025 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants