Skip to content

Commit

Permalink
Populate LogsBloom field with its default fault for block responses
Browse files Browse the repository at this point in the history
  • Loading branch information
m-Peter committed Jul 22, 2024
1 parent 1ee807f commit 80fdaba
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,7 @@ func (b *BlockChainAPI) prepareBlockResponse(
Nonce: types.BlockNonce{0x1},
Timestamp: hexutil.Uint64(block.Timestamp),
BaseFeePerGas: hexutil.Big(*big.NewInt(0)),
LogsBloom: types.LogsBloom([]*types.Log{}),
}

// todo remove after previewnet, temp fix to mock some of the timestamps
Expand Down
13 changes: 13 additions & 0 deletions tests/web3js/eth_non_interactive_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,19 @@ it('get block', async () => {
assert.isNull(no)
})

it('get earliest/genesis block', async () => {
let block = await web3.eth.getBlock('earliest')

assert.notDeepEqual(block, {})
assert.equal(block.number, 0n)
assert.isString(block.hash)
assert.isString(block.parentHash)
assert.lengthOf(block.logsBloom, 514)
assert.isDefined(block.timestamp)
assert.isTrue(block.timestamp >= 1714090657n)
assert.isUndefined(block.transactions)
})

it('get block and transactions with COA interactions', async () => {
// First 2 blocks are formed from COA deployment and fund.
const blockNumbers = [1, 2]
Expand Down

0 comments on commit 80fdaba

Please sign in to comment.