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: add method for finding oldest state and computing state #1038

Merged
merged 3 commits into from
Aug 24, 2022

Conversation

frrist
Copy link
Member

@frrist frrist commented Aug 18, 2022

What

This PR adds 4 new commands to the chain command.

find oldest

Finds the range of states lily has a complete state tree for:

$ lily chain find-oldest
Newest:
	StateRoot:	1830000
	Messages:	1830000
Oldest:
	StateRoot:	1828199
	Messages:	1828199

list states

Lists all states lily has and their completeness:

$ lily chain list-state --limit=1829989
+---------+-----------+----------+
|  HEIGHT | STATETREE | MESSAGES |
+---------+-----------+----------+
| 1830000 | true      | true     |
+---------+-----------+----------+
| 1829999 | true      | true     |
+---------+-----------+----------+
| 1829998 | true      | true     |
+---------+-----------+----------+
| 1829997 | true      | true     |
+---------+-----------+----------+
| 1829996 | true      | true     |
+---------+-----------+----------+
| 1829995 | true      | true     |
+---------+-----------+----------+
| 1829994 | true      | true     |
+---------+-----------+----------+
| 1829993 | true      | true     |
+---------+-----------+----------+
| 1829992 | true      | true     |
+---------+-----------+----------+
| 1829991 | true      | true     |
+---------+-----------+----------+
| 1829990 | true      | true     |
+---------+-----------+----------+
| 1829989 | true      | true     |
+---------+-----------+----------+

compute

compute the state of a tipset specified by epoch:

$ lily chain compute --epoch=1829776

compute range

computes a range of tipsets specified by epochs:

$ lily chain compute-range --to=1829981 --from=1829777

@frrist frrist requested a review from placer14 August 18, 2022 00:27
@frrist frrist self-assigned this Aug 18, 2022
@codecov-commenter
Copy link

codecov-commenter commented Aug 18, 2022

Codecov Report

Merging #1038 (c149d21) into master (2dac569) will not change coverage.
The diff coverage is n/a.

@@          Coverage Diff           @@
##           master   #1038   +/-   ##
======================================
  Coverage    34.4%   34.4%           
======================================
  Files          44      44           
  Lines        2925    2925           
======================================
  Hits         1008    1008           
  Misses       1821    1821           
  Partials       96      96           

@frrist frrist added this to the Lily v0.12.0 milestone Aug 18, 2022
HasReceipts: maybeFullTS.HasReceipts,
HasState: maybeFullTS.HasState,
})
if !maybeFullTS.HasState || int64(head.Height()-abi.ChainEpoch(i)) == limit {
Copy link
Member Author

Choose a reason for hiding this comment

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

So this is probably wrong due to null rounds

Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be sufficient to allow for some N number of null rounds before breaking? A value which skips null rounds and increments M until it's more than N and then break? Is there another way you would approach this?

@frrist frrist force-pushed the frrist/find-oldest-statetree branch from 781795a to 9d827a4 Compare August 23, 2022 23:58
@frrist frrist requested a review from kasteph August 24, 2022 18:40
Copy link
Contributor

@kasteph kasteph left a comment

Choose a reason for hiding this comment

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

looks good! if i could give feedback, would it be possible to have a json output option of find-oldest? prob not in scope of this pr.

frrist and others added 3 commits August 24, 2022 12:26
* chore: Refactor state list commands into one; Output JSON

* chore: Add docs and prefixes

* chore: fmt the go

Co-authored-by: Mike Greenberg <[email protected]>
@frrist frrist force-pushed the frrist/find-oldest-statetree branch from c149d21 to ad7e623 Compare August 24, 2022 19:26
@frrist frrist merged commit 593dad6 into master Aug 24, 2022
@frrist frrist deleted the frrist/find-oldest-statetree branch August 24, 2022 20:17
@placer14
Copy link
Contributor

placer14 commented Aug 25, 2022

@kasteph this PR exports the output in JSON:

ubuntu@ip-172-31-20-4:~/lily$ ./lily chain state-inspect --limit 1 --verbose | jq
2022-08-25T02:25:53.280Z        WARN    cliutil util/apiinfo.go:81      API Token not set and requested, capabilities might be limited.
{
  "summary": {
    "messages": {
      "newest": 1962369,
      "oldest": 1962369
    },
    "stateroots": {
      "newest": 1962369,
      "oldest": 1962369
    }
  },
  "details": {
    "1962369": {
      "messages": true,
      "receipts": true,
      "stateroot": true
    }
  }
}

(If you want to find oldest state, run with --limit 10000000000 and it should return the oldest state in the JSON summary.)

@kasteph
Copy link
Contributor

kasteph commented Sep 1, 2022

@placer14 thanks! I probably missed the --verbose flag (or based on the timeline accdg to GitHub, it was added after my review 😅 ).

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.

Add API method to report oldest tipset lily is capable of processing
4 participants