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

[Merged by Bors] - Add support for beaconAPI in lcli functions #3252

Closed
wants to merge 16 commits into from

Conversation

paulhauner
Copy link
Member

@paulhauner paulhauner commented Jun 9, 2022

Issue Addressed

NA

Proposed Changes

Modifies lcli skip-slots and lcli transition-blocks allow them to source blocks/states from a beaconAPI and also gives them some more features to assist with benchmarking.

Additional Info

Breaks the current lcli skip-slots and lcli transition-blocks APIs by changing some flag names. It should be simple enough to figure out the changes via --help.

Currently blocked on #3263.

@paulhauner paulhauner added the work-in-progress PR is a work-in-progress label Jun 9, 2022
bors bot pushed a commit that referenced this pull request Jun 10, 2022
## Issue Addressed

NA

## Proposed Changes

- Uses a `Vec` in `SingleEpochParticipationCache` rather than `HashMap` to speed up processing times at the cost of memory usage.
- Cache the result of `integer_sqrt` rather than recomputing for each validator.
- Cache `state.previous_epoch` rather than recomputing it for each validator.

### Benchmarks

Benchmarks on a recent mainnet state using #3252 to get timing.

#### Without this PR

```
lcli skip-slots --state-path /tmp/state-0x3cdc.ssz --partial-state-advance --slots 32 --state-root 0x3cdc33cd02713d8d6cc33a6dbe2d3a5bf9af1d357de0d175a403496486ff845e --runs 10
[2022-06-09T08:21:02Z INFO  lcli::skip_slots] Using mainnet spec
[2022-06-09T08:21:02Z INFO  lcli::skip_slots] Advancing 32 slots
[2022-06-09T08:21:02Z INFO  lcli::skip_slots] Doing 10 runs
[2022-06-09T08:21:02Z INFO  lcli::skip_slots] State path: "/tmp/state-0x3cdc.ssz"
SSZ decoding /tmp/state-0x3cdc.ssz: 43ms
[2022-06-09T08:21:03Z INFO  lcli::skip_slots] Run 0: 245.718794ms
[2022-06-09T08:21:03Z INFO  lcli::skip_slots] Run 1: 245.364782ms
[2022-06-09T08:21:03Z INFO  lcli::skip_slots] Run 2: 255.866179ms
[2022-06-09T08:21:04Z INFO  lcli::skip_slots] Run 3: 243.838909ms
[2022-06-09T08:21:04Z INFO  lcli::skip_slots] Run 4: 250.431425ms
[2022-06-09T08:21:04Z INFO  lcli::skip_slots] Run 5: 248.68765ms
[2022-06-09T08:21:04Z INFO  lcli::skip_slots] Run 6: 262.051113ms
[2022-06-09T08:21:05Z INFO  lcli::skip_slots] Run 7: 264.293967ms
[2022-06-09T08:21:05Z INFO  lcli::skip_slots] Run 8: 293.202007ms
[2022-06-09T08:21:05Z INFO  lcli::skip_slots] Run 9: 264.552017ms
```

#### With this PR:

```
lcli skip-slots --state-path /tmp/state-0x3cdc.ssz --partial-state-advance --slots 32 --state-root 0x3cdc33cd02713d8d6cc33a6dbe2d3a5bf9af1d357de0d175a403496486ff845e --runs 10
[2022-06-09T08:57:59Z INFO  lcli::skip_slots] Run 0: 73.898678ms
[2022-06-09T08:57:59Z INFO  lcli::skip_slots] Run 1: 75.536978ms
[2022-06-09T08:57:59Z INFO  lcli::skip_slots] Run 2: 75.176104ms
[2022-06-09T08:57:59Z INFO  lcli::skip_slots] Run 3: 76.460828ms
[2022-06-09T08:57:59Z INFO  lcli::skip_slots] Run 4: 75.904195ms
[2022-06-09T08:58:00Z INFO  lcli::skip_slots] Run 5: 75.53077ms
[2022-06-09T08:58:00Z INFO  lcli::skip_slots] Run 6: 74.745572ms
[2022-06-09T08:58:00Z INFO  lcli::skip_slots] Run 7: 75.823489ms
[2022-06-09T08:58:00Z INFO  lcli::skip_slots] Run 8: 74.892055ms
[2022-06-09T08:58:00Z INFO  lcli::skip_slots] Run 9: 76.333569ms
```

## Additional Info

NA
@paulhauner paulhauner changed the title Add more features to lcli skip-slots Add support for beaconAPI in lcli functions Jun 12, 2022
@paulhauner paulhauner force-pushed the lcli-skip-slots-2 branch from f22cc0a to d06dadd Compare July 1, 2022 01:46
@paulhauner paulhauner added ready-for-review The code is ready for review and removed blocked work-in-progress PR is a work-in-progress labels Jul 1, 2022
@michaelsproul michaelsproul marked this pull request as ready for review July 4, 2022 00:49
@paulhauner paulhauner force-pushed the lcli-skip-slots-2 branch from 4aba5ac to 5314b21 Compare July 4, 2022 23:01
Copy link
Member

@realbigsean realbigsean left a comment

Choose a reason for hiding this comment

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

Mostly just some typos, these new commands look really useful!

lcli/src/main.rs Outdated
.help("Path to output a SSZ file."),
)
.arg(
Arg::with_name("state-path")
Copy link
Member

Choose a reason for hiding this comment

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

in the transition-blocks subcommand this is named pre-state-path so might be better to keep it consistent

lcli/src/skip_slots.rs Outdated Show resolved Hide resolved
lcli/src/skip_slots.rs Outdated Show resolved Hide resolved
lcli/src/skip_slots.rs Outdated Show resolved Hide resolved
lcli/src/transition_blocks.rs Outdated Show resolved Hide resolved
lcli/src/transition_blocks.rs Outdated Show resolved Hide resolved
lcli/src/transition_blocks.rs Outdated Show resolved Hide resolved
@realbigsean realbigsean added waiting-on-author The reviewer has suggested changes and awaits thier implementation. and removed ready-for-review The code is ready for review labels Jul 12, 2022
@paulhauner
Copy link
Member Author

All comments addressed, I'm going to add "ready for bors" since this is just an lcli command and seems to have implicit approval.

@paulhauner paulhauner added ready-for-merge This PR is ready to merge. backwards-incompat Backwards-incompatible API change and removed waiting-on-author The reviewer has suggested changes and awaits thier implementation. labels Aug 9, 2022
@paulhauner
Copy link
Member Author

I'm flagging this as backwards-incompat just so that we remember to mention it in the release notes. I don't think that changes to lcli should actually be considered "breaking changes" to Lighthouse.

@michaelsproul
Copy link
Member

bors r+

bors bot pushed a commit that referenced this pull request Aug 9, 2022
## Issue Addressed

NA

## Proposed Changes

Modifies `lcli skip-slots` and `lcli transition-blocks` allow them to source blocks/states from a beaconAPI and also gives them some more features to assist with benchmarking.

## Additional Info

Breaks the current `lcli skip-slots` and `lcli transition-blocks` APIs by changing some flag names. It should be simple enough to figure out the changes via `--help`.

Currently blocked on #3263.
@bors bors bot changed the title Add support for beaconAPI in lcli functions [Merged by Bors] - Add support for beaconAPI in lcli functions Aug 9, 2022
@bors bors bot closed this Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backwards-incompat Backwards-incompatible API change ready-for-merge This PR is ready to merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants