Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
1aeed5b
feat: enhance logging for attestation processing and state transitions
kamilsa Dec 24, 2025
3f5fd55
feat: change logging level to debug for slot events in fork choice
kamilsa Dec 24, 2025
1010bf3
feat: improve logging for fork choice and timeline events
kamilsa Dec 24, 2025
363b51d
feat: enhance logging with emojis for better readability in fork choi…
kamilsa Dec 24, 2025
6bb97ab
feat: enhance logging with emojis for attestation processing and netw…
kamilsa Dec 24, 2025
0851221
refactor: changes generating some files
xDimon Dec 23, 2025
21d50ff
temp fix for ldebug
kamilsa Dec 24, 2025
c9a1b06
feat: add emoji to logging for slot started event
kamilsa Dec 24, 2025
f27a46b
feat: enhance logging by converting peer ID to Base58 format for bett…
kamilsa Dec 24, 2025
ccb2186
feat: enhance logging for received votes and gossiped blocks with add…
kamilsa Dec 24, 2025
42425b5
feat: enhance logging for gossiped votes with additional details and …
kamilsa Dec 24, 2025
edda08b
feat: enhance logging format for better readability and consistency
kamilsa Dec 24, 2025
79577dd
feat: enhance logging format by standardizing delimiters for improved…
kamilsa Dec 24, 2025
91fe532
Docker build fix
Dec 24, 2025
eca7da0
feat: enhance logging by providing clearer context for unknown valida…
kamilsa Dec 25, 2025
41844b9
Merge remote-tracking branch 'origin/enhance/logs' into enhance/logs
kamilsa Dec 25, 2025
0c7f5f2
Fix logs
kamilsa Dec 25, 2025
6c91dfd
feat: enhance logging by improving message clarity and consistency in…
kamilsa Dec 25, 2025
4326cbc
feat: enhance logging format by standardizing hex representation for …
kamilsa Dec 30, 2025
719a442
print status
kamilsa Dec 30, 2025
1e0c3af
extend hash
kamilsa Dec 30, 2025
2c5ddd0
Merge branch 'master' into enhance/logs
kamilsa Jan 7, 2026
bf40024
Revert "temp fix for ldebug"
kamilsa Jan 8, 2026
6dda1e4
refactor: log config over cli
xDimon Dec 26, 2025
6e0cb99
Remove redundant peer id
kamilsa Jan 8, 2026
99edd71
refactor: improve logging format in chain status output
kamilsa Jan 8, 2026
9cb8333
Merge branch 'master' into enhance/logs
kamilsa Jan 8, 2026
273cfa1
feat: add peers total count update dispatch and message structure
kamilsa Jan 8, 2026
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
5 changes: 5 additions & 0 deletions Dockerfile.builder
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ COPY --from=dependencies /root/.rustup /root/.rustup
# Copy project source code
COPY . ${PROJECT}

# Create minimal .git structure for build version generation
# (actual .git is excluded by .dockerignore for smaller image)
RUN mkdir -p ${PROJECT}/.git && \
echo "${GIT_COMMIT}" > ${PROJECT}/.git/HEAD

# Build project
RUN set -eux; \
export PATH="${HOME}/.cargo/bin:${PATH}"; \
Expand Down
8 changes: 8 additions & 0 deletions example/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,11 @@ logging:
- name: storage
children:
- name: block_storage
- name: blockchain
children:
- name: block_tree
- name: fork_choice
level: trace
children:
- name: stf
level: info
76 changes: 61 additions & 15 deletions src/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,81 @@
# SPDX-License-Identifier: Apache-2.0
#

execute_process(
COMMAND git symbolic-ref -q HEAD
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_REF
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)

if(GIT_REF)
set(GIT_REF_FILE "${CMAKE_SOURCE_DIR}/.git/${GIT_REF}")
else()
set(GIT_REF_FILE "${CMAKE_SOURCE_DIR}/.git/HEAD")
endif()

set(BUILD_VERSION_CPP "${CMAKE_BINARY_DIR}/generated/app/build_version.cpp")
set(GET_VERSION_SCRIPT "${CMAKE_SOURCE_DIR}/scripts/get_version.sh")
add_custom_command(
OUTPUT ${BUILD_VERSION_CPP}
COMMAND echo "// Auto-generated file" > ${BUILD_VERSION_CPP}
COMMAND echo "#include <string>" >> ${BUILD_VERSION_CPP}
COMMAND echo "namespace lean {" >> ${BUILD_VERSION_CPP}
COMMAND echo " const std::string &buildVersion() {" >> ${BUILD_VERSION_CPP}
COMMAND printf " static const std::string buildVersion(\"" >> ${BUILD_VERSION_CPP}
COMMAND ${GET_VERSION_SCRIPT} >> ${BUILD_VERSION_CPP}
COMMAND echo "\");" >> ${BUILD_VERSION_CPP}
COMMAND echo " return buildVersion;" >> ${BUILD_VERSION_CPP}
COMMAND echo " }" >> ${BUILD_VERSION_CPP}
COMMAND echo "}" >> ${BUILD_VERSION_CPP}

COMMAND ${CMAKE_COMMAND} -E make_directory "$<SHELL_PATH:${CMAKE_BINARY_DIR}/generated/app>"

COMMAND ${CMAKE_COMMAND} -E echo "// Auto-generated file" > "${BUILD_VERSION_CPP}"
COMMAND ${CMAKE_COMMAND} -E echo "#include <string>" >> "${BUILD_VERSION_CPP}"
COMMAND ${CMAKE_COMMAND} -E echo "" >> "${BUILD_VERSION_CPP}"
COMMAND ${CMAKE_COMMAND} -E echo "namespace lean {" >> "${BUILD_VERSION_CPP}"
COMMAND ${CMAKE_COMMAND} -E echo " const std::string &buildVersion() {" >> "${BUILD_VERSION_CPP}"
COMMAND ${CMAKE_COMMAND} -E env sh -c "printf '%s' ' static const std::string buildVersion(\"' >> \"${BUILD_VERSION_CPP}\""

COMMAND ${CMAKE_COMMAND} -E env sh -c "\"${GET_VERSION_SCRIPT}\" >> \"${BUILD_VERSION_CPP}\""

COMMAND ${CMAKE_COMMAND} -E echo "\");" >> "${BUILD_VERSION_CPP}"
COMMAND ${CMAKE_COMMAND} -E echo " return buildVersion;" >> "${BUILD_VERSION_CPP}"
COMMAND ${CMAKE_COMMAND} -E echo " }" >> "${BUILD_VERSION_CPP}"
COMMAND ${CMAKE_COMMAND} -E echo "} // namespace lean" >> "${BUILD_VERSION_CPP}"

COMMENT "Generate build_version.cpp"
DEPENDS ${GET_VERSION_SCRIPT}
DEPENDS
"${GET_VERSION_SCRIPT}"
"${GIT_REF_FILE}"
VERBATIM
)
add_library(build_version
"${BUILD_VERSION_CPP}"
)

set(DEFAULT_LOGGING_YAML_CPP "${CMAKE_BINARY_DIR}/generated/app/default_logging_yaml.cpp")
file(READ "${CMAKE_SOURCE_DIR}/example/config.yaml" DEFAULT_LOGGING_YAML)
configure_file("${CMAKE_CURRENT_LIST_DIR}/default_logging_yaml.cpp.in" "${DEFAULT_LOGGING_YAML_CPP}")
set(DEFAULT_CONFIG_CPP "${CMAKE_BINARY_DIR}/generated/app/default_config.cpp")
set(DEFAULT_CONFIG_YAML "${CMAKE_SOURCE_DIR}/example/config.yaml")
add_custom_command(
OUTPUT "${DEFAULT_CONFIG_CPP}"

COMMAND ${CMAKE_COMMAND} -E make_directory "$<SHELL_PATH:${CMAKE_BINARY_DIR}/generated/app>"

COMMAND ${CMAKE_COMMAND} -E echo "// Auto-generated file" > "${DEFAULT_CONFIG_CPP}"
COMMAND ${CMAKE_COMMAND} -E echo "#include \"app/default_config.hpp\"" >> "${DEFAULT_CONFIG_CPP}"
COMMAND ${CMAKE_COMMAND} -E echo "" >> "${DEFAULT_CONFIG_CPP}"
COMMAND ${CMAKE_COMMAND} -E echo "namespace lean {" >> "${DEFAULT_CONFIG_CPP}"
COMMAND ${CMAKE_COMMAND} -E echo " const std::string &defaultConfigYaml() {" >> "${DEFAULT_CONFIG_CPP}"
COMMAND ${CMAKE_COMMAND} -E echo " static const std::string defaultConfigYaml = R\"yaml(" >> "${DEFAULT_CONFIG_CPP}"

COMMAND ${CMAKE_COMMAND} -E cat "${DEFAULT_CONFIG_YAML}" >> "${DEFAULT_CONFIG_CPP}"

COMMAND ${CMAKE_COMMAND} -E echo "" >> "${DEFAULT_CONFIG_CPP}"
COMMAND ${CMAKE_COMMAND} -E echo ")yaml\";" >> "${DEFAULT_CONFIG_CPP}"
COMMAND ${CMAKE_COMMAND} -E echo " return defaultConfigYaml;" >> "${DEFAULT_CONFIG_CPP}"
COMMAND ${CMAKE_COMMAND} -E echo " }" >> "${DEFAULT_CONFIG_CPP}"
COMMAND ${CMAKE_COMMAND} -E echo "} // namespace lean" >> "${DEFAULT_CONFIG_CPP}"

DEPENDS "${DEFAULT_CONFIG_YAML}"
COMMENT "Generate default_config.cpp"
VERBATIM
)

add_library(app_configuration SHARED
configuration.cpp
"${DEFAULT_LOGGING_YAML_CPP}"
"${DEFAULT_CONFIG_CPP}"
)
target_link_libraries(app_configuration
Boost::boost
Expand Down
61 changes: 40 additions & 21 deletions src/app/configurator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#include "app/build_version.hpp"
#include "app/configuration.hpp"
#include "app/default_logging_yaml.hpp"
#include "app/default_config.hpp"
#include "app/validator_keys_manifest.hpp"
#include "crypto/xmss/xmss_util.hpp"
#include "log/formatters/filepath.hpp"
Expand Down Expand Up @@ -161,9 +161,17 @@ namespace lean::app {
namespace po = boost::program_options;
namespace fs = std::filesystem;

// clang-format off

po::options_description options;
options.add_options()("help,h", "show help")("version,v", "show version")(
"config,c", po::value<std::string>(), "config-file path");
options.add_options()
("help,h", "show help")
("version,v", "show version")
("config,c", po::value<std::string>(), "config-file path")
("log,l", po::value<std::vector<std::string>>(), "Sets a custom logging filter")
;

// clang-format on

po::variables_map vm;

Expand Down Expand Up @@ -211,6 +219,10 @@ namespace lean::app {
}
}

if (vm.contains("log")) {
logger_cli_args_ = vm["log"].as<std::vector<std::string>>();
}

return false;
}

Expand All @@ -237,10 +249,10 @@ namespace lean::app {
outcome::result<YAML::Node> Configurator::getLoggingConfig() {
auto load_default = [&]() -> outcome::result<YAML::Node> {
try {
return YAML::Load(defaultLoggingYaml())["logging"];
return YAML::Load(defaultConfigYaml())["logging"];
} catch (const std::exception &e) {
file_errors_ << "E: Failed to load default logging config: " << e.what()
<< "\n";
file_errors_ << "E: Failed to load embedded default config: "
<< e.what() << "\n";
return Error::ConfigFileParseFailed;
}
};
Expand All @@ -254,6 +266,7 @@ namespace lean::app {
}
return load_default();
}

outcome::result<std::shared_ptr<Configuration>> Configurator::calculateConfig(
qtils::SharedRef<soralog::Logger> logger) {
logger_ = std::move(logger);
Expand Down Expand Up @@ -405,7 +418,8 @@ namespace lean::app {
auto value = validator_keys_manifest.as<std::string>();
config_->validator_keys_manifest_path_ = value;
} else {
file_errors_ << "E: Value 'general.validator-keys-manifest' must be scalar\n";
file_errors_ << "E: Value 'general.validator-keys-manifest' must "
"be scalar\n";
file_has_error_ = true;
}
}
Expand Down Expand Up @@ -504,10 +518,11 @@ namespace lean::app {
cli_values_map_, "xmss-sk", [&](const std::string &value) {
config_->xmss_secret_key_path_ = value;
});
find_argument<std::string>(
cli_values_map_, "validator-keys-manifest", [&](const std::string &value) {
config_->validator_keys_manifest_path_ = value;
});
find_argument<std::string>(cli_values_map_,
"validator-keys-manifest",
[&](const std::string &value) {
config_->validator_keys_manifest_path_ = value;
});
if (fail) {
return Error::CliArgsParseFailed;
}
Expand Down Expand Up @@ -610,11 +625,13 @@ namespace lean::app {

// Validate and load XMSS keys (mandatory)
if (config_->xmss_public_key_path_.empty()) {
SL_ERROR(logger_, "The '--xmss-pk' (XMSS public key) path must be provided");
SL_ERROR(logger_,
"The '--xmss-pk' (XMSS public key) path must be provided");
return Error::InvalidValue;
}
if (config_->xmss_secret_key_path_.empty()) {
SL_ERROR(logger_, "The '--xmss-sk' (XMSS secret key) path must be provided");
SL_ERROR(logger_,
"The '--xmss-sk' (XMSS secret key) path must be provided");
return Error::InvalidValue;
}

Expand All @@ -637,26 +654,28 @@ namespace lean::app {
}

// Load XMSS keypair from JSON files
OUTCOME_TRY(keypair, crypto::xmss::loadKeypairFromJson(
config_->xmss_secret_key_path_,
config_->xmss_public_key_path_
));
OUTCOME_TRY(
keypair,
crypto::xmss::loadKeypairFromJson(config_->xmss_secret_key_path_,
config_->xmss_public_key_path_));
config_->xmss_keypair_ = std::move(keypair);
SL_INFO(logger_, "Loaded XMSS keypair from:");
SL_INFO(logger_, " Public key: {}", config_->xmss_public_key_path_);
SL_INFO(logger_, " Secret key: {}", config_->xmss_secret_key_path_);

// Load validator keys manifest (mandatory)
if (config_->validator_keys_manifest_path_.empty()) {
SL_ERROR(logger_, "The '--validator-keys-manifest' path must be provided");
SL_ERROR(logger_,
"The '--validator-keys-manifest' path must be provided");
return Error::InvalidValue;
}

config_->validator_keys_manifest_path_ =
resolve_relative(config_->validator_keys_manifest_path_, "validator-keys-manifest");
config_->validator_keys_manifest_path_ = resolve_relative(
config_->validator_keys_manifest_path_, "validator-keys-manifest");
if (not is_regular_file(config_->validator_keys_manifest_path_)) {
SL_ERROR(logger_,
"The 'validator-keys-manifest' file does not exist or is not a file: {}",
"The 'validator-keys-manifest' file does not exist or is not a "
"file: {}",
config_->validator_keys_manifest_path_);
return Error::InvalidValue;
}
Expand Down
4 changes: 4 additions & 0 deletions src/app/configurator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ namespace lean::app {
outcome::result<bool> step2();

outcome::result<YAML::Node> getLoggingConfig();
std::vector<std::string> getLoggingCliArgs() {
return logger_cli_args_;
}

outcome::result<std::shared_ptr<Configuration>> calculateConfig(
qtils::SharedRef<soralog::Logger> logger);
Expand All @@ -70,6 +73,7 @@ namespace lean::app {
bool file_has_warn_ = false;
bool file_has_error_ = false;
std::ostringstream file_errors_;
std::vector<std::string> logger_cli_args_;

boost::program_options::options_description cli_options_;
boost::program_options::variables_map cli_values_map_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace lean {
/**
* YAML to read default logging config.
* YAML to read default config.
*/
const std::string &defaultLoggingYaml();
const std::string &defaultConfigYaml();
} // namespace lean
16 changes: 0 additions & 16 deletions src/app/default_logging_yaml.cpp.in

This file was deleted.

5 changes: 0 additions & 5 deletions src/app/impl/chain_spec_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,6 @@ namespace lean::app {
auto multiaddr = entry.enr.connectAddress();

bootnode_infos.emplace_back(std::move(multiaddr), std::move(peer_id));
SL_INFO(log_,
"Added boot node: {} -> peer={}, address={}",
entry.raw,
bootnode_infos.back().peer_id,
bootnode_infos.back().address.getStringAddress());
} catch (const std::exception &e) {
SL_WARN(log_,
"Failed to extract peer info from ENR '{}': {}",
Expand Down
Loading
Loading