Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

Commit

Permalink
feat(prover): improve /status API
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha committed Nov 3, 2023
1 parent b155b5a commit ebd7d5c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions prover/server/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ type Status struct {
MinPseZkevmTierFee uint64 `json:"minPseZkevmTierFee"`
MaxExpiry uint64 `json:"maxExpiry"`
CurrentCapacity uint64 `json:"currentCapacity"`
ProverAddress string `json:"proverAddress"`
HeartBeatSignature string `json:"heartBeatSignature"`
}

// GetStatus handles a query to the current prover server status.
Expand All @@ -50,12 +52,19 @@ type Status struct {
// @Success 200 {object} Status
// @Router /status [get]
func (srv *ProverServer) GetStatus(c echo.Context) error {
sig, err := crypto.Sign(crypto.Keccak256Hash([]byte("HEART_BEAT")).Bytes(), srv.proverPrivateKey)
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, err)
}

return c.JSON(http.StatusOK, &Status{
MinOptimisticTierFee: srv.minOptimisticTierFee.Uint64(),
MinSgxTierFee: srv.minSgxTierFee.Uint64(),
MinPseZkevmTierFee: srv.minPseZkevmTierFee.Uint64(),
MaxExpiry: uint64(srv.maxExpiry.Seconds()),
CurrentCapacity: srv.capacityManager.ReadCapacity(),
ProverAddress: srv.proverAddress.Hex(),
HeartBeatSignature: common.Bytes2Hex(sig),
})
}

Expand Down

0 comments on commit ebd7d5c

Please sign in to comment.