Skip to content

Commit

Permalink
feat(status-page): order the provers by count descending (#13504)
Browse files Browse the repository at this point in the history
Co-authored-by: dave | d1onys1us <[email protected]>
Co-authored-by: jeff <[email protected]>
Co-authored-by: David <[email protected]>
  • Loading branch information
4 people authored Apr 4, 2023
1 parent 02feb58 commit 49db97d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
8 changes: 6 additions & 2 deletions packages/status-page/src/pages/home/Home.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,13 @@
>
{#await getNumProvers(eventIndexerApiUrl) then provers}
{#each provers.provers as prover}
<div>
<a
href="{l1ExplorerUrl}/address/{prover.address}"
target="_blank"
rel="noreferrer"
>
{addressSubsection(prover.address)}
</div>
</a>
<div>{prover.count}</div>
{/each}
{:catch error}
Expand Down
16 changes: 14 additions & 2 deletions packages/status-page/src/utils/getNumProvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,20 @@ export type UniqueProverResponse = {
export const getNumProvers = async (
eventIndexerApiUrl: string
): Promise<UniqueProverResponse> => {
const resp = await axios.get<UniqueProverResponse>(
const uniqueProversResp = await axios.get<UniqueProverResponse>(
`${eventIndexerApiUrl}/uniqueProvers`
);
return resp.data;
if (uniqueProversResp.data) {
uniqueProversResp.data.provers.sort((a, b) => b.count - a.count);
// Filter out the oracle prover address since it doesn't submit the actual zk proof
const index = uniqueProversResp.data.provers.findIndex(
(uniqueProver) =>
uniqueProver.address === "0x0000000000000000000000000000000000000000"
);
if (index > -1) {
uniqueProversResp.data.provers.splice(index, 1);
uniqueProversResp.data.uniqueProvers--;
}
}
return uniqueProversResp.data || { uniqueProvers: 0, provers: [] };
};

0 comments on commit 49db97d

Please sign in to comment.