-
-
Notifications
You must be signed in to change notification settings - Fork 313
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 debug_getHistoricalSummaries
endpoint
#7245
Merged
wemeetagain
merged 19 commits into
ChainSafe:unstable
from
acolytec3:historicalSummaries-endpoint
Dec 5, 2024
Merged
Changes from 8 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
b45bdd8
feat: add new getHistoricalSummaries endpoint to debug namespace
acolytec3 79e5b62
Add JSON response
acolytec3 9261325
Restructure to use stateId and add proof to response
acolytec3 9eb5077
add test scaffolding
acolytec3 67413ed
Address feedback
acolytec3 3886d03
Move getHistoricalSummaries to lodestar namespace
acolytec3 0b6010b
add lodestar namespace unit test
acolytec3 8991efe
update route name to lodestar namespace
acolytec3 bd790f9
cast state object as Capella state
acolytec3 3b52ad5
Merge branch 'unstable' into historicalSummaries-endpoint
nflaig 0f581ec
Lint
nflaig 7c8c3e4
json properties need to be lower case
nflaig 0381799
Make it v1 since it's now part of lodestar namespace
nflaig 5103424
Group with other /lodestar endpoints
nflaig 5d23e9d
Simplify beacon node impl
nflaig 3822f9f
Rename return type
nflaig eda591d
Update test description
nflaig a2e9cd7
Fix variable name
nflaig d5e5e76
Merge branch 'unstable' into historicalSummaries-endpoint
nflaig File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
packages/api/test/unit/beacon/genericServerTest/lodestar.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import {config} from "@lodestar/config/default"; | ||
import {FastifyInstance} from "fastify"; | ||
import {afterAll, beforeAll, describe, expect, it, vi} from "vitest"; | ||
import {getClient} from "../../../../src/beacon/client/lodestar.js"; | ||
import {Endpoints, getDefinitions} from "../../../../src/beacon/routes/lodestar.js"; | ||
import {getRoutes} from "../../../../src/beacon/server/lodestar.js"; | ||
import {HttpClient} from "../../../../src/utils/client/httpClient.js"; | ||
import {AnyEndpoint} from "../../../../src/utils/codecs.js"; | ||
import {FastifyRoute} from "../../../../src/utils/server/index.js"; | ||
import {WireFormat} from "../../../../src/utils/wireFormat.js"; | ||
import {getMockApi, getTestServer} from "../../../utils/utils.js"; | ||
|
||
describe("lodestar", () => { | ||
describe("get HistoricalSummaries as json", () => { | ||
const mockApi = getMockApi<Endpoints>(getDefinitions(config)); | ||
let baseUrl: string; | ||
let server: FastifyInstance; | ||
|
||
beforeAll(async () => { | ||
const res = getTestServer(); | ||
server = res.server; | ||
for (const route of Object.values(getRoutes(config, mockApi))) { | ||
server.route(route as FastifyRoute<AnyEndpoint>); | ||
} | ||
baseUrl = await res.start(); | ||
}); | ||
|
||
afterAll(async () => { | ||
if (server !== undefined) await server.close(); | ||
}); | ||
|
||
it("getHistoricalSummaries", async () => { | ||
mockApi.getHistoricalSummaries.mockResolvedValue({ | ||
data: { | ||
HistoricalSummaries: [], | ||
proof: [], | ||
}, | ||
}); | ||
|
||
const httpClient = new HttpClient({baseUrl}); | ||
const client = getClient(config, httpClient); | ||
|
||
const res = await client.getHistoricalSummaries({stateId: "head"}, {responseWireFormat: WireFormat.json}); | ||
|
||
expect(res.ok).toBe(true); | ||
expect(res.wireFormat()).toBe(WireFormat.json); | ||
expect(res.json().data).toStrictEqual({ | ||
// biome-ignore lint/style/useNamingConvention: <explanation> | ||
Historical_summaries: [], | ||
proof: [], | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can avoid the
any
below by casting this to aBeaconStateCapella
hereThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like the proof size for
HistoricalSummaries
changed indeneb
(and will maybe again in Electra). Is it still safe to cast it toBeaconStateCapella
here since the shape of the state is changing somewhat?