From 11ebbe0caccaa886b750d64a18cb56abc0ad5909 Mon Sep 17 00:00:00 2001 From: Etan Kissling Date: Tue, 16 Jan 2024 23:54:20 +0100 Subject: [PATCH] fix LC header production for Deneb (#5763) The `blob_gas_used` field was not properly populated when constructing Deneb light client data. This is due to #5026 not applying the change to the entire codebase when the new field got introduced, and due to #5350 not catching that oversight in other modules. Also reviewed codebase and discovered that `shortLog` for Deneb execution payloads has same bug. --- beacon_chain/spec/datatypes/deneb.nim | 1 + beacon_chain/spec/forks_light_client.nim | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/beacon_chain/spec/datatypes/deneb.nim b/beacon_chain/spec/datatypes/deneb.nim index dd624c335..01a5a6349 100644 --- a/beacon_chain/spec/datatypes/deneb.nim +++ b/beacon_chain/spec/datatypes/deneb.nim @@ -585,6 +585,7 @@ func shortLog*(v: ExecutionPayload): auto = block_hash: shortLog(v.block_hash), num_transactions: len(v.transactions), num_withdrawals: len(v.withdrawals), + blob_gas_used: $(v.blob_gas_used), excess_blob_gas: $(v.excess_blob_gas) ) diff --git a/beacon_chain/spec/forks_light_client.nim b/beacon_chain/spec/forks_light_client.nim index ca489428f..09e32c596 100644 --- a/beacon_chain/spec/forks_light_client.nim +++ b/beacon_chain/spec/forks_light_client.nim @@ -1,5 +1,5 @@ # beacon_chain -# Copyright (c) 2023 Status Research & Development GmbH +# Copyright (c) 2023-2024 Status Research & Development GmbH # Licensed and distributed under either of # * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). # * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). @@ -946,6 +946,7 @@ func toDenebLightClientHeader( block_hash: payload.block_hash, transactions_root: hash_tree_root(payload.transactions), withdrawals_root: hash_tree_root(payload.withdrawals), + blob_gas_used: payload.blob_gas_used, excess_blob_gas: payload.excess_blob_gas), execution_branch: blck.message.body.build_proof( capella.EXECUTION_PAYLOAD_GINDEX).get)