Skip to content

Use State structure for tests #85

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

Open
wants to merge 99 commits into
base: main
Choose a base branch
from

Conversation

nikeshnazareth
Copy link
Collaborator

Closes #80.

I wanted to try Leo's suggestion for a state-driven approach. It seems to be much more flexible and easier to reason about. I'm in the middle of migrating the existing tests to this structure, but I ran out of time. I will continue updating it this week but I thought it would be useful to publish the current version in case you have any feedback. Note:

  • this is based off PR 49 but I do not think this PR should be a blocker for merging that one.
  • I know we have not decided to use this structure. I'm just experimenting with it.

ggonzalez94 and others added 30 commits February 24, 2025 09:17
nikeshnazareth and others added 29 commits March 24, 2025 11:30
We had CheckpointUpdated during the constructor and TransitionProven
on every update. We only need one. I think the CheckpointUpdated event
is better in this case because the start checkpoint is always the
previous proven checkpoint. TransitionProven was relevant when we had
arbitrary transitions
We already have a finalizeClosedPeriod function that does something else.
I think we should reserve "finalize" for when there is nothing left
to do in the period, including processing publications and paying stake
This enforces that the deadline is never before the period end.
I think it also makes the cases where provingWindow = 0 more semantically
meaningful.
We no longer process the publication hash directly
This enforces the end is never in the past. I think it also makes the
usage semantically clearer.
Reserve "closed period" for periods that have an end timestamp.
This makes it clear that _closePeriod and finalizePastPeriod are
referring to different conditions
It seems more natural distribute a fraction of the stake when finalising
rather than reduce the saved stake during a proof.
This seems a lot cleaner, with one oddity: the new period only takes
effect in the next block.
We create a new period in the constructor, and I originally thought that
implied we do not need to prove publications in period 0. However, the
_claimProvingVacancy call implies any publication created in the deployment
block is assigned to period 0. Moreover, under all versions in this PR,
any publication that occured before deployment is assigned to period 0.
I now think we should account for this because the ProverManager might be
deployed on a shared publication feed that pre-exists the CheckpointTracker.
I also don't think we should rely on the CheckpointTracker being able to
prove things before the prover manager is assigned, since this puts a
specific constraint on the deployment mechanism.
Base automatically changed from ahead-of-time-prover to main March 26, 2025 13:13
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.

3 participants