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

EIP-4844: Implement calc excess data gas #1417

Closed
jangko opened this issue Jan 11, 2023 · 0 comments · Fixed by #1440
Closed

EIP-4844: Implement calc excess data gas #1417

jangko opened this issue Jan 11, 2023 · 0 comments · Fixed by #1440
Labels

Comments

@jangko
Copy link
Contributor

jangko commented Jan 11, 2023

The value of excess_data_gas can be calculated using the parent header and number of blobs in the block.
For the first post-fork block, parent.excess_data_gas is evaluated as 0.

DATA_GAS_PER_BLOB: 2 ** 17
TARGET_DATA_GAS_PER_BLOCK: 2 ** 18

def calc_excess_data_gas(parent: Header, new_blobs: int) -> int:
    consumed_data_gas = new_blobs * DATA_GAS_PER_BLOB
    if parent.excess_data_gas + consumed_data_gas < TARGET_DATA_GAS_PER_BLOCK:
        return 0
    else:
        return parent.excess_data_gas + consumed_data_gas - TARGET_DATA_GAS_PER_BLOCK

This is definetely can be implemented in casper.nim as part of POS consensus utility.
It will be used at txpool and block validation.

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 a pull request may close this issue.

1 participant