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: stmgr: speed up calculation of genesis circ supply #10553

Merged
merged 2 commits into from
Mar 23, 2023

Conversation

arajasek
Copy link
Contributor

Related Issues

@jennijuju's goroutines reported that when trying to send many messages (or just create a lot of FVMs), this lock becomes contended for.

Proposed Changes

  • Drop the check on genesisMarketFunds, which is zero on mainnet (confirmed)
  • Only take the lock over the genesis multisigs when actually calculating vesting schedules, which should happen once, but was happening every time because genesisMarketFunds was equal to 0

Additional Info

Checklist

Before you mark the PR ready for review, please make sure that:

  • Commits have a clear commit message.
  • PR title is in the form of of <PR type>: <area>: <change being made>
    • example: fix: mempool: Introduce a cache for valid signatures
    • PR type: fix, feat, build, chore, ci, docs, perf, refactor, revert, style, test
    • area, e.g. api, chain, state, market, mempool, multisig, networking, paych, proving, sealing, wallet, deps
  • New features have usage guidelines and / or documentation updates in
  • Tests exist for new functionality or change in behavior
  • CI is green

@arajasek arajasek requested a review from a team as a code owner March 23, 2023 20:04
err := sm.setupGenesisVestingSchedule(ctx)
if err != nil {
return vf, xerrors.Errorf("failed to setup pre-ignition vesting schedule: %w", err)
}
sm.genesisMsigLk.Unlock()
Copy link
Contributor

@shrenujbansal shrenujbansal Mar 23, 2023

Choose a reason for hiding this comment

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

Each of these unlocks don't happen if we err out on the line above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Quite right, I'll move it up above the err return.

@arajasek arajasek force-pushed the asr/drop-genesis-marketfund branch from 2e78d84 to 4d60f6e Compare March 23, 2023 20:56
// TODO: combine all this?
if sm.preIgnitionVesting == nil || sm.genesisPledge.IsZero() || sm.genesisMarketFunds.IsZero() {
if sm.preIgnitionVesting == nil || sm.genesisPledge.IsZero() {
sm.genesisMsigLk.Lock()
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 it might make more sense to move this lock into each of the vesting functions as they are also owned by the state manager and we are trying to make this lock more granular

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I'm happy to do that. Note that we should only be calling each of these methods once, but I think that makes sense.

@arajasek arajasek force-pushed the asr/drop-genesis-marketfund branch from 4d60f6e to bc87017 Compare March 23, 2023 21:05
@arajasek arajasek merged commit 2cd3a05 into master Mar 23, 2023
@arajasek arajasek deleted the asr/drop-genesis-marketfund branch March 23, 2023 21:34
arajasek added a commit that referenced this pull request Mar 29, 2023
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.

2 participants