Closed YanhuiJessica closed 9 months ago
It's been a while since I've looked into how the bloom works, but I think the block bloom is a bloom filter itself, not a contactination of the all the transaction logBlooms.
That's not to say the block logs bloom is absolutely correct here, there might be a bug, but I don't think the first byte must be set because the first transaction's bloom has its first byte set. I might be wrong, of course, so please do correct me if so.
In Ethereum Yellow Paper, the block-level logsBloom $Hb\equiv \bigvee{r\in B_R}(r_b)$, where $B_R$ represents all the txn receipts in the block and $r_b$ represents transaction-level logsBloom.
I also tried anvil
.
$ anvil # start
Transaction Receipt
blockHash 0x018c5487cabd986fe5bf6fb63f1c551a7124e87d574bfb30110eb8ec098df35f
blockNumber 2
contractAddress
cumulativeGasUsed 23274
effectiveGasPrice 3375999642
gasUsed 23274
logs [{"address":"0x5fbdb2315678afecb367f032d93f642f64180aa3","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000002","0x0000000000000000000000000000000000000000000000000000000000001337"],"data":"0x0000000000000000000000000000000000000000000000000000000000000000","blockHash":"0x018c5487cabd986fe5bf6fb63f1c551a7124e87d574bfb30110eb8ec098df35f","blockNumber":"0x2","transactionHash":"0x546c585e3ee7e1eed3a753dd830b8aad87f649dfc90221bdbadbb88be1021272","transactionIndex":"0x0","logIndex":"0x0","transactionLogIndex":"0x0","removed":false}]
logsBloom 0x4400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000004000000000000000000000000000a000000000000000000010000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000100000000000000000000000000000000000000000000000042000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000
root
status 1
transactionHash 0x546c585e3ee7e1eed3a753dd830b8aad87f649dfc90221bdbadbb88be1021272
transactionIndex 0
type 2
Block
baseFeePerGas 875999642
difficulty 0
extraData 0x
gasLimit 30000000
gasUsed 23274
hash 0x018c5487cabd986fe5bf6fb63f1c551a7124e87d574bfb30110eb8ec098df35f
logsBloom 0x4400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000004000000000000000000000000000a000000000000000000010000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000100000000000000000000000000000000000000000000000042000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000
miner 0x0000000000000000000000000000000000000000
mixHash 0x0000000000000000000000000000000000000000000000000000000000000000
nonce 0x0000000000000000
number 2
parentHash 0xd619acf6229a2ea2326cb9ccfa8adf9ef9f4fc44c6bf313d0bc0613c6cdec053
receiptsRoot 0x92cffb4d820c3f1f43da148dcc831792ec6a28ce9860c7558bc9eb04471638d4
sealFields [
0x0000000000000000000000000000000000000000000000000000000000000000
0x0000000000000000
]
sha3Uncles 0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347
size 635
stateRoot 0xfbe79a6cbc3ce180a2fa34e6089e9aa3a1b1aa1f13205140981f610c75446656
timestamp 1696729796
withdrawalsRoot
totalDifficulty 0
transactions: [
0x546c585e3ee7e1eed3a753dd830b8aad87f649dfc90221bdbadbb88be1021272
]
There are 2 hard problems in computer science: cache invalidation, naming things, and off-by-1 errors. 😅
https://github.com/trufflesuite/ganache/pull/4535
I just need to add a test before I can merge.
Expected behaviour
The block-level logsBloom combines the logsBloom of each transaction.
Actual behaviour
The first byte of block-level logsBloom is 0x00, while there's a transaction-level logsBloom with non-zero first byte.
Steps to reproduce the behaviour
call
Log()
Transaction ReceiptBlock