Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/application/impl/app_configuration_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ namespace kagome::application {
desc.add_options()
("help,h", "show this help message")
("version,v", "show version information")
("logcfg", po::value<std::string>(), "optional, path to config file of logger")
("logcfg", po::value<std::string>(), "optional, path to logger config file")
("log,l", po::value<std::vector<std::string>>(),
"Sets a custom logging filter. Syntax is `<target>=<level>`, e.g. -llibp2p=off.\n"
"Log levels (most to least verbose) are trace, debug, verbose, info, warn, error, critical, off. By default, all targets log `info`.\n"
Expand Down
1 change: 1 addition & 0 deletions core/blockchain/impl/block_storage_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ namespace kagome::blockchain {
outcome::result<primitives::BlockHash> BlockStorageImpl::putBlockHeader(
const primitives::BlockHeader &header) {
OUTCOME_TRY(encoded_header, scale::encode(header));
header.updateHash(*hasher_);
const auto &block_hash = header.hash();
OUTCOME_TRY(putToSpace(
*storage_, Space::kHeader, block_hash, std::move(encoded_header)));
Expand Down
3 changes: 2 additions & 1 deletion core/log/configurator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ namespace kagome::log {
po::options_description desc("General options");
desc.add_options()
// clang-format off
("logcfg", po::value<std::string>(), "optional, path to logging config file")
("logcfg", po::value<std::string>())
("log", po::value<std::string>()) // needed to avoid mix `--logcfg` and `--log`
// clang-format on
;

Expand Down
2 changes: 1 addition & 1 deletion core/parachain/backing/grid_tracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ namespace kagome::parachain::grid {
auto it = seconded_counts.find(group_index);
if (it == seconded_counts.end()) {
auto i = seconded_counts.emplace(group_index,
std::vector<size_t>{group_size, 0});
std::vector<size_t>(group_size, 0));
counts = i.first->second;
} else {
counts = it->second;
Expand Down
4 changes: 2 additions & 2 deletions node/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ int main(int argc, const char **argv, const char **env) {
// Logging system
auto logging_system = [&] {
auto custom_log_config_path =
kagome::log::Configurator::getLogConfigFile(argc - 1, argv + 1);
kagome::log::Configurator::getLogConfigFile(argc, argv);
if (custom_log_config_path.has_value()) {
if (not std::filesystem::is_regular_file(
custom_log_config_path.value())) {
std::cerr << "Provided wrong path to config file of logging\n";
std::cerr << "Provided wrong path to logger config file\n";
exit(EXIT_FAILURE);
}
}
Expand Down
20 changes: 11 additions & 9 deletions test/core/blockchain/block_storage_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ class BlockStorageTest : public testing::Test {
void SetUp() override {
root_hash.fill(1);

hasher = std::make_shared<HasherMock>();
spaced_storage = std::make_shared<SpacedStorageMock>();

std::set<Space> required_spaces = {Space::kDefault,
Space::kHeader,
Space::kJustification,
Expand Down Expand Up @@ -77,8 +80,9 @@ class BlockStorageTest : public testing::Test {

std::shared_ptr<BlockStorageImpl> createWithGenesis() {
// calculate hash of genesis block at put block header
EXPECT_CALL(*hasher, blake2b_256(_))
.WillRepeatedly(Return(genesis_block_hash));
static auto encoded_header = Buffer(scale::encode(BlockHeader{}).value());
ON_CALL(*hasher, blake2b_256(encoded_header.view()))
.WillByDefault(Return(genesis_block_hash));

EXPECT_OUTCOME_TRUE(
new_block_storage,
Expand Down Expand Up @@ -106,10 +110,6 @@ TEST_F(BlockStorageTest, CreateWithGenesis) {
TEST_F(BlockStorageTest, CreateWithEmptyStorage) {
auto empty_storage = std::make_shared<BufferStorageMock>();

// calculate hash of genesis block at put block header
EXPECT_CALL(*hasher, blake2b_256(_))
.WillRepeatedly(Return(genesis_block_hash));

// check if storage contained genesis block
EXPECT_CALL(*empty_storage, tryGetMock(_))
.WillRepeatedly(Return(std::nullopt));
Expand Down Expand Up @@ -169,7 +169,6 @@ TEST_F(BlockStorageTest, PutBlock) {
Block block;
block.header.number = 1;
block.header.parent_hash = genesis_block_hash;
block.header.hash_opt = regular_block_hash;

ASSERT_OUTCOME_SUCCESS_TRY(block_storage->putBlock(block));
}
Expand All @@ -184,9 +183,12 @@ TEST_F(BlockStorageTest, PutWithStorageError) {
auto block_storage = createWithGenesis();

Block block;
block.header.number = 666;
block.header.number = 1;
block.header.parent_hash = genesis_block_hash;
block.header.hash_opt = regular_block_hash;

auto encoded_header = Buffer(scale::encode(block.header).value());
ON_CALL(*hasher, blake2b_256(encoded_header.view()))
.WillByDefault(Return(regular_block_hash));

Buffer key{regular_block_hash};

Expand Down