From 403d13070bfe46a5fb1d7d35214bf70b1e0da8b9 Mon Sep 17 00:00:00 2001 From: yperbasis Date: Mon, 12 Aug 2024 14:25:13 +0200 Subject: [PATCH 1/8] start working on cleaner includes --- .clang-tidy | 1 - cmd/dev/embed_json.cpp | 2 ++ cmd/dev/embed_toml.cpp | 2 ++ conanfile.py | 2 +- silkworm/core/chain/config.cpp | 3 ++ silkworm/core/chain/genesis_holesky.cpp | 1 + silkworm/core/chain/genesis_sepolia.cpp | 1 + silkworm/core/common/base.hpp | 2 -- silkworm/core/crypto/ecdsa.c | 4 ++- silkworm/core/crypto/ecdsa.h | 1 - silkworm/core/crypto/rmd160.c | 1 + silkworm/core/crypto/rmd160.h | 1 - silkworm/core/crypto/secp256k1n.cpp | 2 ++ silkworm/core/crypto/sha256.c | 1 + silkworm/core/execution/evm.cpp | 1 + silkworm/core/protocol/ethash_config.cpp | 4 +++ silkworm/core/rlp/decode.hpp | 6 ++-- silkworm/core/rlp/encode.hpp | 6 +--- silkworm/core/rlp/header.hpp | 28 +++++++++++++++++++ silkworm/core/types/y_parity_and_chain_id.cpp | 4 +++ silkworm/rpc/json/log.cpp | 1 - 21 files changed, 57 insertions(+), 17 deletions(-) create mode 100644 silkworm/core/rlp/header.hpp diff --git a/.clang-tidy b/.clang-tidy index 4b08ed4573..3bc91d8ece 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -54,7 +54,6 @@ Checks: > -misc-no-recursion, -misc-non-private-member-variables-in-classes, -misc-use-anonymous-namespace, - -misc-include-cleaner, modernize-*, -modernize-avoid-c-arrays, -modernize-use-nodiscard, diff --git a/cmd/dev/embed_json.cpp b/cmd/dev/embed_json.cpp index 6405ba4f02..e1c9495c13 100644 --- a/cmd/dev/embed_json.cpp +++ b/cmd/dev/embed_json.cpp @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -62,6 +63,7 @@ void to_byte_array(fs::path& in, fs::path& out, const std::string& ns) { std::ofstream out_stream{out.string()}; out_stream << "/* Generated from " << in.filename().string() << " using silkworm embed_json tool */\n"; out_stream << "#include \"" + var_name + ".hpp\"\n"; + out_stream << "#include \n"; out_stream << "constexpr char " << var_name << "_data_internal[] = {\n"; auto max{bytes.size()}; diff --git a/cmd/dev/embed_toml.cpp b/cmd/dev/embed_toml.cpp index 58a61339e4..0c06f1ba8d 100644 --- a/cmd/dev/embed_toml.cpp +++ b/cmd/dev/embed_toml.cpp @@ -15,7 +15,9 @@ */ #include +#include #include +#include #include #include #include diff --git a/conanfile.py b/conanfile.py index cf32e42e54..f486ede728 100644 --- a/conanfile.py +++ b/conanfile.py @@ -33,7 +33,7 @@ def requirements(self): self.requires('asio-grpc/2.9.2') self.requires('benchmark/1.6.1') self.requires('boost/1.83.0') - self.requires('cli11/2.2.0') + self.requires('cli11/2.4.2') self.requires('gmp/6.2.1') self.requires('grpc/1.54.3') self.requires('gtest/1.12.1') diff --git a/silkworm/core/chain/config.cpp b/silkworm/core/chain/config.cpp index a74886d66c..179cb18800 100644 --- a/silkworm/core/chain/config.cpp +++ b/silkworm/core/chain/config.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -27,6 +28,8 @@ namespace silkworm { +using namespace std::string_view_literals; + constexpr const char* kTerminalTotalDifficulty{"terminalTotalDifficulty"}; static inline void member_to_json(nlohmann::json& json, const std::string& key, const std::optional& source) { diff --git a/silkworm/core/chain/genesis_holesky.cpp b/silkworm/core/chain/genesis_holesky.cpp index a9a69414ff..7ca08cc5b9 100644 --- a/silkworm/core/chain/genesis_holesky.cpp +++ b/silkworm/core/chain/genesis_holesky.cpp @@ -1,5 +1,6 @@ /* Generated from genesis_holesky.json using silkworm embed_json tool */ #include "genesis_holesky.hpp" +#include constexpr char genesis_holesky_data_internal[] = { 0x7b, 0x22, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x22, 0x3a, 0x7b, 0x22, 0x30, 0x78, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, diff --git a/silkworm/core/chain/genesis_sepolia.cpp b/silkworm/core/chain/genesis_sepolia.cpp index 77279767fb..681ae11802 100644 --- a/silkworm/core/chain/genesis_sepolia.cpp +++ b/silkworm/core/chain/genesis_sepolia.cpp @@ -1,5 +1,6 @@ /* Generated from genesis_sepolia.json using silkworm embed_json tool */ #include "genesis_sepolia.hpp" +#include constexpr char genesis_sepolia_data_internal[] = { 0x7b, 0x22, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x22, 0x3a, 0x7b, 0x22, 0x30, 0x78, 0x61, 0x32, 0x41, 0x36, 0x64, 0x39, 0x33, 0x34, 0x33, 0x39, 0x31, 0x34, 0x34, 0x46, 0x46, 0x45, 0x34, 0x44, 0x32, diff --git a/silkworm/core/common/base.hpp b/silkworm/core/common/base.hpp index 16d6a0bf5b..3de7bae29a 100644 --- a/silkworm/core/common/base.hpp +++ b/silkworm/core/common/base.hpp @@ -36,8 +36,6 @@ namespace silkworm { -using namespace std::string_view_literals; - template concept UnsignedIntegral = std::unsigned_integral || std::same_as || std::same_as || std::same_as; diff --git a/silkworm/core/crypto/ecdsa.c b/silkworm/core/crypto/ecdsa.c index e0210c23bd..aba7065850 100644 --- a/silkworm/core/crypto/ecdsa.c +++ b/silkworm/core/crypto/ecdsa.c @@ -16,10 +16,12 @@ #include "ecdsa.h" +#include +#include #include +#include #include -#include #include //! \brief Tries recover public key used for message signing. diff --git a/silkworm/core/crypto/ecdsa.h b/silkworm/core/crypto/ecdsa.h index 10a6601ceb..2a870df1b7 100644 --- a/silkworm/core/crypto/ecdsa.h +++ b/silkworm/core/crypto/ecdsa.h @@ -20,7 +20,6 @@ #include #include -#include #include #if defined(__cplusplus) diff --git a/silkworm/core/crypto/rmd160.c b/silkworm/core/crypto/rmd160.c index dbe51b6922..bde4ac805a 100644 --- a/silkworm/core/crypto/rmd160.c +++ b/silkworm/core/crypto/rmd160.c @@ -36,6 +36,7 @@ /* header files */ #include "rmd160.h" +#include #include /********************************************************************/ diff --git a/silkworm/core/crypto/rmd160.h b/silkworm/core/crypto/rmd160.h index e6e63526cc..a5f30b659b 100644 --- a/silkworm/core/crypto/rmd160.h +++ b/silkworm/core/crypto/rmd160.h @@ -37,7 +37,6 @@ #pragma once -#include #include #if defined(__cplusplus) diff --git a/silkworm/core/crypto/secp256k1n.cpp b/silkworm/core/crypto/secp256k1n.cpp index 53756ab226..c47145be70 100644 --- a/silkworm/core/crypto/secp256k1n.cpp +++ b/silkworm/core/crypto/secp256k1n.cpp @@ -16,6 +16,8 @@ #include "secp256k1n.hpp" +#include + namespace silkworm { bool is_valid_signature(const intx::uint256& r, const intx::uint256& s, bool homestead) noexcept { diff --git a/silkworm/core/crypto/sha256.c b/silkworm/core/crypto/sha256.c index abe1aa620e..b0551edc98 100644 --- a/silkworm/core/crypto/sha256.c +++ b/silkworm/core/crypto/sha256.c @@ -21,6 +21,7 @@ #include "sha256.h" +#include #include #if defined(__x86_64__) diff --git a/silkworm/core/execution/evm.cpp b/silkworm/core/execution/evm.cpp index 17455992e8..cafec00c8f 100644 --- a/silkworm/core/execution/evm.cpp +++ b/silkworm/core/execution/evm.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include diff --git a/silkworm/core/protocol/ethash_config.cpp b/silkworm/core/protocol/ethash_config.cpp index 35c4c20da4..ed8d65d330 100644 --- a/silkworm/core/protocol/ethash_config.cpp +++ b/silkworm/core/protocol/ethash_config.cpp @@ -16,6 +16,10 @@ #include "ethash_config.hpp" +#include + +#include + namespace silkworm::protocol { nlohmann::json EthashConfig::to_json() const noexcept { diff --git a/silkworm/core/rlp/decode.hpp b/silkworm/core/rlp/decode.hpp index be83a2923a..1e7922176a 100644 --- a/silkworm/core/rlp/decode.hpp +++ b/silkworm/core/rlp/decode.hpp @@ -23,12 +23,10 @@ #include #include -#include - -#include #include #include -#include +#include +#include namespace silkworm::rlp { diff --git a/silkworm/core/rlp/encode.hpp b/silkworm/core/rlp/encode.hpp index bdc32eb98d..5222f10086 100644 --- a/silkworm/core/rlp/encode.hpp +++ b/silkworm/core/rlp/encode.hpp @@ -24,14 +24,10 @@ #include #include #include +#include namespace silkworm::rlp { -struct Header { - bool list{false}; - size_t payload_length{0}; -}; - inline constexpr uint8_t kEmptyStringCode{0x80}; inline constexpr uint8_t kEmptyListCode{0xC0}; diff --git a/silkworm/core/rlp/header.hpp b/silkworm/core/rlp/header.hpp new file mode 100644 index 0000000000..49b7bf2e94 --- /dev/null +++ b/silkworm/core/rlp/header.hpp @@ -0,0 +1,28 @@ +/* + Copyright 2022 The Silkworm Authors + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace silkworm::rlp { + +struct Header { + bool list{false}; + size_t payload_length{0}; +}; + +} // namespace silkworm::rlp diff --git a/silkworm/core/types/y_parity_and_chain_id.cpp b/silkworm/core/types/y_parity_and_chain_id.cpp index 4a8aa9163d..4347039d7a 100644 --- a/silkworm/core/types/y_parity_and_chain_id.cpp +++ b/silkworm/core/types/y_parity_and_chain_id.cpp @@ -16,6 +16,10 @@ #include "y_parity_and_chain_id.hpp" +#include + +#include + namespace silkworm { intx::uint256 y_parity_and_chain_id_to_v(bool odd, const std::optional& chain_id) noexcept { diff --git a/silkworm/rpc/json/log.cpp b/silkworm/rpc/json/log.cpp index abf981b1c1..8b25a24bb3 100644 --- a/silkworm/rpc/json/log.cpp +++ b/silkworm/rpc/json/log.cpp @@ -22,7 +22,6 @@ #include #include -#include #include #include From 9ca306ce43bdc8900f16b9c1759f81bdfa83e07a Mon Sep 17 00:00:00 2001 From: yperbasis Date: Mon, 12 Aug 2024 14:33:39 +0200 Subject: [PATCH 2/8] fix compilation --- cmd/dev/embed_toml.cpp | 2 +- silkworm/core/chain/config.hpp | 1 + silkworm/node/stagedsync/stages/stage_interhashes/_test.cpp | 1 + .../node/stagedsync/stages/stage_interhashes/trie_loader.cpp | 1 + silkworm/rpc/core/account_dumper.cpp | 1 + 5 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/dev/embed_toml.cpp b/cmd/dev/embed_toml.cpp index 0c06f1ba8d..a44ecaac0a 100644 --- a/cmd/dev/embed_toml.cpp +++ b/cmd/dev/embed_toml.cpp @@ -15,7 +15,7 @@ */ #include -#include +#include #include #include #include diff --git a/silkworm/core/chain/config.hpp b/silkworm/core/chain/config.hpp index 8ae27df054..67ef7cb3e4 100644 --- a/silkworm/core/chain/config.hpp +++ b/silkworm/core/chain/config.hpp @@ -133,6 +133,7 @@ struct ChainConfig { std::ostream& operator<<(std::ostream& out, const ChainConfig& obj); using namespace evmc::literals; +using namespace std::string_view_literals; inline constexpr evmc::bytes32 kMainnetGenesisHash{0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3_bytes32}; constinit extern const ChainConfig kMainnetConfig; diff --git a/silkworm/node/stagedsync/stages/stage_interhashes/_test.cpp b/silkworm/node/stagedsync/stages/stage_interhashes/_test.cpp index 2cd8a641b4..ddd01b33be 100644 --- a/silkworm/node/stagedsync/stages/stage_interhashes/_test.cpp +++ b/silkworm/node/stagedsync/stages/stage_interhashes/_test.cpp @@ -17,6 +17,7 @@ #include #include +#include #include #include #include diff --git a/silkworm/node/stagedsync/stages/stage_interhashes/trie_loader.cpp b/silkworm/node/stagedsync/stages/stage_interhashes/trie_loader.cpp index 44de8a391d..7b48a0bf6a 100644 --- a/silkworm/node/stagedsync/stages/stage_interhashes/trie_loader.cpp +++ b/silkworm/node/stagedsync/stages/stage_interhashes/trie_loader.cpp @@ -19,6 +19,7 @@ #include #include +#include #include #include #include diff --git a/silkworm/rpc/core/account_dumper.cpp b/silkworm/rpc/core/account_dumper.cpp index c8b4f199f7..53527e20c6 100644 --- a/silkworm/rpc/core/account_dumper.cpp +++ b/silkworm/rpc/core/account_dumper.cpp @@ -20,6 +20,7 @@ #include #include +#include #include #include #include From 89e0711b821c5299e8b0b289955f6091bd9c2226 Mon Sep 17 00:00:00 2001 From: yperbasis Date: Mon, 12 Aug 2024 15:01:06 +0200 Subject: [PATCH 3/8] more iwyu --- cmd/dev/embed_json.cpp | 7 ++++++- cmd/dev/embed_toml.cpp | 1 - silkworm/core/chain/config.cpp | 3 +++ silkworm/core/chain/config.hpp | 2 +- silkworm/core/chain/genesis_bor_mainnet.cpp | 1 + silkworm/core/chain/genesis_mainnet.cpp | 1 + silkworm/core/crypto/kzg.cpp | 2 ++ silkworm/core/execution/processor.cpp | 2 ++ silkworm/core/protocol/bor/config.cpp | 2 ++ silkworm/core/protocol/bor_rule_set.cpp | 1 + silkworm/core/rlp/encode.cpp | 2 ++ silkworm/core/trie/hash_builder.cpp | 1 + silkworm/core/trie/nibbles.cpp | 2 ++ silkworm/core/trie/node.cpp | 1 + silkworm/core/types/transaction.cpp | 1 + silkworm/core/types/y_parity_and_chain_id.cpp | 1 + 16 files changed, 27 insertions(+), 3 deletions(-) diff --git a/cmd/dev/embed_json.cpp b/cmd/dev/embed_json.cpp index e1c9495c13..604d560538 100644 --- a/cmd/dev/embed_json.cpp +++ b/cmd/dev/embed_json.cpp @@ -14,15 +14,20 @@ limitations under the License. */ +#include +#include +#include #include +#include #include #include #include #include +#include #include #include -#include +#include namespace fs = std::filesystem; diff --git a/cmd/dev/embed_toml.cpp b/cmd/dev/embed_toml.cpp index a44ecaac0a..812aa44791 100644 --- a/cmd/dev/embed_toml.cpp +++ b/cmd/dev/embed_toml.cpp @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include diff --git a/silkworm/core/chain/config.cpp b/silkworm/core/chain/config.cpp index 179cb18800..18479471a4 100644 --- a/silkworm/core/chain/config.cpp +++ b/silkworm/core/chain/config.cpp @@ -22,6 +22,8 @@ #include #include +#include + #include #include #include @@ -29,6 +31,7 @@ namespace silkworm { using namespace std::string_view_literals; +using namespace evmc::literals; constexpr const char* kTerminalTotalDifficulty{"terminalTotalDifficulty"}; diff --git a/silkworm/core/chain/config.hpp b/silkworm/core/chain/config.hpp index 67ef7cb3e4..53ae59de87 100644 --- a/silkworm/core/chain/config.hpp +++ b/silkworm/core/chain/config.hpp @@ -132,8 +132,8 @@ struct ChainConfig { std::ostream& operator<<(std::ostream& out, const ChainConfig& obj); -using namespace evmc::literals; using namespace std::string_view_literals; +using namespace evmc::literals; inline constexpr evmc::bytes32 kMainnetGenesisHash{0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3_bytes32}; constinit extern const ChainConfig kMainnetConfig; diff --git a/silkworm/core/chain/genesis_bor_mainnet.cpp b/silkworm/core/chain/genesis_bor_mainnet.cpp index e41c960dc6..77bde814f0 100644 --- a/silkworm/core/chain/genesis_bor_mainnet.cpp +++ b/silkworm/core/chain/genesis_bor_mainnet.cpp @@ -1,5 +1,6 @@ /* Generated from genesis_bor_mainnet.json using silkworm embed_json tool */ #include "genesis_bor_mainnet.hpp" +#include constexpr char genesis_bor_mainnet_data_internal[] = { 0x7b, 0x22, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x22, 0x3a, 0x7b, 0x22, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, diff --git a/silkworm/core/chain/genesis_mainnet.cpp b/silkworm/core/chain/genesis_mainnet.cpp index 18875e1d09..da8b0a8b41 100644 --- a/silkworm/core/chain/genesis_mainnet.cpp +++ b/silkworm/core/chain/genesis_mainnet.cpp @@ -1,5 +1,6 @@ /* Generated from genesis_mainnet.json using silkworm embed_json tool */ #include "genesis_mainnet.hpp" +#include constexpr char genesis_mainnet_data_internal[] = { 0x7b, 0x22, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x22, 0x3a, 0x7b, 0x22, 0x33, 0x32, 0x38, 0x32, 0x37, 0x39, 0x31, 0x64, 0x36, 0x66, 0x64, 0x37, 0x31, 0x33, 0x66, 0x31, 0x65, 0x39, 0x34, 0x66, 0x34, diff --git a/silkworm/core/crypto/kzg.cpp b/silkworm/core/crypto/kzg.cpp index 5adde3528b..dbef9e0385 100644 --- a/silkworm/core/crypto/kzg.cpp +++ b/silkworm/core/crypto/kzg.cpp @@ -18,6 +18,8 @@ #include +#include + #include #include diff --git a/silkworm/core/execution/processor.cpp b/silkworm/core/execution/processor.cpp index 9eba65d30d..eb6fb8a17f 100644 --- a/silkworm/core/execution/processor.cpp +++ b/silkworm/core/execution/processor.cpp @@ -18,6 +18,8 @@ #include +#include + #include #include #include diff --git a/silkworm/core/protocol/bor/config.cpp b/silkworm/core/protocol/bor/config.cpp index 258be9c002..d1825adb46 100644 --- a/silkworm/core/protocol/bor/config.cpp +++ b/silkworm/core/protocol/bor/config.cpp @@ -20,7 +20,9 @@ #include #include +#include #include +#include #include #include diff --git a/silkworm/core/protocol/bor_rule_set.cpp b/silkworm/core/protocol/bor_rule_set.cpp index 0de3411a3a..0820cefb43 100644 --- a/silkworm/core/protocol/bor_rule_set.cpp +++ b/silkworm/core/protocol/bor_rule_set.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include "param.hpp" diff --git a/silkworm/core/rlp/encode.cpp b/silkworm/core/rlp/encode.cpp index 7b39792125..477d1823f1 100644 --- a/silkworm/core/rlp/encode.cpp +++ b/silkworm/core/rlp/encode.cpp @@ -16,6 +16,8 @@ #include "encode.hpp" +#include + namespace silkworm::rlp { void encode_header(Bytes& to, Header header) { diff --git a/silkworm/core/trie/hash_builder.cpp b/silkworm/core/trie/hash_builder.cpp index 1a59b4bcd9..514eb1067d 100644 --- a/silkworm/core/trie/hash_builder.cpp +++ b/silkworm/core/trie/hash_builder.cpp @@ -26,6 +26,7 @@ #include #include #include +#include namespace silkworm::trie { diff --git a/silkworm/core/trie/nibbles.cpp b/silkworm/core/trie/nibbles.cpp index 22047836ba..50336a5545 100644 --- a/silkworm/core/trie/nibbles.cpp +++ b/silkworm/core/trie/nibbles.cpp @@ -16,6 +16,8 @@ #include "nibbles.hpp" +#include + namespace silkworm::trie { Bytes pack_nibbles(ByteView unpacked) { diff --git a/silkworm/core/trie/node.cpp b/silkworm/core/trie/node.cpp index 28995f0a26..5fb3b86824 100644 --- a/silkworm/core/trie/node.cpp +++ b/silkworm/core/trie/node.cpp @@ -20,6 +20,7 @@ #include #include +#include #include namespace silkworm::trie { diff --git a/silkworm/core/types/transaction.cpp b/silkworm/core/types/transaction.cpp index 05b4ace0be..9c77d4280f 100644 --- a/silkworm/core/types/transaction.cpp +++ b/silkworm/core/types/transaction.cpp @@ -20,6 +20,7 @@ #include +#include #include #include #include diff --git a/silkworm/core/types/y_parity_and_chain_id.cpp b/silkworm/core/types/y_parity_and_chain_id.cpp index 4347039d7a..7a1dab1062 100644 --- a/silkworm/core/types/y_parity_and_chain_id.cpp +++ b/silkworm/core/types/y_parity_and_chain_id.cpp @@ -17,6 +17,7 @@ #include "y_parity_and_chain_id.hpp" #include +#include #include From 67b86d51af01580d9d2d330d07c52fd6252b6230 Mon Sep 17 00:00:00 2001 From: yperbasis Date: Mon, 12 Aug 2024 16:54:42 +0200 Subject: [PATCH 4/8] moar iwyu --- silkworm/core/chain/genesis.cpp | 1 + silkworm/core/chain/genesis_mumbai.cpp | 1 + silkworm/core/common/test_util.cpp | 3 +++ silkworm/core/common/util.cpp | 1 + silkworm/core/execution/call_tracer.cpp | 3 +++ silkworm/core/execution/evm.cpp | 6 ++++++ silkworm/core/execution/precompile.cpp | 1 + silkworm/core/execution/processor.cpp | 3 +++ silkworm/core/execution/processor_test.cpp | 2 ++ silkworm/core/protocol/blockchain.cpp | 7 +++++++ silkworm/core/protocol/bor_rule_set.cpp | 1 + silkworm/core/protocol/ethash_rule_set.cpp | 7 ++++++- silkworm/core/protocol/rule_set.cpp | 1 + silkworm/core/protocol/validation.cpp | 2 ++ silkworm/core/rlp/decode.cpp | 4 +++- silkworm/core/rlp/encode.cpp | 3 +++ silkworm/core/state/delta.cpp | 2 ++ silkworm/core/state/in_memory_state.cpp | 7 +++++++ silkworm/core/state/intra_block_state.cpp | 4 ++++ silkworm/core/trie/nibbles.cpp | 3 +++ silkworm/core/trie/prefix_set.cpp | 3 +++ silkworm/core/types/account.cpp | 3 +++ silkworm/core/types/log.cpp | 1 + silkworm/core/types/transaction.cpp | 1 + silkworm/core/types/withdrawal.cpp | 1 + silkworm/rpc/core/evm_executor.cpp | 1 + silkworm/rpc/types/log.cpp | 1 - 27 files changed, 70 insertions(+), 3 deletions(-) diff --git a/silkworm/core/chain/genesis.cpp b/silkworm/core/chain/genesis.cpp index 88eaceb174..1cab3d0785 100644 --- a/silkworm/core/chain/genesis.cpp +++ b/silkworm/core/chain/genesis.cpp @@ -17,6 +17,7 @@ #include "genesis.hpp" #include +#include #include #include diff --git a/silkworm/core/chain/genesis_mumbai.cpp b/silkworm/core/chain/genesis_mumbai.cpp index 592e7a5ac6..d1fdedd06b 100644 --- a/silkworm/core/chain/genesis_mumbai.cpp +++ b/silkworm/core/chain/genesis_mumbai.cpp @@ -1,5 +1,6 @@ /* Generated from genesis_mumbai.json using silkworm embed_json tool */ #include "genesis_mumbai.hpp" +#include constexpr char genesis_mumbai_data_internal[] = { 0x7b, 0x22, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x22, 0x3a, 0x7b, 0x22, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, diff --git a/silkworm/core/common/test_util.cpp b/silkworm/core/common/test_util.cpp index 2e44c0e892..b999202726 100644 --- a/silkworm/core/common/test_util.cpp +++ b/silkworm/core/common/test_util.cpp @@ -16,8 +16,11 @@ #include "test_util.hpp" +#include + #include #include +#include namespace silkworm::test { diff --git a/silkworm/core/common/util.cpp b/silkworm/core/common/util.cpp index 9d7bafae66..3f267d6c9c 100644 --- a/silkworm/core/common/util.cpp +++ b/silkworm/core/common/util.cpp @@ -17,6 +17,7 @@ #include "util.hpp" #include +#include #include #include diff --git a/silkworm/core/execution/call_tracer.cpp b/silkworm/core/execution/call_tracer.cpp index b7c7a5cf25..76f57758a1 100644 --- a/silkworm/core/execution/call_tracer.cpp +++ b/silkworm/core/execution/call_tracer.cpp @@ -16,6 +16,8 @@ #include "call_tracer.hpp" +#include + #include #include #include @@ -24,6 +26,7 @@ #include #include +#include using namespace evmone; using namespace evmone::baseline; diff --git a/silkworm/core/execution/evm.cpp b/silkworm/core/execution/evm.cpp index cafec00c8f..e9edb817de 100644 --- a/silkworm/core/execution/evm.cpp +++ b/silkworm/core/execution/evm.cpp @@ -18,20 +18,26 @@ #include #include +#include #include +#include #include #include #include #include #include +#include #include #include +#include +#include #include #include #include #include +#include namespace silkworm { diff --git a/silkworm/core/execution/precompile.cpp b/silkworm/core/execution/precompile.cpp index a67d5aa38c..2b03ecad0d 100644 --- a/silkworm/core/execution/precompile.cpp +++ b/silkworm/core/execution/precompile.cpp @@ -33,6 +33,7 @@ #include #pragma GCC diagnostic pop +#include #include #include #include diff --git a/silkworm/core/execution/processor.cpp b/silkworm/core/execution/processor.cpp index eb6fb8a17f..2f55d1ab6e 100644 --- a/silkworm/core/execution/processor.cpp +++ b/silkworm/core/execution/processor.cpp @@ -16,13 +16,16 @@ #include "processor.hpp" +#include #include +#include #include #include #include #include +#include namespace silkworm { diff --git a/silkworm/core/execution/processor_test.cpp b/silkworm/core/execution/processor_test.cpp index 5019040e1d..f7f675b389 100644 --- a/silkworm/core/execution/processor_test.cpp +++ b/silkworm/core/execution/processor_test.cpp @@ -16,6 +16,8 @@ #include "processor.hpp" +#include + #include #include diff --git a/silkworm/core/protocol/blockchain.cpp b/silkworm/core/protocol/blockchain.cpp index 9bd2fe0e8b..0434d6d7fa 100644 --- a/silkworm/core/protocol/blockchain.cpp +++ b/silkworm/core/protocol/blockchain.cpp @@ -16,8 +16,15 @@ #include "blockchain.hpp" +#include +#include +#include + +#include + #include #include +#include namespace silkworm::protocol { diff --git a/silkworm/core/protocol/bor_rule_set.cpp b/silkworm/core/protocol/bor_rule_set.cpp index 0820cefb43..0a7b1ed5b7 100644 --- a/silkworm/core/protocol/bor_rule_set.cpp +++ b/silkworm/core/protocol/bor_rule_set.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include diff --git a/silkworm/core/protocol/ethash_rule_set.cpp b/silkworm/core/protocol/ethash_rule_set.cpp index ca309d5925..5af8cf64cf 100644 --- a/silkworm/core/protocol/ethash_rule_set.cpp +++ b/silkworm/core/protocol/ethash_rule_set.cpp @@ -16,6 +16,11 @@ #include "ethash_rule_set.hpp" +#include + +#include +#include + #include #include #include @@ -181,7 +186,7 @@ intx::uint256 EthashRuleSet::difficulty(uint64_t block_number, const uint64_t bl std::ostream& operator<<(std::ostream& out, const BlockReward& reward) { out << "miner_reward: " << intx::to_string(reward.miner) << " ommer_rewards: ["; - for (std::size_t i{0}; i < reward.ommers.size(); ++i) { + for (size_t i{0}; i < reward.ommers.size(); ++i) { out << intx::to_string(reward.ommers[i]); if (i != reward.ommers.size() - 1) { out << " "; diff --git a/silkworm/core/protocol/rule_set.cpp b/silkworm/core/protocol/rule_set.cpp index 8fb74fb095..1cf57230a6 100644 --- a/silkworm/core/protocol/rule_set.cpp +++ b/silkworm/core/protocol/rule_set.cpp @@ -17,6 +17,7 @@ #include "rule_set.hpp" #include +#include #include #include diff --git a/silkworm/core/protocol/validation.cpp b/silkworm/core/protocol/validation.cpp index aca26cfd0e..e0965f08a9 100644 --- a/silkworm/core/protocol/validation.cpp +++ b/silkworm/core/protocol/validation.cpp @@ -17,8 +17,10 @@ #include "validation.hpp" #include +#include #include +#include #include #include #include diff --git a/silkworm/core/rlp/decode.cpp b/silkworm/core/rlp/decode.cpp index 0f81fbcefb..c5ea050584 100644 --- a/silkworm/core/rlp/decode.cpp +++ b/silkworm/core/rlp/decode.cpp @@ -17,7 +17,9 @@ #include "decode.hpp" #include -#include +#include + +#include #include diff --git a/silkworm/core/rlp/encode.cpp b/silkworm/core/rlp/encode.cpp index 477d1823f1..40f1a2bc1c 100644 --- a/silkworm/core/rlp/encode.cpp +++ b/silkworm/core/rlp/encode.cpp @@ -16,6 +16,9 @@ #include "encode.hpp" +#include + +#include #include namespace silkworm::rlp { diff --git a/silkworm/core/state/delta.cpp b/silkworm/core/state/delta.cpp index 4f83f51579..ffc4a65dfd 100644 --- a/silkworm/core/state/delta.cpp +++ b/silkworm/core/state/delta.cpp @@ -18,6 +18,8 @@ #include +#include + #include namespace silkworm::state { diff --git a/silkworm/core/state/in_memory_state.cpp b/silkworm/core/state/in_memory_state.cpp index 115e306d90..5566e1344e 100644 --- a/silkworm/core/state/in_memory_state.cpp +++ b/silkworm/core/state/in_memory_state.cpp @@ -17,14 +17,21 @@ #include "in_memory_state.hpp" #include +#include +#include +#include #include +#include +#include #include #include #include #include #include +#include +#include #include namespace silkworm { diff --git a/silkworm/core/state/intra_block_state.cpp b/silkworm/core/state/intra_block_state.cpp index 2b4db6b43a..c0822e87e5 100644 --- a/silkworm/core/state/intra_block_state.cpp +++ b/silkworm/core/state/intra_block_state.cpp @@ -17,9 +17,13 @@ #include "intra_block_state.hpp" #include +#include + +#include #include #include +#include namespace silkworm { diff --git a/silkworm/core/trie/nibbles.cpp b/silkworm/core/trie/nibbles.cpp index 50336a5545..8528493e6b 100644 --- a/silkworm/core/trie/nibbles.cpp +++ b/silkworm/core/trie/nibbles.cpp @@ -16,8 +16,11 @@ #include "nibbles.hpp" +#include #include +#include + namespace silkworm::trie { Bytes pack_nibbles(ByteView unpacked) { diff --git a/silkworm/core/trie/prefix_set.cpp b/silkworm/core/trie/prefix_set.cpp index e99413a0be..658f9ee644 100644 --- a/silkworm/core/trie/prefix_set.cpp +++ b/silkworm/core/trie/prefix_set.cpp @@ -17,8 +17,11 @@ #include "prefix_set.hpp" #include +#include #include +#include + namespace silkworm::trie { void PrefixSet::insert(ByteView key, bool marker) { insert(Bytes(key), marker); } diff --git a/silkworm/core/types/account.cpp b/silkworm/core/types/account.cpp index f61b79f7b5..73066de066 100644 --- a/silkworm/core/types/account.cpp +++ b/silkworm/core/types/account.cpp @@ -16,9 +16,12 @@ #include "account.hpp" +#include + #include #include #include +#include #include namespace silkworm { diff --git a/silkworm/core/types/log.cpp b/silkworm/core/types/log.cpp index d74e90e8b1..1cc786ec29 100644 --- a/silkworm/core/types/log.cpp +++ b/silkworm/core/types/log.cpp @@ -16,6 +16,7 @@ #include "log.hpp" +#include #include #include #include diff --git a/silkworm/core/types/transaction.cpp b/silkworm/core/types/transaction.cpp index 9c77d4280f..e647ab4907 100644 --- a/silkworm/core/types/transaction.cpp +++ b/silkworm/core/types/transaction.cpp @@ -16,6 +16,7 @@ #include "transaction.hpp" +#include #include #include diff --git a/silkworm/core/types/withdrawal.cpp b/silkworm/core/types/withdrawal.cpp index 8f57435f90..36a04beb4a 100644 --- a/silkworm/core/types/withdrawal.cpp +++ b/silkworm/core/types/withdrawal.cpp @@ -16,6 +16,7 @@ #include "withdrawal.hpp" +#include #include #include #include diff --git a/silkworm/rpc/core/evm_executor.cpp b/silkworm/rpc/core/evm_executor.cpp index 63650185fd..6ee379b952 100644 --- a/silkworm/rpc/core/evm_executor.cpp +++ b/silkworm/rpc/core/evm_executor.cpp @@ -16,6 +16,7 @@ #include "evm_executor.hpp" +#include #include #include #include diff --git a/silkworm/rpc/types/log.cpp b/silkworm/rpc/types/log.cpp index 92262d342a..6329bc41cf 100644 --- a/silkworm/rpc/types/log.cpp +++ b/silkworm/rpc/types/log.cpp @@ -18,7 +18,6 @@ #include -#include #include namespace silkworm::rpc { From 219c9ddf152bbbae4b62f1f50ad1605bd166f58c Mon Sep 17 00:00:00 2001 From: yperbasis Date: Mon, 12 Aug 2024 16:58:57 +0200 Subject: [PATCH 5/8] fix include --- silkworm/core/protocol/rule_set.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/silkworm/core/protocol/rule_set.cpp b/silkworm/core/protocol/rule_set.cpp index 1cf57230a6..bec048f209 100644 --- a/silkworm/core/protocol/rule_set.cpp +++ b/silkworm/core/protocol/rule_set.cpp @@ -17,7 +17,7 @@ #include "rule_set.hpp" #include -#include +#include #include #include From 05cc86e338c5b1273cea487643ea94a76d480f92 Mon Sep 17 00:00:00 2001 From: yperbasis Date: Mon, 12 Aug 2024 22:36:54 +0200 Subject: [PATCH 6/8] moar iwyu --- silkworm/core/execution/call_tracer.cpp | 5 +++++ silkworm/core/protocol/bor/config.cpp | 7 +++++++ silkworm/core/protocol/ethash_rule_set.cpp | 7 +++++++ silkworm/core/rlp/decode.cpp | 5 +++++ silkworm/core/rlp/encode.cpp | 5 +++++ silkworm/core/state/in_memory_state.cpp | 7 ++++++- silkworm/core/trie/node.cpp | 6 ++++++ silkworm/core/trie/prefix_set.cpp | 1 + silkworm/core/types/account.cpp | 6 ++++++ silkworm/core/types/log.cpp | 6 +++++- silkworm/core/types/transaction.cpp | 1 + silkworm/core/types/withdrawal.cpp | 5 +++++ 12 files changed, 59 insertions(+), 2 deletions(-) diff --git a/silkworm/core/execution/call_tracer.cpp b/silkworm/core/execution/call_tracer.cpp index 76f57758a1..a5faabed27 100644 --- a/silkworm/core/execution/call_tracer.cpp +++ b/silkworm/core/execution/call_tracer.cpp @@ -16,14 +16,19 @@ #include "call_tracer.hpp" +#include #include +#include +#include #include #include #include #include #include +#include +#include #include #include #include diff --git a/silkworm/core/protocol/bor/config.cpp b/silkworm/core/protocol/bor/config.cpp index d1825adb46..c7afc719ed 100644 --- a/silkworm/core/protocol/bor/config.cpp +++ b/silkworm/core/protocol/bor/config.cpp @@ -16,10 +16,17 @@ #include "config.hpp" +#include #include #include +#include +#include + +#include +#include #include +#include #include #include #include diff --git a/silkworm/core/protocol/ethash_rule_set.cpp b/silkworm/core/protocol/ethash_rule_set.cpp index 5af8cf64cf..23a7ceb5be 100644 --- a/silkworm/core/protocol/ethash_rule_set.cpp +++ b/silkworm/core/protocol/ethash_rule_set.cpp @@ -17,15 +17,22 @@ #include "ethash_rule_set.hpp" #include +#include +#include +#include #include #include +#include #include +#include #include #include +#include #include "param.hpp" +#include "rule_set.hpp" namespace silkworm::protocol { diff --git a/silkworm/core/rlp/decode.cpp b/silkworm/core/rlp/decode.cpp index c5ea050584..9261fc9fed 100644 --- a/silkworm/core/rlp/decode.cpp +++ b/silkworm/core/rlp/decode.cpp @@ -17,12 +17,17 @@ #include "decode.hpp" #include +#include #include #include +#include +#include #include +#include "header.hpp" + namespace silkworm::rlp { tl::expected decode_header(ByteView& from) noexcept { diff --git a/silkworm/core/rlp/encode.cpp b/silkworm/core/rlp/encode.cpp index 40f1a2bc1c..8760759582 100644 --- a/silkworm/core/rlp/encode.cpp +++ b/silkworm/core/rlp/encode.cpp @@ -16,11 +16,16 @@ #include "encode.hpp" +#include +#include + #include #include #include +#include "header.hpp" + namespace silkworm::rlp { void encode_header(Bytes& to, Header header) { diff --git a/silkworm/core/state/in_memory_state.cpp b/silkworm/core/state/in_memory_state.cpp index 5566e1344e..b4c7490420 100644 --- a/silkworm/core/state/in_memory_state.cpp +++ b/silkworm/core/state/in_memory_state.cpp @@ -16,14 +16,17 @@ #include "in_memory_state.hpp" +#include +#include #include #include #include #include -#include #include +#include +#include #include #include #include @@ -32,7 +35,9 @@ #include #include #include +#include #include +#include namespace silkworm { diff --git a/silkworm/core/trie/node.cpp b/silkworm/core/trie/node.cpp index 5fb3b86824..14f9d88d34 100644 --- a/silkworm/core/trie/node.cpp +++ b/silkworm/core/trie/node.cpp @@ -17,9 +17,15 @@ #include "node.hpp" #include +#include +#include #include +#include + #include +#include +#include #include #include diff --git a/silkworm/core/trie/prefix_set.cpp b/silkworm/core/trie/prefix_set.cpp index 658f9ee644..1eae9de1bc 100644 --- a/silkworm/core/trie/prefix_set.cpp +++ b/silkworm/core/trie/prefix_set.cpp @@ -18,6 +18,7 @@ #include #include +#include #include #include diff --git a/silkworm/core/types/account.cpp b/silkworm/core/types/account.cpp index 73066de066..862ea5306f 100644 --- a/silkworm/core/types/account.cpp +++ b/silkworm/core/types/account.cpp @@ -16,8 +16,14 @@ #include "account.hpp" +#include +#include + #include +#include +#include +#include #include #include #include diff --git a/silkworm/core/types/log.cpp b/silkworm/core/types/log.cpp index 1cc786ec29..8f25d4f337 100644 --- a/silkworm/core/types/log.cpp +++ b/silkworm/core/types/log.cpp @@ -16,10 +16,14 @@ #include "log.hpp" +#include + #include +#include +#include #include +#include #include -#include namespace silkworm::rlp { diff --git a/silkworm/core/types/transaction.cpp b/silkworm/core/types/transaction.cpp index e647ab4907..4dc84af3d5 100644 --- a/silkworm/core/types/transaction.cpp +++ b/silkworm/core/types/transaction.cpp @@ -20,6 +20,7 @@ #include #include +#include #include #include diff --git a/silkworm/core/types/withdrawal.cpp b/silkworm/core/types/withdrawal.cpp index 36a04beb4a..abf1afb773 100644 --- a/silkworm/core/types/withdrawal.cpp +++ b/silkworm/core/types/withdrawal.cpp @@ -16,9 +16,14 @@ #include "withdrawal.hpp" +#include + #include +#include +#include #include #include +#include #include namespace silkworm::rlp { From 997a9dfdce9d03834c395e69c6d9fdd02ddee3a0 Mon Sep 17 00:00:00 2001 From: yperbasis Date: Mon, 12 Aug 2024 22:39:28 +0200 Subject: [PATCH 7/8] fix compilation --- silkworm/core/types/log.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/silkworm/core/types/log.cpp b/silkworm/core/types/log.cpp index 8f25d4f337..2b891afeb0 100644 --- a/silkworm/core/types/log.cpp +++ b/silkworm/core/types/log.cpp @@ -24,6 +24,7 @@ #include #include #include +#include namespace silkworm::rlp { From b472f3a63b12e72b0e133719e357111c8177294f Mon Sep 17 00:00:00 2001 From: yperbasis Date: Mon, 12 Aug 2024 22:51:15 +0200 Subject: [PATCH 8/8] iwyu 5 --- silkworm/core/common/util.cpp | 5 +++++ silkworm/core/trie/node.cpp | 3 +++ silkworm/core/types/account.cpp | 1 + silkworm/core/types/address.cpp | 10 ++++++++++ silkworm/core/types/receipt.cpp | 7 ++++++- 5 files changed, 25 insertions(+), 1 deletion(-) diff --git a/silkworm/core/common/util.cpp b/silkworm/core/common/util.cpp index 3f267d6c9c..dc09c9baf7 100644 --- a/silkworm/core/common/util.cpp +++ b/silkworm/core/common/util.cpp @@ -19,9 +19,14 @@ #include #include #include +#include #include +#include + #include +#include +#include namespace silkworm { diff --git a/silkworm/core/trie/node.cpp b/silkworm/core/trie/node.cpp index 14f9d88d34..bd698508d0 100644 --- a/silkworm/core/trie/node.cpp +++ b/silkworm/core/trie/node.cpp @@ -17,10 +17,13 @@ #include "node.hpp" #include +#include #include #include #include +#include +#include #include #include diff --git a/silkworm/core/types/account.cpp b/silkworm/core/types/account.cpp index 862ea5306f..ca3fd027dc 100644 --- a/silkworm/core/types/account.cpp +++ b/silkworm/core/types/account.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include #include diff --git a/silkworm/core/types/address.cpp b/silkworm/core/types/address.cpp index 97cd283db8..b67c190fb1 100644 --- a/silkworm/core/types/address.cpp +++ b/silkworm/core/types/address.cpp @@ -16,11 +16,21 @@ #include "address.hpp" +#include +#include +#include +#include +#include + #include +#include #include +#include +#include #include #include +#include namespace silkworm { diff --git a/silkworm/core/types/receipt.cpp b/silkworm/core/types/receipt.cpp index 8ba3e23e5c..5cac177220 100644 --- a/silkworm/core/types/receipt.cpp +++ b/silkworm/core/types/receipt.cpp @@ -16,8 +16,13 @@ #include "receipt.hpp" -#include +#include + +#include #include +#include + +#include "transaction.hpp" namespace silkworm::rlp {