This commit updates the explorer web app to run on a Gunicorn-based WSGI server for testnet and mainnet rather than the built-in dev server. In doing so, it provides for improved scalability, reliability, integration with Nginx, and flexible run configuration.
We’ve introduced a dedicated configuration file (gunicorn_config.py) allowing control over the number of worker processes and threads. By adjusting these values, we can handle more simultaneous requests, fine-tune performance based on CPU resources, and tweak other operational parameters to suit deployment needs.
Update Summary:
- Added gunicorn_config.py to configure bind address, workers, threads, pidfile, and logs
- Updated the testnet and mainnet ports to run on 8000 instead of the 5000 dev port
- Created wsgi.py to load and expose the Flask app via `create_app()`
- Updated requirements.txt to include Gunicorn dependency
- Modified makefile start-% target to start with Gunicorn for testnet/mainnet instead of the development server
- Adjusted stop task to stop Gunicorn server when stopping the explorer
- We updated the requirements.txt install to run quietly
- Updated Makefile to export LOG_HOME so it can be accessed by gunicorn_config.py
This update introduces code to ensure blocks with PoW rewards containing coins already applied to the contract state prior to a reorg are synced. Additionally, it brings awareness to the need for rolling back the contract state to a specific height during reorgs.
This fix adjusts the range query in `reset_to_height` to start from `reset_height + 1`, ensuring transactions from `reset_height` are excluded when deleting reset block transactions.
Summary of changes:
- Updated the `get_by_range` query to exclude `reset_height` transactions
- Enhanced debug statements to validate transaction deletions and associated block heights during reorgs
This commit adds support for the `$(VERBOSE)` variable in the `start-%` targets, allowing changing verbosity levels when starting the explorer node environment. The help message has also been updated to include more details.
This commit enhances subscription initialization to handle scenarios where the explorer database is out of sync with darkfid.
Summary of changes:
- Added "Blockchain not fully synced" error check during block subscription initialization
- Implemented a retry mechanism to resync blocks and reattempt the subscription process
This commit modifies the `wait_for_darkfid_startup` target in the Makefile to search for a later log message during darkfid startup. Results from testnet testing revealed that additional synchronization occurs before darkfid starts, necessitating a longer wait time is needed before starting explorerd.
This commit updates the `calculate_tx_gas_data` function to apply state changes during contract execution, enabling contract data availability for subsequent contract calls during block sync. Additionally, `put_block` was modified to apply PoW reward transactions to the WASM runtime, ensuring their effects are visible to transaction runtimes used for fee calculations where applicable.
Minor cleanup was performed.