Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions beacon_chain/el/el_manager.nim
Original file line number Diff line number Diff line change
Expand Up @@ -551,8 +551,8 @@ func asConsensusType*(rpcExecutionPayload: ExecutionPayloadV3):
mapIt(rpcExecutionPayload.transactions, it.getTransaction)),
withdrawals: List[capella.Withdrawal, MAX_WITHDRAWALS_PER_PAYLOAD].init(
mapIt(rpcExecutionPayload.withdrawals, it.asConsensusWithdrawal)),
data_gas_used: rpcExecutionPayload.dataGasUsed.uint64,
excess_data_gas: rpcExecutionPayload.excessDataGas.uint64)
blob_gas_used: rpcExecutionPayload.blobGasUsed.uint64,
excess_blob_gas: rpcExecutionPayload.excessBlobGas.uint64)

func asConsensusType*(payload: engine_api.GetPayloadV3Response):
deneb.ExecutionPayloadForSigning =
Expand Down Expand Up @@ -641,8 +641,8 @@ func asEngineExecutionPayload*(executionPayload: deneb.ExecutionPayload):
blockHash: executionPayload.block_hash.asBlockHash,
transactions: mapIt(executionPayload.transactions, it.getTypedTransaction),
withdrawals: mapIt(executionPayload.withdrawals, it.asEngineWithdrawal),
dataGasUsed: Quantity(executionPayload.data_gas_used),
excessDataGas: Quantity(executionPayload.excess_data_gas))
blobGasUsed: Quantity(executionPayload.blob_gas_used),
excessBlobGas: Quantity(executionPayload.excess_blob_gas))

func shortLog*(b: Eth1Block): string =
try:
Expand Down
4 changes: 2 additions & 2 deletions beacon_chain/libnimbus_lc/libnimbus_lc.h
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,7 @@ const ETHUInt256 *ETHExecutionPayloadHeaderGetBaseFeePerGas(
* @return Data gas used.
*/
ETH_RESULT_USE_CHECK
int ETHExecutionPayloadHeaderGetDataGasUsed(
int ETHExecutionPayloadHeaderGetBlobGasUsed(
const ETHExecutionPayloadHeader *execution);

/**
Expand All @@ -1020,7 +1020,7 @@ int ETHExecutionPayloadHeaderGetDataGasUsed(
* @return Excess data gas.
*/
ETH_RESULT_USE_CHECK
int ETHExecutionPayloadHeaderGetExcessDataGas(
int ETHExecutionPayloadHeaderGetExcessBlobGas(
const ETHExecutionPayloadHeader *execution);

#if __has_feature(nullability)
Expand Down
8 changes: 4 additions & 4 deletions beacon_chain/libnimbus_lc/libnimbus_lc.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,7 @@ func ETHExecutionPayloadHeaderGetBaseFeePerGas(
## * Base fee per gas.
addr execution[].base_fee_per_gas

func ETHExecutionPayloadHeaderGetDataGasUsed(
func ETHExecutionPayloadHeaderGetBlobGasUsed(
execution: ptr ExecutionPayloadHeader): cint {.exported.} =
## Obtains the data gas used of a given execution payload header.
##
Expand All @@ -1154,9 +1154,9 @@ func ETHExecutionPayloadHeaderGetDataGasUsed(
##
## Returns:
## * Data gas used.
execution[].data_gas_used.cint
execution[].blob_gas_used.cint

func ETHExecutionPayloadHeaderGetExcessDataGas(
func ETHExecutionPayloadHeaderGetExcessBlobGas(
execution: ptr ExecutionPayloadHeader): cint {.exported.} =
## Obtains the excess data gas of a given execution payload header.
##
Expand All @@ -1165,4 +1165,4 @@ func ETHExecutionPayloadHeaderGetExcessDataGas(
##
## Returns:
## * Excess data gas.
execution[].excess_data_gas.cint
execution[].excess_blob_gas.cint
8 changes: 4 additions & 4 deletions beacon_chain/libnimbus_lc/test_libnimbus_lc.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,11 @@ static void visualizeHeader(const ETHLightClientHeader *header, const ETHConsens
printGweiString(executionBaseFeePerGas);
printf(" Gwei\n");

int executionDataGasUsed = ETHExecutionPayloadHeaderGetDataGasUsed(execution);
printf(" - data_gas_used: %d\n", executionDataGasUsed);
int executionBlobGasUsed = ETHExecutionPayloadHeaderGetBlobGasUsed(execution);
printf(" - blob_gas_used: %d\n", executionBlobGasUsed);

int executionExcessDataGas = ETHExecutionPayloadHeaderGetExcessDataGas(execution);
printf(" - excess_data_gas: %d\n", executionExcessDataGas);
int executionExcessBlobGas = ETHExecutionPayloadHeaderGetExcessBlobGas(execution);
printf(" - excess_blob_gas: %d\n", executionExcessBlobGas);
}

ETH_RESULT_USE_CHECK
Expand Down
4 changes: 2 additions & 2 deletions beacon_chain/spec/beaconstate.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1346,8 +1346,8 @@ func upgrade_to_deneb*(cfg: RuntimeConfig, pre: capella.BeaconState):
block_hash: pre.latest_execution_payload_header.block_hash,
transactions_root: pre.latest_execution_payload_header.transactions_root,
withdrawals_root: pre.latest_execution_payload_header.withdrawals_root,
data_gas_used: 0, # [New in Deneb]
excess_data_gas: 0 # [New in Deneb]
blob_gas_used: 0, # [New in Deneb]
excess_blob_gas: 0 # [New in Deneb]
)

(ref deneb.BeaconState)(
Expand Down
16 changes: 8 additions & 8 deletions beacon_chain/spec/datatypes/deneb.nim
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ type
block_hash*: Eth2Digest # Hash of execution block
transactions*: List[Transaction, MAX_TRANSACTIONS_PER_PAYLOAD]
withdrawals*: List[Withdrawal, MAX_WITHDRAWALS_PER_PAYLOAD]
data_gas_used*: uint64 # [New in Deneb]
excess_data_gas*: uint64 # [New in Deneb]
blob_gas_used*: uint64 # [New in Deneb]
excess_blob_gas*: uint64 # [New in Deneb]

ExecutionPayloadForSigning* = object
executionPayload*: ExecutionPayload
Expand Down Expand Up @@ -133,8 +133,8 @@ type
## Hash of execution block
transactions_root*: Eth2Digest
withdrawals_root*: Eth2Digest
data_gas_used*: uint64 # [New in Deneb]
excess_data_gas*: uint64 # [New in Deneb]
blob_gas_used*: uint64 # [New in Deneb]
excess_blob_gas*: uint64 # [New in Deneb]

ExecutePayload* = proc(
execution_payload: ExecutionPayload): bool {.gcsafe, raises: [Defect].}
Expand Down Expand Up @@ -571,7 +571,7 @@ func shortLog*(v: ExecutionPayload): auto =
block_hash: shortLog(v.block_hash),
num_transactions: len(v.transactions),
num_withdrawals: len(v.withdrawals),
excess_data_gas: $(v.excess_data_gas)
excess_blob_gas: $(v.excess_blob_gas)
)

func shortLog*(x: seq[BlobIdentifier]): string =
Expand Down Expand Up @@ -612,7 +612,7 @@ func is_valid_light_client_header*(
let epoch = header.beacon.slot.epoch

if epoch < cfg.DENEB_FORK_EPOCH:
if header.execution.excess_data_gas != 0:
if header.execution.excess_blob_gas != 0:
return false

if epoch < cfg.CAPELLA_FORK_EPOCH:
Expand Down Expand Up @@ -648,8 +648,8 @@ func upgrade_lc_header_to_deneb*(
block_hash: pre.execution.block_hash,
transactions_root: pre.execution.transactions_root,
withdrawals_root: pre.execution.withdrawals_root,
data_gas_used: 0, # [New in Deneb:EIP4844]
excess_data_gas: 0), # [New in Deneb:EIP4844]
blob_gas_used: 0, # [New in Deneb:EIP4844]
excess_blob_gas: 0), # [New in Deneb:EIP4844]
execution_branch: pre.execution_branch)

# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/deneb/light-client/fork.md#upgrading-light-client-data
Expand Down
10 changes: 5 additions & 5 deletions beacon_chain/spec/eth2_apis/eth2_rest_serialization.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1367,7 +1367,7 @@ proc readValue*(reader: var JsonReader[RestJson],

let bodyKind =
if execution_payload.isSome() and
execution_payload.get().data_gas_used.isSome() and
execution_payload.get().blob_gas_used.isSome() and
blob_kzg_commitments.isSome():
ConsensusFork.Deneb
elif execution_payload.isSome() and
Expand Down Expand Up @@ -1487,11 +1487,11 @@ proc readValue*(reader: var JsonReader[RestJson],
value.denebBody.execution_payload.withdrawals,
ep_src.withdrawals.get())
assign(
value.denebBody.execution_payload.data_gas_used,
ep_src.data_gas_used.get())
value.denebBody.execution_payload.blob_gas_used,
ep_src.blob_gas_used.get())
assign(
value.denebBody.execution_payload.excess_data_gas,
ep_src.excess_data_gas.get())
value.denebBody.execution_payload.excess_blob_gas,
ep_src.excess_blob_gas.get())

## RestPublishedBeaconBlock
proc readValue*(reader: var JsonReader[RestJson],
Expand Down
4 changes: 2 additions & 2 deletions beacon_chain/spec/eth2_apis/rest_types.nim
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ type
transactions*: List[Transaction, MAX_TRANSACTIONS_PER_PAYLOAD]
withdrawals*: Option[List[Withdrawal, MAX_WITHDRAWALS_PER_PAYLOAD]]
## [New in Capella]
data_gas_used*: Option[uint64] ## [New in Deneb]
excess_data_gas*: Option[uint64] ## [New in Deneb]
blob_gas_used*: Option[uint64] ## [New in Deneb]
excess_blob_gas*: Option[uint64] ## [New in Deneb]


PrepareBeaconProposer* = object
Expand Down
2 changes: 1 addition & 1 deletion beacon_chain/spec/forks_light_client.nim
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ func toDenebLightClientHeader(
block_hash: payload.block_hash,
transactions_root: hash_tree_root(payload.transactions),
withdrawals_root: hash_tree_root(payload.withdrawals),
excess_data_gas: payload.excess_data_gas),
excess_blob_gas: payload.excess_blob_gas),
execution_branch: blck.message.body.build_proof(
capella.EXECUTION_PAYLOAD_INDEX).get)

Expand Down
12 changes: 6 additions & 6 deletions beacon_chain/spec/helpers.nim
Original file line number Diff line number Diff line change
Expand Up @@ -430,14 +430,14 @@ proc payloadToBlockHeader*(
some payload.computeWithdrawalsTrieRoot()
else:
none(Hash256)
dataGasUsed =
blobGasUsed =
when typeof(payload).toFork >= ConsensusFork.Deneb:
some payload.data_gas_used
some payload.blob_gas_used
else:
none(uint64)
excessDataGas =
excessBlobGas =
when typeof(payload).toFork >= ConsensusFork.Deneb:
some payload.excess_data_gas
some payload.excess_blob_gas
else:
none(uint64)

Expand All @@ -459,8 +459,8 @@ proc payloadToBlockHeader*(
nonce : default(BlockNonce),
fee : some payload.base_fee_per_gas,
withdrawalsRoot: withdrawalsRoot,
dataGasUsed : dataGasUsed, # EIP-4844
excessDataGas : excessDataGas) # EIP-4844
blobGasUsed : blobGasUsed, # EIP-4844
excessBlobGas : excessBlobGas) # EIP-4844

proc compute_execution_block_hash*(
payload: ForkyExecutionPayload): Eth2Digest =
Expand Down
4 changes: 2 additions & 2 deletions beacon_chain/spec/state_transition_block.nim
Original file line number Diff line number Diff line change
Expand Up @@ -668,8 +668,8 @@ proc process_execution_payload*(
extra_data: payload.extra_data,
transactions_root: hash_tree_root(payload.transactions),
withdrawals_root: hash_tree_root(payload.withdrawals),
data_gas_used: payload.data_gas_used, # [New in Deneb]
excess_data_gas: payload.excess_data_gas) # [New in Deneb]
blob_gas_used: payload.blob_gas_used, # [New in Deneb]
excess_blob_gas: payload.excess_blob_gas) # [New in Deneb]

ok()

Expand Down
4 changes: 2 additions & 2 deletions ncli/ncli_testnet.nim
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,8 @@ func `as`(blk: BlockObject, T: type deneb.ExecutionPayloadHeader): T =
block_hash: blk.hash as Eth2Digest,
transactions_root: blk.transactionsRoot as Eth2Digest,
withdrawals_root: blk.withdrawalsRoot.getOrDefault() as Eth2Digest,
data_gas_used: uint64 blk.dataGasUsed.getOrDefault(),
excess_data_gas: uint64 blk.excessDataGas.getOrDefault())
blob_gas_used: uint64 blk.blobGasUsed.getOrDefault(),
excess_blob_gas: uint64 blk.excessBlobGas.getOrDefault())

proc createDepositTreeSnapshot(deposits: seq[DepositData],
blockHash: Eth2Digest,
Expand Down
Loading