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

fix: null rounds: pass correct timestamp to the FVM. #10189

Merged
merged 5 commits into from
Feb 10, 2023

Conversation

raulk
Copy link
Member

@raulk raulk commented Feb 6, 2023

Related Issues

Fixes filecoin-project/ref-fvm#1632.

Proposed Changes

This PR calculates the correct timestamp for a null round and passes it to the FVM.

I had two choices here:

  1. Calculate from genesis, or
  2. Calculate from the parent tipset.

I chose the former because I consider it safer/simpler. it requires exactly two store lookups (one to the metadata store, one to the chain blockstore).

The latter should be OK as well, and may possibly require no disk lookups at all, since the parent tipset is likely to be the heaviest tipset, but it's harder to reason about and the GetTipsetByHeight interface is a bit messy.

Happy to switch if over if folks prefer (2).

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

@raulk raulk force-pushed the raulk/timestamp-null-rounds branch from e95b3c5 to 4810bbc Compare February 6, 2023 13:16
@jennijuju jennijuju modified the milestone: Network v18 Feb 6, 2023
@raulk raulk force-pushed the raulk/timestamp-null-rounds branch from 4810bbc to 0cf3a5e Compare February 6, 2023 16:59
@raulk raulk requested a review from Stebalien February 6, 2023 16:59
@raulk raulk marked this pull request as ready for review February 6, 2023 16:59
@raulk raulk requested a review from a team as a code owner February 6, 2023 16:59
Copy link
Contributor

@magik6k magik6k left a comment

Choose a reason for hiding this comment

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

So I think this doesn't have consensus impact, and if it does we'll pick that up running on mainnet pretty quick.

Tests seem validly angry, may need to change to getting timestamp from parent tipset

Failed
=== RUN   TestConformance/reward/reward--ok-miners-awarded-no-premiums--tape.json/tape
    runner.go:200: failed to apply tipset 0: failed to get genesis when backfilling null rounds: datastore: key not found
        --- FAIL: TestConformance/reward/reward--ok-miners-awarded-no-premiums--tape.json/tape (0.00s)

@magik6k
Copy link
Contributor

magik6k commented Feb 7, 2023

(rebase should fix test-itest-fevm fails)

@raulk
Copy link
Member Author

raulk commented Feb 7, 2023

That test vector is generated here. That's a synthetic test vector that advances the chain artificially by adding null rounds, to then verify that the correct reward was dispensed.

Before, processing a null round didn't require accessing chain data; now it does. This would still be a problem even if we accessed just the parent, because that suite does not produce any chain data. (Similarly those suites wouldn't work with lookbacks).

@raulk
Copy link
Member Author

raulk commented Feb 7, 2023

I'm afraid the only solution I can think of is to skip that test vector :-/

@raulk
Copy link
Member Author

raulk commented Feb 7, 2023

So I think this doesn't have consensus impact, and if it does we'll pick that up running on mainnet pretty quick.

How often do we have null rounds on mainnet? We'll definitely pick up regressions on non-null rounds quickly, but not sure about the former.

@Kubuxu
Copy link
Contributor

Kubuxu commented Feb 7, 2023

Around 0.6% of epochs are expected to be null rounds.

@arajasek
Copy link
Contributor

arajasek commented Feb 7, 2023

I'm afraid the only solution I can think of is to skip that test vector :-/

Yeah, I think skipping that test vector is fine.

How often do we have null rounds on mainnet? We'll definitely pick up regressions on non-null rounds quickly, but not sure about the former.

Null rounds are pretty common on mainnet, but @magik6k is right that this has no consensus impact today. Definitely no impact today (timestamps aren't provided to the VM in nv17 and earlier), and cron doesn't currently use the timestamp.

We no longer need it because specs-actors is deprecated.
v7 vectors have been merged to master.
@raulk raulk requested a review from magik6k February 9, 2023 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants