Skip to content
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

distributions: add distributions events #5044

Merged
merged 7 commits into from
Feb 3, 2025

Conversation

TalDerei
Copy link
Collaborator

@TalDerei TalDerei commented Feb 2, 2025

Describe your changes

add LQT pool size increase event to the distributions component, emitted at the end of each block.

Issue ticket number and link

references #5041

Checklist before requesting a review

  • I have added guiding text to explain how a reviewer should test these changes.

  • If this code contains consensus-breaking changes, I have added the "consensus-breaking" label. Otherwise, I declare my belief that there are not consensus-breaking changes, for the following reason:

    LQT branch

@TalDerei TalDerei added the consensus-breaking breaking change to execution of on-chain data label Feb 2, 2025
@TalDerei TalDerei self-assigned this Feb 2, 2025
@TalDerei TalDerei marked this pull request as draft February 2, 2025 23:28
@TalDerei TalDerei changed the title distributions: events distributions: add distributions events Feb 2, 2025
@TalDerei TalDerei marked this pull request as ready for review February 2, 2025 23:55
@cronokirby
Copy link
Contributor

I think we should go ahead and add an event type for this, since we'll be writing an app view for the events here at some point. For emission, c.f.

event::EventValueCircuitBreakerCredit {
as an example

.get_cummulative_lqt_reward_issuance(current_epoch.index - 1)
.await
.ok_or_else(|| {
tonic::Status::not_found(format!(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not an RPC, so we shouldn't return an RPC error. In fact, we shouldn't return an error at all. We do not want to interrupt component logic. Just default to zero.

));

self.set_lqt_reward_issuance_for_epoch(current_epoch.index, new_issuance);
self.set_cumulative_lqt_reward_issuance(current_epoch.index, cumulative_issuance);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method only gets called at the end of every epoch, so something is wrong here right?

Copy link
Collaborator Author

@TalDerei TalDerei Feb 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well in the way I interpreted the event definition and it's associated fields (event emission every epoch), the logic is correct. I'll modify it to instead emit an event every block 👍

let cumulative_issuance = previous_issuance + new_issuance;

// Emit an event for LQT pool size increase.
self.record_proto(event::event_lqt_pool_size_increase(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should emit an event every block, but we don't need to do anything else, the goal for this event is to be a convenient tick for observability, that's all we need imo.

Copy link
Member

@erwanor erwanor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are a few bugs, we should just emit an event every block and populate it using the reward rule for the budget. No need for extra state keys or tracking

Copy link
Member

@erwanor erwanor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Member

@erwanor erwanor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great

@erwanor erwanor merged commit 9420356 into protocol/lqt_branch Feb 3, 2025
13 checks passed
@erwanor erwanor deleted the distrubutions-events branch February 3, 2025 11:37
conorsch pushed a commit that referenced this pull request Feb 4, 2025
## Describe your changes

add LQT pool size increase event to the distributions component, emitted
at the end of each block.

## Issue ticket number and link

references #5041

## Checklist before requesting a review

- [x] I have added guiding text to explain how a reviewer should test
these changes.

- [x] If this code contains consensus-breaking changes, I have added the
"consensus-breaking" label. Otherwise, I declare my belief that there
are not consensus-breaking changes, for the following reason:

  > LQT branch
conorsch pushed a commit that referenced this pull request Feb 5, 2025
## Describe your changes

add LQT pool size increase event to the distributions component, emitted
at the end of each block.

## Issue ticket number and link

references #5041

## Checklist before requesting a review

- [x] I have added guiding text to explain how a reviewer should test
these changes.

- [x] If this code contains consensus-breaking changes, I have added the
"consensus-breaking" label. Otherwise, I declare my belief that there
are not consensus-breaking changes, for the following reason:

  > LQT branch
conorsch pushed a commit that referenced this pull request Feb 5, 2025
## Describe your changes

add LQT pool size increase event to the distributions component, emitted
at the end of each block.

## Issue ticket number and link

references #5041

## Checklist before requesting a review

- [x] I have added guiding text to explain how a reviewer should test
these changes.

- [x] If this code contains consensus-breaking changes, I have added the
"consensus-breaking" label. Otherwise, I declare my belief that there
are not consensus-breaking changes, for the following reason:

  > LQT branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
consensus-breaking breaking change to execution of on-chain data
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants