This update adds a startup banner to explorerd that logs key details about the DarkFi Explorer Node when it starts successfully. The banner includes information such as the network, JSON-RPC endpoint, database path, configuration path, syncing details, and the connected DarkFi node, improving visibility and making debugging easier during startup. Additionally, longer log messages were shortened where possible to improve message length consistency.
Summary of Changes:
- Added the `log_started_banner` function to display the startup banner
- Updated the binary crate's main method to call `log_started_banner` after a successful startup
- Shortened some log messages to maintain a more consistent length where possible
This update introduces configuration support for multiple networks (localnet, testnet, and mainnet) in the explorer site, enabling tailored provisioning for development, testing, and production environments.
Summary of Updates:
- Added network-specific configurations in `site_config.toml` based on the latest `explorerd` configurations
- Set up `log_path` directories for each network
- Removed devnet placeholder configuration
This update adds configuration support for multiple networks (localnet, testnet, and mainnet) to the explorer daemon, enabling provisioning of tailored instances for development, testing, and production environments.
Summary of Updates:
- Added `--network` argument to the binary crate args for specifying networks (localnet, testnet, and mainnet)
- Implemented a `config` module for configuration management
- Introduced `ExplorerConfig` and `ExplorerNetworkConfig` structures to model and work with the complete configuration file programmatically in Rust
- Implemented `TryFrom` traits for configuration conversions
- Added tests for configuration loading and network selection logic, which also validate the `explorerd_config.toml` configuration file
- Updated the `explorer_config.toml` file to define initial configurations for localnet, testnet, and mainnet
- Renamed the configuration key `db_path` to `database` for consistency across the project
- Added toml dependency to Cargo.toml
- Removed unused drk dependency from Cargo.toml
- Added rpc to feature list for darkfi dependency
Improved logging capabilities for better visibility in the `localnet` environment and during application startup.
Summary of Updates:
- Added a function `add_console_handler_if_localnet` to enable console logging for all loggers when running on `localnet`
- Automatically create the log directory if it does not exist
- Log a banner with key startup details when the application successfully starts
This commit introduces error, application, and request logging to the explorer site. These changes establish a robust and unified logging system for monitoring and debugging the explorer across environments. Logs are stored in the directory specified in the site configuration TOML file under `log_path` (defaulting to the current directory if not specified).
Summary of Updates:
- Added `log` module that provides functionality to setup logging for the explorer Flask application
- Added support for specifying logging directories per environment through `log_path` in `site_config.toml`
- Implemented error logging handler to capture detailed error information in `error.log`
- Added application logging for general app-level logs such as debug and informational messages
- Integrated request logging by tying the Werkzeug logger to the same log file as the application logger
- Added `RotatingFileHandler` for mainnet logging
- Updated the 500 error handler to log detailed error information prior to rendering the `500.html` page
Added log statements to display the endpoint URLs when connecting to Darkfi nodes and starting the JSON-RPC server. These updates help confirm connections and debug any issues during deployment on different networks.
This update improves the configuration setup for the explorer site by replacing hardcoded values with a TOML-based configuration file, enabling easier configuration and deployment across different networks, such as devnet, testnet, and mainnet.
- Introduced a `load_toml_config` function to load environment-specific key-value pairs from a TOML configuration file into the Flask app's `app.config`
- Created an initial `site_config.toml` file to define default configurations for various environments (e.g., localnet, devnet, testnet, and mainnet). The configurations for devnet, testnet, and mainnet are still a work in progress and marked as TODOs.
- Updated the RPC module to connect to the explorerd using the values specified in the configuration file
- Added tomli to requirements.txt
This commit introduces timing code to measure the duration of block syncs and reorgs to improve observability of performance.
### Changes:
- Updated the log statement for each block being synced to include the sync time per block and changed it to debug level
- Enhanced logging to provide details about the number of blocks synced, the new explorer block count, and the total sync duration during the initial sync
- Added timers to track the duration of block sync and subscribe sync reorgs
- Added a timer to measure the total time taken to subscribe and sync each block
Changed logging for inserting contract source and metadata from `info` to `debug` to reduce verbosity. Added a high-level `info` log to indicate successful loading of native contract metadata.
Added a utility to format a `Duration` into a user-friendly format using days, hours, minutes, and seconds. Durations under one minute include fractional seconds with nanosecond precision (up to 9 decimal places), while longer durations use whole seconds, rounded to the nearest second. Includes unit tests to ensure correctness across various scenarios.
This commit adds a check to ensure that the genesis block is included when syncing blocks after a reorg resets the blockchain state to start block sync from block 0.
This commit relocates the explorer code from the research directory to `bin/explorer` to include it as part of future releases.
### Summary of Updates:
#### Darkfi Project
- Updated `Cargo.toml` to include `bin/explorer/explorerd` as a workspace member
- Updated `Cargo.lock` to include the `explorerd` package
- Updated the `Makefile` to include `explorerd` in the build process
#### Explorer Daemon
- Renamed the project directory from `blockchain-explorer` to `explorer`
- Moved the explorer daemon source code to `bin/explorer/explorerd`
- Updated the cargo package name to `explorerd`
- Updated log statement targets from `blockchain-explorer::` to `explorerd::`
- Renamed the explorer configuration file to `explorerd_config.toml`
- Removed Halo2 patches as they are now included in the root package
- Changed default db_path to use explorerd instead of blockchain-explorer in the path
- Changed binary crate Arg structopt name from blockchain-explorer to explorerd
#### Explorer Site
- Moved the explorer site source code to `bin/explorer/site`
- Updated README.md to include new build instructions for explorerd