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

Automatic rewards upgrade tx #238

Merged
merged 5 commits into from
May 2, 2023
Merged

Automatic rewards upgrade tx #238

merged 5 commits into from
May 2, 2023

Conversation

joshuahannan
Copy link
Member

@joshuahannan joshuahannan commented Apr 24, 2023

Adds the plan for the transaction to upgrade the FlowEpoch contract and enable automatic rewards.

Also updates the reset epoch transaction to not include the rewards arguments

@joshuahannan joshuahannan changed the title first draft of automatic rewards upgrade tx Automatic rewards upgrade tx Apr 24, 2023

## Sequence of signing:

1. DapperLabs generates the Signature Request ID on the [site]() for the `upgrade_and_enable_rewards.cdc` transaction with the given args.
Copy link
Collaborator

Choose a reason for hiding this comment

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

For contract upgrades, the generated URL contains the encoded contract text which is very long, and the browser throws a "URL too long" error.
Hence, for such upgrades, I copy past the args manually instead of generating a prepopulated URL link.
Will do the same this Wednesday.

@@ -0,0 +1,38 @@
# Update FlowIDTableStaking Contract
Copy link
Member

Choose a reason for hiding this comment

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

Could we document where the bonusTokenAmount argument value came from?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, I added that to the README

Copy link
Collaborator

@bjartek bjartek left a comment

Choose a reason for hiding this comment

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

I have not dug deep into this, but how does automatic payouts work here. I see the code in FlowFees but I do not see the bigger pictuer on how this will pay out without having to run a transaction.


// Set the new payout in the staking contract and proposed Epoch Metadata
self.borrowStakingAdmin().setEpochTokenPayout(proposedPayout)
let proposedMetadata = self.getEpochMetadata(self.proposedEpochCounter())
Copy link
Collaborator

Choose a reason for hiding this comment

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

could this not be done way sooner to avoid doing lots of computation if it fails?

Copy link
Member Author

Choose a reason for hiding this comment

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

Can you elaborate? I'm not sure what you want to be done sooner here

Copy link
Collaborator

Choose a reason for hiding this comment

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

Line 517 panics if it cannot borrow

@joshuahannan
Copy link
Member Author

@bjartek The FlowEpoch.Heartbeat resource has the advanceBlock() method that is called every block by the system chunk. It acts as a state machine and when a certain view has passed, the epoch advances to a new stage.

https://github.com/onflow/flow-core-contracts/blob/master/contracts/epochs/FlowEpoch.cdc#L346-L379

Line 360 is were rewards are paid automatically

@bjartek
Copy link
Collaborator

bjartek commented May 2, 2023

@bjartek The FlowEpoch.Heartbeat resource has the advanceBlock() method that is called every block by the system chunk. It acts as a state machine and when a certain view has passed, the epoch advances to a new stage.

https://github.com/onflow/flow-core-contracts/blob/master/contracts/epochs/FlowEpoch.cdc#L346-L379

Line 360 is were rewards are paid automatically

Ok. Will this advanceBlock() block for a long while when processing this payout or is it up?

The reason i ask is that i have seen very different seal times for blocks where the payout tx is beeing called.

@joshuahannan
Copy link
Member Author

joshuahannan commented May 2, 2023

advanceBlock() may be a little slow at first (similar to what the payout transactions are like now) when the payout happens, but we have a few improvements coming in the future that should help a lot with performance like delegator staking minimums and splitting the rewards payout into batches.

@vishalchangrani vishalchangrani merged commit e40b750 into main May 2, 2023
KshitijChaudhary666 added a commit to onflow/flips that referenced this pull request Jun 6, 2023
KshitijChaudhary666 added a commit to onflow/flips that referenced this pull request Jun 6, 2023
dsainati1 pushed a commit to onflow/flips that referenced this pull request Jul 11, 2023
@joshuahannan joshuahannan deleted the may-3-rewards-upgrade branch October 28, 2024 16:36
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.

5 participants