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

First pass API for introspection of edges and assertions #371

Merged
merged 15 commits into from
Jul 24, 2023
Merged

Conversation

prestonvanloon
Copy link
Member

@prestonvanloon prestonvanloon commented Jul 20, 2023

Working on adding API endpoints that would be useful for introspection into the validator and the current edges or challenges.

Work-in-progress and looking for early review.

Current progress:

  • ListEdges, sorted by CreatedAtBlock
  • Stubbed endpoints for GetEdge by ID, ListAssertions, GetAssertion by ID

Future work:

  • Query params to sort by any field
  • Query params to filter by any field value
  • Completion of stubbed endpoints above
  • TUI / CLI tooling to represent the data in a meaningful way and make querying easier
  • API schema / docs
  • GraphQL (?)

@prestonvanloon prestonvanloon marked this pull request as ready for review July 20, 2023 20:00
Comment on lines +31 to +34

// Validator's point of view
// IsHonest bool `json:"isHonest"`
// AgreesWithStartCommitment `json:"agreesWithStartCommitment"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// Validator's point of view
// IsHonest bool `json:"isHonest"`
// AgreesWithStartCommitment `json:"agreesWithStartCommitment"`

EndCommitment: toCommitment(e.EndCommitment),
MutualID: common.Hash(e.MutualId()),
OriginID: common.Hash(e.OriginId()),
ClaimID: func() common.Hash {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This pattern is so neat

EndHeight: e.EndCommitment.Height,
EndCommit: mock.Commit(e.EndCommitment.Hash.Bytes()),
OriginID: mock.OriginId(e.OriginID.Bytes()),
ClaimID: string(e.ClaimID.Bytes()),
Copy link
Collaborator

Choose a reason for hiding this comment

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

There's a .String() method on hashes too

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, but that returns it in the hex string form where we need it to be back in the original form

@prestonvanloon prestonvanloon merged commit 7a2277e into main Jul 24, 2023
6 checks passed
@prestonvanloon prestonvanloon deleted the api branch August 3, 2023 21:12
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.

2 participants