-
Notifications
You must be signed in to change notification settings - Fork 2
refactor: add rollback support to epoch activity counter #142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…ory. - Refactored state management to include for tracking epoch activities. - Introduced for publishing epoch activity messages. - Added to manage historical epoch data. - Updated REST handlers to support new state management structure. - Improved handling of block information and epoch transitions.
…vity_couter module - Introduced query to retrieve total blocks minted for specified VRF key hashes. - Updated to include response type. - Enhanced state management to support retrieval of total blocks minted by pools. - Refactored REST handlers to utilize the new total blocks minted query, improving data aggregation for pool statistics.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the BlockfrostREST now covers this through the query, this might be a good time to kill this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I"ll remove rest.rs and move to blockfrost module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
827462f
This is fixed
|
||
// History of epochs (disabled by default) | ||
epoch_history: Option<BTreeMap<u64, EpochActivityMessage>>, | ||
// Total blocks minted till epoch N |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment: ... for each SPO
Also is it the start of epoch N or the end?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- or actually, reading the code, the current state in this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, that is actually till current block number.
So total_blocks_minted is updated for every block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me update the comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated comment
@@ -173,12 +172,8 @@ impl SPOState { | |||
{ | |||
let span = | |||
info_span!("spo_state.handle_epoch_activity", block = block_info.number); | |||
async { | |||
span.in_scope(|| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting - if this is a direct replacement, this needs sharing!
…ounter module - Implemented new REST handlers for fetching the latest epoch and specific epoch information. - Removed obsolete REST handling code to streamline the module.
📋 Overview
This PR introduces improvements to the Epoch Activity Counter module, focusing on enhanced state management, rollback support, historical data storage capabilities.
🔧 Key Changes
1. Enhanced State Management with Rollback Support
StateHistory<State>
to handle blockchain rollbacks gracefully2. Historical Data Storage System
store-history
configuration option to enable/disable historical data storageDashMap
for thread-safe concurrent access to historical data3. Improved Query System
GetTotalBlocksMintedByPools
query to retrieve cumulative block minting datapools.rs
toepochs.rs
for better organization4. Architecture Improvements
epoch_activity_publisher.rs
: Dedicated message publishingepochs_history.rs
: Historical data managementstore_config.rs
: Configuration handling5. Dependency Updates
tracing-subscriber
dependabot alert.dashmap
for concurrent hash map operations🧪 Testing