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

Adding lighthouse/peers methods in BeaconNodeHttpClient #3042

Closed
wants to merge 5 commits into from

Conversation

leruaa
Copy link

@leruaa leruaa commented Feb 25, 2022

Issue Addressed

Issue #3041

Proposed Changes

  • Add the corresponding get_lighthouse_peers() and get_lighthouse_connected_peers() methods to BeaconNodeHttpClient
  • Impl Deserialize on Peer struct and all fields structs recursively

@CLAassistant
Copy link

CLAassistant commented Feb 25, 2022

CLA assistant check
All committers have signed the CLA.

@leruaa leruaa marked this pull request as ready for review March 2, 2022 19:28
@michaelsproul michaelsproul added waiting-on-author The reviewer has suggested changes and awaits thier implementation. backwards-incompat Backwards-incompatible API change labels Mar 3, 2022
@leruaa leruaa requested a review from michaelsproul March 3, 2022 20:43
@leruaa
Copy link
Author

leruaa commented Mar 3, 2022

I noticed that the score is not serialized as:

"score": {
  "score": 0
}

like described in the book, but like that:

"score": {
  "RealScore": {
    "lighthouse_score": 0,
    "gossipsub_score": 0,
    "ignore_negative_gossipsub_score": false,
    "score": 0
  }
}

Do we want to keep all the score details? Maybe we could streamline to just:

"score": 0

But obviously, that another breaking change...

Comment on lines +534 to +536
let instant = now
.checked_sub(duration)
.ok_or_else(|| Error::custom("checked_sub error"))?;
Copy link
Member

Choose a reason for hiding this comment

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

I think we need to avoid erroring in this case, or it'll create issues when translating Instants between machines. If the duration we get off the wire is greater than our current instant then it'll error. Ideally we could use saturating_sub, but it doesn't exist for Instant, so I think our best option is probably to do .checked_sub(duration).unwrap_or_else(Instant::now).

Copy link
Collaborator

Choose a reason for hiding this comment

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

Un-addressed comment by author @leruaa. Double checking there's still demand to call lighthouse only APIs programatically with the internal eth2 tooling?

Copy link
Member

Choose a reason for hiding this comment

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

I think we can close this, as Jack has implemented it more recently in #4937

@dapplion
Copy link
Collaborator

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 waiting-on-author The reviewer has suggested changes and awaits thier implementation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants