Skip to content
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

Blobgas computation in CL #3813

Closed
wants to merge 24 commits into from
Closed

Blobgas computation in CL #3813

wants to merge 24 commits into from

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 <hsiaowei.eth@gmail.com>
Co-authored-by: Hsiao-Wei Wang <hsiaowei.eth@gmail.com>
Co-authored-by: Hsiao-Wei Wang <hsiaowei.eth@gmail.com>
specs/electra/beacon-chain.md Outdated Show resolved Hide resolved
specs/electra/beacon-chain.md Outdated Show resolved Hide resolved
specs/electra/beacon-chain.md Show resolved Hide resolved
dankrad and others added 2 commits June 25, 2024 12:03
Co-authored-by: Potuz <potuz@prysmaticlabs.com>
@@ -423,10 +435,50 @@ class BeaconState(Container):
# [New in Electra:EIP7251]
pending_partial_withdrawals: List[PendingPartialWithdrawal, PENDING_PARTIAL_WITHDRAWALS_LIMIT]
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
Collaborator

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
Collaborator

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)

@@ -332,7 +344,7 @@ class ExecutionPayload(Container):
transactions: List[Transaction, MAX_TRANSACTIONS_PER_PAYLOAD]
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
Collaborator

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)

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.

7 participants