Skip to content

Commit

Permalink
Merge pull request #2122 from oasisprotocol/lw/fix-missing-validators
Browse files Browse the repository at this point in the history
Fix getting all validators from nexus (defaulted to first 100)
  • Loading branch information
lukaw3d authored Feb 19, 2025
2 parents 94420f5 + 99304cf commit 24366d9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions .changelog/2122.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Display all validators, not just first 100
2 changes: 1 addition & 1 deletion playwright/tests/validators.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ test.beforeEach(async ({ page }) => {
await warnSlowApi(page)
await mockApi(page, '500000000000')
// Unmock validators list API
await page.unroute('**/consensus/validators')
await page.unroute('**/consensus/validators?*')
await expectNoErrorsInConsole(page, {
ignoreError: message => {
// Some validator icons need authentication
Expand Down
4 changes: 2 additions & 2 deletions playwright/utils/mockApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export async function mockApi(context: BrowserContext | Page, balance: number |
}),
})
})
await context.route('**/consensus/validators', route => {
await context.route('**/consensus/validators?*', route => {
route.fulfill({
body: JSON.stringify({
is_total_count_clipped: false,
Expand Down Expand Up @@ -201,7 +201,7 @@ export async function mockApiMoreData(context: BrowserContext | Page) {
}),
})
})
await context.route('**/consensus/validators', route => {
await context.route('**/consensus/validators?*', route => {
route.fulfill({
body: JSON.stringify({
is_total_count_clipped: false,
Expand Down
2 changes: 1 addition & 1 deletion src/vendors/nexus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function getNexusAPIs(url: string | 'https://nexus.oasis.io/v1/') {
}

async function getAllValidators(): Promise<Validator[]> {
const validatorsResponse = await api.consensusValidatorsGet({})
const validatorsResponse = await api.consensusValidatorsGet({ limit: 1000 })
if (!validatorsResponse) throw new Error('Wrong response code')

return parseValidatorsList(validatorsResponse.validators)
Expand Down

0 comments on commit 24366d9

Please sign in to comment.