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

feat: refactor vesting funds into a head and a tail #1636

Merged
merged 4 commits into from
Feb 28, 2025

Conversation

Stebalien
Copy link
Member

This lets us efficiently take fees from vesting funds without loading/storing this object each time. It also lets us check if there are funds to vest without having to load any additional state, because the "next" batch of vesting funds are always stored in the root state object.

If FIP-0100 passes, we'll likely want this change as we'll otherwise read/write the vesting funds queue on every deadline for every miner.

fixes #1594

@Stebalien
Copy link
Member Author

Built on #1635.

@Stebalien Stebalien force-pushed the steb/vesting-head branch 2 times, most recently from d4e6f8f to 8c53bc7 Compare February 21, 2025 05:14
@Stebalien
Copy link
Member Author

This is significantly more than just "fixing #1594" so it probably requires a FIP update to FIP-0100. But, IMO, we should strongly consider this because without it, we'll be re-writing the vesting queue every deadline. I guess that isn't terrible in the grand scheme of things but.... it's not great.

@Stebalien Stebalien force-pushed the steb/vesting-head branch 2 times, most recently from accd9fc to 9565521 Compare February 21, 2025 05:28
@Stebalien Stebalien force-pushed the steb/vesting-head branch 4 times, most recently from 242e68e to dfd6787 Compare February 24, 2025 21:37
@Stebalien
Copy link
Member Author

I think I've addressed all the feedback so far.

Stebalien added a commit to filecoin-project/go-state-types that referenced this pull request Feb 27, 2025

Verified

This commit was signed with the committer’s verified signature.
rvagg Rod Vagg
I've also changed the `LoadVestingFunds` to return a `[]VestingFund` so
we can abstract across the different underlying representations.

related to filecoin-project/builtin-actors#1636
Stebalien added a commit to filecoin-project/go-state-types that referenced this pull request Feb 27, 2025

Verified

This commit was signed with the committer’s verified signature.
rvagg Rod Vagg
I've also changed the `LoadVestingFunds` to return a `[]VestingFund` so
we can abstract across the different underlying representations.

related to filecoin-project/builtin-actors#1636
Stebalien added a commit to filecoin-project/go-state-types that referenced this pull request Feb 27, 2025

Verified

This commit was signed with the committer’s verified signature.
rvagg Rod Vagg
I've also changed the `LoadVestingFunds` to return a `[]VestingFund` so
we can abstract across the different underlying representations.

related to filecoin-project/builtin-actors#1636
@Stebalien
Copy link
Member Author

Re-do of filecoin-project/go-state-types#353, merging in the correct order.

Stebalien added a commit to filecoin-project/go-state-types that referenced this pull request Feb 27, 2025

Verified

This commit was signed with the committer’s verified signature.
rvagg Rod Vagg
I've also changed the `LoadVestingFunds` to return a `[]VestingFund` so
we can abstract across the different underlying representations.

related to filecoin-project/builtin-actors#1636
Stebalien added a commit to filecoin-project/go-state-types that referenced this pull request Feb 27, 2025

Verified

This commit was signed with the committer’s verified signature.
rvagg Rod Vagg
I've also changed the `LoadVestingFunds` to return a `[]VestingFund` so
we can abstract across the different underlying representations.

related to filecoin-project/builtin-actors#1636

Verified

This commit was signed with the committer’s verified signature.
rvagg Rod Vagg
1. In the test harness, check if we should vest every epoch. The queue
should already be quantized.
2. Correctly handle the fact that we vest at the _end_ of an epoch in
the cron vesting test.
@rvagg
Copy link
Member

rvagg commented Feb 27, 2025

I've done another pass and this lgtm but I'll wait to see it squashed and rebased on feat/fip-0100 before 👍

@rvagg rvagg changed the base branch from master to feat/fip-0100 February 27, 2025 05:58
@Stebalien Stebalien force-pushed the steb/vesting-head branch 2 times, most recently from e350902 to 5d619b6 Compare February 27, 2025 06:09

Verified

This commit was signed with the committer’s verified signature.
rvagg Rod Vagg
This lets us efficiently take fees from vesting funds without
loading/storing this object each time. It also lets us check if there
are funds to vest without having to load any additional state, because
the "next" batch of vesting funds are always stored in the root state object.

If FIP-0100 passes, we'll likely want this change as we'll otherwise
read/write the vesting funds queue on every deadline for every miner.

fixes #1594
@rvagg
Copy link
Member

rvagg commented Feb 27, 2025

All good, but:

  1. I think you've unnecessarily overcomplicated the bottom of advance_and_submit_posts()
  2. Comment at the top of add_locked_funds() still needs to be made accurate, and if you add a test that demonstrates precisely where vesting happens then that's a bonus

@Stebalien
Copy link
Member Author

I think you've unnecessarily overcomplicated the bottom of advance_and_submit_posts()

You're right. The real issue was that the test was using stale state (which I also fixed).

@Stebalien Stebalien requested a review from rvagg February 27, 2025 23:29
@Stebalien Stebalien merged commit a78d23f into feat/fip-0100 Feb 28, 2025
11 checks passed
@Stebalien Stebalien deleted the steb/vesting-head branch February 28, 2025 01:43
rvagg pushed a commit that referenced this pull request Mar 4, 2025
* test: correctly handle cron vesting in tests

1. In the test harness, check if we should vest every epoch. The queue
should already be quantized.
2. Correctly handle the fact that we vest at the _end_ of an epoch in
the cron vesting test.

* feat: refactor vesting funds into a head and a tail

This lets us efficiently take fees from vesting funds without
loading/storing this object each time. It also lets us check if there
are funds to vest without having to load any additional state, because
the "next" batch of vesting funds are always stored in the root state object.

If FIP-0100 passes, we'll likely want this change as we'll otherwise
read/write the vesting funds queue on every deadline for every miner.

fixes #1594

* doc: explain deadline alignment

* review: simplify test
rvagg pushed a commit to filecoin-project/go-state-types that referenced this pull request Mar 5, 2025
I've also changed the `LoadVestingFunds` to return a `[]VestingFund` so
we can abstract across the different underlying representations.

related to filecoin-project/builtin-actors#1636
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🎉 Done
Status: 🎉 Done
Development

Successfully merging this pull request may close these issues.

No vesting during cron
4 participants