Skip to content

Commit

Permalink
Merge branch 'main' into taikoon-ui-setup
Browse files Browse the repository at this point in the history
  • Loading branch information
dantaik authored Apr 29, 2024
2 parents b0de72e + bf31bb6 commit 08ca14f
Show file tree
Hide file tree
Showing 58 changed files with 995 additions and 378 deletions.
2 changes: 1 addition & 1 deletion packages/bridge-ui/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ export CONFIGURED_EVENT_INDEXER=
export PUBLIC_SLOW_L1_BRIDGING_WARNING=false

# Fees
export PUBLIC_FEE_MULTIPLIER =
export PUBLIC_FEE_MULTIPLIER=
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import { AddressInputState } from '$components/Bridge/SharedBridgeComponents/AddressInput/state';
import { enteredAmount, selectedNFTs, selectedToken, tokenBalance } from '$components/Bridge/state';
import { importDone } from '$components/Bridge/state';
1;
import { detectContractType, type NFT, TokenType } from '$libs/token';
import { checkOwnership } from '$libs/token/checkOwnership';
import { getTokenWithInfoFromAddress } from '$libs/token/getTokenWithInfoFromAddress';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
aria-expanded={modalOpen}
class={buttonClasses}
on:click={handlePillClick}>
<div class="f-items-center space-x-2 w-full">
<div class="f-items-center space-x-2 w-full whitespace-nowrap">
{#if !value}
<span>{$t('chain_selector.placeholder')}</span>
{/if}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
class=" h-[64px] rounded-[10px]
{disabled ? 'opacity-50 ' : 'hover:bg-primary-brand cursor-pointer'}"
aria-disabled={disabled}>
<label class="f-row items-center w-full h-full p-[16px]">
<label class="f-row items-center w-full h-full p-[16px] text-primary-content hover:text-white">
<input
type="radio"
name="nft-radio"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
<Card title={$t('transactions.title')} text={$t('transactions.description')}>
<div class="space-y-[35px]">
{#if isDesktopOrLarger}
<div class="my-[30px] f-between-center max-h-[36px]">
<div class="my-[30px] f-between-center max-h-[36px] gap-2">
<ChainSelector
type={ChainSelectorType.SMALL}
direction={ChainSelectorDirection.SOURCE}
Expand Down
10 changes: 5 additions & 5 deletions packages/guardian-prover-health-check/healthcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ type HealthCheckRepository interface {
ctx context.Context,
req *http.Request,
) (paginate.Page, error)
GetByGuardianProverID(
GetByGuardianProverAddress(
ctx context.Context,
req *http.Request,
id int,
address string,
) (paginate.Page, error)
GetMostRecentByGuardianProverID(
GetMostRecentByGuardianProverAddress(
ctx context.Context,
req *http.Request,
id int,
address string,
) (*HealthCheck, error)
Save(opts SaveHealthCheckOpts) error
GetUptimeByGuardianProverID(ctx context.Context, id int) (float64, int, error)
GetUptimeByGuardianProverAddress(ctx context.Context, address string) (float64, int, error)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package http

import (
"errors"
"net/http"

echo "github.com/labstack/echo/v4"
)

// GetHealthChecksByGuardianProverAddress
//
// returns the health checks.
//
// @Summary Get health checks by guardian prover address
// @ID get-health-checks-by-guardian-prover-address
// @Accept json
// @Produce json
// @Success 200 {object} paginate.Page
// @Router /healthchecks [get]
// @Param address string true "guardian prover address with which to query"

func (srv *Server) GetHealthChecksByGuardianProverAddress(c echo.Context) error {
address := c.Param("address")
if address == "" {
return c.JSON(http.StatusBadRequest, errors.New("no address provided"))
}

page, err := srv.healthCheckRepo.GetByGuardianProverAddress(c.Request().Context(), c.Request(), address)
if err != nil {
return c.JSON(http.StatusBadRequest, err)
}

return c.JSON(http.StatusOK, page)
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func Test_GetHealthChecksByGuardianProverID(t *testing.T) {
}{
{
"success",
"1",
"0x123",
http.StatusOK,
// nolint: lll
[]string{`[{"id":0,"guardianProverId":1,"alive":true,"expectedAddress":"0x123","recoveredAddress":"0x123","signedResponse":"0x123"}]`},
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,32 @@ package http
import (
"errors"
"net/http"
"strconv"

echo "github.com/labstack/echo/v4"
)

// GetMostRecentHealthCheckByGuardianProverID
// GetMostRecentHealthCheckByGuardianProverAddress
//
// returns the health checks.
//
// @Summary GetMostRecentHealthCheckByGuardianProverID
// @ID get-most-recent-health-checks-by-guardian-prover-id
// @Summary GetMostRecentHealthCheckByGuardianProverAddress
// @ID get-most-recent-health-checks-by-guardian-prover-address
// @Accept json
// @Produce json
// @Success 200 {object} paginate.Page
// @Router /liveness [get]

func (srv *Server) GetMostRecentHealthCheckByGuardianProverID(
func (srv *Server) GetMostRecentHealthCheckByGuardianProverAddress(
c echo.Context,
) error {
idParam := c.Param("id")
if idParam == "" {
return c.JSON(http.StatusBadRequest, errors.New("no id provided"))
address := c.Param("address")
if address == "" {
return c.JSON(http.StatusBadRequest, errors.New("no address provided"))
}

id, err := strconv.Atoi(idParam)
if err != nil {
return c.JSON(http.StatusBadRequest, err)
}

healthCheck, err := srv.healthCheckRepo.GetMostRecentByGuardianProverID(c.Request().Context(), c.Request(), id)
healthCheck, err := srv.healthCheckRepo.GetMostRecentByGuardianProverAddress(
c.Request().Context(), c.Request(), address,
)
if err != nil {
return c.JSON(http.StatusBadRequest, err)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package http

import (
"errors"
"net/http"

echo "github.com/labstack/echo/v4"
"github.com/labstack/gommon/log"
)

// GetMostRecentSignedBlockByGuardianProverID
//
// returns signed block data by each guardian prover.
//
// @Summary Get most recent signed block by guardian prover address
// @ID get-most-recent-signed-block-by-guardian-prover-address
// @Accept json
// @Produce json
// @Success 200 {object} block
// @Router /signedBlocks/:address[get]

func (srv *Server) GetMostRecentSignedBlockByGuardianProverAddress(c echo.Context) error {
address := c.Param("address")
if address == "" {
return c.JSON(http.StatusBadRequest, errors.New("no address provided"))
}

signedBlock, err := srv.signedBlockRepo.GetMostRecentByGuardianProverAddress(
address,
)

if err != nil {
log.Error("Failed to most recent block by guardian prover address", "error", err)
return echo.NewHTTPError(http.StatusInternalServerError, err)
}

return c.JSON(http.StatusOK, signedBlock)
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
guardianproverhealthcheck "github.com/taikoxyz/taiko-mono/packages/guardian-prover-health-check"
)

func Test_GetMostRecentSignedBlockByGuardianProverID(t *testing.T) {
func Test_GetMostRecentSignedBlockByGuardianProverAddress(t *testing.T) {
srv := newTestServer("")

for i := 0; i < 10; i++ {
Expand All @@ -35,7 +35,7 @@ func Test_GetMostRecentSignedBlockByGuardianProverID(t *testing.T) {
}{
{
"success",
"1",
"0x123",
http.StatusOK,
// nolint: lll
[]string{`{"guardianProverID":1,"blockID":9,"blockHash":"0x123","signature":"0x123","recoveredAddress":"0x123","createdAt":"0001-01-01T00:00:00Z"}`},
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package http

import (
"errors"
"net/http"

echo "github.com/labstack/echo/v4"
)

// GetMostRecentStartupByGuardianProverAddress
//
// returns the startup
//
// @Summary GetMostRecentStartupByGuardianProverAddress
// @ID get-most-recent-startup-by-guardian-prover-address
// @Accept json
// @Produce json
// @Success 200 {object} guardianproverhealthcheck.Startup
// @Router /mostRecentStartup/:address [get]

func (srv *Server) GetMostRecentStartupByGuardianProverAddress(
c echo.Context,
) error {
address := c.Param("address")
if address == "" {
return c.JSON(http.StatusBadRequest, errors.New("no address provided"))
}

startup, err := srv.startupRepo.GetMostRecentByGuardianProverAddress(
c.Request().Context(), address,
)
if err != nil {
return c.JSON(http.StatusBadRequest, err)
}

return c.JSON(http.StatusOK, startup)
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
guardianproverhealthcheck "github.com/taikoxyz/taiko-mono/packages/guardian-prover-health-check"
)

func Test_GetMostRecentStartupByGuardianProverID(t *testing.T) {
func Test_GetMostRecentStartupByGuardianProverAddress(t *testing.T) {
srv := newTestServer("")

for i := 0; i < 5; i++ {
Expand All @@ -36,7 +36,7 @@ func Test_GetMostRecentStartupByGuardianProverID(t *testing.T) {
}{
{
"success",
"1",
"0x123",
http.StatusOK,
// nolint: lll
[]string{`{"guardianProverID":1,"guardianProverAddress":"0x123","l1NodeVersion":"v1.0.0","l2NodeVersion":"v1.0.0","revision":"asdf","guardianVersion":"v1.0.0","createdAt":"0001-01-01T00:00:00Z"}`},
Expand Down

This file was deleted.

Loading

0 comments on commit 08ca14f

Please sign in to comment.