Skip to content

Commit a727cd7

Browse files
authored
fix(l1): compute logs_bloom when building payloads (#3219)
**Motivation** Our build payload process was not computing and setting the `logs_bloom` field on the block's header, which resulted in other clients rejecting blocks built by us. This came up when testing setting up a localnet with ethrex along with other clients. **Description** <!-- A clear and concise general description of the changes this PR introduces --> <!-- Link to issues: Resolves #111, Resolves #222 --> Closes #issue_number
1 parent 0ed60d3 commit a727cd7

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

crates/blockchain/payload.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ use ethrex_common::{
1010
constants::{DEFAULT_OMMERS_HASH, DEFAULT_REQUESTS_HASH, GAS_PER_BLOB},
1111
types::{
1212
AccountUpdate, BlobsBundle, Block, BlockBody, BlockHash, BlockHeader, BlockNumber,
13-
ChainConfig, MempoolTransaction, Receipt, Transaction, Withdrawal, calc_excess_blob_gas,
14-
calculate_base_fee_per_blob_gas, calculate_base_fee_per_gas, compute_receipts_root,
15-
compute_transactions_root, compute_withdrawals_root,
13+
ChainConfig, MempoolTransaction, Receipt, Transaction, Withdrawal, bloom_from_logs,
14+
calc_excess_blob_gas, calculate_base_fee_per_blob_gas, calculate_base_fee_per_gas,
15+
compute_receipts_root, compute_transactions_root, compute_withdrawals_root,
1616
requests::{EncodedRequests, compute_requests_hash},
1717
},
1818
};
@@ -540,6 +540,15 @@ impl Blockchain {
540540
context.payload.header.requests_hash = context.requests_hash;
541541
context.payload.header.gas_used = context.payload.header.gas_limit - context.remaining_gas;
542542
context.account_updates = account_updates;
543+
544+
let mut logs = vec![];
545+
for receipt in context.receipts.iter().cloned() {
546+
for log in receipt.logs {
547+
logs.push(log);
548+
}
549+
}
550+
551+
context.payload.header.logs_bloom = bloom_from_logs(&logs);
543552
Ok(())
544553
}
545554
}

0 commit comments

Comments
 (0)