-
Notifications
You must be signed in to change notification settings - Fork 2
feat: make pools history endpoint #121
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
Closed
Closed
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
de67837
refactor: add fees to epoch_active_counter state to track fees from b…
golddydev 09ea431
feat: add EpochState for pools history data in SPO state.
golddydev 9d45285
refactor: enhance SPOState to manage vrf vkey hash epoch data
golddydev d886444
Merge branch 'main' into golddydev/prepare-state-for-pools-history
golddydev 5068acf
refactor: optimize stake calculation in generate_spdd function
golddydev 3b20eff
fix: format issue
golddydev b0ad202
feat: add SPO reward state management
golddydev d010b1c
refactor: remove logging from SPO stake distribution and epoch activi…
golddydev c8ed01d
feat: implement pool epoch history endpoint
golddydev 4e7fdb7
refactor: remove reward state wronly implemented in account state
golddydev 2bc48f5
chore: streamline SPDD generation in handle_spdd function
golddydev a79ebf4
Merge branch 'main' into golddydev/prepare-state-for-pools-history
golddydev 9843b89
refactor: add delegators count to DelegatedState in SPDD message and …
golddydev 6532ab0
refactor: add vrf_key_hashes mapping to BlockState
golddydev c862de1
feat: calculate and store active size in epoch state
golddydev 22f6f69
feat: add PoolEpochStateRest struct and update pool history handling
golddydev d2c487c
chore: remove logs
golddydev 39f0f8d
feat: add SPO rewards publisher and handler
golddydev 751d6bb
fix: update documentation for SPO rewards publisher
golddydev bc74093
docs: update handle_spo_rewards documentation
golddydev 74b50e5
feat: enhance pool history handling with latest epoch filtering
golddydev 29cb3fd
refactor: rename variables for clarity in accounts state and SPO rewa…
golddydev b575ec3
chore: update spors to spo_rewards
golddydev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
use acropolis_common::messages::{CardanoMessage, Message, SPORewardsMessage}; | ||
use acropolis_common::{BlockInfo, KeyHash, SPORewards}; | ||
use caryatid_sdk::Context; | ||
use std::sync::Arc; | ||
|
||
/// Message publisher for Stake Pool Delegation Distribution (SPDD) | ||
pub struct SPORewardsPublisher { | ||
/// Module context | ||
context: Arc<Context<Message>>, | ||
|
||
/// Topic to publish on | ||
topic: String, | ||
} | ||
|
||
impl SPORewardsPublisher { | ||
/// Construct with context and topic to publish on | ||
pub fn new(context: Arc<Context<Message>>, topic: String) -> Self { | ||
Self { context, topic } | ||
} | ||
|
||
/// Publish the SPO rewards | ||
pub async fn publish_spo_rewards( | ||
&mut self, | ||
block: &BlockInfo, | ||
spo_rewards: Vec<(KeyHash, SPORewards)>, | ||
) -> anyhow::Result<()> { | ||
self.context | ||
.message_bus | ||
.publish( | ||
&self.topic, | ||
Arc::new(Message::Cardano(( | ||
block.clone(), | ||
CardanoMessage::SPORewards(SPORewardsMessage { | ||
epoch: block.epoch - 1, // End of previous epoch | ||
spos: spo_rewards.into_iter().collect(), | ||
}), | ||
))), | ||
) | ||
.await | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
active_size
could be computed in the REST handler iftotal_active_stake
was stored by epoch.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.
Well, that is why I used
RationalNumber
, decimal is only calculated on demand (rest handler)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.
The current design is storing
total_active_stake
for eachPoolEpochState
as the denominator when thisRationalNumber
could be constructed in the REST handler.