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

add init tip distribution account functionality in between epochs #66

Merged
merged 2 commits into from
Jul 14, 2022

Conversation

segfaultdoc
Copy link
Contributor

Problem

We want initialize a validator's TipDistributionAccount (TDA) in between epochs.

Summary of Changes

Upon startup a validator initializes the TipManager object, which in turn creates an in memory TDA. There is no tx propagated to the network initializing it with the program until the validator is leader. Each slot the validator is a leader for, it'll check to see if it should init the TDA on-chain.

The logic is as follows:

  1. Receive packets in bundle_stage
  2. Check to see if need to init a TDA. Need to init if the epoch has changed OR the currently set TDA does not exist in the bank. The latter would imply an init-tda tx was never propagated or accepted by the network.
  3. If need to init submit as a bundle top of block along with a maybe_init_config tx (existing code).
  4. Check to see if the on-chain tip_receiver == my_tda, if not then submit a tx to the network as TOB or 2nd of Block to change tip-receiver to the validator's current epoch TDA

@segfaultdoc segfaultdoc force-pushed the seg/tda-init branch 2 times, most recently from 04e08f8 to cc5fe2e Compare July 6, 2022 19:20
Copy link
Contributor

@whistlinwilly whistlinwilly left a comment

Choose a reason for hiding this comment

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

sorry for delay ser

Copy link
Contributor

@buffalu buffalu left a comment

Choose a reason for hiding this comment

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

initial review. main points:

  • i don't think we need tip manager to be locked?
  • do we need to store mutable state in tip_manager? i think we can get away without it.
  • nits

@segfaultdoc segfaultdoc force-pushed the seg/tda-init branch 15 times, most recently from fece3d6 to 5b20f7a Compare July 8, 2022 20:31
@segfaultdoc segfaultdoc force-pushed the seg/tda-init branch 4 times, most recently from f8b7e53 to 1cbf062 Compare July 11, 2022 20:20
Copy link
Contributor

@buffalu buffalu left a comment

Choose a reason for hiding this comment

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

few smaller comments, most of it seems gucci mane

@segfaultdoc segfaultdoc requested a review from buffalu July 12, 2022 20:35
@segfaultdoc segfaultdoc force-pushed the seg/tda-init branch 2 times, most recently from 1eb3a17 to e9dbdde Compare July 13, 2022 00:56
@segfaultdoc segfaultdoc force-pushed the seg/tda-init branch 2 times, most recently from 7476b8c to 851aeed Compare July 13, 2022 17:02
@segfaultdoc segfaultdoc merged commit 6b9f256 into master Jul 14, 2022
@segfaultdoc segfaultdoc deleted the seg/tda-init branch July 14, 2022 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants