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

defer delegatee rewards until end of validator staking period #1262

Merged
merged 25 commits into from
Apr 3, 2023

Conversation

dhrubabasu
Copy link
Contributor

@dhrubabasu dhrubabasu commented Mar 28, 2023

Why this should be merged

Delegatee rewards are often dust amounts which pollute the P-Chain state unnecessarily and make it hard for the validator to spend (case in point: https://explorer-xp.avax.network/tx/3x5sF5zXBto8CHMDR9mFXt5NegymfFpmUxdNTs9TKpPC8TR6a). This PR modifies the delegatee logic so that we consolidate all the delegatee rewards into a single reward utxo distributed at the end of the validator staking period.

How this works

In Cortina, we only provide the validator their delegatee rewards at the end of their validation period. It is awarded in a separate UTXO (first reward utxo is the validation reward, second reward utxo is the total accrued delegatee rewards).

How this was tested

  • CI
  • Taking a synced Fuji db and running with the new code (should work as expected and be able to handle the DB format conversion)
  • Run a local network testing the upgrade flow (adding validators + delegators) making sure both the non-grandfathered and grandfathered cases work
  • Re-sync mainnet

@dhrubabasu dhrubabasu self-assigned this Mar 28, 2023
@patrick-ogrady patrick-ogrady added this to the v1.10.0 (Cortina) milestone Mar 29, 2023
@patrick-ogrady patrick-ogrady added the vm This involves virtual machines label Mar 29, 2023
vms/platformvm/state/state.go Outdated Show resolved Hide resolved
vms/platformvm/state/validator_metadata.go Outdated Show resolved Hide resolved
vms/platformvm/state/validator_metadata.go Outdated Show resolved Hide resolved
vms/platformvm/state/state.go Outdated Show resolved Hide resolved
vms/platformvm/txs/executor/proposal_tx_executor.go Outdated Show resolved Hide resolved
@dhrubabasu dhrubabasu changed the base branch from dev to delegatee-reward-tracking-support March 31, 2023 13:15
Copy link
Contributor

@StephenButtolph StephenButtolph left a comment

Choose a reason for hiding this comment

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

LGTM pending verification with the manual tests.

@@ -25,7 +25,7 @@ import (
// for the primary network
func TestAdvanceTimeTxUpdatePrimaryNetworkStakers(t *testing.T) {
require := require.New(t)
env := newEnvironment( /*postBanff*/ false)
env := newEnvironment(false /*=postBanff*/, false /*=postCortina*/)
Copy link
Contributor

Choose a reason for hiding this comment

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

IIRC, we are going to change these tests to be postCortina one Cortina activates?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think a lot of these tests should be re-vamped. This test is still running pre-Banff...

Copy link
Contributor

@abi87 abi87 left a comment

Choose a reason for hiding this comment

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

just minor questions, lgtm

Base automatically changed from delegatee-reward-tracking-support to dev April 3, 2023 20:10
@StephenButtolph StephenButtolph merged commit 729883a into dev Apr 3, 2023
14 checks passed
@StephenButtolph StephenButtolph deleted the batched-delegatee-rewards branch April 3, 2023 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vm This involves virtual machines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants