-
Notifications
You must be signed in to change notification settings - Fork 21
Description
Historical Steps Functionality
The historical steps functionality is implemented in the calc_hist function in consensus/poscan_grid2d/src/lib.rs: lib.rs:697-758
This function retrieves a configurable number of historical blocks based on a hash value and uses them to calculate a new hash. The number of historical steps is configured in the difficulty pallet: lib.rs:76
Problem
Cache is not specifically used in the mining loop while picking up the historical steps, which heavily involves SSD usage. SSD is way slower than RAM at performing the task.
Solution
The implementation focuses on caching the results of historical step calculations to improve performance. The current codebase already has a caching mechanism for block hashes, but it could be enhanced with a dedicated cache for historical steps. The suggested implementation builds on the existing architecture while adding specific optimizations for historical step calculations.
Explore deepWiki considerations: https://deepwiki.com/search/how-to-implement-cache-ram-for_2868e9b8-a8c5-41ea-92ad-30a450971352