TLA Line data Source code
1 : // evmone: Fast Ethereum Virtual Machine implementation
2 : // Copyright 2023 The evmone Authors.
3 : // SPDX-License-Identifier: Apache-2.0
4 :
5 : #pragma once
6 : #include "hash_utils.hpp"
7 : #include <span>
8 :
9 : namespace evmone::state
10 : {
11 : struct Log;
12 : struct TransactionReceipt;
13 :
14 : /// The 2048-bit hash suitable for keeping an Ethereum bloom filter of transactions logs.
15 : struct BloomFilter
16 : {
17 : //// The 256 bytes of the bloom filter value.
18 : uint8_t bytes[256] = {};
19 :
20 : /// Implicit operator converting to bytes_view.
21 CBC 159 : inline constexpr operator bytes_view() const noexcept { return {bytes, sizeof(bytes)}; }
22 : };
23 :
24 : /// Computes combined bloom fitter for set of logs.
25 : /// It's used to compute bloom filter for single transaction.
26 : [[nodiscard]] BloomFilter compute_bloom_filter(std::span<const Log> logs) noexcept;
27 :
28 : /// Computes combined bloom fitter for set of TransactionReceipts
29 : /// It's used to compute bloom filter for a block.
30 : [[nodiscard]] BloomFilter compute_bloom_filter(
31 : std::span<const TransactionReceipt> receipts) noexcept;
32 :
33 : /// Loads BloomFilter from bytes_view
34 : BloomFilter bloom_filter_from_bytes(const bytes_view& data) noexcept;
35 :
36 : } // namespace evmone::state
|