From 665da61fcbd8849bac3de0255da0ce6e452dc5c0 Mon Sep 17 00:00:00 2001 From: d1onys1us <13951458+d1onys1us@users.noreply.github.com> Date: Thu, 15 Feb 2024 23:21:11 -0500 Subject: [PATCH 01/47] ci(repo): fix merge queue status check (#15857) --- .github/workflows/validate-pr-title.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/validate-pr-title.yml b/.github/workflows/validate-pr-title.yml index 1ae95faf3b..7f651d4f61 100644 --- a/.github/workflows/validate-pr-title.yml +++ b/.github/workflows/validate-pr-title.yml @@ -6,9 +6,11 @@ on: - opened - edited - synchronize + merge_group: jobs: validate-pr-title: + if: github.event_name == 'pull_request_target' runs-on: ubuntu-latest steps: - uses: amannn/action-semantic-pull-request@v5 From 78f04812de1bcb22ed40c9ae9b16e42d3d3783c2 Mon Sep 17 00:00:00 2001 From: D <51912515+adaki2004@users.noreply.github.com> Date: Fri, 16 Feb 2024 18:00:44 +0530 Subject: [PATCH 02/47] feat(protocol): add GuardianApproval event to GuardianProver (#15817) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Keszey Dániel Co-authored-by: Daniel Wang <99078276+dantaik@users.noreply.github.com> --- packages/protocol/contracts/L1/provers/GuardianProver.sol | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/protocol/contracts/L1/provers/GuardianProver.sol b/packages/protocol/contracts/L1/provers/GuardianProver.sol index 4d5e47b0fe..1b771d3afc 100644 --- a/packages/protocol/contracts/L1/provers/GuardianProver.sol +++ b/packages/protocol/contracts/L1/provers/GuardianProver.sol @@ -20,6 +20,10 @@ import "./Guardians.sol"; /// @title GuardianProver contract GuardianProver is Guardians { + event GuardianApproval( + address indexed addr, uint256 indexed blockId, bytes32 blockHash, bool approved + ); + /// @notice Initializes the contract with the provided address manager. /// @param _addressManager The address of the address manager contract. function init(address _addressManager) external initializer { @@ -45,5 +49,7 @@ contract GuardianProver is Guardians { deleteApproval(hash); ITaikoL1(resolve("taiko", false)).proveBlock(meta.id, abi.encode(meta, tran, proof)); } + + emit GuardianApproval(msg.sender, meta.id, tran.blockHash, approved); } } From 9d87da50a4c5074ecdc3411ca820029f6dd5e69d Mon Sep 17 00:00:00 2001 From: Daniel Wang <99078276+dantaik@users.noreply.github.com> Date: Fri, 16 Feb 2024 23:25:39 +0800 Subject: [PATCH 03/47] chore(protocol): improve permission check (#15863) Co-authored-by: Brecht Devos --- packages/protocol/contracts/L1/TaikoL1.sol | 8 +++++--- packages/protocol/contracts/L1/TaikoToken.sol | 2 +- packages/protocol/contracts/L2/TaikoL2.sol | 10 +++++++++- packages/protocol/contracts/bridge/Bridge.sol | 2 +- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/packages/protocol/contracts/L1/TaikoL1.sol b/packages/protocol/contracts/L1/TaikoL1.sol index 979912fa35..5270a2a4ad 100644 --- a/packages/protocol/contracts/L1/TaikoL1.sol +++ b/packages/protocol/contracts/L1/TaikoL1.sol @@ -118,7 +118,8 @@ contract TaikoL1 is /// @notice Pause block proving. /// @param pause True if paused. - function pauseProving(bool pause) external onlyOwner { + function pauseProving(bool pause) external { + _authorizePause(msg.sender); LibProving.pauseProving(state, pause); } @@ -130,7 +131,7 @@ contract TaikoL1 is } function unpause() public override { - OwnerUUPSUpgradable.unpause(); + OwnerUUPSUpgradable.unpause(); // permission checked inside state.slotB.lastUnpausedAt = uint64(block.timestamp); } @@ -267,7 +268,8 @@ contract TaikoL1 is function _authorizePause(address) internal view + virtual override - onlyFromOwnerOrNamed("rollup_watchdog") + onlyFromOwnerOrNamed("chain_pauser") { } } diff --git a/packages/protocol/contracts/L1/TaikoToken.sol b/packages/protocol/contracts/L1/TaikoToken.sol index dea6690783..373a29cb16 100644 --- a/packages/protocol/contracts/L1/TaikoToken.sol +++ b/packages/protocol/contracts/L1/TaikoToken.sol @@ -57,7 +57,7 @@ contract TaikoToken is EssentialContract, ERC20SnapshotUpgradeable, ERC20VotesUp } /// @notice Creates a new token snapshot. - function snapshot() public onlyOwner { + function snapshot() public onlyFromOwnerOrNamed("snapshooter") { _snapshot(); } diff --git a/packages/protocol/contracts/L2/TaikoL2.sol b/packages/protocol/contracts/L2/TaikoL2.sol index 7ee875b2cb..c70c78c8d4 100644 --- a/packages/protocol/contracts/L2/TaikoL2.sol +++ b/packages/protocol/contracts/L2/TaikoL2.sol @@ -164,7 +164,15 @@ contract TaikoL2 is CrossChainOwned, ICrossChainSync { } /// @notice Withdraw token or Ether from this address - function withdraw(address token, address to) external onlyOwner nonReentrant whenNotPaused { + function withdraw( + address token, + address to + ) + external + onlyFromOwnerOrNamed("withdrawer") + nonReentrant + whenNotPaused + { if (to == address(0)) revert L2_INVALID_PARAM(); if (token == address(0)) { to.sendEther(address(this).balance); diff --git a/packages/protocol/contracts/bridge/Bridge.sol b/packages/protocol/contracts/bridge/Bridge.sol index 684859555c..7a68148882 100644 --- a/packages/protocol/contracts/bridge/Bridge.sol +++ b/packages/protocol/contracts/bridge/Bridge.sol @@ -494,7 +494,7 @@ contract Bridge is EssentialContract, IBridge { view virtual override - onlyFromOwnerOrNamed("bridge_watchdog") + onlyFromOwnerOrNamed("bridge_pauser") { } /// @notice Invokes a call message on the Bridge. From c1ed8b7fc974f7feac2c19ae4481bb831000d000 Mon Sep 17 00:00:00 2001 From: jeff <113397187+cyberhorsey@users.noreply.github.com> Date: Fri, 16 Feb 2024 07:50:04 -0800 Subject: [PATCH 04/47] fix(relayer): fix queue log when error is nil (#15861) --- packages/relayer/pkg/queue/rabbitmq/queue.go | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/relayer/pkg/queue/rabbitmq/queue.go b/packages/relayer/pkg/queue/rabbitmq/queue.go index 552780ce36..95012e9941 100644 --- a/packages/relayer/pkg/queue/rabbitmq/queue.go +++ b/packages/relayer/pkg/queue/rabbitmq/queue.go @@ -76,9 +76,9 @@ func (r *RabbitMQ) connect() error { r.conn = conn r.ch = ch - r.connErrCh = r.conn.NotifyClose(make(chan *amqp.Error, 1)) + r.connErrCh = r.conn.NotifyClose(make(chan *amqp.Error)) - r.chErrCh = r.ch.NotifyClose(make(chan *amqp.Error, 1)) + r.chErrCh = r.ch.NotifyClose(make(chan *amqp.Error)) r.subscriptionCtx, r.subscriptionCancel = context.WithCancel(context.Background()) @@ -208,10 +208,20 @@ func (r *RabbitMQ) Notify(ctx context.Context, wg *sync.WaitGroup) error { return nil case err := <-r.connErrCh: - slog.Error("rabbitmq notify close connection", "err", err.Error()) + if err != nil { + slog.Error("rabbitmq notify close connection", "err", err.Error()) + } else { + slog.Error("rabbitmq notify close connection") + } + return queue.ErrClosed case err := <-r.chErrCh: - slog.Error("rabbitmq notify close channel", "err", err.Error()) + if err != nil { + slog.Error("rabbitmq notify close channel", "err", err.Error()) + } else { + slog.Error("rabbitmq notify close channel") + } + return queue.ErrClosed case returnMsg := <-r.notifyReturnCh: slog.Error("rabbitmq notify return", "id", returnMsg.MessageId, "err", returnMsg.ReplyText) From a8be223c5758622137d347978aa3d9a6cf2429e1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 16 Feb 2024 15:19:33 -0500 Subject: [PATCH 05/47] chore(deps): bump actions/checkout from 2 to 4 (#15833) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/bridge-ui-v2.yml | 2 +- .github/workflows/eventindexer.yml | 6 +++--- .github/workflows/guardianproverhealthcheck.yaml | 6 +++--- .github/workflows/protocol.yml | 2 +- .github/workflows/relayer.yml | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/bridge-ui-v2.yml b/.github/workflows/bridge-ui-v2.yml index b07dfe5849..9295db1d49 100644 --- a/.github/workflows/bridge-ui-v2.yml +++ b/.github/workflows/bridge-ui-v2.yml @@ -19,7 +19,7 @@ jobs: access_token: ${{ github.token }} - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install pnpm dependencies uses: ./.github/actions/install-pnpm-dependencies diff --git a/.github/workflows/eventindexer.yml b/.github/workflows/eventindexer.yml index 4d340d6d7b..e46e831974 100644 --- a/.github/workflows/eventindexer.yml +++ b/.github/workflows/eventindexer.yml @@ -17,7 +17,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version: 1.21.0 - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: @@ -37,7 +37,7 @@ jobs: with: access_token: ${{ github.token }} - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-go@v3 with: go-version: ">=1.21.0" @@ -60,7 +60,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: ref: ${{ github.ref }} diff --git a/.github/workflows/guardianproverhealthcheck.yaml b/.github/workflows/guardianproverhealthcheck.yaml index 4a2f8dc167..305fdb2456 100644 --- a/.github/workflows/guardianproverhealthcheck.yaml +++ b/.github/workflows/guardianproverhealthcheck.yaml @@ -17,7 +17,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version: 1.21.0 - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: @@ -37,7 +37,7 @@ jobs: with: access_token: ${{ github.token }} - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-go@v3 with: go-version: "1.21.0" @@ -60,7 +60,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: ref: ${{ github.ref }} diff --git a/.github/workflows/protocol.yml b/.github/workflows/protocol.yml index 3ab258ab7b..99bfb89c34 100644 --- a/.github/workflows/protocol.yml +++ b/.github/workflows/protocol.yml @@ -19,7 +19,7 @@ jobs: access_token: ${{ github.token }} - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: recursive diff --git a/.github/workflows/relayer.yml b/.github/workflows/relayer.yml index 6252c9a540..6dc290da21 100644 --- a/.github/workflows/relayer.yml +++ b/.github/workflows/relayer.yml @@ -17,7 +17,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version: 1.21.0 - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: @@ -37,7 +37,7 @@ jobs: with: access_token: ${{ github.token }} - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-go@v3 with: go-version: "1.21.0" @@ -60,7 +60,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: ref: ${{ github.ref }} From 1506b53f2744269a8d4f6cf0c7d204a30018df00 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 16 Feb 2024 12:22:41 -0800 Subject: [PATCH 06/47] chore(deps): bump google-github-actions/release-please-action from 3 to 4 (#15826) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/release-please.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index bc8f1e16f3..a7f54817eb 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -7,6 +7,6 @@ jobs: release-please: runs-on: ubuntu-latest steps: - - uses: google-github-actions/release-please-action@v3 + - uses: google-github-actions/release-please-action@v4 with: command: manifest From da711512414bab17460b2817cb14f26cdf24c569 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 16 Feb 2024 12:22:54 -0800 Subject: [PATCH 07/47] chore(deps): bump styfle/cancel-workflow-action from 0.11.0 to 0.12.1 (#15820) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: d1onys1us <13951458+d1onys1us@users.noreply.github.com> --- .github/workflows/bridge-ui-v2.yml | 2 +- .github/workflows/eventindexer.yml | 2 +- .github/workflows/guardianproverhealthcheck.yaml | 2 +- .github/workflows/protocol.yml | 2 +- .github/workflows/relayer.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/bridge-ui-v2.yml b/.github/workflows/bridge-ui-v2.yml index 9295db1d49..8f72d55131 100644 --- a/.github/workflows/bridge-ui-v2.yml +++ b/.github/workflows/bridge-ui-v2.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Cancel previous runs - uses: styfle/cancel-workflow-action@0.11.0 + uses: styfle/cancel-workflow-action@0.12.1 with: access_token: ${{ github.token }} diff --git a/.github/workflows/eventindexer.yml b/.github/workflows/eventindexer.yml index e46e831974..d692ed7778 100644 --- a/.github/workflows/eventindexer.yml +++ b/.github/workflows/eventindexer.yml @@ -33,7 +33,7 @@ jobs: needs: lint steps: - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.11.0 + uses: styfle/cancel-workflow-action@0.12.1 with: access_token: ${{ github.token }} diff --git a/.github/workflows/guardianproverhealthcheck.yaml b/.github/workflows/guardianproverhealthcheck.yaml index 305fdb2456..a011ca4f33 100644 --- a/.github/workflows/guardianproverhealthcheck.yaml +++ b/.github/workflows/guardianproverhealthcheck.yaml @@ -33,7 +33,7 @@ jobs: needs: lint steps: - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.11.0 + uses: styfle/cancel-workflow-action@0.12.1 with: access_token: ${{ github.token }} diff --git a/.github/workflows/protocol.yml b/.github/workflows/protocol.yml index 99bfb89c34..5959e0e150 100644 --- a/.github/workflows/protocol.yml +++ b/.github/workflows/protocol.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Cancel previous runs - uses: styfle/cancel-workflow-action@0.11.0 + uses: styfle/cancel-workflow-action@0.12.1 with: access_token: ${{ github.token }} diff --git a/.github/workflows/relayer.yml b/.github/workflows/relayer.yml index 6dc290da21..52e1e809db 100644 --- a/.github/workflows/relayer.yml +++ b/.github/workflows/relayer.yml @@ -33,7 +33,7 @@ jobs: needs: lint steps: - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.11.0 + uses: styfle/cancel-workflow-action@0.12.1 with: access_token: ${{ github.token }} From e3ade1d98a91d43e236e63374f61b78b5bf8f315 Mon Sep 17 00:00:00 2001 From: jeff <113397187+cyberhorsey@users.noreply.github.com> Date: Fri, 16 Feb 2024 12:23:08 -0800 Subject: [PATCH 08/47] feat(guardian-prover-health-check): guardian prover updates (#15815) Co-authored-by: David --- .../healthcheck.go | 4 ++ ...ealth_checks_by_guardian_prover_id_test.go | 2 + .../http/get_health_checks_test.go | 2 + ...cent_startup_by_guardian_prover_id_test.go | 6 ++- .../get_node_info_by_guardian_prover_id.go | 53 +++++++++++++++++++ ...get_startups_by_guardian_prover_id_test.go | 6 ++- .../http/post_health_check.go | 11 +++- .../http/post_startup.go | 22 +++++--- .../http/routes.go | 2 + .../1666650599_create_health_checks_table.sql | 2 + .../1666651002_create_startups_table.sql | 4 +- .../mock/health_check_repo.go | 2 + .../mock/startup_repo.go | 4 +- .../repo/healthcheck.go | 2 + .../repo/healthcheck_test.go | 6 +++ .../repo/startup.go | 4 +- .../repo/startup_test.go | 10 ++-- .../guardian-prover-health-check/startup.go | 14 ++++- 18 files changed, 136 insertions(+), 20 deletions(-) create mode 100644 packages/guardian-prover-health-check/http/get_node_info_by_guardian_prover_id.go diff --git a/packages/guardian-prover-health-check/healthcheck.go b/packages/guardian-prover-health-check/healthcheck.go index 0dca91f3ab..95e185e50a 100644 --- a/packages/guardian-prover-health-check/healthcheck.go +++ b/packages/guardian-prover-health-check/healthcheck.go @@ -15,6 +15,8 @@ type HealthCheck struct { ExpectedAddress string `json:"expectedAddress"` RecoveredAddress string `json:"recoveredAddress"` SignedResponse string `json:"signedResponse"` + LatestL1Block uint64 `json:"latestL1Block"` + LatestL2Block uint64 `json:"latestL2Block"` CreatedAt time.Time `json:"createdAt"` } @@ -24,6 +26,8 @@ type SaveHealthCheckOpts struct { ExpectedAddress string RecoveredAddress string SignedResponse string + LatestL1Block uint64 + LatestL2Block uint64 } type HealthCheckRepository interface { diff --git a/packages/guardian-prover-health-check/http/get_health_checks_by_guardian_prover_id_test.go b/packages/guardian-prover-health-check/http/get_health_checks_by_guardian_prover_id_test.go index 3b4e59f17c..5c7db95912 100644 --- a/packages/guardian-prover-health-check/http/get_health_checks_by_guardian_prover_id_test.go +++ b/packages/guardian-prover-health-check/http/get_health_checks_by_guardian_prover_id_test.go @@ -21,6 +21,8 @@ func Test_GetHealthChecksByGuardianProverID(t *testing.T) { ExpectedAddress: "0x123", RecoveredAddress: "0x123", SignedResponse: "0x123", + LatestL1Block: 5, + LatestL2Block: 7, }) assert.Nil(t, err) diff --git a/packages/guardian-prover-health-check/http/get_health_checks_test.go b/packages/guardian-prover-health-check/http/get_health_checks_test.go index d32db8b46b..0fdf5ea3a4 100644 --- a/packages/guardian-prover-health-check/http/get_health_checks_test.go +++ b/packages/guardian-prover-health-check/http/get_health_checks_test.go @@ -20,6 +20,8 @@ func Test_GetHealthChecks(t *testing.T) { ExpectedAddress: "0x123", RecoveredAddress: "0x123", SignedResponse: "0x123", + LatestL1Block: 5, + LatestL2Block: 7, }) assert.Nil(t, err) diff --git a/packages/guardian-prover-health-check/http/get_most_recent_startup_by_guardian_prover_id_test.go b/packages/guardian-prover-health-check/http/get_most_recent_startup_by_guardian_prover_id_test.go index 554393198f..d643f66fa0 100644 --- a/packages/guardian-prover-health-check/http/get_most_recent_startup_by_guardian_prover_id_test.go +++ b/packages/guardian-prover-health-check/http/get_most_recent_startup_by_guardian_prover_id_test.go @@ -20,7 +20,9 @@ func Test_GetMostRecentStartupByGuardianProverID(t *testing.T) { GuardianProverID: 1, GuardianProverAddress: "0x123", Revision: "asdf", - Version: "v1.0.0", + GuardianVersion: "v1.0.0", + L1NodeVersion: "v1.0.0", + L2NodeVersion: "v1.0.0", }) assert.Nil(t, err) @@ -37,7 +39,7 @@ func Test_GetMostRecentStartupByGuardianProverID(t *testing.T) { "1", http.StatusOK, // nolint: lll - []string{`{"guardianProverID":1,"guardianProverAddress":"0x123","revision":"asdf","version":"v1.0.0","createdAt":"0001-01-01T00:00:00Z"}`}, + []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"}`}, }, { "doesntExist", diff --git a/packages/guardian-prover-health-check/http/get_node_info_by_guardian_prover_id.go b/packages/guardian-prover-health-check/http/get_node_info_by_guardian_prover_id.go new file mode 100644 index 0000000000..26fa49aed6 --- /dev/null +++ b/packages/guardian-prover-health-check/http/get_node_info_by_guardian_prover_id.go @@ -0,0 +1,53 @@ +package http + +import ( + "errors" + "net/http" + "strconv" + + echo "github.com/labstack/echo/v4" + guardianproverhealthcheck "github.com/taikoxyz/taiko-mono/packages/guardian-prover-health-check" +) + +// GetNodeInfoByGuardianProverID +// +// returns the startup +// +// @Summary GetNodeInfoByGuardianProverID +// @ID get-node-info-by-guardian-prover-id +// @Accept json +// @Produce json +// @Success 200 {object} guardianproverhealthcheck.NodeInfo +// @Router /nodeInfo/:id [get] + +func (srv *Server) GetNodeInfoByGuardianProverID( + c echo.Context, +) error { + idParam := c.Param("id") + if idParam == "" { + return c.JSON(http.StatusBadRequest, errors.New("no id provided")) + } + + id, err := strconv.Atoi(idParam) + if err != nil { + return c.JSON(http.StatusBadRequest, err) + } + + startup, err := srv.startupRepo.GetMostRecentByGuardianProverID(c.Request().Context(), id) + if err != nil { + return c.JSON(http.StatusBadRequest, err) + } + + healthCheck, err := srv.healthCheckRepo.GetMostRecentByGuardianProverID(c.Request().Context(), c.Request(), id) + if err != nil { + return c.JSON(http.StatusBadRequest, err) + } + + nodeInfo := guardianproverhealthcheck.NodeInfo{ + Startup: *startup, + LatestL1BlockNumber: healthCheck.LatestL1Block, + LatestL2BlockNumber: healthCheck.LatestL2Block, + } + + return c.JSON(http.StatusOK, nodeInfo) +} diff --git a/packages/guardian-prover-health-check/http/get_startups_by_guardian_prover_id_test.go b/packages/guardian-prover-health-check/http/get_startups_by_guardian_prover_id_test.go index 4ae1b1b5e3..30d461209a 100644 --- a/packages/guardian-prover-health-check/http/get_startups_by_guardian_prover_id_test.go +++ b/packages/guardian-prover-health-check/http/get_startups_by_guardian_prover_id_test.go @@ -19,7 +19,9 @@ func Test_GetStartupsByGuardianProverID(t *testing.T) { GuardianProverID: 1, GuardianProverAddress: "0x123", Revision: "asdf", - Version: "v1.0.0", + GuardianVersion: "v1.0.0", + L1NodeVersion: "v1.0.0", + L2NodeVersion: "v1.0.0", }) assert.Nil(t, err) @@ -37,7 +39,7 @@ func Test_GetStartupsByGuardianProverID(t *testing.T) { "1", http.StatusOK, // nolint: lll - []string{`{"items":\[{"guardianProverID":1,"guardianProverAddress":"0x123","revision":"asdf","version":"v1.0.0","createdAt":"0001-01-01T00:00:00Z"}\],"page":0,"size":0,"max_page":0,"total_pages":0,"total":0,"last":false,"first":false,"visible":0}`}, + []string{`{"items":\[{"guardianProverID":1,"guardianProverAddress":"0x123","l1NodeVersion":"v1.0.0","l2NodeVersion":"v1.0.0","revision":"asdf","guardianVersion":"v1.0.0","createdAt":"0001-01-01T00:00:00Z"}\],"page":0,"size":0,"max_page":0,"total_pages":0,"total":0,"last":false,"first":false,"visible":0}`}, }, { "successDoesntExist", diff --git a/packages/guardian-prover-health-check/http/post_health_check.go b/packages/guardian-prover-health-check/http/post_health_check.go index fc8742d085..672f1e6ff6 100644 --- a/packages/guardian-prover-health-check/http/post_health_check.go +++ b/packages/guardian-prover-health-check/http/post_health_check.go @@ -16,6 +16,8 @@ var ( type healthCheckReq struct { ProverAddress string `json:"prover"` HeartBeatSignature string `json:"heartBeatSignature"` + LatestL1Block uint64 `json:"latestL1Block"` + LatestL2Block uint64 `json:"latestL2Block"` } // PostHealthCheck @@ -58,6 +60,8 @@ func (srv *Server) PostHealthCheck(c echo.Context) error { ExpectedAddress: recoveredGuardianProver.Address.Hex(), RecoveredAddress: recoveredGuardianProver.Address.Hex(), SignedResponse: req.HeartBeatSignature, + LatestL1Block: req.LatestL1Block, + LatestL2Block: req.LatestL2Block, }); err != nil { return c.JSON(http.StatusBadRequest, err) } @@ -69,7 +73,12 @@ func (srv *Server) PostHealthCheck(c echo.Context) error { } } - slog.Info("successful health check", "guardianProver", recoveredGuardianProver.Address.Hex()) + slog.Info("successful health check", + "id", recoveredGuardianProver.ID.Uint64(), + "guardianProver", recoveredGuardianProver.Address.Hex(), + "latestL1Block", req.LatestL1Block, + "latestL2Block", req.LatestL2Block, + ) return c.JSON(http.StatusOK, nil) } diff --git a/packages/guardian-prover-health-check/http/post_startup.go b/packages/guardian-prover-health-check/http/post_startup.go index a928df0815..c08785144c 100644 --- a/packages/guardian-prover-health-check/http/post_startup.go +++ b/packages/guardian-prover-health-check/http/post_startup.go @@ -11,10 +11,12 @@ import ( ) type startupReq struct { - ProverAddress string `json:"prover"` - Version string `json:"version"` - Revision string `json:"revision"` - Signature string `json:"signature"` + ProverAddress string `json:"prover"` + GuardianVersion string `json:"guardianVersion"` + L1NodeVersion string `json:"l1NodeVersion"` + L2NodeVersion string `json:"l2NodeVersion"` + Revision string `json:"revision"` + Signature string `json:"signature"` } // PostStartup @@ -39,7 +41,9 @@ func (srv *Server) PostStartup(c echo.Context) error { msg := crypto.Keccak256Hash( common.HexToAddress(req.ProverAddress).Bytes(), []byte(req.Revision), - []byte(req.Version), + []byte(req.GuardianVersion), + []byte(req.L1NodeVersion), + []byte(req.L2NodeVersion), ).Bytes() recoveredGuardianProver, err := guardianproverhealthcheck.SignatureToGuardianProver( @@ -59,7 +63,9 @@ func (srv *Server) PostStartup(c echo.Context) error { // address. if err := srv.startupRepo.Save(guardianproverhealthcheck.SaveStartupOpts{ GuardianProverID: recoveredGuardianProver.ID.Uint64(), - Version: req.Version, + GuardianVersion: req.GuardianVersion, + L1NodeVersion: req.L1NodeVersion, + L2NodeVersion: req.L2NodeVersion, Revision: req.Revision, GuardianProverAddress: req.ProverAddress, }); err != nil { @@ -69,7 +75,9 @@ func (srv *Server) PostStartup(c echo.Context) error { slog.Info("successful startup", "guardianProver", recoveredGuardianProver.Address.Hex(), "revision", req.Revision, - "version", req.Version, + "guardianVersion", req.GuardianVersion, + "l1NodeVersion", req.L1NodeVersion, + "l2NodeVersion", req.L2NodeVersion, ) return c.JSON(http.StatusOK, nil) diff --git a/packages/guardian-prover-health-check/http/routes.go b/packages/guardian-prover-health-check/http/routes.go index 1b2ca39405..209181c6f6 100644 --- a/packages/guardian-prover-health-check/http/routes.go +++ b/packages/guardian-prover-health-check/http/routes.go @@ -25,4 +25,6 @@ func (srv *Server) configureRoutes() { srv.echo.GET("/mostRecentStartup/:id", srv.GetMostRecentStartupByGuardianProverID) srv.echo.POST("/startup", srv.PostStartup) + + srv.echo.GET("/nodeInfo/:id", srv.GetNodeInfoByGuardianProverID) } diff --git a/packages/guardian-prover-health-check/migrations/1666650599_create_health_checks_table.sql b/packages/guardian-prover-health-check/migrations/1666650599_create_health_checks_table.sql index 6a6e0be514..bd9f4c0439 100644 --- a/packages/guardian-prover-health-check/migrations/1666650599_create_health_checks_table.sql +++ b/packages/guardian-prover-health-check/migrations/1666650599_create_health_checks_table.sql @@ -7,6 +7,8 @@ CREATE TABLE IF NOT EXISTS health_checks ( expected_address VARCHAR(42) NOT NULL, recovered_address VARCHAR(42) NOT NULL DEFAULT "", signed_response VARCHAR(5000) NOT NULL DEFAULT "", + latest_l1_block BIGINT NOT NULL, + latest_l2_block BIGINT NOT NULL, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP , updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ); diff --git a/packages/guardian-prover-health-check/migrations/1666651002_create_startups_table.sql b/packages/guardian-prover-health-check/migrations/1666651002_create_startups_table.sql index 22f3ebdf9b..2467b7649e 100644 --- a/packages/guardian-prover-health-check/migrations/1666651002_create_startups_table.sql +++ b/packages/guardian-prover-health-check/migrations/1666651002_create_startups_table.sql @@ -5,7 +5,9 @@ CREATE TABLE IF NOT EXISTS startups ( guardian_prover_id int NOT NULL, guardian_prover_address VARCHAR(42) NOT NULL, revision VARCHAR(255) NOT NULL, - version VARCHAR(255) NOT NULL, + guardian_version VARCHAR(255) NOT NULL, + l1_node_version VARCHAR(255) NOT NULL, + l2_node_version VARCHAR(255) NOT NULL, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ); diff --git a/packages/guardian-prover-health-check/mock/health_check_repo.go b/packages/guardian-prover-health-check/mock/health_check_repo.go index 8e10a38e3d..e125af371d 100644 --- a/packages/guardian-prover-health-check/mock/health_check_repo.go +++ b/packages/guardian-prover-health-check/mock/health_check_repo.go @@ -51,6 +51,8 @@ func (h *HealthCheckRepo) Save(opts guardianproverhealthcheck.SaveHealthCheckOpt ExpectedAddress: opts.ExpectedAddress, RecoveredAddress: opts.RecoveredAddress, SignedResponse: opts.SignedResponse, + LatestL1Block: opts.LatestL1Block, + LatestL2Block: opts.LatestL2Block, }, ) diff --git a/packages/guardian-prover-health-check/mock/startup_repo.go b/packages/guardian-prover-health-check/mock/startup_repo.go index 12c1eb9df7..07d797de8f 100644 --- a/packages/guardian-prover-health-check/mock/startup_repo.go +++ b/packages/guardian-prover-health-check/mock/startup_repo.go @@ -56,7 +56,9 @@ func (h *StartupRepo) Save(opts guardianproverhealthcheck.SaveStartupOpts) error GuardianProverID: opts.GuardianProverID, GuardianProverAddress: opts.GuardianProverAddress, Revision: opts.Revision, - Version: opts.Version, + GuardianVersion: opts.GuardianVersion, + L1NodeVersion: opts.L1NodeVersion, + L2NodeVersion: opts.L2NodeVersion, }, ) diff --git a/packages/guardian-prover-health-check/repo/healthcheck.go b/packages/guardian-prover-health-check/repo/healthcheck.go index 27565dcad5..fc60a3a04d 100644 --- a/packages/guardian-prover-health-check/repo/healthcheck.go +++ b/packages/guardian-prover-health-check/repo/healthcheck.go @@ -86,6 +86,8 @@ func (r *HealthCheckRepository) Save(opts guardianproverhealthcheck.SaveHealthCh RecoveredAddress: opts.RecoveredAddress, SignedResponse: opts.SignedResponse, GuardianProverID: opts.GuardianProverID, + LatestL1Block: opts.LatestL1Block, + LatestL2Block: opts.LatestL2Block, } if err := r.startQuery().Create(b).Error; err != nil { return err diff --git a/packages/guardian-prover-health-check/repo/healthcheck_test.go b/packages/guardian-prover-health-check/repo/healthcheck_test.go index 74191069c3..c1be0c453f 100644 --- a/packages/guardian-prover-health-check/repo/healthcheck_test.go +++ b/packages/guardian-prover-health-check/repo/healthcheck_test.go @@ -57,6 +57,8 @@ func TestIntegration_HealthCheck_Save(t *testing.T) { ExpectedAddress: "0x123", RecoveredAddress: "0x123", SignedResponse: "0x123456", + LatestL1Block: 5, + LatestL2Block: 7, }, nil, }, @@ -94,6 +96,8 @@ func TestIntegration_HealthCheck_UptimeByGuardianProverId(t *testing.T) { ExpectedAddress: "0x123", RecoveredAddress: "0x123", SignedResponse: "0x123456", + LatestL1Block: 5, + LatestL2Block: 7, }) assert.Equal(t, err, nil) @@ -104,6 +108,8 @@ func TestIntegration_HealthCheck_UptimeByGuardianProverId(t *testing.T) { ExpectedAddress: "0x123", RecoveredAddress: "0x123", SignedResponse: "0x123456", + LatestL1Block: 5, + LatestL2Block: 7, }) assert.Equal(t, err, nil) diff --git a/packages/guardian-prover-health-check/repo/startup.go b/packages/guardian-prover-health-check/repo/startup.go index 9a1d141ed7..4b788c67e7 100644 --- a/packages/guardian-prover-health-check/repo/startup.go +++ b/packages/guardian-prover-health-check/repo/startup.go @@ -64,7 +64,9 @@ func (r *StartupRepository) Save(opts guardianproverhealthcheck.SaveStartupOpts) GuardianProverAddress: opts.GuardianProverAddress, GuardianProverID: opts.GuardianProverID, Revision: opts.Revision, - Version: opts.Version, + GuardianVersion: opts.GuardianVersion, + L1NodeVersion: opts.L1NodeVersion, + L2NodeVersion: opts.L2NodeVersion, } if err := r.startQuery().Create(b).Error; err != nil { return err diff --git a/packages/guardian-prover-health-check/repo/startup_test.go b/packages/guardian-prover-health-check/repo/startup_test.go index fefe421371..533a07177e 100644 --- a/packages/guardian-prover-health-check/repo/startup_test.go +++ b/packages/guardian-prover-health-check/repo/startup_test.go @@ -55,7 +55,7 @@ func TestIntegration_Startup_Save(t *testing.T) { GuardianProverID: 1, GuardianProverAddress: "0x123", Revision: "asdf", - Version: "v1.0.0", + GuardianVersion: "v1.0.0", }, nil, }, @@ -82,7 +82,9 @@ func TestIntegration_Startup_GetByGuardianProverID(t *testing.T) { GuardianProverID: 1, GuardianProverAddress: "0x123", Revision: "asdf", - Version: "v1.0.0", + GuardianVersion: "v1.0.0", + L1NodeVersion: "v0.1.0", + L2NodeVersion: "v0.0.1", }) assert.Equal(t, nil, err) @@ -91,7 +93,9 @@ func TestIntegration_Startup_GetByGuardianProverID(t *testing.T) { GuardianProverID: 1, GuardianProverAddress: "0x123", Revision: "zxxc", - Version: "v1.0.1", + GuardianVersion: "v1.0.1", + L1NodeVersion: "v0.1.0", + L2NodeVersion: "v0.0.1", }) assert.Equal(t, nil, err) diff --git a/packages/guardian-prover-health-check/startup.go b/packages/guardian-prover-health-check/startup.go index 33ea79dd01..0a70c2b9cc 100644 --- a/packages/guardian-prover-health-check/startup.go +++ b/packages/guardian-prover-health-check/startup.go @@ -13,8 +13,10 @@ import ( type Startup struct { GuardianProverID uint64 `json:"guardianProverID"` GuardianProverAddress string `json:"guardianProverAddress"` + L1NodeVersion string `json:"l1NodeVersion"` + L2NodeVersion string `json:"l2NodeVersion"` Revision string `json:"revision"` - Version string `json:"version"` + GuardianVersion string `json:"guardianVersion"` CreatedAt time.Time `json:"createdAt"` } @@ -22,7 +24,15 @@ type SaveStartupOpts struct { GuardianProverID uint64 GuardianProverAddress string Revision string - Version string + GuardianVersion string + L1NodeVersion string `json:"l1NodeVersion"` + L2NodeVersion string `json:"l2NodeVersion"` +} + +type NodeInfo struct { + Startup + LatestL1BlockNumber uint64 `json:"latestL1BlockNumber"` + LatestL2BlockNumber uint64 `json:"latestL2BlockNumber"` } type StartupRepository interface { From 7a02c6833295420b34a3002471dba26a9b008ded Mon Sep 17 00:00:00 2001 From: Wlurs <68749185+Wlurs@users.noreply.github.com> Date: Fri, 16 Feb 2024 22:30:28 +0200 Subject: [PATCH 09/47] docs(repo): fix CONTRIBUTING.md broken link (#15868) --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3e27701b0b..81b21700ba 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,7 +23,7 @@ This section describes our coding standards at Taiko. ### Pull requests -Specify the scope of your change with a [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/) in the PR title (for example, `feat(scope): description of feature`). This will be squashed and merged into the `main` branch. You can find the full list of allowed scopes [here](https://github.com/taikoxyz/taiko-mono/blob/main/.github/workflows/lint-pr.yml#L19). +Specify the scope of your change with a [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/) in the PR title (for example, `feat(scope): description of feature`). This will be squashed and merged into the `main` branch. You can find the full list of allowed scopes [here](https://github.com/taikoxyz/taiko-mono/blob/main/.github/workflows/validate-pr-title.yml). Because we squash all of the changes into a single commit, please try to keep the PR limited to the scope specified in the commit message. This commit message will end up in the automated changelog by checking which packages are affected by the commit. From 81359fd9201bb8a39095e6bdbcb3ac977a7bb5ef Mon Sep 17 00:00:00 2001 From: Korbinian Date: Sat, 17 Feb 2024 01:21:09 +0300 Subject: [PATCH 10/47] feat(bridge-ui-v2)!: bridge UI version 2.1 (#15775) --- packages/bridge-ui-v2/.env.example | 3 + packages/bridge-ui-v2/README.md | 34 +- .../bridge-ui-v2/__mocks__/@wagmi/core.ts | 14 +- packages/bridge-ui-v2/__mocks__/viem.ts | 3 + packages/bridge-ui-v2/package.json | 12 +- .../bridge-ui-v2/scripts/exportJsonToEnv.js | 53 +- packages/bridge-ui-v2/src/abi/index.ts | 2 +- packages/bridge-ui-v2/src/app.config.ts | 5 + packages/bridge-ui-v2/src/app.css | 1 + .../AccountConnectionToast.svelte | 11 +- .../src/components/Bridge/Actions.svelte | 215 - .../src/components/Bridge/Bridge.svelte | 298 +- .../components/Bridge/FungibleBridge.svelte | 66 + .../ImportStep/ImportStep.svelte | 14 + .../ImportStep/TokenInput/TokenInput.svelte | 307 ++ .../ReviewStep/ReviewStep.svelte | 80 + .../StepNavigation/StepBack.svelte | 6 + .../StepNavigation/StepNavigation.svelte | 100 + .../Bridge/FungibleBridgeComponents/index.ts | 3 + .../src/components/Bridge/NFTBridge.svelte | 262 +- .../IDInput/IDInput.svelte | 23 +- .../IDInput/state.ts | 0 .../ImportStep/ImportActions.svelte | 66 + .../ImportStep/ImportStep.svelte | 65 + .../ImportStep/ManualImport.svelte | 195 + .../ImportStep/ScannedImport.svelte | 118 + .../NFTBridgeComponents/ImportStep/state.ts | 5 + .../ReviewStep}/ReviewStep.svelte | 76 +- .../StepNavigation/StepBack.svelte | 6 + .../StepNavigation/StepNavigation.svelte | 99 + .../Bridge/NFTBridgeComponents/index.ts | 3 + .../NFTBridgeSteps/ConfirmationStep.svelte | 228 - .../Bridge/NFTBridgeSteps/ImportStep.svelte | 417 -- .../components/Bridge/NFTBridgeSteps/index.ts | 4 - .../SharedBridgeComponents/Actions.svelte | 154 + .../AddressInput/AddressInput.svelte | 4 +- .../AddressInput/state.ts | 0 .../ConfirmationStep/ConfirmationStep.svelte | 254 ++ .../ProcessingFee/NoneOption.svelte | 11 +- .../ProcessingFee/ProcessingFee.svelte | 56 +- .../ProcessingFee/RecommendedFee.svelte | 9 +- .../ProcessingFee/index.ts | 0 .../RecipientStep}/Recipient.svelte | 4 +- .../RecipientStep}/RecipientStep.svelte | 4 +- .../Bridge/SharedBridgeComponents/index.ts | 4 + ...{Amount.svelte => TokenAmountInput.svelte} | 186 +- .../src/components/Bridge/state.ts | 7 +- .../src/components/Bridge/types.ts | 12 +- .../src/components/Button/ActionButton.svelte | 3 +- .../src/components/Card/Card.svelte | 8 +- .../ChainSelector/ChainSelector.svelte | 221 - .../ChainSelector/ChainSelectorWrapper.svelte | 95 - .../src/components/ChainSelector/index.ts | 2 - .../ChainSelectors/ChainPill/ChainPill.svelte | 74 + .../ChainSelectors/ChainSelector.svelte | 79 + .../CombinedChainSelector.svelte | 109 + .../SelectorDialogs/ChainsDialog.svelte | 98 + .../SelectorDialogs/ChainsDropdown.svelte | 75 + .../SwitchChainsButton.svelte | 17 +- .../src/components/ChainSelectors/index.ts | 2 + .../src/components/ChainSelectors/types.ts | 10 + .../ConnectButton/ConnectButton.svelte | 63 +- .../src/components/Faucet/Faucet.svelte | 37 +- .../src/components/InputBox/InputBox.svelte | 18 +- .../components/LinkButton/LinkButton.svelte | 2 +- .../components/NFTs/NFTCards/NFTCard.svelte | 32 +- .../NFTs/NFTCards/NFTCardGrid.svelte | 6 +- .../src/components/NFTs/NFTDisplay.svelte | 4 +- .../src/components/NFTs/NFTInfoDialog.svelte | 121 +- .../components/NFTs/NFTList/NFTList.svelte | 2 - .../NFTs/NFTList/NFTListItem.svelte | 28 +- .../src/components/OnNetwork/OnNetwork.svelte | 10 +- .../SideNavigation/SideNavigation.svelte | 8 +- .../src/components/Stepper/Stepper.svelte | 7 +- .../SwitchChainModal/SwitchChainModal.svelte | 10 +- .../TokenDropdown/AddCustomERC20.svelte | 49 +- .../TokenDropdown/DialogView.svelte | 10 +- .../TokenDropdown/DropdownView.svelte | 9 +- .../TokenDropdown/TokenDropdown.svelte | 212 +- .../{ => Filter}/StatusFilterDialog.svelte | 0 .../{ => Filter}/StatusFilterDropdown.svelte | 4 +- .../components/Transactions/Filter/index.ts | 2 + .../Transactions/InsufficientFunds.svelte | 3 +- .../Transactions/MobileDetailsDialog.svelte | 151 +- .../Transactions/{ => Status}/Status.svelte | 23 +- .../{ => Status}/StatusInfoDialog.svelte | 0 .../components/Transactions/Status/index.ts | 2 + .../Transactions/Transaction.svelte | 150 +- .../Transactions/Transactions.svelte | 30 +- packages/bridge-ui-v2/src/i18n/en.json | 90 +- .../bridge-ui-v2/src/libs/bridge/Bridge.ts | 64 +- .../src/libs/bridge/ERC1155Bridge.ts | 109 +- .../src/libs/bridge/ERC20Bridge.ts | 159 +- .../src/libs/bridge/ERC721Bridge.ts | 128 +- .../bridge-ui-v2/src/libs/bridge/ETHBridge.ts | 81 +- .../bridge-ui-v2/src/libs/bridge/bridges.ts | 15 + .../src/libs/bridge/checkBalanceToBridge.ts | 115 +- .../src/libs/bridge/estimateCostOfBridging.ts | 5 +- .../bridge-ui-v2/src/libs/bridge/fetchNFTs.ts | 3 +- .../src/libs/bridge/getBridgeArgs.ts | 32 +- .../libs/bridge/isTransactionProcessable.ts | 19 +- .../src/libs/bridge/messageStatusPoller.ts | 10 +- .../bridge-ui-v2/src/libs/bridge/types.ts | 5 +- .../bridge-ui-v2/src/libs/chain/chains.ts | 13 +- .../src/libs/connect/web3modal.ts | 8 +- .../customActions/closeOnClickOrEscape.ts | 48 + .../closeOnEscapeOrOutsideClick.ts | 69 +- .../src/libs/customActions/index.ts | 1 + .../bridge-ui-v2/src/libs/error/errors.ts | 20 + .../src/libs/eventIndexer/types.ts | 2 +- .../src/libs/fee/recommendProcessingFee.ts | 90 +- .../src/libs/network/getAlternateNetwork.ts | 37 + .../bridge-ui-v2/src/libs/network/index.ts | 1 + .../src/libs/network/setAlternateNetwork.ts | 18 + .../src/libs/proof/BridgeProver.ts | 32 +- .../src/libs/relayer/RelayerAPIService.ts | 6 +- .../bridge-ui-v2/src/libs/relayer/types.ts | 2 +- .../src/libs/storage/BridgeTxService.ts | 18 +- .../libs/storage/CustomTokenService.test.ts | 2 + .../src/libs/token/checkMintable.test.ts | 128 - .../src/libs/token/checkMintable.ts | 9 +- .../src/libs/token/checkOwnership.ts | 11 +- .../src/libs/token/detectContractType.test.ts | 18 +- .../src/libs/token/detectContractType.ts | 24 +- ...etBalance.test.ts => fetchBalance.test.ts} | 50 +- .../token/{getBalance.ts => fetchBalance.ts} | 30 +- .../src/libs/token/fetchNFTImage.ts | 10 - .../src/libs/token/fetchNFTImageUrl.ts | 169 +- .../src/libs/token/fetchNFTMetadata.ts | 115 + .../src/libs/token/getAddress.test.ts | 61 +- .../bridge-ui-v2/src/libs/token/getAddress.ts | 21 +- ...calInfo.ts => getCanonicalInfoForToken.ts} | 178 +- .../libs/token/getCrossChainAddress.test.ts | 160 - .../src/libs/token/getCrossChainAddress.ts | 147 - .../src/libs/token/getTokenAddresses.ts | 136 + .../src/libs/token/getTokenApprovalStatus.ts | 44 +- .../token/getTokenWithInfoFromAddress.test.ts | 47 +- .../libs/token/getTokenWithInfoFromAddress.ts | 74 +- packages/bridge-ui-v2/src/libs/token/index.ts | 3 +- .../src/libs/token/isDeployedCrossChain.ts | 24 - .../src/libs/token/mapTransactionHashToNFT.ts | 73 + .../bridge-ui-v2/src/libs/token/mint.test.ts | 51 - packages/bridge-ui-v2/src/libs/token/mint.ts | 5 +- packages/bridge-ui-v2/src/libs/token/types.ts | 8 +- .../src/libs/util/balance.test.ts | 2 + .../bridge-ui-v2/src/libs/util/balance.ts | 11 +- .../libs/util/checkForPausedContracts.test.ts | 21 +- .../src/libs/util/checkForPausedContracts.ts | 32 +- .../src/libs/util/fetchNFTMetadata.ts | 129 - .../src/libs/util/getConnectedWallet.ts | 3 +- .../src/libs/util/parseNFTMetadata.ts | 3 +- .../src/libs/util/resolveIPFSUri.ts | 31 + .../src/libs/util/safeReadContract.ts | 6 +- .../bridge-ui-v2/src/libs/wagmi/client.ts | 20 +- .../bridge-ui-v2/src/libs/wagmi/watcher.ts | 57 +- .../bridge-ui-v2/src/routes/+layout.svelte | 18 +- packages/bridge-ui-v2/src/stores/account.ts | 6 +- .../bridge-ui-v2/src/stores/bridgedToken.ts | 32 + packages/bridge-ui-v2/src/stores/canonical.ts | 32 - packages/bridge-ui-v2/src/stores/index.ts | 2 +- packages/bridge-ui-v2/src/stores/metadata.ts | 3 +- packages/bridge-ui-v2/src/stores/network.ts | 6 +- .../src/stores/pendingTransactions.ts | 9 +- packages/bridge-ui-v2/src/stores/tokenInfo.ts | 50 + .../bridge-ui-v2/src/styles/components.css | 2 +- packages/bridge-ui-v2/src/styles/gimmicks.css | 85 + packages/bridge-ui-v2/src/styles/override.css | 1 + .../bridge-ui-v2/src/styles/utilities.css | 2 +- packages/bridge-ui-v2/tailwind.config.js | 5 +- packages/bridge-ui-v2/wagmi.config.ts | 5 - packages/eventindexer/docs/swagger.json | 610 ++- packages/eventindexer/docs/swagger.yaml | 108 +- .../src/styles/utilities.css | 4 - packages/relayer/docs/swagger.json | 270 +- packages/relayer/docs/swagger.yaml | 56 +- pnpm-lock.yaml | 3938 +++++++++++++---- 176 files changed, 8541 insertions(+), 5101 deletions(-) create mode 100644 packages/bridge-ui-v2/__mocks__/viem.ts delete mode 100644 packages/bridge-ui-v2/src/components/Bridge/Actions.svelte create mode 100644 packages/bridge-ui-v2/src/components/Bridge/FungibleBridge.svelte create mode 100644 packages/bridge-ui-v2/src/components/Bridge/FungibleBridgeComponents/ImportStep/ImportStep.svelte create mode 100644 packages/bridge-ui-v2/src/components/Bridge/FungibleBridgeComponents/ImportStep/TokenInput/TokenInput.svelte create mode 100644 packages/bridge-ui-v2/src/components/Bridge/FungibleBridgeComponents/ReviewStep/ReviewStep.svelte create mode 100644 packages/bridge-ui-v2/src/components/Bridge/FungibleBridgeComponents/StepNavigation/StepBack.svelte create mode 100644 packages/bridge-ui-v2/src/components/Bridge/FungibleBridgeComponents/StepNavigation/StepNavigation.svelte create mode 100644 packages/bridge-ui-v2/src/components/Bridge/FungibleBridgeComponents/index.ts rename packages/bridge-ui-v2/src/components/Bridge/{ => NFTBridgeComponents}/IDInput/IDInput.svelte (75%) rename packages/bridge-ui-v2/src/components/Bridge/{ => NFTBridgeComponents}/IDInput/state.ts (100%) create mode 100644 packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/ImportStep/ImportActions.svelte create mode 100644 packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/ImportStep/ImportStep.svelte create mode 100644 packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/ImportStep/ManualImport.svelte create mode 100644 packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/ImportStep/ScannedImport.svelte create mode 100644 packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/ImportStep/state.ts rename packages/bridge-ui-v2/src/components/Bridge/{NFTBridgeSteps => NFTBridgeComponents/ReviewStep}/ReviewStep.svelte (66%) create mode 100644 packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/StepNavigation/StepBack.svelte create mode 100644 packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/StepNavigation/StepNavigation.svelte create mode 100644 packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/index.ts delete mode 100644 packages/bridge-ui-v2/src/components/Bridge/NFTBridgeSteps/ConfirmationStep.svelte delete mode 100644 packages/bridge-ui-v2/src/components/Bridge/NFTBridgeSteps/ImportStep.svelte delete mode 100644 packages/bridge-ui-v2/src/components/Bridge/NFTBridgeSteps/index.ts create mode 100644 packages/bridge-ui-v2/src/components/Bridge/SharedBridgeComponents/Actions.svelte rename packages/bridge-ui-v2/src/components/Bridge/{ => SharedBridgeComponents}/AddressInput/AddressInput.svelte (97%) rename packages/bridge-ui-v2/src/components/Bridge/{ => SharedBridgeComponents}/AddressInput/state.ts (100%) create mode 100644 packages/bridge-ui-v2/src/components/Bridge/SharedBridgeComponents/ConfirmationStep/ConfirmationStep.svelte rename packages/bridge-ui-v2/src/components/Bridge/{ => SharedBridgeComponents}/ProcessingFee/NoneOption.svelte (78%) rename packages/bridge-ui-v2/src/components/Bridge/{ => SharedBridgeComponents}/ProcessingFee/ProcessingFee.svelte (88%) rename packages/bridge-ui-v2/src/components/Bridge/{ => SharedBridgeComponents}/ProcessingFee/RecommendedFee.svelte (78%) rename packages/bridge-ui-v2/src/components/Bridge/{ => SharedBridgeComponents}/ProcessingFee/index.ts (100%) rename packages/bridge-ui-v2/src/components/Bridge/{ => SharedBridgeComponents/RecipientStep}/Recipient.svelte (97%) rename packages/bridge-ui-v2/src/components/Bridge/{NFTBridgeSteps => SharedBridgeComponents/RecipientStep}/RecipientStep.svelte (82%) create mode 100644 packages/bridge-ui-v2/src/components/Bridge/SharedBridgeComponents/index.ts rename packages/bridge-ui-v2/src/components/Bridge/{Amount.svelte => TokenAmountInput.svelte} (53%) delete mode 100644 packages/bridge-ui-v2/src/components/ChainSelector/ChainSelector.svelte delete mode 100644 packages/bridge-ui-v2/src/components/ChainSelector/ChainSelectorWrapper.svelte delete mode 100644 packages/bridge-ui-v2/src/components/ChainSelector/index.ts create mode 100644 packages/bridge-ui-v2/src/components/ChainSelectors/ChainPill/ChainPill.svelte create mode 100644 packages/bridge-ui-v2/src/components/ChainSelectors/ChainSelector.svelte create mode 100644 packages/bridge-ui-v2/src/components/ChainSelectors/CombinedChainSelector/CombinedChainSelector.svelte create mode 100644 packages/bridge-ui-v2/src/components/ChainSelectors/SelectorDialogs/ChainsDialog.svelte create mode 100644 packages/bridge-ui-v2/src/components/ChainSelectors/SelectorDialogs/ChainsDropdown.svelte rename packages/bridge-ui-v2/src/components/{Bridge => ChainSelectors/SwitchChainsButton}/SwitchChainsButton.svelte (60%) create mode 100644 packages/bridge-ui-v2/src/components/ChainSelectors/index.ts create mode 100644 packages/bridge-ui-v2/src/components/ChainSelectors/types.ts rename packages/bridge-ui-v2/src/components/Transactions/{ => Filter}/StatusFilterDialog.svelte (100%) rename packages/bridge-ui-v2/src/components/Transactions/{ => Filter}/StatusFilterDropdown.svelte (95%) create mode 100644 packages/bridge-ui-v2/src/components/Transactions/Filter/index.ts rename packages/bridge-ui-v2/src/components/Transactions/{ => Status}/Status.svelte (92%) rename packages/bridge-ui-v2/src/components/Transactions/{ => Status}/StatusInfoDialog.svelte (100%) create mode 100644 packages/bridge-ui-v2/src/components/Transactions/Status/index.ts create mode 100644 packages/bridge-ui-v2/src/libs/customActions/closeOnClickOrEscape.ts create mode 100644 packages/bridge-ui-v2/src/libs/network/getAlternateNetwork.ts create mode 100644 packages/bridge-ui-v2/src/libs/network/index.ts create mode 100644 packages/bridge-ui-v2/src/libs/network/setAlternateNetwork.ts delete mode 100644 packages/bridge-ui-v2/src/libs/token/checkMintable.test.ts rename packages/bridge-ui-v2/src/libs/token/{getBalance.test.ts => fetchBalance.test.ts} (69%) rename packages/bridge-ui-v2/src/libs/token/{getBalance.ts => fetchBalance.ts} (53%) delete mode 100644 packages/bridge-ui-v2/src/libs/token/fetchNFTImage.ts create mode 100644 packages/bridge-ui-v2/src/libs/token/fetchNFTMetadata.ts rename packages/bridge-ui-v2/src/libs/token/{getCanonicalInfo.ts => getCanonicalInfoForToken.ts} (71%) delete mode 100644 packages/bridge-ui-v2/src/libs/token/getCrossChainAddress.test.ts delete mode 100644 packages/bridge-ui-v2/src/libs/token/getCrossChainAddress.ts create mode 100644 packages/bridge-ui-v2/src/libs/token/getTokenAddresses.ts delete mode 100644 packages/bridge-ui-v2/src/libs/token/isDeployedCrossChain.ts create mode 100644 packages/bridge-ui-v2/src/libs/token/mapTransactionHashToNFT.ts delete mode 100644 packages/bridge-ui-v2/src/libs/token/mint.test.ts delete mode 100644 packages/bridge-ui-v2/src/libs/util/fetchNFTMetadata.ts create mode 100644 packages/bridge-ui-v2/src/libs/util/resolveIPFSUri.ts create mode 100644 packages/bridge-ui-v2/src/stores/bridgedToken.ts delete mode 100644 packages/bridge-ui-v2/src/stores/canonical.ts create mode 100644 packages/bridge-ui-v2/src/stores/tokenInfo.ts create mode 100644 packages/bridge-ui-v2/src/styles/gimmicks.css diff --git a/packages/bridge-ui-v2/.env.example b/packages/bridge-ui-v2/.env.example index 37f6154085..23fdf490c9 100644 --- a/packages/bridge-ui-v2/.env.example +++ b/packages/bridge-ui-v2/.env.example @@ -11,6 +11,9 @@ export PUBLIC_WALLETCONNECT_PROJECT_ID="" export PUBLIC_NFT_BRIDGE_ENABLED="" export PUBLIC_NFT_BATCH_TRANSFERS_ENABLED="" +# comma separated list of IPFS gateways, e.g. "https://ipfs.io,https://cloudflare-ipfs.com",... +export PUBLIC_IPFS_GATEWAYS="" + # Sentry export PUBLIC_SENTRY_DSN=https:// export SENTRY_ORG= diff --git a/packages/bridge-ui-v2/README.md b/packages/bridge-ui-v2/README.md index 0d08ed3e88..3e508e1912 100644 --- a/packages/bridge-ui-v2/README.md +++ b/packages/bridge-ui-v2/README.md @@ -6,6 +6,7 @@ This package contains the Bridge UI built with svelte and wagmi - [Development setup](#development-setup) - [Set up environment variables](#set-up-environment-variables) - [Set up configurations](#set-up-configurations) + - [Optional flags](#optional-flags) - [Start a development server:](#start-a-development-server) - [Building](#building) @@ -48,6 +49,7 @@ These are the additional configuration files that have to be filled in: | **/config/configuredBridges.json** | Defines the chains that are connected via taiko bridges and lists the contract addresses | | **/config/configuredChains.json** | Defines some metadata for the chains, such as name, icons, explorer URL, etc. | | **/config/configuredRelayer.json** | If chains have a relayer, the URL and the chain IDs it covers are entered here | +| **/config/configuredEventIndexer.json** | NFT Indexer we can query to help with importing NFTs | | **/config/configuredCustomTokens.json** | Defines a list of tokens that should be available in the token dropdowns | --- @@ -81,6 +83,30 @@ To get started, open your terminal in `/packages/bridge-ui-v2/` **Beware**, that if you make changes to the json files, you need to export them to the .env again via script.
+#### Optional flags + +```bash +pnpm export:config -- -- +``` + +You can store multiple configs in subfolders, currently the script accepts: +`--a5`, `--a6` for version and `--dev`, `--prod` for env + +The folder structure should look like this then: + +``` +config/ +|-- dev/ +| |-- a5/ +| |-- a6/ +|-- prod/ +| |-- a5/ +| |-- a6/ +``` + +More could be configured manually in `scripts/exportJsonToEnv.js` +
+ ### Start a development server: ```bash @@ -88,6 +114,10 @@ pnpm dev # or start the server and open the app in a new browser tab pnpm dev -- --open + +# if you want to expose the IP to your network you can use this flag +pnpm dev --host + ``` ## Building @@ -95,9 +125,9 @@ pnpm dev -- --open To create a production version of your app: ```bash -npm run build +pnpm run build ``` -You can preview the production build with `npm run preview`. +You can preview the production build with `pnpm run preview`. To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment. diff --git a/packages/bridge-ui-v2/__mocks__/@wagmi/core.ts b/packages/bridge-ui-v2/__mocks__/@wagmi/core.ts index f125fa957b..876af31d54 100644 --- a/packages/bridge-ui-v2/__mocks__/@wagmi/core.ts +++ b/packages/bridge-ui-v2/__mocks__/@wagmi/core.ts @@ -8,9 +8,9 @@ export const getPublicClient = vi.fn(); export const getContract = vi.fn(); -export const fetchBalance = vi.fn(); +export const getBalance = vi.fn(); -export const fetchToken = vi.fn(); +export const getToken = vi.fn(); export const readContract = vi.fn(); @@ -43,3 +43,13 @@ export const configureChains = vi.fn().mockReturnValue({ export const defaultWagmiConfig = vi.fn(() => { return 'mockWagmiConfig'; }); + +export const http = vi.fn(); + +export const createConfig = vi.fn(() => { + return { + chains: mockChains, + }; +}); + +export const reconnect = vi.fn(); diff --git a/packages/bridge-ui-v2/__mocks__/viem.ts b/packages/bridge-ui-v2/__mocks__/viem.ts new file mode 100644 index 0000000000..3fbf2ad442 --- /dev/null +++ b/packages/bridge-ui-v2/__mocks__/viem.ts @@ -0,0 +1,3 @@ +import { vi } from 'vitest'; + +export const getContract = vi.fn(); diff --git a/packages/bridge-ui-v2/package.json b/packages/bridge-ui-v2/package.json index a15a666b97..3f3b5e1d1f 100644 --- a/packages/bridge-ui-v2/package.json +++ b/packages/bridge-ui-v2/package.json @@ -17,7 +17,7 @@ "format": "prettier --write .", "lint": "prettier --check . && eslint .", "lint:fix": "pnpm format && eslint . --fix", - "generate:abi": "cd ../protocol && pnpm forge build && cd - && pnpm wagmi generate", + "generate:abi": "cd ../protocol && pnpm forge build --evm-version cancun && cd - && pnpm wagmi generate", "export:config": "pnpm ./scripts/exportJsonToEnv.js" }, "devDependencies": { @@ -30,7 +30,7 @@ "@typescript-eslint/eslint-plugin": "^6.13.2", "@typescript-eslint/parser": "^6.13.2", "@vitest/coverage-v8": "^0.33.0", - "@wagmi/cli": "^1.5.2", + "@wagmi/cli": "^2.1.0", "abitype": "^0.8.11", "ajv": "^8.12.0", "autoprefixer": "^10.4.16", @@ -59,8 +59,10 @@ }, "type": "module", "dependencies": { - "@wagmi/core": "^1.4.13", - "@web3modal/wagmi": "^3.5.3", + "@wagmi/connectors": "^4.1.13", + "@wagmi/core": "^2.6.4", + "@walletconnect/ethereum-provider": "^2.11.1", + "@web3modal/wagmi": "^4.0.1", "@zerodevx/svelte-toast": "^0.9.5", "axios": "^1.6.1", "buffer": "^6.0.3", @@ -68,6 +70,6 @@ "events": "^3.3.0", "object-hash": "^3.0.0", "svelte-i18n": "^3.7.4", - "viem": "^1.18.9" + "viem": "^2.7.8" } } diff --git a/packages/bridge-ui-v2/scripts/exportJsonToEnv.js b/packages/bridge-ui-v2/scripts/exportJsonToEnv.js index 9ab0ce051e..00db08b0a5 100755 --- a/packages/bridge-ui-v2/scripts/exportJsonToEnv.js +++ b/packages/bridge-ui-v2/scripts/exportJsonToEnv.js @@ -9,18 +9,57 @@ const Logger = new LogUtil('exportJsonToEnv'); const envFile = './.env'; -const bridgesPath = 'config/configuredBridges.json'; -const chainsPath = 'config/configuredChains.json'; -const tokensPath = 'config/configuredCustomTokens.json'; -const relayerPath = 'config/configuredRelayer.json'; -const eventIndexerPath = 'config/configuredEventIndexer.json'; +const defaultPaths = { + bridges: 'configuredBridges.json', + chains: 'configuredChains.json', + tokens: 'configuredCustomTokens.json', + relayer: 'configuredRelayer.json', + eventIndexer: 'configuredEventIndexer.json', +}; + +// Parse command line arguments +const args = process.argv.slice(2); +const isLocal = args.includes('--local'); +const isDev = args.includes('--dev'); +const isProd = args.includes('--prod'); +const isA6 = args.includes('--a6'); +const isA5 = args.includes('--a5'); + +// Determine the environment +let environment = ''; +if (isDev) { + environment = 'dev'; +} else if (isProd) { + environment = 'prod'; +} else if (isLocal) { + environment = 'local'; +} + +// Determine the version +let version = ''; +if (isA6) { + version = 'a6'; +} else if (isA5) { + version = 'a5'; +} + +Logger.info(`Detected ${environment} environment and ${version} version.`); + +// Generate paths based on environment and version or create default paths +const paths = {}; +Object.entries(defaultPaths).forEach(([key, value]) => { + const fileName = path.basename(value); + const filePath = path.dirname(value); + const updatedPath = path.join('config', environment, version, filePath, fileName); + paths[key] = updatedPath; +}); // Create a backup of the existing .env file fs.copyFileSync(envFile, `${envFile}.bak`); -const jsonFiles = [bridgesPath, chainsPath, tokensPath, relayerPath, eventIndexerPath]; +Object.entries(paths).forEach(([, value]) => { + const jsonFile = value; -jsonFiles.forEach((jsonFile) => { if (fs.existsSync(jsonFile)) { Logger.info(`Exporting ${jsonFile} to .env file...`); diff --git a/packages/bridge-ui-v2/src/abi/index.ts b/packages/bridge-ui-v2/src/abi/index.ts index 1f88d3413a..884a773301 100644 --- a/packages/bridge-ui-v2/src/abi/index.ts +++ b/packages/bridge-ui-v2/src/abi/index.ts @@ -2791,4 +2791,4 @@ export const freeMintErc20ABI = [ name: 'transferFrom', outputs: [{ name: '', internalType: 'bool', type: 'bool' }], }, -] as const; +] as const; \ No newline at end of file diff --git a/packages/bridge-ui-v2/src/app.config.ts b/packages/bridge-ui-v2/src/app.config.ts index 7d567d0e29..254b547e76 100644 --- a/packages/bridge-ui-v2/src/app.config.ts +++ b/packages/bridge-ui-v2/src/app.config.ts @@ -55,3 +55,8 @@ export const toastConfig = { export const apiService = { timeout: 5000, }; + +export const ipfsConfig = { + gatewayTimeout: 200, + overallTimeout: 5000, +}; diff --git a/packages/bridge-ui-v2/src/app.css b/packages/bridge-ui-v2/src/app.css index 13d7a2df9a..641f0b2456 100644 --- a/packages/bridge-ui-v2/src/app.css +++ b/packages/bridge-ui-v2/src/app.css @@ -2,3 +2,4 @@ @import './styles/components.css'; @import './styles/utilities.css'; @import './styles/override.css'; +@import './styles/gimmicks.css'; diff --git a/packages/bridge-ui-v2/src/components/AccountConnectionToast/AccountConnectionToast.svelte b/packages/bridge-ui-v2/src/components/AccountConnectionToast/AccountConnectionToast.svelte index 34be1eca94..b1f4df6273 100644 --- a/packages/bridge-ui-v2/src/components/AccountConnectionToast/AccountConnectionToast.svelte +++ b/packages/bridge-ui-v2/src/components/AccountConnectionToast/AccountConnectionToast.svelte @@ -9,7 +9,16 @@ // when the account is connected or disconnected via toast function onAccountChange(newAccount: Account, oldAccount?: Account) { if (newAccount?.isConnected) { - successToast({ title: $t('messages.account.connected') }); + if (newAccount.chain === oldAccount?.chain) { + // if the chain stays the same, we switched accounts + successToast({ title: $t('messages.account.connected') }); + } else { + // otherwise we switched chains + successToast({ + title: $t('messages.network.success.title'), + message: $t('messages.network.success.message', { values: { chainName: newAccount.chain?.name } }), + }); + } } else if (oldAccount && newAccount?.isDisconnected) { // We check if there was previous account, if not // the user just hit the app, and there is no need diff --git a/packages/bridge-ui-v2/src/components/Bridge/Actions.svelte b/packages/bridge-ui-v2/src/components/Bridge/Actions.svelte deleted file mode 100644 index a4db9babfd..0000000000 --- a/packages/bridge-ui-v2/src/components/Bridge/Actions.svelte +++ /dev/null @@ -1,215 +0,0 @@ - - -{#if oldStyle} - - -
- {#if !$selectedTokenIsBridged && $selectedToken && !isETH} - - {#if $validatingAmount && !approving} - {$t('bridge.button.validating')}. - {/if} - {#if approving} - {$t('bridge.button.approving')} - {:else if $allApproved && !$validatingAmount && $enteredAmount > 0} -
- - {$t('bridge.button.approved')} -
- {:else if !$validatingAmount} - {$t('bridge.button.approve')} - {/if} -
- - {/if} - - {#if bridging} - {$t('bridge.button.bridging')} - {:else} - {$t('bridge.button.bridge')} - {/if} - -
-{:else} - - -
- {#if $selectedToken && !isETH && !$selectedTokenIsBridged} - - {#if approving} - {$t('bridge.button.approving')} - {:else if $allApproved} -
- - {$t('bridge.button.approved')} -
- {:else} - {$t('bridge.button.approve')} - {/if} -
- {/if} - - {#if bridging} - {$t('bridge.button.bridging')} - {:else} - {$t('bridge.button.bridge')} - {/if} - -
-{/if} diff --git a/packages/bridge-ui-v2/src/components/Bridge/Bridge.svelte b/packages/bridge-ui-v2/src/components/Bridge/Bridge.svelte index a59a7ed5b8..91b5b1dfd8 100644 --- a/packages/bridge-ui-v2/src/components/Bridge/Bridge.svelte +++ b/packages/bridge-ui-v2/src/components/Bridge/Bridge.svelte @@ -1,298 +1,12 @@ - {#if $activeBridge === BridgeTypes.FUNGIBLE} - -
-
- -
- - {#if displayL1Warning} - {$t('bridge.alerts.slow_bridging')} - {/if} - - - - - -
- - -
- -
- - -
- - - -{:else if $activeBridge === BridgeTypes.NFT} - + +{:else} + {/if} - - - diff --git a/packages/bridge-ui-v2/src/components/Bridge/FungibleBridge.svelte b/packages/bridge-ui-v2/src/components/Bridge/FungibleBridge.svelte new file mode 100644 index 0000000000..a69f35b33d --- /dev/null +++ b/packages/bridge-ui-v2/src/components/Bridge/FungibleBridge.svelte @@ -0,0 +1,66 @@ + + +
+ + {$t('bridge.step.import.title')} + {$t('bridge.step.review.title')} + {$t('bridge.step.confirm.title')} + + + +
+ {#if activeStep === BridgeSteps.IMPORT} + + + {:else if activeStep === BridgeSteps.REVIEW} + + + {:else if activeStep === BridgeSteps.RECIPIENT} + + + {:else if activeStep === BridgeSteps.CONFIRM} + + + {/if} + + +
+
+
diff --git a/packages/bridge-ui-v2/src/components/Bridge/FungibleBridgeComponents/ImportStep/ImportStep.svelte b/packages/bridge-ui-v2/src/components/Bridge/FungibleBridgeComponents/ImportStep/ImportStep.svelte new file mode 100644 index 0000000000..db48080294 --- /dev/null +++ b/packages/bridge-ui-v2/src/components/Bridge/FungibleBridgeComponents/ImportStep/ImportStep.svelte @@ -0,0 +1,14 @@ + + + + + diff --git a/packages/bridge-ui-v2/src/components/Bridge/FungibleBridgeComponents/ImportStep/TokenInput/TokenInput.svelte b/packages/bridge-ui-v2/src/components/Bridge/FungibleBridgeComponents/ImportStep/TokenInput/TokenInput.svelte new file mode 100644 index 0000000000..0c71abda6d --- /dev/null +++ b/packages/bridge-ui-v2/src/components/Bridge/FungibleBridgeComponents/ImportStep/TokenInput/TokenInput.svelte @@ -0,0 +1,307 @@ + + +
+
+ {$t('inputs.amount.label')} + + {$t('common.balance')}: + {#if $errorComputingBalance && !$computingBalance} + {$t('common.not_available_short')} + {:else if $computingBalance} + + {:else} + {balance} + {/if} + +
+
+
+ + handleAmountInputChange(value)} + bind:this={inputBox} + class="min-h-[64px] pl-[15px] w-full border-0 h-full !rounded-r-none z-20 {$$props.class}" /> + + +
+ + + +
+ + + +
+ +
+ {#if displayFeeMsg} +
+ {$t('recipient.label')} +
+ {:else if showInsufficientBalanceAlert} + + {:else if showInvalidTokenAlert} + + {:else} + + {/if} +
+
+ + + + + diff --git a/packages/bridge-ui-v2/src/components/Bridge/FungibleBridgeComponents/ReviewStep/ReviewStep.svelte b/packages/bridge-ui-v2/src/components/Bridge/FungibleBridgeComponents/ReviewStep/ReviewStep.svelte new file mode 100644 index 0000000000..17a5dd1a86 --- /dev/null +++ b/packages/bridge-ui-v2/src/components/Bridge/FungibleBridgeComponents/ReviewStep/ReviewStep.svelte @@ -0,0 +1,80 @@ + + +
+
+
{$t('bridge.nft.step.review.transfer_details')}
+ {$t('common.edit')} +
+
+
+
{$t('common.from')}
+
{$connectedSourceChain?.name}
+
+ +
+
{$t('common.to')}
+
{$destChain?.name}
+
+ +
+
{$t('common.amount')}
+
{renderedDisplay}
+
+ +
+
{$t('common.name')}
+
{$selectedToken?.symbol}
+
+
+
+ +{#if displayL1Warning} + {$t('bridge.alerts.slow_bridging')} +{/if} + +
+ +
+
+
{$t('bridge.nft.step.review.recipient_details')}
+ +
+ + +
+ +
diff --git a/packages/bridge-ui-v2/src/components/Bridge/FungibleBridgeComponents/StepNavigation/StepBack.svelte b/packages/bridge-ui-v2/src/components/Bridge/FungibleBridgeComponents/StepNavigation/StepBack.svelte new file mode 100644 index 0000000000..85ea940620 --- /dev/null +++ b/packages/bridge-ui-v2/src/components/Bridge/FungibleBridgeComponents/StepNavigation/StepBack.svelte @@ -0,0 +1,6 @@ + + + diff --git a/packages/bridge-ui-v2/src/components/Bridge/FungibleBridgeComponents/StepNavigation/StepNavigation.svelte b/packages/bridge-ui-v2/src/components/Bridge/FungibleBridgeComponents/StepNavigation/StepNavigation.svelte new file mode 100644 index 0000000000..fda2738caf --- /dev/null +++ b/packages/bridge-ui-v2/src/components/Bridge/FungibleBridgeComponents/StepNavigation/StepNavigation.svelte @@ -0,0 +1,100 @@ + + +{#if showStepNavigation} +
+ {#if activeStep === BridgeSteps.IMPORT} +
+ handleNextStep()}> + {nextStepButtonText} + + {/if} + {#if activeStep === BridgeSteps.REVIEW} + handleNextStep()}> + {nextStepButtonText} + + + handlePreviousStep()}> + {$t('common.back')} + + {/if} + + {#if activeStep === BridgeSteps.RECIPIENT} + handleNextStep()}> + {nextStepButtonText} + + {/if} + + {#if activeStep === BridgeSteps.CONFIRM} + {#if bridgingStatus === BridgingStatus.DONE} + handleNextStep()}> + {nextStepButtonText} + + {:else} + handlePreviousStep()}> + {$t('common.back')} + + {/if} + {/if} +
+{/if} diff --git a/packages/bridge-ui-v2/src/components/Bridge/FungibleBridgeComponents/index.ts b/packages/bridge-ui-v2/src/components/Bridge/FungibleBridgeComponents/index.ts new file mode 100644 index 0000000000..f0d41ac5d0 --- /dev/null +++ b/packages/bridge-ui-v2/src/components/Bridge/FungibleBridgeComponents/index.ts @@ -0,0 +1,3 @@ +export { default as ImportStep } from './ImportStep/ImportStep.svelte'; +export { default as ReviewStep } from './ReviewStep/ReviewStep.svelte'; +export { default as StepNavigation } from './StepNavigation/StepNavigation.svelte'; diff --git a/packages/bridge-ui-v2/src/components/Bridge/NFTBridge.svelte b/packages/bridge-ui-v2/src/components/Bridge/NFTBridge.svelte index d5c49ab1df..ef47daeeef 100644 --- a/packages/bridge-ui-v2/src/components/Bridge/NFTBridge.svelte +++ b/packages/bridge-ui-v2/src/components/Bridge/NFTBridge.svelte @@ -1,55 +1,51 @@
- {$t('bridge.nft.step.import.title')} - {$t('bridge.nft.step.review.title')} - {$t('bridge.nft.step.confirm.title')} + {$t('bridge.step.import.title')} + {$t('bridge.step.review.title')} + {$t('bridge.step.confirm.title')}
- - {#if activeStep === NFTSteps.IMPORT} - + {#if activeStep === BridgeSteps.IMPORT} + + + {:else if activeStep === BridgeSteps.REVIEW} - {:else if activeStep === NFTSteps.REVIEW} + {:else if activeStep === BridgeSteps.RECIPIENT} - {:else if activeStep === NFTSteps.RECIPIENT} + {:else if activeStep === BridgeSteps.CONFIRM} - {:else if activeStep === NFTSteps.CONFIRM} {/if} - - {#if activeStep === NFTSteps.REVIEW} -
- (activeStep = NFTSteps.CONFIRM)}> - {nextStepButtonText} - - -
- {:else if activeStep === NFTSteps.IMPORT} - {#if importMethod === ImportMethod.MANUAL} -
- -
- {nextStepButtonText} - - -
- {:else if scanned && foundNFTs.length > 0} -
-
- - {nextStepButtonText} - - -
- {/if} - {:else if activeStep === NFTSteps.RECIPIENT} -
- (activeStep = NFTSteps.REVIEW)} - >{nextStepButtonText} - - - -
- {:else if activeStep === NFTSteps.CONFIRM} -
- {#if bridgingStatus === 'done'} - {$t('bridge.nft.step.confirm.button.back')} - - {:else} - - {/if} -
- {/if} + +
diff --git a/packages/bridge-ui-v2/src/components/Bridge/IDInput/IDInput.svelte b/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/IDInput/IDInput.svelte similarity index 75% rename from packages/bridge-ui-v2/src/components/Bridge/IDInput/IDInput.svelte rename to packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/IDInput/IDInput.svelte index afcd380ab3..af08bec130 100644 --- a/packages/bridge-ui-v2/src/components/Bridge/IDInput/IDInput.svelte +++ b/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/IDInput/IDInput.svelte @@ -3,6 +3,7 @@ import { t } from 'svelte-i18n'; import { Icon } from '$components/Icon'; + import InputBox from '$components/InputBox/InputBox.svelte'; import { uid } from '$libs/util/uid'; import { IDInputState as State } from './state'; @@ -11,7 +12,9 @@ export let isDisabled = false; export let enteredIds: number[] = []; export let limit = 1; - export let state: State = State.DEFAULT; + // export let state: State = State.DEFAULT; + + let typeClass = ''; export const clearIds = () => { enteredIds = []; @@ -46,7 +49,9 @@ dispatch('inputValidation'); } - $: typeClass = state === State.VALID ? 'success' : state === State.INVALID ? 'error' : ''; + $: state = State.DEFAULT; + + $: typeClass = state === State.INVALID ? 'error' : ''; onDestroy(() => { clearIds(); @@ -58,16 +63,18 @@
- validateInput(e.target)} - class="w-full input-box withValdiation py-6 pr-16 px-[26px] title-subsection-bold placeholder:text-tertiary-content {typeClass} {$$props.class}" /> - + class="withValdiation w-full input-box py-6 pr-16 px-[26px] {typeClass} {$$props.class}" /> + {#if enteredIds && enteredIds.length > 0} + + {/if}
diff --git a/packages/bridge-ui-v2/src/components/Bridge/IDInput/state.ts b/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/IDInput/state.ts similarity index 100% rename from packages/bridge-ui-v2/src/components/Bridge/IDInput/state.ts rename to packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/IDInput/state.ts diff --git a/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/ImportStep/ImportActions.svelte b/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/ImportStep/ImportActions.svelte new file mode 100644 index 0000000000..a0707919c6 --- /dev/null +++ b/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/ImportStep/ImportActions.svelte @@ -0,0 +1,66 @@ + + +
+ {#if firstScan} + + {$t('bridge.actions.nft_scan')} + + + ($selectedImportMethod = ImportMethod.MANUAL)}> + {$t('bridge.actions.nft_manual')} + + {:else} + + (async () => { + await scanForNFTs(); + })()}> + {$t('bridge.actions.nft_scan_again')} + + + ($selectedImportMethod = ImportMethod.MANUAL)}> + {$t('bridge.actions.nft_manual')} + + + +

{$t('bridge.nft.step.import.no_nft_found')}

+
+ {/if} +
diff --git a/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/ImportStep/ImportStep.svelte b/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/ImportStep/ImportStep.svelte new file mode 100644 index 0000000000..6f58217612 --- /dev/null +++ b/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/ImportStep/ImportStep.svelte @@ -0,0 +1,65 @@ + + +
+ +
+ +
+{#if $selectedImportMethod === ImportMethod.MANUAL} + +{:else if $selectedImportMethod === ImportMethod.SCAN} + +{:else} + +{/if} diff --git a/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/ImportStep/ManualImport.svelte b/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/ImportStep/ManualImport.svelte new file mode 100644 index 0000000000..323c702e4c --- /dev/null +++ b/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/ImportStep/ManualImport.svelte @@ -0,0 +1,195 @@ + + + + + +
+ + +
+ {#if displayOwnershipError} + + {/if} +
+
+{#if showNFTAmountInput && !isDisabled} + +{/if} +
diff --git a/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/ImportStep/ScannedImport.svelte b/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/ImportStep/ScannedImport.svelte new file mode 100644 index 0000000000..3bc5211259 --- /dev/null +++ b/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/ImportStep/ScannedImport.svelte @@ -0,0 +1,118 @@ + + +{$selectedNFTs?.length}
+validBalance {validBalance}
+$enteredAmount gt 0 {$enteredAmount > 0}
+has amount {nftHasAmount}
+(nftHasAmount ? $enteredAmount gt 0 : true) {nftHasAmount ? $enteredAmount > 0 : true}
+{hasSelectedNFT && (nftHasAmount ? $enteredAmount > 0 : true)} + +
+
+
+

+ {$t('bridge.nft.step.import.scan_screen.title', { values: { number: foundNFTs.length } })} +

+
+ + + +
+
+
+ +
+
+ {#if nftHasAmount} +
+ +
+ {/if} + +
+

{$t('bridge.nft.step.import.scan_screen.description')}

+ + {$t('common.add')} + +
+
diff --git a/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/ImportStep/state.ts b/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/ImportStep/state.ts new file mode 100644 index 0000000000..f3b70047ea --- /dev/null +++ b/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/ImportStep/state.ts @@ -0,0 +1,5 @@ +import { writable } from 'svelte/store'; + +import { ImportMethod } from '$components/Bridge/types'; + +export const selectedImportMethod = writable(ImportMethod.NONE); diff --git a/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeSteps/ReviewStep.svelte b/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/ReviewStep/ReviewStep.svelte similarity index 66% rename from packages/bridge-ui-v2/src/components/Bridge/NFTBridgeSteps/ReviewStep.svelte rename to packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/ReviewStep/ReviewStep.svelte index e721cc7549..4d76c7d378 100644 --- a/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeSteps/ReviewStep.svelte +++ b/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/ReviewStep/ReviewStep.svelte @@ -3,25 +3,25 @@ import { t } from 'svelte-i18n'; import { chainConfig } from '$chainConfig'; - import { ProcessingFee } from '$components/Bridge/ProcessingFee'; - import Recipient from '$components/Bridge/Recipient.svelte'; - import { - destNetwork as destinationChain, - enteredAmount, - selectedNFTs, - selectedTokenIsBridged, - } from '$components/Bridge/state'; - import { ChainSelector } from '$components/ChainSelector'; + import { Alert } from '$components/Alert'; + import { ProcessingFee, Recipient } from '$components/Bridge/SharedBridgeComponents'; + import { destNetwork as destChain, enteredAmount, selectedNFTs, selectedToken } from '$components/Bridge/state'; + import { ChainSelector, ChainSelectorDirection, ChainSelectorType } from '$components/ChainSelectors'; import { IconFlipper } from '$components/Icon'; import { NFTDisplay } from '$components/NFTs'; - import { getCanonicalInfoForToken } from '$libs/token/getCanonicalInfo'; + import { PUBLIC_SLOW_L1_BRIDGING_WARNING } from '$env/static/public'; + import { LayerType } from '$libs/chain'; + import { fetchNFTImageUrl } from '$libs/token/fetchNFTImageUrl'; import { shortenAddress } from '$libs/util/shortenAddress'; - import { network } from '$stores/network'; + import { connectedSourceChain } from '$stores/network'; export let hasEnoughEth: boolean = false; let recipientComponent: Recipient; let processingFeeComponent: ProcessingFee; + let slowL1Warning = PUBLIC_SLOW_L1_BRIDGING_WARNING || false; + + $: displayL1Warning = slowL1Warning && $destChain?.id && chainConfig[$destChain.id].type === LayerType.L1; const dispatch = createEventDispatcher(); @@ -40,38 +40,51 @@ } }; + const fetchImage = async () => { + if (!$selectedNFTs || $selectedNFTs?.length === 0) return; + const srcChainId = $connectedSourceChain?.id; + const destChainId = $destChain?.id; + if (!srcChainId || !destChainId) return; + + await Promise.all( + $selectedNFTs.map(async (nft) => { + fetchNFTImageUrl(nft).then((nftWithUrl) => { + $selectedToken = nftWithUrl; + $selectedNFTs = [nftWithUrl]; + }); + }), + ); + nftsToDisplay = $selectedNFTs; + }; + const editTransactionDetails = () => { dispatch('editTransactionDetails'); }; + onMount(async () => { + await fetchImage(); + }); + $: nftsToDisplay = $selectedNFTs ? $selectedNFTs : []; // check if any of the selected NFTs are ERC1155 tokens $: isERC1155 = $selectedNFTs ? $selectedNFTs.some((nft) => nft.type === 'ERC1155') : false; - - onMount(async () => { - const srcChainId = $network?.id; - const destChainId = $destinationChain?.id; - const nfts = $selectedNFTs; - if (!nfts || nfts.length === 0 || !srcChainId || !destChainId) return; - const [info] = await Promise.all([getCanonicalInfoForToken({ token: nfts[0], srcChainId, destChainId })]); - - if (info) $selectedTokenIsBridged = nfts[0].addresses[srcChainId] !== info.address; - });
{$t('bridge.nft.step.review.transfer_details')}
+ {$t('common.edit')}
{$t('common.from')}
-
{$network?.name}
+
{$connectedSourceChain?.name}
{$t('common.to')}
-
{$destinationChain?.name}
+
{$destChain?.name}
@@ -79,8 +92,8 @@
    {#each nftsToDisplay as nft} - {@const currentChain = $network?.id} - {#if currentChain && $destinationChain?.id} + {@const currentChain = $connectedSourceChain?.id} + {#if currentChain && $destChain?.id}
+{#if displayL1Warning} + {$t('bridge.alerts.slow_bridging')} +{/if} +
- {$t('bridge.nft.step.review.your_tokens')} - + +
{$t('bridge.nft.step.review.recipient_details')}
- +
diff --git a/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/StepNavigation/StepBack.svelte b/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/StepNavigation/StepBack.svelte new file mode 100644 index 0000000000..85ea940620 --- /dev/null +++ b/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/StepNavigation/StepBack.svelte @@ -0,0 +1,6 @@ + + + diff --git a/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/StepNavigation/StepNavigation.svelte b/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/StepNavigation/StepNavigation.svelte new file mode 100644 index 0000000000..5cf0d761a6 --- /dev/null +++ b/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/StepNavigation/StepNavigation.svelte @@ -0,0 +1,99 @@ + + +{#if showStepNavigation} +
+ {#if activeStep === BridgeSteps.IMPORT} + {#if $selectedImportMethod !== ImportMethod.NONE} + handleNextStep()}> + {nextStepButtonText} + + + ($selectedImportMethod = ImportMethod.NONE)}>{$t('common.back')} + {/if} + {/if} + {#if activeStep === BridgeSteps.REVIEW} + handleNextStep()}> + {nextStepButtonText} + + + handlePreviousStep()}> + {$t('common.back')} + + {/if} + + {#if activeStep === BridgeSteps.RECIPIENT} + handleNextStep()}> + {nextStepButtonText} + + {/if} + + {#if activeStep === BridgeSteps.CONFIRM} + {#if bridgingStatus === BridgingStatus.DONE} + handleNextStep()}> + {nextStepButtonText} + + {:else} + handlePreviousStep()}> + {$t('common.back')} + + {/if} + {/if} +
+{/if} diff --git a/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/index.ts b/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/index.ts new file mode 100644 index 0000000000..f0d41ac5d0 --- /dev/null +++ b/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeComponents/index.ts @@ -0,0 +1,3 @@ +export { default as ImportStep } from './ImportStep/ImportStep.svelte'; +export { default as ReviewStep } from './ReviewStep/ReviewStep.svelte'; +export { default as StepNavigation } from './StepNavigation/StepNavigation.svelte'; diff --git a/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeSteps/ConfirmationStep.svelte b/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeSteps/ConfirmationStep.svelte deleted file mode 100644 index 2ca2b418cd..0000000000 --- a/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeSteps/ConfirmationStep.svelte +++ /dev/null @@ -1,228 +0,0 @@ - - -
-
-
- {#if bridgingStatus === 'done'} - -
- -

{@html statusTitle}

- - {@html statusDescription} -
- {:else if !$allApproved && !approving} - -
-

{$t('bridge.nft.step.confirm.approve.title')}

- {$t('bridge.nft.step.confirm.approve.description')} -
- {:else if bridging || approving} - -
-

{$t('bridge.nft.step.confirm.processing')}

- {$t('bridge.nft.step.confirm.approve.pending')} -
- {:else if $allApproved && !approving && !bridging} - -
-

{$t('bridge.nft.step.confirm.approved.title')}

- {$t('bridge.nft.step.confirm.approved.description')} -
- {/if} -
-
- {#if bridgingStatus !== 'done'} -
-
- -
- {/if} -
diff --git a/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeSteps/ImportStep.svelte b/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeSteps/ImportStep.svelte deleted file mode 100644 index f5cd11a639..0000000000 --- a/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeSteps/ImportStep.svelte +++ /dev/null @@ -1,417 +0,0 @@ - - -
- -
- -{#if displayL1Warning} - {$t('bridge.alerts.slow_bridging')} -{/if} - -{#if importMethod === ImportMethod.MANUAL} -
- - - -
- - -
- {#if displayOwnershipError} - - {/if} -
-
- {#if showNFTAmountInput} - - {/if} -
-{:else} - - - {#if !scanned || nothingFound} -
- -
- {#if scanned} - - (async () => { - await scanForNFTs(); - })()}> - {$t('bridge.actions.nft_scan_again')} - - - changeImportMethod()}> - {$t('bridge.actions.nft_manual')} - - - -

{$t('bridge.nft.step.import.no_nft_found')}

-
- {:else} - - (async () => { - await scanForNFTs(); - })()}> - {$t('bridge.actions.nft_scan')} - - - changeImportMethod()}> - {$t('bridge.actions.nft_manual')} - {/if} -
- {/if} - {#if scanned && foundNFTs.length > 0} -
-
-
-

- {$t('bridge.nft.step.import.scan_screen.title', { values: { number: foundNFTs.length } })} -

-
- - - -
-
-
- -
-
- {#if nftHasAmount} -
- -
- {/if} - -
-

{$t('bridge.nft.step.import.scan_screen.description')}

- changeImportMethod()}> - {$t('common.add')} - -
-
- {/if} -{/if} diff --git a/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeSteps/index.ts b/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeSteps/index.ts deleted file mode 100644 index 21cf32dba7..0000000000 --- a/packages/bridge-ui-v2/src/components/Bridge/NFTBridgeSteps/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export { default as ConfirmationStep } from './ConfirmationStep.svelte'; -export { default as ImportStep } from './ImportStep.svelte'; -export { default as RecipientStep } from './RecipientStep.svelte'; -export { default as ReviewStep } from './ReviewStep.svelte'; diff --git a/packages/bridge-ui-v2/src/components/Bridge/SharedBridgeComponents/Actions.svelte b/packages/bridge-ui-v2/src/components/Bridge/SharedBridgeComponents/Actions.svelte new file mode 100644 index 0000000000..60d843fbe7 --- /dev/null +++ b/packages/bridge-ui-v2/src/components/Bridge/SharedBridgeComponents/Actions.svelte @@ -0,0 +1,154 @@ + + +
+ {#if $selectedToken && !isETH && !$selectedTokenIsBridged} + + {#if approving} + {$t('bridge.button.approving')} + {:else if $allApproved} +
+ + {$t('bridge.button.approved')} +
+ {:else if checking} + {$t('bridge.button.validating')} + {:else} + {$t('bridge.button.approve')} + {/if} +
+ {/if} + + {#if bridging} + {$t('bridge.button.bridging')} + {:else} + {$t('bridge.button.bridge')} + {/if} + +
diff --git a/packages/bridge-ui-v2/src/components/Bridge/AddressInput/AddressInput.svelte b/packages/bridge-ui-v2/src/components/Bridge/SharedBridgeComponents/AddressInput/AddressInput.svelte similarity index 97% rename from packages/bridge-ui-v2/src/components/Bridge/AddressInput/AddressInput.svelte rename to packages/bridge-ui-v2/src/components/Bridge/SharedBridgeComponents/AddressInput/AddressInput.svelte index 87ca97195a..de29b0836e 100644 --- a/packages/bridge-ui-v2/src/components/Bridge/AddressInput/AddressInput.svelte +++ b/packages/bridge-ui-v2/src/components/Bridge/SharedBridgeComponents/AddressInput/AddressInput.svelte @@ -89,7 +89,7 @@ placeholder="0x1B77..." bind:value={ethereumAddress} on:input={validateAddress} - class="w-full input-box withValdiation py-6 pr-16 px-[26px] title-subsection-bold placeholder:text-tertiary-content {classes}" /> + class="w-full input-box withValdiation py-6 pr-16 px-[26px] font-bold placeholder:text-tertiary-content {classes}" /> {#if ethereumAddress} -
- - - - -
diff --git a/packages/bridge-ui-v2/src/components/ChainSelector/ChainSelectorWrapper.svelte b/packages/bridge-ui-v2/src/components/ChainSelector/ChainSelectorWrapper.svelte deleted file mode 100644 index 791c098cac..0000000000 --- a/packages/bridge-ui-v2/src/components/ChainSelector/ChainSelectorWrapper.svelte +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - - - - diff --git a/packages/bridge-ui-v2/src/components/ChainSelector/index.ts b/packages/bridge-ui-v2/src/components/ChainSelector/index.ts deleted file mode 100644 index 8dd0a64e2f..0000000000 --- a/packages/bridge-ui-v2/src/components/ChainSelector/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default as ChainSelector } from './ChainSelector.svelte'; -export { default as ChainSelectorWrapper } from './ChainSelectorWrapper.svelte'; diff --git a/packages/bridge-ui-v2/src/components/ChainSelectors/ChainPill/ChainPill.svelte b/packages/bridge-ui-v2/src/components/ChainSelectors/ChainPill/ChainPill.svelte new file mode 100644 index 0000000000..1276537ccd --- /dev/null +++ b/packages/bridge-ui-v2/src/components/ChainSelectors/ChainPill/ChainPill.svelte @@ -0,0 +1,74 @@ + + +
+
+ {#if label} + + {/if} + +
+ {#if isDesktopOrLarger} + + {:else} + + {/if} +
+ + diff --git a/packages/bridge-ui-v2/src/components/ChainSelectors/ChainSelector.svelte b/packages/bridge-ui-v2/src/components/ChainSelectors/ChainSelector.svelte new file mode 100644 index 0000000000..641a639fe1 --- /dev/null +++ b/packages/bridge-ui-v2/src/components/ChainSelectors/ChainSelector.svelte @@ -0,0 +1,79 @@ + + +{#if type === ChainSelectorType.COMBINED} + +{:else if type === ChainSelectorType.SMALL} + +{/if} + + + diff --git a/packages/bridge-ui-v2/src/components/ChainSelectors/CombinedChainSelector/CombinedChainSelector.svelte b/packages/bridge-ui-v2/src/components/ChainSelectors/CombinedChainSelector/CombinedChainSelector.svelte new file mode 100644 index 0000000000..37feb77cf2 --- /dev/null +++ b/packages/bridge-ui-v2/src/components/ChainSelectors/CombinedChainSelector/CombinedChainSelector.svelte @@ -0,0 +1,109 @@ + + +
+ {#if switchingNetwork} + + {/if} +
+ + {#if isDesktopOrLarger} + + {:else} + + {/if} +
+ + {#if !switchingNetwork} +
+
+ +
+
+ {/if} + +
+ + {#if isDesktopOrLarger} + + {:else} + + {/if} +
+
+ + diff --git a/packages/bridge-ui-v2/src/components/ChainSelectors/SelectorDialogs/ChainsDialog.svelte b/packages/bridge-ui-v2/src/components/ChainSelectors/SelectorDialogs/ChainsDialog.svelte new file mode 100644 index 0000000000..a4c5371e2e --- /dev/null +++ b/packages/bridge-ui-v2/src/components/ChainSelectors/SelectorDialogs/ChainsDialog.svelte @@ -0,0 +1,98 @@ + + + (isOpen = false), uuid: dialogId }}> + diff --git a/packages/bridge-ui-v2/src/components/ChainSelectors/SelectorDialogs/ChainsDropdown.svelte b/packages/bridge-ui-v2/src/components/ChainSelectors/SelectorDialogs/ChainsDropdown.svelte new file mode 100644 index 0000000000..37a7b8e1ae --- /dev/null +++ b/packages/bridge-ui-v2/src/components/ChainSelectors/SelectorDialogs/ChainsDropdown.svelte @@ -0,0 +1,75 @@ + + +
+
    (isOpen = false) }}> + {#each chains as chain (chain.id)} + {@const disabled = (isDestination && chain.id === $connectedSourceChain?.id) || chain.id === value?.id} + {@const icon = chainConfig[Number(chain.id)]?.icon || 'Unknown Chain'} + + {/each} +
+
diff --git a/packages/bridge-ui-v2/src/components/Bridge/SwitchChainsButton.svelte b/packages/bridge-ui-v2/src/components/ChainSelectors/SwitchChainsButton/SwitchChainsButton.svelte similarity index 60% rename from packages/bridge-ui-v2/src/components/Bridge/SwitchChainsButton.svelte rename to packages/bridge-ui-v2/src/components/ChainSelectors/SwitchChainsButton/SwitchChainsButton.svelte index 25b7a4704e..f601e6c709 100644 --- a/packages/bridge-ui-v2/src/components/Bridge/SwitchChainsButton.svelte +++ b/packages/bridge-ui-v2/src/components/ChainSelectors/SwitchChainsButton/SwitchChainsButton.svelte @@ -1,18 +1,22 @@ - diff --git a/packages/bridge-ui-v2/src/components/ChainSelectors/index.ts b/packages/bridge-ui-v2/src/components/ChainSelectors/index.ts new file mode 100644 index 0000000000..88e16772d7 --- /dev/null +++ b/packages/bridge-ui-v2/src/components/ChainSelectors/index.ts @@ -0,0 +1,2 @@ +export { default as ChainSelector } from './ChainSelector.svelte'; +export * from './types'; diff --git a/packages/bridge-ui-v2/src/components/ChainSelectors/types.ts b/packages/bridge-ui-v2/src/components/ChainSelectors/types.ts new file mode 100644 index 0000000000..4899d4c71e --- /dev/null +++ b/packages/bridge-ui-v2/src/components/ChainSelectors/types.ts @@ -0,0 +1,10 @@ +export enum ChainSelectorType { + COMBINED, + SMALL, +} + +export enum ChainSelectorDirection { + SOURCE, + DESTINATION, + BOTH, +} diff --git a/packages/bridge-ui-v2/src/components/ConnectButton/ConnectButton.svelte b/packages/bridge-ui-v2/src/components/ConnectButton/ConnectButton.svelte index 3c73b70e66..ff6ceaaa3e 100644 --- a/packages/bridge-ui-v2/src/components/ConnectButton/ConnectButton.svelte +++ b/packages/bridge-ui-v2/src/components/ConnectButton/ConnectButton.svelte @@ -2,10 +2,17 @@ import { onDestroy, onMount } from 'svelte'; import { t } from 'svelte-i18n'; - import { Button } from '$components/Button'; + import { ActionButton } from '$components/Button'; import { Icon } from '$components/Icon'; + import { getChainImage } from '$libs/chain'; import { web3modal } from '$libs/connect'; + import { refreshUserBalance, renderEthBalance } from '$libs/util/balance'; import { noop } from '$libs/util/noop'; + import { shortenAddress } from '$libs/util/shortenAddress'; + import { account } from '$stores/account'; + import { ethBalance } from '$stores/balance'; + import { connectedSourceChain } from '$stores/network'; + export let connected = false; let web3modalOpen = false; @@ -20,24 +27,64 @@ web3modalOpen = state.open; } - onMount(() => { + $: currentChainId = $connectedSourceChain?.id; + $: accountAddress = $account?.address || ''; + + $: balance = $ethBalance || 0n; + + onMount(async () => { unsubscribeWeb3Modal = web3modal.subscribeState(onWeb3Modal); + await refreshUserBalance(); }); onDestroy(unsubscribeWeb3Modal); {#if connected} - + {:else} - +
+ {/if} + + + diff --git a/packages/bridge-ui-v2/src/components/Faucet/Faucet.svelte b/packages/bridge-ui-v2/src/components/Faucet/Faucet.svelte index 66625a5cd2..a1e5f9c0d0 100644 --- a/packages/bridge-ui-v2/src/components/Faucet/Faucet.svelte +++ b/packages/bridge-ui-v2/src/components/Faucet/Faucet.svelte @@ -1,14 +1,14 @@
- - + +
{#if alertMessage} @@ -204,7 +211,7 @@ {:else} diff --git a/packages/bridge-ui-v2/src/components/InputBox/InputBox.svelte b/packages/bridge-ui-v2/src/components/InputBox/InputBox.svelte index 062438ee87..094a6fcea8 100644 --- a/packages/bridge-ui-v2/src/components/InputBox/InputBox.svelte +++ b/packages/bridge-ui-v2/src/components/InputBox/InputBox.svelte @@ -2,21 +2,23 @@ import { classNames } from '$libs/util/classNames'; export let error = false; + let inputElement: HTMLInputElement; - let input: HTMLInputElement; + export let value: string | number | number[] = ''; + + $: disabled = $$props.disabled || false; let classes = classNames( - 'w-full input-box placeholder:text-tertiary-content bg-neutral-background shadow-none font-bold text-2xl', + 'w-full input-box bg-neutral-background shadow-none placeholder:text-tertiary-content font-bold shadow-none outline-none ', + disabled ? 'cursor-not-allowed ' : 'cursor-pointer', $$props.class, ); // Public API - export const getValue = () => { - return input.value; - }; - export const setValue = (value: string) => (input.value = value); + export const setValue = (value: string) => (inputElement.value = value); + export const getValue = () => inputElement.value; export const clear = () => setValue(''); - export const focus = () => input.focus(); + export const focus = () => inputElement.focus(); - + diff --git a/packages/bridge-ui-v2/src/components/LinkButton/LinkButton.svelte b/packages/bridge-ui-v2/src/components/LinkButton/LinkButton.svelte index e7762bf350..c9d3d64759 100644 --- a/packages/bridge-ui-v2/src/components/LinkButton/LinkButton.svelte +++ b/packages/bridge-ui-v2/src/components/LinkButton/LinkButton.svelte @@ -8,7 +8,7 @@ $: activeClass = active ? 'body-bold bg-primary-interactive text-grey-10 hover:!bg-primary-interactive hover:!text-grey-10' - : 'body-regular hover:bg-secondary-interactive-hover'; + : 'body-regular hover:bg-primary-interactive-hover'; $: classes = classNames('p-3 rounded-full flex justify-start content-center', activeClass, $$props.class); diff --git a/packages/bridge-ui-v2/src/components/NFTs/NFTCards/NFTCard.svelte b/packages/bridge-ui-v2/src/components/NFTs/NFTCards/NFTCard.svelte index 53388c980a..064744e951 100644 --- a/packages/bridge-ui-v2/src/components/NFTs/NFTCards/NFTCard.svelte +++ b/packages/bridge-ui-v2/src/components/NFTs/NFTCards/NFTCard.svelte @@ -10,8 +10,6 @@ const placeholderUrl = '/placeholder.svg'; - $: imageUrl = nft.metadata?.image || placeholderUrl; - let isChecked = false; let modalOpen = false; @@ -22,19 +20,27 @@ }; const handleImageClick = () => { + if (viewOnly) return; selectNFT(nft); }; + let imageLoaded = false; + + function handleImageLoad() { + imageLoaded = true; + } + + $: imageUrl = nft.metadata?.image || placeholderUrl; + $: { isChecked = $selectedNFTs ? $selectedNFTs.some((selected) => selected.tokenId === nft.tokenId) : false; }
- {#if !viewOnly} - {#if isDesktopOrLarger} {:else} - + {/if}
+ +
+ + + diff --git a/packages/bridge-ui-v2/src/components/Transactions/StatusFilterDialog.svelte b/packages/bridge-ui-v2/src/components/Transactions/Filter/StatusFilterDialog.svelte similarity index 100% rename from packages/bridge-ui-v2/src/components/Transactions/StatusFilterDialog.svelte rename to packages/bridge-ui-v2/src/components/Transactions/Filter/StatusFilterDialog.svelte diff --git a/packages/bridge-ui-v2/src/components/Transactions/StatusFilterDropdown.svelte b/packages/bridge-ui-v2/src/components/Transactions/Filter/StatusFilterDropdown.svelte similarity index 95% rename from packages/bridge-ui-v2/src/components/Transactions/StatusFilterDropdown.svelte rename to packages/bridge-ui-v2/src/components/Transactions/Filter/StatusFilterDropdown.svelte index 7841ee3b63..87e4f1d885 100644 --- a/packages/bridge-ui-v2/src/components/Transactions/StatusFilterDropdown.svelte +++ b/packages/bridge-ui-v2/src/components/Transactions/Filter/StatusFilterDropdown.svelte @@ -5,11 +5,13 @@ import { MessageStatus } from '$libs/bridge'; import { closeOnEscapeOrOutsideClick } from '$libs/customActions'; import { classNames } from '$libs/util/classNames'; + import { uid } from '$libs/util/uid'; export let selectedStatus: MessageStatus | null = null; let flipped = false; let menuOpen = false; + let uuid = `dropdown-${uid()}`; let iconFlipperComponent: IconFlipper; const closeMenu = () => { @@ -63,7 +65,7 @@
    (menuOpen = false) }}> + use:closeOnEscapeOrOutsideClick={{ enabled: menuOpen, callback: () => (menuOpen = false), uuid: uuid }}> {#each options as option (option.value)}
+ -
diff --git a/packages/starter-dapp/src/components/ChainDropdown.svelte b/packages/starter-dapp/src/components/ChainDropdown.svelte deleted file mode 100644 index 74219d1345..0000000000 --- a/packages/starter-dapp/src/components/ChainDropdown.svelte +++ /dev/null @@ -1,69 +0,0 @@ - - - diff --git a/packages/starter-dapp/src/components/Loader.svelte b/packages/starter-dapp/src/components/Loader.svelte deleted file mode 100644 index a70c8626ca..0000000000 --- a/packages/starter-dapp/src/components/Loader.svelte +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/packages/starter-dapp/src/components/MessageStatusTooltip.svelte b/packages/starter-dapp/src/components/MessageStatusTooltip.svelte deleted file mode 100644 index 11905df6db..0000000000 --- a/packages/starter-dapp/src/components/MessageStatusTooltip.svelte +++ /dev/null @@ -1,43 +0,0 @@ - - - - -
- A bridge message will pass through various states: -

-
    -
  • - Pending: Your asset is not ready to be bridged. Taiko - A1 => {import.meta.env - ? import.meta.env.VITE_MAINNET_CHAIN_NAME - : "Ethereum A2"} bridging can take several hours before being ready. - {import.meta.env - ? import.meta.env.VITE_MAINNET_CHAIN_NAME - : "Ethereum A2"} => {import.meta.env - ? import.meta.env.VITE_TAIKO_CHAIN_NAME - : "Taiko A2"} should be available to claim within minutes. -
  • -
  • - Claim: Your asset is ready to be claimed on the - destination chain and requires a transaction, or if a processing fee - is set, relayer will pick it up. -
  • -
  • - Claimed: Your asset has finished bridging and is - available to you on the destination chain. -
  • -
  • - Retry: The relayer has failed to process this - message, and you must retry the processing yourself. -
  • -
  • - Release: Your bridged asset is unable to be processed - and is available to you on the source chain. -
  • -
-
-
-
diff --git a/packages/starter-dapp/src/components/Navbar.svelte b/packages/starter-dapp/src/components/Navbar.svelte deleted file mode 100644 index a31761b00b..0000000000 --- a/packages/starter-dapp/src/components/Navbar.svelte +++ /dev/null @@ -1,65 +0,0 @@ - - - diff --git a/packages/starter-dapp/src/components/Tooltip.svelte b/packages/starter-dapp/src/components/Tooltip.svelte deleted file mode 100644 index 1ccae3a015..0000000000 --- a/packages/starter-dapp/src/components/Tooltip.svelte +++ /dev/null @@ -1,11 +0,0 @@ - - - (isOpen = true)} - size="18" - variation="outline" -/> diff --git a/packages/starter-dapp/src/components/buttons/Connect.svelte b/packages/starter-dapp/src/components/buttons/Connect.svelte deleted file mode 100644 index 9a0c9cc0e7..0000000000 --- a/packages/starter-dapp/src/components/buttons/Connect.svelte +++ /dev/null @@ -1,112 +0,0 @@ - - - - - ($isConnectWalletModalOpen = false)} -> -
- {#each $wagmiClient.connectors as connector} - - {/each} -
-
diff --git a/packages/starter-dapp/src/components/icons/CoinbaseWallet.svelte b/packages/starter-dapp/src/components/icons/CoinbaseWallet.svelte deleted file mode 100644 index 01c8968d12..0000000000 --- a/packages/starter-dapp/src/components/icons/CoinbaseWallet.svelte +++ /dev/null @@ -1,5 +0,0 @@ -Coinbase Wallet diff --git a/packages/starter-dapp/src/components/icons/ERC20.svelte b/packages/starter-dapp/src/components/icons/ERC20.svelte deleted file mode 100644 index 3a46357b12..0000000000 --- a/packages/starter-dapp/src/components/icons/ERC20.svelte +++ /dev/null @@ -1,6 +0,0 @@ - - - \ No newline at end of file diff --git a/packages/starter-dapp/src/components/icons/ETH.svelte b/packages/starter-dapp/src/components/icons/ETH.svelte deleted file mode 100644 index e6175b1b4c..0000000000 --- a/packages/starter-dapp/src/components/icons/ETH.svelte +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - diff --git a/packages/starter-dapp/src/components/icons/Horse.svelte b/packages/starter-dapp/src/components/icons/Horse.svelte deleted file mode 100644 index a85f98f06a..0000000000 --- a/packages/starter-dapp/src/components/icons/Horse.svelte +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/starter-dapp/src/components/icons/Loader.svelte b/packages/starter-dapp/src/components/icons/Loader.svelte deleted file mode 100644 index a342c73fe8..0000000000 --- a/packages/starter-dapp/src/components/icons/Loader.svelte +++ /dev/null @@ -1,16 +0,0 @@ - - - - diff --git a/packages/starter-dapp/src/components/icons/MetaMask.svelte b/packages/starter-dapp/src/components/icons/MetaMask.svelte deleted file mode 100644 index 3650b83c3b..0000000000 --- a/packages/starter-dapp/src/components/icons/MetaMask.svelte +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/packages/starter-dapp/src/components/icons/TKO.svelte b/packages/starter-dapp/src/components/icons/TKO.svelte deleted file mode 100644 index ea41b411a3..0000000000 --- a/packages/starter-dapp/src/components/icons/TKO.svelte +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - diff --git a/packages/starter-dapp/src/components/icons/TaikoLight.svelte b/packages/starter-dapp/src/components/icons/TaikoLight.svelte deleted file mode 100644 index 1dbbdba228..0000000000 --- a/packages/starter-dapp/src/components/icons/TaikoLight.svelte +++ /dev/null @@ -1,5 +0,0 @@ - - - \ No newline at end of file diff --git a/packages/starter-dapp/src/components/icons/TaikoLogo.svelte b/packages/starter-dapp/src/components/icons/TaikoLogo.svelte deleted file mode 100644 index 26595968c9..0000000000 --- a/packages/starter-dapp/src/components/icons/TaikoLogo.svelte +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/packages/starter-dapp/src/components/icons/TaikoLogoFluo.svelte b/packages/starter-dapp/src/components/icons/TaikoLogoFluo.svelte deleted file mode 100644 index 4bf4baf934..0000000000 --- a/packages/starter-dapp/src/components/icons/TaikoLogoFluo.svelte +++ /dev/null @@ -1,5 +0,0 @@ - - - \ No newline at end of file diff --git a/packages/starter-dapp/src/components/icons/WalletConnect.svelte b/packages/starter-dapp/src/components/icons/WalletConnect.svelte deleted file mode 100644 index 474cecf5e9..0000000000 --- a/packages/starter-dapp/src/components/icons/WalletConnect.svelte +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/starter-dapp/src/components/modals/Modal.svelte b/packages/starter-dapp/src/components/modals/Modal.svelte deleted file mode 100644 index 89a1027679..0000000000 --- a/packages/starter-dapp/src/components/modals/Modal.svelte +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - diff --git a/packages/starter-dapp/src/components/modals/SwitchEthereumChainModal.svelte b/packages/starter-dapp/src/components/modals/SwitchEthereumChainModal.svelte deleted file mode 100644 index 71da144078..0000000000 --- a/packages/starter-dapp/src/components/modals/SwitchEthereumChainModal.svelte +++ /dev/null @@ -1,57 +0,0 @@ - - - -
- {$_("switchChainModal.subtitle")} -
- - -
-
-
diff --git a/packages/starter-dapp/src/components/modals/TooltipModal.svelte b/packages/starter-dapp/src/components/modals/TooltipModal.svelte deleted file mode 100644 index a7ea557e7f..0000000000 --- a/packages/starter-dapp/src/components/modals/TooltipModal.svelte +++ /dev/null @@ -1,17 +0,0 @@ - - - -
-
- -
- -
-
diff --git a/packages/starter-dapp/src/components/providers/BaseQueries.svelte b/packages/starter-dapp/src/components/providers/BaseQueries.svelte deleted file mode 100644 index 4fa864ce7a..0000000000 --- a/packages/starter-dapp/src/components/providers/BaseQueries.svelte +++ /dev/null @@ -1 +0,0 @@ - diff --git a/packages/starter-dapp/src/components/providers/QueryProvider.svelte b/packages/starter-dapp/src/components/providers/QueryProvider.svelte deleted file mode 100644 index 91774c4acb..0000000000 --- a/packages/starter-dapp/src/components/providers/QueryProvider.svelte +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - diff --git a/packages/starter-dapp/src/domain/bridge.ts b/packages/starter-dapp/src/domain/bridge.ts deleted file mode 100644 index 437337a51c..0000000000 --- a/packages/starter-dapp/src/domain/bridge.ts +++ /dev/null @@ -1,58 +0,0 @@ -import type { BigNumber, ethers, Transaction } from "ethers"; -import type { Message } from "./message"; - -enum BridgeType { - ERC20 = "ERC20", - ETH = "ETH", - ERC721 = "ERC721", - ERC1155 = "ERC1155", -} - -type ApproveOpts = { - amountInWei: BigNumber; - contractAddress: string; - signer: ethers.Signer; - spenderAddress: string; -}; - -type BridgeOpts = { - amountInWei: BigNumber; - signer: ethers.Signer; - tokenAddress: string; - fromChainId: number; - toChainId: number; - tokenVaultAddress: string; - processingFeeInWei?: BigNumber; - tokenId?: string; - memo?: string; - isBridgedTokenAlreadyDeployed?: boolean; -}; - -type ClaimOpts = { - message: Message; - msgHash: string; - signer: ethers.Signer; - destBridgeAddress: string; - srcBridgeAddress: string; -}; - -type ReleaseOpts = { - message: Message; - msgHash: string; - signer: ethers.Signer; - destBridgeAddress: string; - srcBridgeAddress: string; - destProvider: ethers.providers.JsonRpcProvider; - srcTokenVaultAddress: string; -}; - -interface Bridge { - RequiresAllowance(opts: ApproveOpts): Promise; - Approve(opts: ApproveOpts): Promise; - Bridge(opts: BridgeOpts): Promise; - EstimateGas(opts: BridgeOpts): Promise; - Claim(opts: ClaimOpts): Promise; - ReleaseTokens(opts: ReleaseOpts): Promise; -} - -export { ApproveOpts, BridgeOpts, BridgeType, Bridge, ClaimOpts, ReleaseOpts }; diff --git a/packages/starter-dapp/src/domain/chain.ts b/packages/starter-dapp/src/domain/chain.ts deleted file mode 100644 index 8ac8cc8510..0000000000 --- a/packages/starter-dapp/src/domain/chain.ts +++ /dev/null @@ -1,121 +0,0 @@ -import type { Chain as WagmiChain } from "@wagmi/core"; -import { BigNumber } from "ethers"; -import type { ComponentType } from "svelte"; - -import Eth from "../components/icons/ETH.svelte"; -import Taiko from "../components/icons/TKO.svelte"; - -export const CHAIN_ID_MAINNET = import.meta.env - ? BigNumber.from(import.meta.env.VITE_MAINNET_CHAIN_ID).toNumber() - : 31336; - -export const CHAIN_ID_TAIKO = import.meta.env - ? BigNumber.from(import.meta.env.VITE_TAIKO_CHAIN_ID).toNumber() - : 167001; - -const L1_RPC = import.meta?.env?.VITE_L1_RPC_URL ?? "https://l1rpc.internal.taiko.xyz/"; - -const L2_RPC = import.meta?.env?.VITE_L2_RPC_URL ?? "https://l2rpc.internal.taiko.xyz/"; - -const L1_BRIDGE_ADDRESS = import.meta?.env?.VITE_MAINNET_BRIDGE_ADDRESS ?? "0x0237443359aB0b11EcDC41A7aF1C90226a88c70f"; - -const L2_BRIDGE_ADDRESS = import.meta?.env?.VITE_TAIKO_BRIDGE_ADDRESS ?? "0x0000777700000000000000000000000000000004"; - -const L1_HEADER_SYNC_ADDRESS = import.meta?.env?.VITE_MAINNET_HEADER_SYNC_ADDRESS ?? "0xa6421A7f48498cee3aEb6428a8A2DD5fAA3AcE2f"; - -const L2_HEADER_SYNC_ADDRESS = import.meta?.env?.VITE_TAIKO_HEADER_SYNC_ADDRESS ?? "0x0000777700000000000000000000000000000001"; - -const L1_SIGNAL_SERVICE_ADDRESS = import.meta?.env?.VITE_MAINNET_SIGNAL_SERVICE_ADDRESS ?? "0x403cc7802725928652a3d116Bb1781005e2e76d3"; - -const L2_SIGNAL_SERVICE_ADDRESS = import.meta?.env?.VITE_TAIKO_SIGNAL_SERVICE_ADDRESS ?? "0x0000777700000000000000000000000000000007"; - -const L1_EXPLORER_URL = import.meta?.env?.VITE_L1_EXPLORER_URL ?? "https://l1explorer.internal.taiko.xyz/"; - -const L2_EXPLORER_URL = import.meta?.env?.VITE_L2_EXPLORER_URL ?? "https://l2explorer.internal.taiko.xyz/"; - -export type Chain = { - id: number; - name: string; - rpc: string; - enabled?: boolean; - icon?: ComponentType; - bridgeAddress: string; - headerSyncAddress: string; - explorerUrl: string; - signalServiceAddress: string; -}; - -export const CHAIN_MAINNET = { - id: CHAIN_ID_MAINNET, - name: import.meta.env - ? import.meta.env.VITE_MAINNET_CHAIN_NAME - : "Ethereum A1", - rpc: L1_RPC, - enabled: true, - icon: Eth, - bridgeAddress: L1_BRIDGE_ADDRESS, - headerSyncAddress: L1_HEADER_SYNC_ADDRESS, - explorerUrl: L1_EXPLORER_URL, - signalServiceAddress: L1_SIGNAL_SERVICE_ADDRESS, -}; - -export const CHAIN_TKO = { - id: CHAIN_ID_TAIKO, - name: import.meta.env ? import.meta.env.VITE_TAIKO_CHAIN_NAME : "Taiko A2", - rpc: L2_RPC, - enabled: true, - icon: Taiko, - bridgeAddress: L2_BRIDGE_ADDRESS, - headerSyncAddress: L2_HEADER_SYNC_ADDRESS, - explorerUrl: L2_EXPLORER_URL, - signalServiceAddress: L2_SIGNAL_SERVICE_ADDRESS, -}; - -export const chains: Record = { - [CHAIN_ID_MAINNET]: CHAIN_MAINNET, - [CHAIN_ID_TAIKO]: CHAIN_TKO, -}; - -export const mainnet: WagmiChain = { - id: CHAIN_ID_MAINNET, - name: import.meta.env - ? import.meta.env.VITE_MAINNET_CHAIN_NAME - : "Ethereum A2", - network: "", - nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 }, - rpcUrls: { - default: { - http: [L1_RPC], - }, - }, - blockExplorers: { - default: { - name: "Main", - url: L1_EXPLORER_URL, - }, - }, - // ens: { - // address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", - // }, -}; - -export const taiko: WagmiChain = { - id: CHAIN_ID_TAIKO, - name: import.meta.env ? import.meta.env.VITE_TAIKO_CHAIN_NAME : "Taiko A2", - network: "", - nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 }, - rpcUrls: { - default: { - http: [L2_RPC], - }, - }, - blockExplorers: { - default: { - name: "Main", - url: L2_EXPLORER_URL, - }, - }, - // ens: { - // address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", - // }, -}; diff --git a/packages/starter-dapp/src/i18n.js b/packages/starter-dapp/src/i18n.js deleted file mode 100644 index dba5465363..0000000000 --- a/packages/starter-dapp/src/i18n.js +++ /dev/null @@ -1,42 +0,0 @@ -import { _, dictionary, locale } from "svelte-i18n"; - -function setupI18n({ withLocale: _locale } = { withLocale: "en" }) { - dictionary.set({ - en: { - home: { - title: "Taiko Bridge", - selectToken: "Select Token", - to: "To", - bridge: "Bridge", - approve: "Approve", - }, - bridgeForm: { - fieldLabel: "Amount", - maxLabel: "Max", - balance: "Balance", - processingFeeLabel: "Processing Fee", - bridge: "Bridge", - approve: "Approve", - }, - nav: { - connect: "Connect Wallet", - }, - toast: { - transactionSent: "Transaction sent", - errorSendingTransaction: "Error sending transaction", - errorDisconnecting: "Could not disconnect", - }, - switchChainModal: { - title: "Not on the right network", - subtitle: "Your current network is not supported. Please select one:", - }, - connectModal: { - title: "Connect Wallet", - }, - }, - }); - - locale.set(_locale); -} - -export { _, setupI18n }; diff --git a/packages/starter-dapp/src/main.ts b/packages/starter-dapp/src/main.ts deleted file mode 100644 index 3bbaf7b1fe..0000000000 --- a/packages/starter-dapp/src/main.ts +++ /dev/null @@ -1,12 +0,0 @@ -import "./app.css"; -import App from "./App.svelte"; -import {Buffer} from 'buffer'; - -const app = new App({ - target: document.getElementById("app"), -}); - -// @ts-ignore -window.Buffer = Buffer; - -export default app; diff --git a/packages/starter-dapp/src/pages/home/Home.svelte b/packages/starter-dapp/src/pages/home/Home.svelte deleted file mode 100644 index da2cde0163..0000000000 --- a/packages/starter-dapp/src/pages/home/Home.svelte +++ /dev/null @@ -1,9 +0,0 @@ - - -
-
- Starter Dapp -
-
diff --git a/packages/starter-dapp/src/store/chain.ts b/packages/starter-dapp/src/store/chain.ts deleted file mode 100644 index 43940d29a2..0000000000 --- a/packages/starter-dapp/src/store/chain.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { writable } from "svelte/store"; -import type { Chain } from "../domain/chain"; - -export const fromChain = writable(); -export const toChain = writable(); diff --git a/packages/starter-dapp/src/store/modal.ts b/packages/starter-dapp/src/store/modal.ts deleted file mode 100644 index 276e90bd41..0000000000 --- a/packages/starter-dapp/src/store/modal.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { writable } from "svelte/store"; - -export const isSwitchEthereumChainModalOpen = writable(); -export const isConnectWalletModalOpen = writable(); diff --git a/packages/starter-dapp/src/store/providers.ts b/packages/starter-dapp/src/store/providers.ts deleted file mode 100644 index 10ee6e0c90..0000000000 --- a/packages/starter-dapp/src/store/providers.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { ethers } from "ethers"; -import { writable } from "svelte/store"; - -export const providers = writable< - Map ->(new Map()); diff --git a/packages/starter-dapp/src/store/signer.ts b/packages/starter-dapp/src/store/signer.ts deleted file mode 100644 index 52cd28d836..0000000000 --- a/packages/starter-dapp/src/store/signer.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { writable } from "svelte/store"; -import type { Signer } from "ethers"; - -export const signer = writable(); diff --git a/packages/starter-dapp/src/store/wagmi.ts b/packages/starter-dapp/src/store/wagmi.ts deleted file mode 100644 index 2bcfd78871..0000000000 --- a/packages/starter-dapp/src/store/wagmi.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { writable } from "svelte/store"; -import type { Client } from "@wagmi/core"; -export const wagmiClient = writable(); diff --git a/packages/starter-dapp/src/utils/addressAvatar.spec.ts b/packages/starter-dapp/src/utils/addressAvatar.spec.ts deleted file mode 100644 index 42f316a365..0000000000 --- a/packages/starter-dapp/src/utils/addressAvatar.spec.ts +++ /dev/null @@ -1,16 +0,0 @@ -import Identicon from 'identicon.js'; - -import { DEFAULT_IDENTICON, getAddressAvatarFromIdenticon } from "./addressAvatar"; - -it("should return a base64 avatar string", () => { - const dummyAddress = "0x63FaC9201494f0bd17B9892B9fae4d52fe3BD377"; - const expectedIdenticonString = new Identicon(dummyAddress, 420).toString(); - - expect(getAddressAvatarFromIdenticon(dummyAddress)).toStrictEqual(expectedIdenticonString); -}); - -it("should return default base64 avatar when no address is passed", () => { - const dummyAddress = ""; - - expect(getAddressAvatarFromIdenticon("")).toStrictEqual(DEFAULT_IDENTICON); -}); diff --git a/packages/starter-dapp/src/utils/addressAvatar.ts b/packages/starter-dapp/src/utils/addressAvatar.ts deleted file mode 100644 index 132fb8fe3e..0000000000 --- a/packages/starter-dapp/src/utils/addressAvatar.ts +++ /dev/null @@ -1,21 +0,0 @@ -import Identicon from "identicon.js"; -import { ethers } from "ethers"; - -export const DEFAULT_IDENTICON = new Identicon( - "c157a79031e1c40f85931829bc5fc552", - { - foreground: [0, 0, 0, 255], - background: [255, 255, 255, 255], - margin: 0.2, - size: 420, - } -).toString(); - -export const getAddressAvatarFromIdenticon = (address: string): string => { - if (!address || !ethers.utils.isAddress(address)) { - return DEFAULT_IDENTICON; - } - - const data = new Identicon(address, 420).toString(); - return data; -}; diff --git a/packages/starter-dapp/src/utils/addressSubsection.spec.ts b/packages/starter-dapp/src/utils/addressSubsection.spec.ts deleted file mode 100644 index d9b26eca0a..0000000000 --- a/packages/starter-dapp/src/utils/addressSubsection.spec.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { addressSubsection } from "./addressSubsection"; - -it("should return string with prefix and suffix", () => { - const dummyAddress = "0x63FaC9201494f0bd17B9892B9fae4d52fe3BD377"; - - expect(addressSubsection(dummyAddress)).toStrictEqual("0x63F...D377"); -}); - -it("should return 0x if empty", () => { - const dummyAddress = ""; - - expect(addressSubsection("")).toStrictEqual("0x"); -}); diff --git a/packages/starter-dapp/src/utils/addressSubsection.ts b/packages/starter-dapp/src/utils/addressSubsection.ts deleted file mode 100644 index 5d4b7e201a..0000000000 --- a/packages/starter-dapp/src/utils/addressSubsection.ts +++ /dev/null @@ -1,4 +0,0 @@ -export const addressSubsection = (address: string) => { - if (!address) return "0x"; - return `${address.substring(0, 5)}...${address.substring(38, 42)}`; -}; diff --git a/packages/starter-dapp/src/utils/remove0xPrefixIfPresent.spec.ts b/packages/starter-dapp/src/utils/remove0xPrefixIfPresent.spec.ts deleted file mode 100644 index fbf1f658f7..0000000000 --- a/packages/starter-dapp/src/utils/remove0xPrefixIfPresent.spec.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { remove0xPrefixIfPresent } from "./remove0xPrefixIfPresent"; - -it("Should remove 0x if it is present (for 1-n sets of '0x'), and leave string alone if not", () => { - expect(remove0xPrefixIfPresent("0x555")).toStrictEqual("555"); - expect(remove0xPrefixIfPresent("0x0x0x555")).toStrictEqual("555"); - expect(remove0xPrefixIfPresent("555")).toStrictEqual("555"); -}); diff --git a/packages/starter-dapp/src/utils/remove0xPrefixIfPresent.ts b/packages/starter-dapp/src/utils/remove0xPrefixIfPresent.ts deleted file mode 100644 index d5cc971dc0..0000000000 --- a/packages/starter-dapp/src/utils/remove0xPrefixIfPresent.ts +++ /dev/null @@ -1,12 +0,0 @@ -function remove0xPrefixIfPresent(s: string): string { - if (!s.startsWith("0x")) { - return s; - } - - while (s.startsWith("0x")) { - s = s.slice(2); - } - return s; -} - -export { remove0xPrefixIfPresent }; diff --git a/packages/starter-dapp/src/utils/switchEthereumChain.ts b/packages/starter-dapp/src/utils/switchEthereumChain.ts deleted file mode 100644 index 189a3a3ba1..0000000000 --- a/packages/starter-dapp/src/utils/switchEthereumChain.ts +++ /dev/null @@ -1,40 +0,0 @@ -import type { Ethereum } from "@wagmi/core"; -import { ethers } from "ethers"; -import type { Chain } from "../domain/chain"; - -export const switchEthereumChain = async (ethereum: Ethereum, chain: Chain) => { - try { - await ethereum.request({ - method: "wallet_switchEthereumChain", - params: [{ chainId: ethers.utils.hexValue(chain.id) }], - }); - } catch (switchError) { - // This error code indicates that the chain has not been added to MetaMask. - if ( - switchError.code === 4902 || - switchError?.data?.originalError?.code === 4902 - ) { - try { - await ethereum.request({ - method: "wallet_addEthereumChain", - params: [ - { - chainId: ethers.utils.hexValue(chain.id), - chainName: chain.name, - rpcUrls: [chain.rpc], - nativeCurrency: { - symbol: "ETH", - decimals: 18, - name: "Ethereum", - }, - }, - ], - }); - } catch (addError) { - throw addError; - } - } else { - throw switchError; - } - } -}; diff --git a/packages/starter-dapp/src/utils/toast.spec.ts b/packages/starter-dapp/src/utils/toast.spec.ts deleted file mode 100644 index b6ba65d8d8..0000000000 --- a/packages/starter-dapp/src/utils/toast.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -const mockPush = jest.fn(); - -jest.mock("@zerodevx/svelte-toast", () => ({ - ...(jest.requireActual("@zerodevx/svelte-toast") as object), - toast: { - push: mockPush, - }, -})); - -import { successToast, errorToast, successOpts, errorOpts } from "./toast"; -describe("toasts", function () { - beforeEach(() => { - jest.resetAllMocks(); - }); - it("should call successToast with msg and opts", () => { - successToast("msg"); - expect(mockPush).toHaveBeenCalledWith("msg", successOpts); - }); - - it("should call errorToast with msg and opts", () => { - errorToast("msg"); - expect(mockPush).toHaveBeenCalledWith("msg", errorOpts); - }); -}); diff --git a/packages/starter-dapp/src/utils/toast.ts b/packages/starter-dapp/src/utils/toast.ts deleted file mode 100644 index acc3ace9fa..0000000000 --- a/packages/starter-dapp/src/utils/toast.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { toast } from "@zerodevx/svelte-toast"; -import type { SvelteToastOptions } from "@zerodevx/svelte-toast"; - -export const errorOpts: SvelteToastOptions = { - theme: { - "--toastBackground": "#FF0000", - "--toastColor": "#e3e3e3", - "--toastHeight": "50px", - "--toastContainerTop": "auto", - "--toastContainerRight": "auto", - "--toastContainerBottom": "2rem", - "--toastContainerLeft": "auto", - "--toastBorderRadius": "0.9rem", - }, -}; - -export const successOpts: SvelteToastOptions = { - theme: { - "--toastBackground": "#008000", - "--toastColor": "#e3e3e3", - "--toastHeight": "50px", - "--toastContainerTop": "auto", - "--toastContainerRight": "auto", - "--toastContainerBottom": "2rem", - "--toastContainerLeft": "auto", - "--toastBorderRadius": "0.9rem", - }, -}; - -export const errorToast = (msg: string) => { - toast.push(msg, errorOpts); -}; - -export const successToast = (msg: string) => { - toast.push(msg, successOpts); -}; diff --git a/packages/starter-dapp/src/utils/truncateString.spec.ts b/packages/starter-dapp/src/utils/truncateString.spec.ts deleted file mode 100644 index 1aee7850d6..0000000000 --- a/packages/starter-dapp/src/utils/truncateString.spec.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { truncateString } from "./truncateString"; - -it("should truncate when string > maxLength", () => { - const dummyBalance = - "148234732894732894723894432847328947.42384732894732894732894"; - - expect(truncateString(dummyBalance)).toStrictEqual("1482347328"); -}); - -it("should return string when < maxLength", () => { - const dummyBalance = "1"; - - expect(truncateString(dummyBalance, 2)).toStrictEqual(dummyBalance); -}); - -it("should return empty string if empty", () => { - const dummyAddress = ""; - - expect(truncateString("")).toStrictEqual(""); -}); diff --git a/packages/starter-dapp/src/utils/truncateString.ts b/packages/starter-dapp/src/utils/truncateString.ts deleted file mode 100644 index 3e969178e2..0000000000 --- a/packages/starter-dapp/src/utils/truncateString.ts +++ /dev/null @@ -1,4 +0,0 @@ -export const truncateString = (str: string, maxLength: number = 10) => { - if (!str) return ""; - return str.length > maxLength ? `${str.substring(0, maxLength)}` : str; -}; diff --git a/packages/starter-dapp/src/vite-env.d.ts b/packages/starter-dapp/src/vite-env.d.ts deleted file mode 100644 index 4078e7476a..0000000000 --- a/packages/starter-dapp/src/vite-env.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -/// -/// diff --git a/packages/starter-dapp/svelte.config.cjs b/packages/starter-dapp/svelte.config.cjs deleted file mode 100644 index 8bf5d4b3f5..0000000000 --- a/packages/starter-dapp/svelte.config.cjs +++ /dev/null @@ -1,7 +0,0 @@ -const sveltePreprocess = require('svelte-preprocess'); - -module.exports = { - // Consult https://github.com/sveltejs/svelte-preprocess - // for more information about preprocessors - preprocess: sveltePreprocess() -} diff --git a/packages/starter-dapp/tailwind.config.cjs b/packages/starter-dapp/tailwind.config.cjs deleted file mode 100644 index d5c19f5be0..0000000000 --- a/packages/starter-dapp/tailwind.config.cjs +++ /dev/null @@ -1,93 +0,0 @@ -const colors = require("tailwindcss/colors"); -module.exports = { - content: ["./src/**/*.{html,js,svelte,ts}"], - plugins: [require("daisyui")], - darkMode: ['[data-theme="dark"]'], - theme: { - extend: { - colors: { - "dark-1": "var(--color-dark-1)", - "dark-2": "var(--color-dark-2)", - "dark-3": "var(--color-dark-3)", - "dark-4": "var(--color-dark-4)", - "dark-5": "var(--color-dark-5)", - "dark-6": "var(--color-dark-6)", - "transaction-table": "var(--color-transaction-table)", - "bridge-form": "var(--color-bridge-form)", - }, - keyframes: { - rise: { - '0%': { position: 'absolute', bottom: '-10px' }, - // '100%': { position: 'static' }, - } - }, - animation: { - rise: 'rise 0.5s ease-in-out', - } - } - }, - daisyui: { - styled: true, - themes: true, - base: true, - utils: true, - logs: true, - rtl: false, - prefix: "", - darkTheme: "dark", - themes: [ - { - dark: { - ...require("daisyui/colors/themes")["[data-theme=black]"], - "primary": "#242424", - "secondary": "#181818", - "accent": "#FC0FC0", - "accent-focus": "#E30EAD", - "accent-content": "#F3F3F3", - "neutral": "#242424", - "base-100": "#0F0F0F", - "info": "#373737", - "success": "#008000", - "warning": "#FFFF00", - "error": "#FF0000", - "--color-dark-1": "#000000", - "--color-dark-2": "#181818", - "--color-dark-3": "#0F0F0F", - "--color-dark-4": "#242424", - "--color-dark-5": "#373737", - "--color-dark-6": "#4F4F4F", - "--color-transaction-table": "#FFFFFF", - "--rounded-btn": "1rem", - "--btn-text-case": "capitalize", - "--rounded-box": "18px", - "--color-bridge-form": colors.zinc[800], - }, - light: { - ...require("daisyui/colors/themes")["[data-theme=light]"], - "accent": "#FC0FC0", - "accent-focus": "#E30EAD", - "accent-content": "#F3F3F3", - "neutral": "#d4d4d4", - "neutral-focus": "#a3a3a3", - "neutral-content": "#181818", - "base-100": "#FAFAFA", - "info": "#373737", - "success": "#008000", - "warning": "#FFFF00", - "error": "#FF0000", - "--color-dark-1": "#000000", - "--color-dark-2": "#FFFFFF", - "--color-dark-3": "#FAFAFA", - "--color-dark-4": "#242424", - "--color-dark-5": "#CDCDCD", - "--color-dark-6": "#4F4F4F", - "--color-transaction-table": "#1F2937", - "--rounded-btn": "1rem", - "--btn-text-case": "capitalize", - "--rounded-box": "18px", - "--color-bridge-form": colors.zinc[200], - }, - }, - ], - } -}; diff --git a/packages/starter-dapp/tsconfig.json b/packages/starter-dapp/tsconfig.json deleted file mode 100644 index 9094dab45e..0000000000 --- a/packages/starter-dapp/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "@tsconfig/svelte/tsconfig.json", - "compilerOptions": { - "target": "es2022", - "useDefineForClassFields": true, - "module": "es2022", - "resolveJsonModule": true, - "baseUrl": ".", - /** - * Typecheck JS in `.svelte` and `.js` files by default. - * Disable checkJs if you'd like to use dynamic types in JS. - * Note that setting allowJs false does not prevent the use - * of JS in `.svelte` files. - */ - "allowJs": true, - "checkJs": true, - "isolatedModules": false - }, - "include": ["src/**/*.d.ts", "src/**/*.ts", "src/**/*.js", "src/**/*.svelte"], - "references": [{ "path": "./tsconfig.node.json" }] -} diff --git a/packages/starter-dapp/tsconfig.node.json b/packages/starter-dapp/tsconfig.node.json deleted file mode 100644 index 65dbdb96ae..0000000000 --- a/packages/starter-dapp/tsconfig.node.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "compilerOptions": { - "composite": true, - "module": "ESNext", - "moduleResolution": "Node" - }, - "include": ["vite.config.ts"] -} diff --git a/packages/starter-dapp/vite.config.ts b/packages/starter-dapp/vite.config.ts deleted file mode 100644 index e90bff74dd..0000000000 --- a/packages/starter-dapp/vite.config.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { defineConfig } from "vite"; -import { svelte } from "@sveltejs/vite-plugin-svelte"; -import polyfillNode from "rollup-plugin-polyfill-node"; -import { viteStaticCopy } from "vite-plugin-static-copy"; - -// https://vitejs.dev/config/ -export default defineConfig({ - define: { - global: 'globalThis', - 'process.env.NODE_DEBUG': false, - 'process.env.LINK_API_URL': false, - 'process.env.SDK_VERSION': "'unknown'" - }, - plugins: [ - svelte(), - polyfillNode(), - viteStaticCopy({ - targets: [ - { - src: "src/assets/lottie/loader.json", - dest: "lottie", - }, - ], - }), - ], -}); diff --git a/packages/status-page/.babelrc b/packages/status-page/.babelrc deleted file mode 100644 index 7ae1eb65a8..0000000000 --- a/packages/status-page/.babelrc +++ /dev/null @@ -1,8 +0,0 @@ -{ - "presets": [["@babel/preset-env", {"targets": {"node": "current"}}]], - "env": { - "test": { - "plugins": ["transform-es2015-modules-commonjs"] - } - } - } \ No newline at end of file diff --git a/packages/status-page/.default.env b/packages/status-page/.default.env deleted file mode 100644 index bf00ad724e..0000000000 --- a/packages/status-page/.default.env +++ /dev/null @@ -1,17 +0,0 @@ -VITE_NODE_ENV=production -VITE_L1_RPC_URL="https://l1rpc.internal.taiko.xyz" -VITE_L2_RPC_URL="https://l2rpc.internal.taiko.xyz" -VITE_L3_RPC_URL="https://l2rpc.internal.taiko.xyz" -VITE_TAIKO_TOKEN_ADDRESS="0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e" -VITE_L2_TAIKO_L2_ADDRESS="0x1000777700000000000000000000000000000001" -VITE_L2_TAIKO_L1_ADDRESS="0x0B306BF915C4d645ff596e518fAf3F9669b97016" -VITE_L3_TAIKO_L2_ADDRESS="0x1000777700000000000000000000000000000001" -VITE_L3_TAIKO_L1_ADDRESS="0x0B306BF915C4d645ff596e518fAf3F9669b97016" -VITE_L1_EXPLORER_URL="https://l1explorer.internal.taiko.xyz" -VITE_L2_EXPLORER_URL="https://l2explorer.internal.taiko.xyz" -VITE_L3_EXPLORER_URL="https://l3explorer.internal.taiko.xyz" -VITE_FEE_TOKEN_SYMBOL=TTKO -VITE_ORACLE_PROVER_ADDRESS="0x1567CDAb5F7a69154e61A16D8Ff5eE6A3e991b39" -VITE_L2_EVENT_INDEXER_API_URL="http://localhost:4100" -VITE_L3_EVENT_INDEXER_API_URL="http://localhost:4100" -VITE_ENABLE_L3=true \ No newline at end of file diff --git a/packages/status-page/.gitignore b/packages/status-page/.gitignore deleted file mode 100644 index c5bb7501d7..0000000000 --- a/packages/status-page/.gitignore +++ /dev/null @@ -1,30 +0,0 @@ -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -pnpm-debug.log* -lerna-debug.log* - -node_modules -dist -dist-ssr -*.local - -# Editor directories and files -.vscode/* -!.vscode/extensions.json -.idea -.DS_Store -*.suo -*.ntvs* -*.njsproj -*.sln -*.sw? -.env -.a1.env -.s.env -.a3.env -# vite -vite.config.ts.timestamp-*.mjs \ No newline at end of file diff --git a/packages/status-page/CHANGELOG.md b/packages/status-page/CHANGELOG.md deleted file mode 100644 index e9fdd2b3c1..0000000000 --- a/packages/status-page/CHANGELOG.md +++ /dev/null @@ -1,146 +0,0 @@ -# Changelog - -## [0.12.0](https://github.com/taikoxyz/taiko-mono/compare/status-page-v0.11.0...status-page-v0.12.0) (2023-07-10) - - -### Features - -* **eventindexer:** galaxe api, 2 indexing, http only mode, event query optimizations ([#14122](https://github.com/taikoxyz/taiko-mono/issues/14122)) ([9c6d918](https://github.com/taikoxyz/taiko-mono/commit/9c6d918c8c7c474da88912fafa59e2a2f054f3b7)) - - -### Bug Fixes - -* **status-page:** proposer title ([#14058](https://github.com/taikoxyz/taiko-mono/issues/14058)) ([412ba70](https://github.com/taikoxyz/taiko-mono/commit/412ba70b7f313c4e81d3b773733e8940d16df6e1)) - -## [0.11.0](https://github.com/taikoxyz/taiko-mono/compare/status-page-v0.10.0...status-page-v0.11.0) (2023-06-26) - - -### Features - -* **protocol:** use ring buffer for ETH deposit and optimize storage ([#13868](https://github.com/taikoxyz/taiko-mono/issues/13868)) ([acffb61](https://github.com/taikoxyz/taiko-mono/commit/acffb61b13b44fd4792e8f4a31498d788ca38961)) - - -### Bug Fixes - -* **status-page:** fix stretched favicon ([#13982](https://github.com/taikoxyz/taiko-mono/issues/13982)) ([103f1ae](https://github.com/taikoxyz/taiko-mono/commit/103f1aea772c5eb5e9a293f2ba661d0c4eb96156)) -* **status-page:** use ttko from env ([#13998](https://github.com/taikoxyz/taiko-mono/issues/13998)) ([2c83f3b](https://github.com/taikoxyz/taiko-mono/commit/2c83f3b8faad27315ec25d6150327631320b0798)) - -## [0.10.0](https://github.com/taikoxyz/taiko-mono/compare/status-page-v0.9.0...status-page-v0.10.0) (2023-06-12) - - -### Features - -* **status-page:** disable L3 on boolean env var ([#13838](https://github.com/taikoxyz/taiko-mono/issues/13838)) ([fed0ca0](https://github.com/taikoxyz/taiko-mono/commit/fed0ca0e9a9176c3feaae38b426df45e09d9af3a)) -* **status-page:** show latest proof reward ([#13842](https://github.com/taikoxyz/taiko-mono/issues/13842)) ([12a6d04](https://github.com/taikoxyz/taiko-mono/commit/12a6d04541404f8d4258e39c442102cf526c73eb)) -* **status-page:** Status decimals fix + L2 EIP1559 stats added ([#13832](https://github.com/taikoxyz/taiko-mono/issues/13832)) ([3871641](https://github.com/taikoxyz/taiko-mono/commit/38716418801e2d0f84181c891dbfb1bfa3a4f9f0)) -* **status-page:** updates for a3 ([#13821](https://github.com/taikoxyz/taiko-mono/issues/13821)) ([7ed816d](https://github.com/taikoxyz/taiko-mono/commit/7ed816d8db7ac75468faa235c09f147db5009034)) - -## [0.9.0](https://github.com/taikoxyz/taiko-mono/compare/status-page-v0.8.0...status-page-v0.9.0) (2023-05-26) - - -### Features - -* **eventindexer:** add stats tracking ([#13810](https://github.com/taikoxyz/taiko-mono/issues/13810)) ([bfbbb97](https://github.com/taikoxyz/taiko-mono/commit/bfbbb97fcb67dc33749f0f08f84b8bd54eae9aeb)) -* **status-page:** handle multiple layers ([#13770](https://github.com/taikoxyz/taiko-mono/issues/13770)) ([92a4d56](https://github.com/taikoxyz/taiko-mono/commit/92a4d56c7f3b42151b913b053e6717fca3adc347)) - - -### Bug Fixes - -* **protocol:** rename treasure to treasury ([#13780](https://github.com/taikoxyz/taiko-mono/issues/13780)) ([ccecd70](https://github.com/taikoxyz/taiko-mono/commit/ccecd708276bce3eca84b92c7c48c95b2156dd18)) -* **status-page:** eth deposit display ([#13763](https://github.com/taikoxyz/taiko-mono/issues/13763)) ([fedab00](https://github.com/taikoxyz/taiko-mono/commit/fedab00148c332a5538265100b103dab9fff98e5)) - -## [0.8.0](https://github.com/taikoxyz/taiko-mono/compare/status-page-v0.7.0...status-page-v0.8.0) (2023-05-11) - - -### Features - -* **protocol:** major protocol upgrade for alpha-3 testnet ([#13640](https://github.com/taikoxyz/taiko-mono/issues/13640)) ([02552f2](https://github.com/taikoxyz/taiko-mono/commit/02552f2aa001893d326062ce627004c61b46cd26)) - -## [0.7.0](https://github.com/taikoxyz/taiko-mono/compare/status-page-v0.6.0...status-page-v0.7.0) (2023-04-27) - - -### Features - -* **eventindexer:** ProposeEvents filtering, API exposing, and getting count by address/event + tests ([#13624](https://github.com/taikoxyz/taiko-mono/issues/13624)) ([839a0be](https://github.com/taikoxyz/taiko-mono/commit/839a0bef7c64dd2b1e2ecc5194cf9a1e29f9a0cd)) - - -### Bug Fixes - -* **status-page:** Status page slots ([#13605](https://github.com/taikoxyz/taiko-mono/issues/13605)) ([f0c291f](https://github.com/taikoxyz/taiko-mono/commit/f0c291f671cfe5b81b2f567ee7701a73edb79095)) - -## [0.6.0](https://github.com/taikoxyz/taiko-mono/compare/status-page-v0.5.0...status-page-v0.6.0) (2023-04-08) - - -### Features - -* **status-page:** order the provers by count descending ([#13504](https://github.com/taikoxyz/taiko-mono/issues/13504)) ([49db97d](https://github.com/taikoxyz/taiko-mono/commit/49db97d75019d71beb8466c646934bfabba5b13d)) - - -### Bug Fixes - -* **repo:** fix multiple typos ([#13558](https://github.com/taikoxyz/taiko-mono/issues/13558)) ([f54242a](https://github.com/taikoxyz/taiko-mono/commit/f54242aa95e5c5563f8f0a7f9af0a1eab20ab67b)) -* **status-page:** add max height and scrollable to prover details popup ([#13498](https://github.com/taikoxyz/taiko-mono/issues/13498)) ([d126791](https://github.com/taikoxyz/taiko-mono/commit/d126791775bbaa59a107975077b9d32811bd09ea)) -* **status-page:** latest proof time ([#13511](https://github.com/taikoxyz/taiko-mono/issues/13511)) ([c0bc671](https://github.com/taikoxyz/taiko-mono/commit/c0bc671572a13b48d33ea567fc884a72e51f2be0)) - -## [0.5.0](https://github.com/taikoxyz/taiko-mono/compare/status-page-v0.4.0...status-page-v0.5.0) (2023-03-29) - - -### Features - -* **eventindexer:** Event indexer ([#13439](https://github.com/taikoxyz/taiko-mono/issues/13439)) ([08b26d2](https://github.com/taikoxyz/taiko-mono/commit/08b26d21577ed8ecd14beed5a600108fe7a0f765)) -* **protocol:** merge alpha 2 to main ([#13369](https://github.com/taikoxyz/taiko-mono/issues/13369)) ([2b9cc64](https://github.com/taikoxyz/taiko-mono/commit/2b9cc6466509372f35109b48c00948d2234b0d59)) -* **relayer:** merge alpha-2 to main ([#13376](https://github.com/taikoxyz/taiko-mono/issues/13376)) ([3148f6b](https://github.com/taikoxyz/taiko-mono/commit/3148f6ba955e1b3918289332d2ee30f139edea8b)) - - -### Bug Fixes - -* **status-page:** add some padding to the status page ([#13392](https://github.com/taikoxyz/taiko-mono/issues/13392)) ([0034508](https://github.com/taikoxyz/taiko-mono/commit/0034508027be35595f4e9aafc23fee308604b25e)) -* **status-page:** hide fee related statuses ([#13450](https://github.com/taikoxyz/taiko-mono/issues/13450)) ([31ad254](https://github.com/taikoxyz/taiko-mono/commit/31ad2548387c712d77b0dcbb35b53222546d7417)) - -## [0.4.0](https://github.com/taikoxyz/taiko-mono/compare/status-page-v0.3.0...status-page-v0.4.0) (2023-03-01) - - -### Features - -* **status-page:** remove is halted ([#13231](https://github.com/taikoxyz/taiko-mono/issues/13231)) ([d3d1c39](https://github.com/taikoxyz/taiko-mono/commit/d3d1c3952a2f459363e40e9052ea76422845c81e)) - -## [0.3.0](https://github.com/taikoxyz/taiko-mono/compare/status-page-v0.2.0...status-page-v0.3.0) (2023-02-15) - - -### Features - -* **protocol:** change statevariables to return a struct ([#13113](https://github.com/taikoxyz/taiko-mono/issues/13113)) ([0bffeb0](https://github.com/taikoxyz/taiko-mono/commit/0bffeb0f3d17938bf2146772962719ae21ce22fa)) -* **relayer:** catch relayer & status page up to new testnet ([#13114](https://github.com/taikoxyz/taiko-mono/issues/13114)) ([543f242](https://github.com/taikoxyz/taiko-mono/commit/543f242bfbf18b155f3476c2d172e79d3041ffc9)) - - -### Bug Fixes - -* **status-page:** Status block proven ([#13150](https://github.com/taikoxyz/taiko-mono/issues/13150)) ([21e62fd](https://github.com/taikoxyz/taiko-mono/commit/21e62fd87bd2020dcc519b68bd19848424d4e902)) - -## [0.2.0](https://github.com/taikoxyz/taiko-mono/compare/status-page-v0.1.0...status-page-v0.2.0) (2023-01-31) - - -### Features - -* **status-page:** Tokenomics metrics ([#13076](https://github.com/taikoxyz/taiko-mono/issues/13076)) ([cbd3e0b](https://github.com/taikoxyz/taiko-mono/commit/cbd3e0b850a4611b308daf949a2ee65c24ff01ec)) - - -### Bug Fixes - -* **status-page:** fix local dependency not found error for jest-dom ([#12991](https://github.com/taikoxyz/taiko-mono/issues/12991)) ([b7974bf](https://github.com/taikoxyz/taiko-mono/commit/b7974bf0c8a80aa200313ec27ab44857e22142ee)) - -## [0.1.0](https://github.com/taikoxyz/taiko-mono/compare/status-page-v0.0.1...status-page-v0.1.0) (2023-01-19) - - -### Features - -* **bridge-ui:** bridge light and dark themes ([#12957](https://github.com/taikoxyz/taiko-mono/issues/12957)) ([a36aebd](https://github.com/taikoxyz/taiko-mono/commit/a36aebd8baa2517e970564fcd0a2d0e5d0ea42a8)) -* **status-page:** First PR for a Status Page ([#11449](https://github.com/taikoxyz/taiko-mono/issues/11449)) ([a164ac9](https://github.com/taikoxyz/taiko-mono/commit/a164ac935c2e05bfc8f9fa753f14692bcc457860)) - - -### Bug Fixes - -* **protocol:** Remove enableDestChain functionality ([#12341](https://github.com/taikoxyz/taiko-mono/issues/12341)) ([362d083](https://github.com/taikoxyz/taiko-mono/commit/362d083497cc74b3bcd05a406beeff2101a422ef)) -* **status-page:** change bootnode to regular provider for peers, add a transition and min height ([#12336](https://github.com/taikoxyz/taiko-mono/issues/12336)) ([9fe10e4](https://github.com/taikoxyz/taiko-mono/commit/9fe10e44619452d6cfc39127586a7fe7404aca85)) -* **status-page:** gas price should use l2provider, add descriptions and tooltips ([#12490](https://github.com/taikoxyz/taiko-mono/issues/12490)) ([cd34714](https://github.com/taikoxyz/taiko-mono/commit/cd34714ad29e03d08f673adb6dd61bb88436de50)) -* **tests:** cleanup tests to prepare for tokenomics testing ([#11316](https://github.com/taikoxyz/taiko-mono/issues/11316)) ([d63fae3](https://github.com/taikoxyz/taiko-mono/commit/d63fae30f1e3415d6f377adeab90c062fed5ad42)) diff --git a/packages/status-page/README.md b/packages/status-page/README.md deleted file mode 100644 index 97afeab2e6..0000000000 --- a/packages/status-page/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# Status Page - -Taiko status page helps to show the current status of the network. - -## Pre-installation - -Make sure you have **node** and **npm** installed on your system. You can do it by: - -`brew install node` -`brew install npm` - -## Installation - -To use the [taiko/status-page](https://github.com/taikoxyz/taiko-mono/edit/main/packages/status-page) you need to install **pnpm**: - -`pnpm install` - -## Usage - -You can check the status of the pages with the following code: - -`pnpm start` diff --git a/packages/status-page/index.html b/packages/status-page/index.html deleted file mode 100644 index 5ecd41c745..0000000000 --- a/packages/status-page/index.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - Taiko Status - - -
- - - diff --git a/packages/status-page/jest.config.js b/packages/status-page/jest.config.js deleted file mode 100644 index 7f2d5f3b01..0000000000 --- a/packages/status-page/jest.config.js +++ /dev/null @@ -1,55 +0,0 @@ -/** @type {import('@ts-jest/dist/types').InitialOptionsTsJest} */ -export default { - transform: { - "^.+\\.js$": "babel-jest", - "^.+\\.ts$": "ts-jest", - "^.+\\.svelte$": [ - "svelte-jester", - { - preprocess: true, - }, - ], - }, - globals: { - 'ts-jest': { - diagnostics: { - ignoreCodes: [1343] - }, - astTransformers: { - before: [ - { - path: 'node_modules/ts-jest-mock-import-meta', - } - ], - } - } - }, - transformIgnorePatterns: ["node_modules/(?!(svelte-i18n)/)"], - moduleFileExtensions: ["ts", "js", "svelte", "json"], - collectCoverage: true, - coverageDirectory: "coverage", - coverageReporters: [ - "lcov", - "text", - "cobertura", - "json-summary", - "json", - "text-summary", - "json", - ], - coverageThreshold: { - global: { - statements: 98.36, - branches: 79, - functions: 96, - lines: 100, - }, - }, - modulePathIgnorePatterns: ["/public/build/"], - preset: "ts-jest", - testEnvironment: "jsdom", - testPathIgnorePatterns: ["/node_modules/"], - coveragePathIgnorePatterns: ["/src/components/"], - testTimeout: 40 * 1000, - watchPathIgnorePatterns: ["node_modules"], -}; diff --git a/packages/status-page/package.json b/packages/status-page/package.json deleted file mode 100644 index 880673041f..0000000000 --- a/packages/status-page/package.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "name": "@taiko/status-page", - "version": "0.12.0", - "private": true, - "type": "module", - "scripts": { - "start": "pnpm run dev", - "dev": "vite", - "build": "vite build", - "preview": "vite preview", - "check": "svelte-check --tsconfig ./tsconfig.json", - "test": "pnpm exec jest", - "prettier": "pnpm exec prettier '**/*.{ts,svelte}'", - "prettier:write": "pnpm run prettier -- --write", - "prettier:check": "pnpm run prettier -- --check", - "svelte:check": "npx svelte-check --ignore test-app", - "lint": "pnpm exec eslint './**/*.{ts,svelte}' --ignore-path .eslintignore", - "lint:fix": "pnpm exec eslint --fix './**/*.{ts,svelte}' --ignore-path .eslintignore" - }, - "devDependencies": { - "@babel/preset-env": "^7.16.0", - "@sveltejs/vite-plugin-svelte": "^1.0.1", - "@tsconfig/svelte": "^5.0.2", - "@types/eslint": "^8.2.1", - "@types/estree": "^0.0.50", - "@types/jest": "^27.0.2", - "@types/mixpanel": "^2.14.3", - "@types/sanitize-html": "^2.6.2", - "@typescript-eslint/eslint-plugin": "^6.6.0", - "@typescript-eslint/parser": "^5.16.0", - "@zerodevx/svelte-toast": "^0.6.3", - "autoprefixer": "^10.4.13", - "babel-jest": "^27.3.1", - "babel-plugin-transform-es2015-modules-commonjs": "^6.26.2", - "daisyui": "1.16.6", - "jest": "^27.5.1", - "node-sass": "^7.0.1", - "postcss": "^8.4.19", - "postcss-cli": "^7.1.2", - "postcss-loader": "^7.3.3", - "prettier": "2.7.1", - "rollup-plugin-node-builtins": "^2.0.0", - "rollup-plugin-polyfill-node": "^0.10.2", - "svelte": "^3.53.1", - "svelte-check": "^2.8.0", - "svelte-heros-v2": "^0.3.10", - "svelte-jester": "^2.1.5", - "svelte-loader": "^3.1.2", - "svelte-preprocess": "^4.10.7", - "tailwindcss": "^3.2.4", - "theme-change": "^2.2.0", - "ts-jest": "^27.0.7", - "ts-jest-mock-import-meta": "^0.12.0", - "ts-loader": "^9.2.6", - "tslib": "^2.4.0", - "typescript": "^4.6.4", - "vite": "^3.2.7", - "vite-plugin-static-copy": "^0.12.0" - }, - "dependencies": { - "@coinbase/wallet-sdk": "^3.6.3", - "@ethersproject/experimental": "^5.7.0", - "@lottiefiles/svelte-lottie-player": "^0.2.0", - "@sveltestack/svelte-query": "^1.6.0", - "@wagmi/connectors": "^0.1.1", - "@wagmi/core": "^0.8.0", - "axios": "^1.2.0", - "buffer": "^6.0.3", - "ethers": "^5.7.1", - "identicon.js": "^2.3.3", - "svelte-i18n": "^3.5.1", - "svelte-spa-router": "^3.2.0" - } -} diff --git a/packages/status-page/postcss.config.cjs b/packages/status-page/postcss.config.cjs deleted file mode 100644 index e2dc47804e..0000000000 --- a/packages/status-page/postcss.config.cjs +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - plugins: { - tailwindcss: {}, - autoprefixer: {}, - } -} \ No newline at end of file diff --git a/packages/status-page/public/taiko-favicon.svg b/packages/status-page/public/taiko-favicon.svg deleted file mode 100644 index f61040109c..0000000000 --- a/packages/status-page/public/taiko-favicon.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/packages/status-page/src/App.svelte b/packages/status-page/src/App.svelte deleted file mode 100644 index 91b2e37686..0000000000 --- a/packages/status-page/src/App.svelte +++ /dev/null @@ -1,47 +0,0 @@ - - - -
- - -
-
- - diff --git a/packages/status-page/src/app.css b/packages/status-page/src/app.css deleted file mode 100644 index 9fd61216e5..0000000000 --- a/packages/status-page/src/app.css +++ /dev/null @@ -1,67 +0,0 @@ -.btn.btn-wide { - width: 194px; - height: 56px; -} - -@media (min-width: 768px) { - .btn.md\:btn-wide { - width: 194px; - height: 56px; - } -} - -.btn.btn-token-select { - width: 140px; - height: 60px; -} - -.btn.btn-square { - border-radius: 4px; -} - -/* Invert accent button colors */ -.btn.btn-accent { - background-color: hsla(var(--af) / var(--tw-bg-opacity, 1)); - border-color: hsla(var(--af) / var(--tw-bg-opacity, 1)); - height: 60px; -} - -.btn.btn-accent:hover { - background-color: hsla(var(--a) / var(--tw-bg-opacity, 1)); - border-color: hsla(var(--a) / var(--tw-bg-opacity, 1)); -} - -.dropdown .dropdown-content { - border-radius: 0 0 var(--rounded-box) var(--rounded-box); -} - -.input-group .input.input-primary { - border-radius: 0.5rem; -} - -.form-control .input-group :first-child { - border-radius: 0.5rem; -} - -.form-control .input-group :last-child { - border-radius: 0.5rem; -} - -.taiko-banner { - background-image: url('assets/taiko-banner.svg'); - background-repeat: no-repeat; -} - -.dropdown-content.address-dropdown-content { - border-radius: 6px; -} - -input[type=number]::-webkit-outer-spin-button, -input[type=number]::-webkit-inner-spin-button { - -webkit-appearance: none; - margin: 0; -} - -input[type=number] { - -moz-appearance: textfield; -} \ No newline at end of file diff --git a/packages/status-page/src/assets/lottie/loader.json b/packages/status-page/src/assets/lottie/loader.json deleted file mode 100644 index 7c288a43a3..0000000000 --- a/packages/status-page/src/assets/lottie/loader.json +++ /dev/null @@ -1 +0,0 @@ -{"nm":"Comp 1","mn":"","layers":[{"ty":4,"nm":"Shape Layer 2","mn":"","sr":1,"st":0,"op":300,"ip":0,"hd":false,"cl":"","ln":"","ddd":0,"bm":0,"tt":0,"hasMask":false,"td":0,"ao":0,"ks":{"a":{"a":0,"k":[-22.637,19.301,0],"ix":1},"s":{"a":0,"k":[33.33333333333334,33.33333333333334,100],"ix":6},"sk":{"a":0,"k":0},"p":{"a":0,"k":[100.02066666666668,100.00000000000003,0],"ix":2},"sa":{"a":0,"k":0},"o":{"a":0,"k":80,"ix":11},"r":{"a":1,"k":[{"o":{"x":0.472,"y":0.326},"i":{"x":0.526,"y":0.673},"s":[0],"t":0},{"o":{"x":0.167,"y":0.167},"i":{"x":0.833,"y":0.833},"s":[183],"t":60}],"ix":10}},"ef":[],"shapes":[{"ty":"gr","bm":0,"cl":"","ln":"","hd":false,"mn":"ADBE Vector Group","nm":"Ellipse 1","ix":1,"cix":2,"np":3,"it":[{"ty":"el","bm":0,"cl":"","ln":"","hd":false,"mn":"ADBE Vector Shape - Ellipse","nm":"Ellipse Path 1","d":1,"p":{"a":0,"k":[0,0],"ix":3},"s":{"a":0,"k":[368.602,368.602],"ix":2}},{"ty":"st","bm":0,"cl":"","ln":"","hd":false,"mn":"ADBE Vector Graphic - Stroke","nm":"Stroke 1","lc":2,"lj":1,"ml":4,"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":49,"ix":5},"d":[],"c":{"a":0,"k":[0.9882,0.0588,0.7529],"ix":3}},{"ty":"tr","a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"sk":{"a":0,"k":0,"ix":4},"p":{"a":0,"k":[-22.699,19.301],"ix":2},"r":{"a":0,"k":0,"ix":6},"sa":{"a":0,"k":0,"ix":5},"o":{"a":0,"k":100,"ix":7}}]},{"ty":"tm","bm":0,"cl":"","ln":"","hd":false,"mn":"ADBE Vector Filter - Trim","nm":"Trim Paths 1","ix":2,"e":{"a":1,"k":[{"o":{"x":0.559,"y":0},"i":{"x":0.504,"y":1},"s":[1],"t":0},{"o":{"x":0.167,"y":0.167},"i":{"x":0.833,"y":0.833},"s":[50],"t":30}],"ix":2},"o":{"a":0,"k":0,"ix":3},"s":{"a":1,"k":[{"o":{"x":0.579,"y":0},"i":{"x":0.438,"y":1},"s":[0],"t":30},{"o":{"x":0.167,"y":0.167},"i":{"x":0.833,"y":0.833},"s":[49],"t":60}],"ix":1},"m":1}],"ind":0},{"ty":4,"nm":"Shape Layer 1","mn":"","sr":1,"st":0,"op":300,"ip":0,"hd":false,"cl":"","ln":"","ddd":0,"bm":0,"tt":0,"hasMask":false,"td":0,"ao":0,"ks":{"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[33.33333333333334,33.33333333333334,100],"ix":6},"sk":{"a":0,"k":0},"p":{"a":0,"k":[107.56633333333339,93.56633333333338,0],"ix":2},"sa":{"a":0,"k":0},"o":{"a":0,"k":10,"ix":11},"r":{"a":0,"k":0,"ix":10}},"ef":[],"shapes":[{"ty":"gr","bm":0,"cl":"","ln":"","hd":false,"mn":"ADBE Vector Group","nm":"Ellipse 1","ix":1,"cix":2,"np":3,"it":[{"ty":"el","bm":0,"cl":"","ln":"","hd":false,"mn":"ADBE Vector Shape - Ellipse","nm":"Ellipse Path 1","d":1,"p":{"a":0,"k":[0,0],"ix":3},"s":{"a":0,"k":[368.602,368.602],"ix":2}},{"ty":"st","bm":0,"cl":"","ln":"","hd":false,"mn":"ADBE Vector Graphic - Stroke","nm":"Stroke 1","lc":2,"lj":1,"ml":4,"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":49,"ix":5},"d":[],"c":{"a":0,"k":[0.698,0.0588,0.5373],"ix":3}},{"ty":"tr","a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"sk":{"a":0,"k":0,"ix":4},"p":{"a":0,"k":[-22.699,19.301],"ix":2},"r":{"a":0,"k":0,"ix":6},"sa":{"a":0,"k":0,"ix":5},"o":{"a":0,"k":100,"ix":7}}]}],"ind":1}],"ddd":0,"h":200,"w":200,"meta":{"a":"","k":"","d":"","g":"@lottiefiles/toolkit-js 0.17.3","tc":"#ffffff"},"v":"5.5.0","fr":30,"op":60,"ip":0,"assets":[]} \ No newline at end of file diff --git a/packages/status-page/src/assets/taiko-banner.svg b/packages/status-page/src/assets/taiko-banner.svg deleted file mode 100644 index e351b7b9ab..0000000000 --- a/packages/status-page/src/assets/taiko-banner.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/packages/status-page/src/components/DetailsModal.svelte b/packages/status-page/src/components/DetailsModal.svelte deleted file mode 100644 index a7ea557e7f..0000000000 --- a/packages/status-page/src/components/DetailsModal.svelte +++ /dev/null @@ -1,17 +0,0 @@ - - - -
-
- -
- -
-
diff --git a/packages/status-page/src/components/Loader.svelte b/packages/status-page/src/components/Loader.svelte deleted file mode 100644 index 70a3a93064..0000000000 --- a/packages/status-page/src/components/Loader.svelte +++ /dev/null @@ -1,16 +0,0 @@ - - - diff --git a/packages/status-page/src/components/Modal.svelte b/packages/status-page/src/components/Modal.svelte deleted file mode 100644 index 89a1027679..0000000000 --- a/packages/status-page/src/components/Modal.svelte +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - diff --git a/packages/status-page/src/components/Navbar.svelte b/packages/status-page/src/components/Navbar.svelte deleted file mode 100644 index 9b4489dd3b..0000000000 --- a/packages/status-page/src/components/Navbar.svelte +++ /dev/null @@ -1,7 +0,0 @@ - - - diff --git a/packages/status-page/src/components/StatusIndicator.svelte b/packages/status-page/src/components/StatusIndicator.svelte deleted file mode 100644 index 9f289e9d24..0000000000 --- a/packages/status-page/src/components/StatusIndicator.svelte +++ /dev/null @@ -1,124 +0,0 @@ - - -
- -

- {header} -

- {#key statusValue} - {#if statusValue || typeof statusValue === "number"} - (onClick ? onClick(statusValue) : "")} - > - - {displayStatusValue(statusValue)} - - - {:else} - - {/if} - {/key} -
- -{#if tooltip} - - -

- {tooltip} -

-
-
-{/if} diff --git a/packages/status-page/src/components/Tooltip.svelte b/packages/status-page/src/components/Tooltip.svelte deleted file mode 100644 index 1ccae3a015..0000000000 --- a/packages/status-page/src/components/Tooltip.svelte +++ /dev/null @@ -1,11 +0,0 @@ - - - (isOpen = true)} - size="18" - variation="outline" -/> diff --git a/packages/status-page/src/components/TooltipModal.svelte b/packages/status-page/src/components/TooltipModal.svelte deleted file mode 100644 index a7ea557e7f..0000000000 --- a/packages/status-page/src/components/TooltipModal.svelte +++ /dev/null @@ -1,17 +0,0 @@ - - - -
-
- -
- -
-
diff --git a/packages/status-page/src/components/icons/Loader.svelte b/packages/status-page/src/components/icons/Loader.svelte deleted file mode 100644 index a342c73fe8..0000000000 --- a/packages/status-page/src/components/icons/Loader.svelte +++ /dev/null @@ -1,16 +0,0 @@ - - - - diff --git a/packages/status-page/src/components/icons/TaikoLogo.svelte b/packages/status-page/src/components/icons/TaikoLogo.svelte deleted file mode 100644 index 6c9572ccba..0000000000 --- a/packages/status-page/src/components/icons/TaikoLogo.svelte +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - diff --git a/packages/status-page/src/components/providers/BaseQueries.svelte b/packages/status-page/src/components/providers/BaseQueries.svelte deleted file mode 100644 index 4fa864ce7a..0000000000 --- a/packages/status-page/src/components/providers/BaseQueries.svelte +++ /dev/null @@ -1 +0,0 @@ - diff --git a/packages/status-page/src/components/providers/QueryProvider.svelte b/packages/status-page/src/components/providers/QueryProvider.svelte deleted file mode 100644 index 91774c4acb..0000000000 --- a/packages/status-page/src/components/providers/QueryProvider.svelte +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - diff --git a/packages/status-page/src/constants/abi/Bridge.ts b/packages/status-page/src/constants/abi/Bridge.ts deleted file mode 100644 index 34525018b5..0000000000 --- a/packages/status-page/src/constants/abi/Bridge.ts +++ /dev/null @@ -1,726 +0,0 @@ -export default [ - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "uint256", - name: "chainId", - type: "uint256", - }, - { - indexed: false, - internalType: "bool", - name: "enabled", - type: "bool", - }, - ], - name: "DestChainEnabled", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "uint8", - name: "version", - type: "uint8", - }, - ], - name: "Initialized", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "bytes32", - name: "signal", - type: "bytes32", - }, - { - components: [ - { - internalType: "uint256", - name: "id", - type: "uint256", - }, - { - internalType: "address", - name: "sender", - type: "address", - }, - { - internalType: "uint256", - name: "srcChainId", - type: "uint256", - }, - { - internalType: "uint256", - name: "destChainId", - type: "uint256", - }, - { - internalType: "address", - name: "owner", - type: "address", - }, - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "address", - name: "refundAddress", - type: "address", - }, - { - internalType: "uint256", - name: "depositValue", - type: "uint256", - }, - { - internalType: "uint256", - name: "callValue", - type: "uint256", - }, - { - internalType: "uint256", - name: "processingFee", - type: "uint256", - }, - { - internalType: "uint256", - name: "gasLimit", - type: "uint256", - }, - { - internalType: "bytes", - name: "data", - type: "bytes", - }, - { - internalType: "string", - name: "memo", - type: "string", - }, - ], - indexed: false, - internalType: "struct IBridge.Message", - name: "message", - type: "tuple", - }, - ], - name: "MessageSent", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "bytes32", - name: "signal", - type: "bytes32", - }, - { - indexed: false, - internalType: "enum LibBridgeData.MessageStatus", - name: "status", - type: "uint8", - }, - ], - name: "MessageStatusChanged", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "previousOwner", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "newOwner", - type: "address", - }, - ], - name: "OwnershipTransferred", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "address", - name: "sender", - type: "address", - }, - { - indexed: false, - internalType: "bytes32", - name: "signal", - type: "bytes32", - }, - ], - name: "SignalSent", - type: "event", - }, - { - inputs: [], - name: "addressManager", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "context", - outputs: [ - { - components: [ - { - internalType: "bytes32", - name: "signal", - type: "bytes32", - }, - { - internalType: "address", - name: "sender", - type: "address", - }, - { - internalType: "uint256", - name: "srcChainId", - type: "uint256", - }, - ], - internalType: "struct IBridge.Context", - name: "", - type: "tuple", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "bytes32", - name: "signal", - type: "bytes32", - }, - ], - name: "getMessageStatus", - outputs: [ - { - internalType: "enum LibBridgeData.MessageStatus", - name: "", - type: "uint8", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "_addressManager", - type: "address", - }, - ], - name: "init", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "_chainId", - type: "uint256", - }, - ], - name: "isDestChainEnabled", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "bytes32", - name: "signal", - type: "bytes32", - }, - { - internalType: "uint256", - name: "srcChainId", - type: "uint256", - }, - { - internalType: "bytes", - name: "proof", - type: "bytes", - }, - ], - name: "isMessageReceived", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "bytes32", - name: "signal", - type: "bytes32", - }, - ], - name: "isMessageSent", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "bytes32", - name: "signal", - type: "bytes32", - }, - { - internalType: "uint256", - name: "srcChainId", - type: "uint256", - }, - { - internalType: "address", - name: "sender", - type: "address", - }, - { - internalType: "bytes", - name: "proof", - type: "bytes", - }, - ], - name: "isSignalReceived", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "sender", - type: "address", - }, - { - internalType: "bytes32", - name: "signal", - type: "bytes32", - }, - ], - name: "isSignalSent", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "owner", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - components: [ - { - internalType: "uint256", - name: "id", - type: "uint256", - }, - { - internalType: "address", - name: "sender", - type: "address", - }, - { - internalType: "uint256", - name: "srcChainId", - type: "uint256", - }, - { - internalType: "uint256", - name: "destChainId", - type: "uint256", - }, - { - internalType: "address", - name: "owner", - type: "address", - }, - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "address", - name: "refundAddress", - type: "address", - }, - { - internalType: "uint256", - name: "depositValue", - type: "uint256", - }, - { - internalType: "uint256", - name: "callValue", - type: "uint256", - }, - { - internalType: "uint256", - name: "processingFee", - type: "uint256", - }, - { - internalType: "uint256", - name: "gasLimit", - type: "uint256", - }, - { - internalType: "bytes", - name: "data", - type: "bytes", - }, - { - internalType: "string", - name: "memo", - type: "string", - }, - ], - internalType: "struct IBridge.Message", - name: "message", - type: "tuple", - }, - { - internalType: "bytes", - name: "proof", - type: "bytes", - }, - ], - name: "processMessage", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "renounceOwnership", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "string", - name: "name", - type: "string", - }, - ], - name: "resolve", - outputs: [ - { - internalType: "address payable", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "chainId", - type: "uint256", - }, - { - internalType: "string", - name: "name", - type: "string", - }, - ], - name: "resolve", - outputs: [ - { - internalType: "address payable", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - components: [ - { - internalType: "uint256", - name: "id", - type: "uint256", - }, - { - internalType: "address", - name: "sender", - type: "address", - }, - { - internalType: "uint256", - name: "srcChainId", - type: "uint256", - }, - { - internalType: "uint256", - name: "destChainId", - type: "uint256", - }, - { - internalType: "address", - name: "owner", - type: "address", - }, - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "address", - name: "refundAddress", - type: "address", - }, - { - internalType: "uint256", - name: "depositValue", - type: "uint256", - }, - { - internalType: "uint256", - name: "callValue", - type: "uint256", - }, - { - internalType: "uint256", - name: "processingFee", - type: "uint256", - }, - { - internalType: "uint256", - name: "gasLimit", - type: "uint256", - }, - { - internalType: "bytes", - name: "data", - type: "bytes", - }, - { - internalType: "string", - name: "memo", - type: "string", - }, - ], - internalType: "struct IBridge.Message", - name: "message", - type: "tuple", - }, - { - internalType: "bool", - name: "lastAttempt", - type: "bool", - }, - ], - name: "retryMessage", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - components: [ - { - internalType: "uint256", - name: "id", - type: "uint256", - }, - { - internalType: "address", - name: "sender", - type: "address", - }, - { - internalType: "uint256", - name: "srcChainId", - type: "uint256", - }, - { - internalType: "uint256", - name: "destChainId", - type: "uint256", - }, - { - internalType: "address", - name: "owner", - type: "address", - }, - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "address", - name: "refundAddress", - type: "address", - }, - { - internalType: "uint256", - name: "depositValue", - type: "uint256", - }, - { - internalType: "uint256", - name: "callValue", - type: "uint256", - }, - { - internalType: "uint256", - name: "processingFee", - type: "uint256", - }, - { - internalType: "uint256", - name: "gasLimit", - type: "uint256", - }, - { - internalType: "bytes", - name: "data", - type: "bytes", - }, - { - internalType: "string", - name: "memo", - type: "string", - }, - ], - internalType: "struct IBridge.Message", - name: "message", - type: "tuple", - }, - ], - name: "sendMessage", - outputs: [ - { - internalType: "bytes32", - name: "signal", - type: "bytes32", - }, - ], - stateMutability: "payable", - type: "function", - }, - { - inputs: [ - { - internalType: "bytes32", - name: "signal", - type: "bytes32", - }, - ], - name: "sendSignal", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "newOwner", - type: "address", - }, - ], - name: "transferOwnership", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - stateMutability: "payable", - type: "receive", - }, -]; diff --git a/packages/status-page/src/constants/abi/TaikoL1.ts b/packages/status-page/src/constants/abi/TaikoL1.ts deleted file mode 100644 index b361d2adb9..0000000000 --- a/packages/status-page/src/constants/abi/TaikoL1.ts +++ /dev/null @@ -1,1363 +0,0 @@ -export default [ - { - inputs: [], - name: "L1_ALREADY_PROVEN", - type: "error", - }, - { - inputs: [], - name: "L1_ALREADY_PROVEN", - type: "error", - }, - { - inputs: [], - name: "L1_BLOCK_ID", - type: "error", - }, - { - inputs: [], - name: "L1_BLOCK_ID", - type: "error", - }, - { - inputs: [], - name: "L1_BLOCK_ID", - type: "error", - }, - { - inputs: [ - { - internalType: "bytes32", - name: "expected", - type: "bytes32", - }, - { - internalType: "bytes32", - name: "actual", - type: "bytes32", - }, - ], - name: "L1_EVIDENCE_MISMATCH", - type: "error", - }, - { - inputs: [ - { - internalType: "bytes32", - name: "expected", - type: "bytes32", - }, - { - internalType: "bytes32", - name: "actual", - type: "bytes32", - }, - ], - name: "L1_EVIDENCE_MISMATCH", - type: "error", - }, - { - inputs: [], - name: "L1_FORK_CHOICE_NOT_FOUND", - type: "error", - }, - { - inputs: [], - name: "L1_FORK_CHOICE_NOT_FOUND", - type: "error", - }, - { - inputs: [], - name: "L1_INSUFFICIENT_TOKEN", - type: "error", - }, - { - inputs: [], - name: "L1_INSUFFICIENT_TOKEN", - type: "error", - }, - { - inputs: [], - name: "L1_INSUFFICIENT_TOKEN", - type: "error", - }, - { - inputs: [], - name: "L1_INVALID_CONFIG", - type: "error", - }, - { - inputs: [], - name: "L1_INVALID_CONFIG", - type: "error", - }, - { - inputs: [], - name: "L1_INVALID_ETH_DEPOSIT", - type: "error", - }, - { - inputs: [], - name: "L1_INVALID_ETH_DEPOSIT", - type: "error", - }, - { - inputs: [], - name: "L1_INVALID_EVIDENCE", - type: "error", - }, - { - inputs: [], - name: "L1_INVALID_EVIDENCE", - type: "error", - }, - { - inputs: [], - name: "L1_INVALID_METADATA", - type: "error", - }, - { - inputs: [], - name: "L1_INVALID_METADATA", - type: "error", - }, - { - inputs: [], - name: "L1_INVALID_PARAM", - type: "error", - }, - { - inputs: [], - name: "L1_INVALID_PROOF", - type: "error", - }, - { - inputs: [], - name: "L1_INVALID_PROOF", - type: "error", - }, - { - inputs: [], - name: "L1_INVALID_PROOF_OVERWRITE", - type: "error", - }, - { - inputs: [], - name: "L1_INVALID_PROOF_OVERWRITE", - type: "error", - }, - { - inputs: [], - name: "L1_NOT_SPECIAL_PROVER", - type: "error", - }, - { - inputs: [], - name: "L1_NOT_SPECIAL_PROVER", - type: "error", - }, - { - inputs: [], - name: "L1_ORACLE_PROVER_DISABLED", - type: "error", - }, - { - inputs: [], - name: "L1_ORACLE_PROVER_DISABLED", - type: "error", - }, - { - inputs: [], - name: "L1_SAME_PROOF", - type: "error", - }, - { - inputs: [], - name: "L1_SAME_PROOF", - type: "error", - }, - { - inputs: [], - name: "L1_SYSTEM_PROVER_DISABLED", - type: "error", - }, - { - inputs: [], - name: "L1_SYSTEM_PROVER_DISABLED", - type: "error", - }, - { - inputs: [], - name: "L1_SYSTEM_PROVER_PROHIBITED", - type: "error", - }, - { - inputs: [], - name: "L1_SYSTEM_PROVER_PROHIBITED", - type: "error", - }, - { - inputs: [], - name: "L1_TOO_MANY_BLOCKS", - type: "error", - }, - { - inputs: [], - name: "L1_TOO_MANY_BLOCKS", - type: "error", - }, - { - inputs: [], - name: "L1_TX_LIST", - type: "error", - }, - { - inputs: [], - name: "L1_TX_LIST", - type: "error", - }, - { - inputs: [], - name: "L1_TX_LIST_HASH", - type: "error", - }, - { - inputs: [], - name: "L1_TX_LIST_HASH", - type: "error", - }, - { - inputs: [], - name: "L1_TX_LIST_NOT_EXIST", - type: "error", - }, - { - inputs: [], - name: "L1_TX_LIST_NOT_EXIST", - type: "error", - }, - { - inputs: [], - name: "L1_TX_LIST_RANGE", - type: "error", - }, - { - inputs: [], - name: "L1_TX_LIST_RANGE", - type: "error", - }, - { - inputs: [], - name: "Overflow", - type: "error", - }, - { - inputs: [], - name: "RESOLVER_DENIED", - type: "error", - }, - { - inputs: [], - name: "RESOLVER_INVALID_ADDR", - type: "error", - }, - { - inputs: [ - { - internalType: "uint256", - name: "chainId", - type: "uint256", - }, - { - internalType: "bytes32", - name: "name", - type: "bytes32", - }, - ], - name: "RESOLVER_ZERO_ADDR", - type: "error", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "address", - name: "addressManager", - type: "address", - }, - ], - name: "AddressManagerChanged", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "uint256", - name: "id", - type: "uint256", - }, - { - components: [ - { - internalType: "uint64", - name: "id", - type: "uint64", - }, - { - internalType: "uint64", - name: "timestamp", - type: "uint64", - }, - { - internalType: "uint64", - name: "l1Height", - type: "uint64", - }, - { - internalType: "bytes32", - name: "l1Hash", - type: "bytes32", - }, - { - internalType: "bytes32", - name: "mixHash", - type: "bytes32", - }, - { - internalType: "bytes32", - name: "txListHash", - type: "bytes32", - }, - { - internalType: "uint24", - name: "txListByteStart", - type: "uint24", - }, - { - internalType: "uint24", - name: "txListByteEnd", - type: "uint24", - }, - { - internalType: "uint32", - name: "gasLimit", - type: "uint32", - }, - { - internalType: "address", - name: "beneficiary", - type: "address", - }, - { - internalType: "address", - name: "treasury", - type: "address", - }, - { - components: [ - { - internalType: "address", - name: "recipient", - type: "address", - }, - { - internalType: "uint96", - name: "amount", - type: "uint96", - }, - ], - internalType: "struct TaikoData.EthDeposit[]", - name: "depositsProcessed", - type: "tuple[]", - }, - ], - indexed: false, - internalType: "struct TaikoData.BlockMetadata", - name: "meta", - type: "tuple", - }, - { - indexed: false, - internalType: "uint64", - name: "blockFee", - type: "uint64", - }, - ], - name: "BlockProposed", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "uint256", - name: "id", - type: "uint256", - }, - { - indexed: false, - internalType: "bytes32", - name: "parentHash", - type: "bytes32", - }, - { - indexed: false, - internalType: "bytes32", - name: "blockHash", - type: "bytes32", - }, - { - indexed: false, - internalType: "bytes32", - name: "signalRoot", - type: "bytes32", - }, - { - indexed: false, - internalType: "address", - name: "prover", - type: "address", - }, - { - indexed: false, - internalType: "uint32", - name: "parentGasUsed", - type: "uint32", - }, - ], - name: "BlockProven", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "uint256", - name: "id", - type: "uint256", - }, - { - indexed: false, - internalType: "bytes32", - name: "blockHash", - type: "bytes32", - }, - { - indexed: false, - internalType: "uint64", - name: "reward", - type: "uint64", - }, - ], - name: "BlockVerified", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "uint256", - name: "srcHeight", - type: "uint256", - }, - { - indexed: false, - internalType: "bytes32", - name: "blockHash", - type: "bytes32", - }, - { - indexed: false, - internalType: "bytes32", - name: "signalRoot", - type: "bytes32", - }, - ], - name: "CrossChainSynced", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - components: [ - { - internalType: "address", - name: "recipient", - type: "address", - }, - { - internalType: "uint96", - name: "amount", - type: "uint96", - }, - ], - indexed: false, - internalType: "struct TaikoData.EthDeposit", - name: "deposit", - type: "tuple", - }, - ], - name: "EthDeposited", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "uint8", - name: "version", - type: "uint8", - }, - ], - name: "Initialized", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "previousOwner", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "newOwner", - type: "address", - }, - ], - name: "OwnershipTransferred", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "uint64", - name: "proofTimeTarget", - type: "uint64", - }, - { - indexed: false, - internalType: "uint64", - name: "proofTimeIssued", - type: "uint64", - }, - { - indexed: false, - internalType: "uint64", - name: "blockFee", - type: "uint64", - }, - { - indexed: false, - internalType: "uint16", - name: "adjustmentQuotient", - type: "uint16", - }, - ], - name: "ProofParamsChanged", - type: "event", - }, - { - inputs: [], - name: "addressManager", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "depositEtherToL2", - outputs: [], - stateMutability: "payable", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "amount", - type: "uint256", - }, - ], - name: "depositTaikoToken", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "blockId", - type: "uint256", - }, - ], - name: "getBlock", - outputs: [ - { - internalType: "bytes32", - name: "_metaHash", - type: "bytes32", - }, - { - internalType: "address", - name: "_proposer", - type: "address", - }, - { - internalType: "uint64", - name: "_proposedAt", - type: "uint64", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "getBlockFee", - outputs: [ - { - internalType: "uint64", - name: "", - type: "uint64", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "getConfig", - outputs: [ - { - components: [ - { - internalType: "uint256", - name: "chainId", - type: "uint256", - }, - { - internalType: "uint256", - name: "maxNumProposedBlocks", - type: "uint256", - }, - { - internalType: "uint256", - name: "ringBufferSize", - type: "uint256", - }, - { - internalType: "uint256", - name: "maxVerificationsPerTx", - type: "uint256", - }, - { - internalType: "uint64", - name: "blockMaxGasLimit", - type: "uint64", - }, - { - internalType: "uint64", - name: "maxTransactionsPerBlock", - type: "uint64", - }, - { - internalType: "uint64", - name: "maxBytesPerTxList", - type: "uint64", - }, - { - internalType: "uint256", - name: "txListCacheExpiry", - type: "uint256", - }, - { - internalType: "uint256", - name: "proofCooldownPeriod", - type: "uint256", - }, - { - internalType: "uint256", - name: "systemProofCooldownPeriod", - type: "uint256", - }, - { - internalType: "uint256", - name: "realProofSkipSize", - type: "uint256", - }, - { - internalType: "uint256", - name: "ethDepositGas", - type: "uint256", - }, - { - internalType: "uint256", - name: "ethDepositMaxFee", - type: "uint256", - }, - { - internalType: "uint64", - name: "ethDepositMinCountPerBlock", - type: "uint64", - }, - { - internalType: "uint64", - name: "ethDepositMaxCountPerBlock", - type: "uint64", - }, - { - internalType: "uint96", - name: "ethDepositMaxAmount", - type: "uint96", - }, - { - internalType: "uint96", - name: "ethDepositMinAmount", - type: "uint96", - }, - { - internalType: "bool", - name: "relaySignalRoot", - type: "bool", - }, - ], - internalType: "struct TaikoData.Config", - name: "", - type: "tuple", - }, - ], - stateMutability: "pure", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "blockId", - type: "uint256", - }, - ], - name: "getCrossChainBlockHash", - outputs: [ - { - internalType: "bytes32", - name: "", - type: "bytes32", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "blockId", - type: "uint256", - }, - ], - name: "getCrossChainSignalRoot", - outputs: [ - { - internalType: "bytes32", - name: "", - type: "bytes32", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "blockId", - type: "uint256", - }, - { - internalType: "bytes32", - name: "parentHash", - type: "bytes32", - }, - { - internalType: "uint32", - name: "parentGasUsed", - type: "uint32", - }, - ], - name: "getForkChoice", - outputs: [ - { - components: [ - { - internalType: "bytes32", - name: "key", - type: "bytes32", - }, - { - internalType: "bytes32", - name: "blockHash", - type: "bytes32", - }, - { - internalType: "bytes32", - name: "signalRoot", - type: "bytes32", - }, - { - internalType: "uint64", - name: "provenAt", - type: "uint64", - }, - { - internalType: "address", - name: "prover", - type: "address", - }, - { - internalType: "uint32", - name: "gasUsed", - type: "uint32", - }, - ], - internalType: "struct TaikoData.ForkChoice", - name: "", - type: "tuple", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint64", - name: "proofTime", - type: "uint64", - }, - ], - name: "getProofReward", - outputs: [ - { - internalType: "uint64", - name: "", - type: "uint64", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "getStateVariables", - outputs: [ - { - components: [ - { - internalType: "uint64", - name: "blockFee", - type: "uint64", - }, - { - internalType: "uint64", - name: "accBlockFees", - type: "uint64", - }, - { - internalType: "uint64", - name: "genesisHeight", - type: "uint64", - }, - { - internalType: "uint64", - name: "genesisTimestamp", - type: "uint64", - }, - { - internalType: "uint64", - name: "numBlocks", - type: "uint64", - }, - { - internalType: "uint64", - name: "proofTimeIssued", - type: "uint64", - }, - { - internalType: "uint64", - name: "proofTimeTarget", - type: "uint64", - }, - { - internalType: "uint64", - name: "lastVerifiedBlockId", - type: "uint64", - }, - { - internalType: "uint64", - name: "accProposedAt", - type: "uint64", - }, - { - internalType: "uint64", - name: "nextEthDepositToProcess", - type: "uint64", - }, - { - internalType: "uint64", - name: "numEthDeposits", - type: "uint64", - }, - ], - internalType: "struct TaikoData.StateVariables", - name: "", - type: "tuple", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "addr", - type: "address", - }, - ], - name: "getTaikoTokenBalance", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint16", - name: "id", - type: "uint16", - }, - ], - name: "getVerifierName", - outputs: [ - { - internalType: "bytes32", - name: "", - type: "bytes32", - }, - ], - stateMutability: "pure", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "_addressManager", - type: "address", - }, - { - internalType: "bytes32", - name: "_genesisBlockHash", - type: "bytes32", - }, - { - internalType: "uint64", - name: "_initBlockFee", - type: "uint64", - }, - { - internalType: "uint64", - name: "_initProofTimeTarget", - type: "uint64", - }, - { - internalType: "uint64", - name: "_initProofTimeIssued", - type: "uint64", - }, - { - internalType: "uint16", - name: "_adjustmentQuotient", - type: "uint16", - }, - ], - name: "init", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "owner", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "bytes", - name: "input", - type: "bytes", - }, - { - internalType: "bytes", - name: "txList", - type: "bytes", - }, - ], - name: "proposeBlock", - outputs: [ - { - components: [ - { - internalType: "uint64", - name: "id", - type: "uint64", - }, - { - internalType: "uint64", - name: "timestamp", - type: "uint64", - }, - { - internalType: "uint64", - name: "l1Height", - type: "uint64", - }, - { - internalType: "bytes32", - name: "l1Hash", - type: "bytes32", - }, - { - internalType: "bytes32", - name: "mixHash", - type: "bytes32", - }, - { - internalType: "bytes32", - name: "txListHash", - type: "bytes32", - }, - { - internalType: "uint24", - name: "txListByteStart", - type: "uint24", - }, - { - internalType: "uint24", - name: "txListByteEnd", - type: "uint24", - }, - { - internalType: "uint32", - name: "gasLimit", - type: "uint32", - }, - { - internalType: "address", - name: "beneficiary", - type: "address", - }, - { - internalType: "address", - name: "treasury", - type: "address", - }, - { - components: [ - { - internalType: "address", - name: "recipient", - type: "address", - }, - { - internalType: "uint96", - name: "amount", - type: "uint96", - }, - ], - internalType: "struct TaikoData.EthDeposit[]", - name: "depositsProcessed", - type: "tuple[]", - }, - ], - internalType: "struct TaikoData.BlockMetadata", - name: "meta", - type: "tuple", - }, - ], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "blockId", - type: "uint256", - }, - { - internalType: "bytes", - name: "input", - type: "bytes", - }, - ], - name: "proveBlock", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "renounceOwnership", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "chainId", - type: "uint256", - }, - { - internalType: "bytes32", - name: "name", - type: "bytes32", - }, - { - internalType: "bool", - name: "allowZeroAddress", - type: "bool", - }, - ], - name: "resolve", - outputs: [ - { - internalType: "address payable", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "bytes32", - name: "name", - type: "bytes32", - }, - { - internalType: "bool", - name: "allowZeroAddress", - type: "bool", - }, - ], - name: "resolve", - outputs: [ - { - internalType: "address payable", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "newAddressManager", - type: "address", - }, - ], - name: "setAddressManager", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "uint64", - name: "newProofTimeTarget", - type: "uint64", - }, - { - internalType: "uint64", - name: "newProofTimeIssued", - type: "uint64", - }, - { - internalType: "uint64", - name: "newBlockFee", - type: "uint64", - }, - { - internalType: "uint16", - name: "newAdjustmentQuotient", - type: "uint16", - }, - ], - name: "setProofParams", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "state", - outputs: [ - { - internalType: "uint64", - name: "genesisHeight", - type: "uint64", - }, - { - internalType: "uint64", - name: "genesisTimestamp", - type: "uint64", - }, - { - internalType: "uint16", - name: "adjustmentQuotient", - type: "uint16", - }, - { - internalType: "uint48", - name: "__reserved71", - type: "uint48", - }, - { - internalType: "uint64", - name: "__reserved72", - type: "uint64", - }, - { - internalType: "uint64", - name: "accProposedAt", - type: "uint64", - }, - { - internalType: "uint64", - name: "accBlockFees", - type: "uint64", - }, - { - internalType: "uint64", - name: "numBlocks", - type: "uint64", - }, - { - internalType: "uint64", - name: "nextEthDepositToProcess", - type: "uint64", - }, - { - internalType: "uint64", - name: "blockFee", - type: "uint64", - }, - { - internalType: "uint64", - name: "proofTimeIssued", - type: "uint64", - }, - { - internalType: "uint64", - name: "lastVerifiedBlockId", - type: "uint64", - }, - { - internalType: "uint64", - name: "proofTimeTarget", - type: "uint64", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "newOwner", - type: "address", - }, - ], - name: "transferOwnership", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "maxBlocks", - type: "uint256", - }, - ], - name: "verifyBlocks", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "amount", - type: "uint256", - }, - ], - name: "withdrawTaikoToken", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - stateMutability: "payable", - type: "receive", - }, -]; diff --git a/packages/status-page/src/constants/abi/TaikoL2.ts b/packages/status-page/src/constants/abi/TaikoL2.ts deleted file mode 100644 index 3986e958a0..0000000000 --- a/packages/status-page/src/constants/abi/TaikoL2.ts +++ /dev/null @@ -1,670 +0,0 @@ -export default [ - { - inputs: [ - { - internalType: "uint64", - name: "expected", - type: "uint64", - }, - { - internalType: "uint64", - name: "actual", - type: "uint64", - }, - ], - name: "L2_BASEFEE_MISMATCH", - type: "error", - }, - { - inputs: [], - name: "L2_INVALID_1559_PARAMS", - type: "error", - }, - { - inputs: [], - name: "L2_INVALID_CHAIN_ID", - type: "error", - }, - { - inputs: [], - name: "L2_INVALID_GOLDEN_TOUCH_K", - type: "error", - }, - { - inputs: [], - name: "L2_INVALID_SENDER", - type: "error", - }, - { - inputs: [ - { - internalType: "bytes32", - name: "expected", - type: "bytes32", - }, - { - internalType: "bytes32", - name: "actual", - type: "bytes32", - }, - ], - name: "L2_PUBLIC_INPUT_HASH_MISMATCH", - type: "error", - }, - { - inputs: [], - name: "L2_TOO_LATE", - type: "error", - }, - { - inputs: [], - name: "M1559_OUT_OF_STOCK", - type: "error", - }, - { - inputs: [], - name: "M1559_OUT_OF_STOCK", - type: "error", - }, - { - inputs: [ - { - internalType: "uint64", - name: "expected", - type: "uint64", - }, - { - internalType: "uint64", - name: "actual", - type: "uint64", - }, - ], - name: "M1559_UNEXPECTED_CHANGE", - type: "error", - }, - { - inputs: [ - { - internalType: "uint64", - name: "expected", - type: "uint64", - }, - { - internalType: "uint64", - name: "actual", - type: "uint64", - }, - ], - name: "M1559_UNEXPECTED_CHANGE", - type: "error", - }, - { - inputs: [], - name: "Overflow", - type: "error", - }, - { - inputs: [], - name: "RESOLVER_DENIED", - type: "error", - }, - { - inputs: [], - name: "RESOLVER_INVALID_ADDR", - type: "error", - }, - { - inputs: [ - { - internalType: "uint256", - name: "chainId", - type: "uint256", - }, - { - internalType: "bytes32", - name: "name", - type: "bytes32", - }, - ], - name: "RESOLVER_ZERO_ADDR", - type: "error", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "address", - name: "addressManager", - type: "address", - }, - ], - name: "AddressManagerChanged", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "uint64", - name: "number", - type: "uint64", - }, - { - indexed: false, - internalType: "uint64", - name: "basefee", - type: "uint64", - }, - { - indexed: false, - internalType: "uint64", - name: "gaslimit", - type: "uint64", - }, - { - indexed: false, - internalType: "uint64", - name: "timestamp", - type: "uint64", - }, - { - indexed: false, - internalType: "bytes32", - name: "parentHash", - type: "bytes32", - }, - { - indexed: false, - internalType: "uint256", - name: "prevrandao", - type: "uint256", - }, - { - indexed: false, - internalType: "address", - name: "coinbase", - type: "address", - }, - { - indexed: false, - internalType: "uint32", - name: "chainid", - type: "uint32", - }, - ], - name: "Anchored", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "uint256", - name: "srcHeight", - type: "uint256", - }, - { - indexed: false, - internalType: "bytes32", - name: "blockHash", - type: "bytes32", - }, - { - indexed: false, - internalType: "bytes32", - name: "signalRoot", - type: "bytes32", - }, - ], - name: "CrossChainSynced", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "uint8", - name: "version", - type: "uint8", - }, - ], - name: "Initialized", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "previousOwner", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "newOwner", - type: "address", - }, - ], - name: "OwnershipTransferred", - type: "event", - }, - { - inputs: [], - name: "GOLDEN_TOUCH_ADDRESS", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "GOLDEN_TOUCH_PRIVATEKEY", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "addressManager", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "bytes32", - name: "l1Hash", - type: "bytes32", - }, - { - internalType: "bytes32", - name: "l1SignalRoot", - type: "bytes32", - }, - { - internalType: "uint64", - name: "l1Height", - type: "uint64", - }, - { - internalType: "uint64", - name: "parentGasUsed", - type: "uint64", - }, - ], - name: "anchor", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "gasExcess", - outputs: [ - { - internalType: "uint64", - name: "", - type: "uint64", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint32", - name: "timeSinceParent", - type: "uint32", - }, - { - internalType: "uint64", - name: "gasLimit", - type: "uint64", - }, - { - internalType: "uint64", - name: "parentGasUsed", - type: "uint64", - }, - ], - name: "getBasefee", - outputs: [ - { - internalType: "uint256", - name: "_basefee", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "number", - type: "uint256", - }, - ], - name: "getBlockHash", - outputs: [ - { - internalType: "bytes32", - name: "", - type: "bytes32", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "number", - type: "uint256", - }, - ], - name: "getCrossChainBlockHash", - outputs: [ - { - internalType: "bytes32", - name: "", - type: "bytes32", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "number", - type: "uint256", - }, - ], - name: "getCrossChainSignalRoot", - outputs: [ - { - internalType: "bytes32", - name: "", - type: "bytes32", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "getEIP1559Config", - outputs: [ - { - components: [ - { - internalType: "uint128", - name: "yscale", - type: "uint128", - }, - { - internalType: "uint64", - name: "xscale", - type: "uint64", - }, - { - internalType: "uint64", - name: "gasIssuedPerSecond", - type: "uint64", - }, - ], - internalType: "struct TaikoL2.EIP1559Config", - name: "", - type: "tuple", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "_addressManager", - type: "address", - }, - { - components: [ - { - internalType: "uint64", - name: "basefee", - type: "uint64", - }, - { - internalType: "uint64", - name: "gasIssuedPerSecond", - type: "uint64", - }, - { - internalType: "uint64", - name: "gasExcessMax", - type: "uint64", - }, - { - internalType: "uint64", - name: "gasTarget", - type: "uint64", - }, - { - internalType: "uint64", - name: "ratio2x1x", - type: "uint64", - }, - ], - internalType: "struct TaikoL2.EIP1559Params", - name: "_param1559", - type: "tuple", - }, - ], - name: "init", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "latestSyncedL1Height", - outputs: [ - { - internalType: "uint64", - name: "", - type: "uint64", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "owner", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "parentTimestamp", - outputs: [ - { - internalType: "uint64", - name: "", - type: "uint64", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "publicInputHash", - outputs: [ - { - internalType: "bytes32", - name: "", - type: "bytes32", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "renounceOwnership", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "chainId", - type: "uint256", - }, - { - internalType: "bytes32", - name: "name", - type: "bytes32", - }, - { - internalType: "bool", - name: "allowZeroAddress", - type: "bool", - }, - ], - name: "resolve", - outputs: [ - { - internalType: "address payable", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "bytes32", - name: "name", - type: "bytes32", - }, - { - internalType: "bool", - name: "allowZeroAddress", - type: "bool", - }, - ], - name: "resolve", - outputs: [ - { - internalType: "address payable", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "newAddressManager", - type: "address", - }, - ], - name: "setAddressManager", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "bytes32", - name: "digest", - type: "bytes32", - }, - { - internalType: "uint8", - name: "k", - type: "uint8", - }, - ], - name: "signAnchor", - outputs: [ - { - internalType: "uint8", - name: "v", - type: "uint8", - }, - { - internalType: "uint256", - name: "r", - type: "uint256", - }, - { - internalType: "uint256", - name: "s", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "newOwner", - type: "address", - }, - ], - name: "transferOwnership", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, -]; diff --git a/packages/status-page/src/constants/abi/TaikoToken.ts b/packages/status-page/src/constants/abi/TaikoToken.ts deleted file mode 100644 index a6cf40a5f7..0000000000 --- a/packages/status-page/src/constants/abi/TaikoToken.ts +++ /dev/null @@ -1,1036 +0,0 @@ -export default [ - { - inputs: [], - name: "RESOLVER_DENIED", - type: "error", - }, - { - inputs: [], - name: "RESOLVER_INVALID_ADDR", - type: "error", - }, - { - inputs: [ - { - internalType: "uint256", - name: "chainId", - type: "uint256", - }, - { - internalType: "bytes32", - name: "name", - type: "bytes32", - }, - ], - name: "RESOLVER_ZERO_ADDR", - type: "error", - }, - { - inputs: [], - name: "TKO_INVALID_ADDR", - type: "error", - }, - { - inputs: [], - name: "TKO_INVALID_PREMINT_PARAMS", - type: "error", - }, - { - inputs: [], - name: "TKO_MINT_DISALLOWED", - type: "error", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "address", - name: "addressManager", - type: "address", - }, - ], - name: "AddressManagerChanged", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "owner", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "spender", - type: "address", - }, - { - indexed: false, - internalType: "uint256", - name: "value", - type: "uint256", - }, - ], - name: "Approval", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "address", - name: "account", - type: "address", - }, - { - indexed: false, - internalType: "uint256", - name: "amount", - type: "uint256", - }, - ], - name: "Burn", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "delegator", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "fromDelegate", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "toDelegate", - type: "address", - }, - ], - name: "DelegateChanged", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "delegate", - type: "address", - }, - { - indexed: false, - internalType: "uint256", - name: "previousBalance", - type: "uint256", - }, - { - indexed: false, - internalType: "uint256", - name: "newBalance", - type: "uint256", - }, - ], - name: "DelegateVotesChanged", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "uint8", - name: "version", - type: "uint8", - }, - ], - name: "Initialized", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "address", - name: "account", - type: "address", - }, - { - indexed: false, - internalType: "uint256", - name: "amount", - type: "uint256", - }, - ], - name: "Mint", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "previousOwner", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "newOwner", - type: "address", - }, - ], - name: "OwnershipTransferred", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "address", - name: "account", - type: "address", - }, - ], - name: "Paused", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "uint256", - name: "id", - type: "uint256", - }, - ], - name: "Snapshot", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "from", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "to", - type: "address", - }, - { - indexed: false, - internalType: "uint256", - name: "value", - type: "uint256", - }, - ], - name: "Transfer", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "address", - name: "account", - type: "address", - }, - ], - name: "Unpaused", - type: "event", - }, - { - inputs: [], - name: "DOMAIN_SEPARATOR", - outputs: [ - { - internalType: "bytes32", - name: "", - type: "bytes32", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "addressManager", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "owner", - type: "address", - }, - { - internalType: "address", - name: "spender", - type: "address", - }, - ], - name: "allowance", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "spender", - type: "address", - }, - { - internalType: "uint256", - name: "amount", - type: "uint256", - }, - ], - name: "approve", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "account", - type: "address", - }, - ], - name: "balanceOf", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "account", - type: "address", - }, - { - internalType: "uint256", - name: "snapshotId", - type: "uint256", - }, - ], - name: "balanceOfAt", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "amount", - type: "uint256", - }, - ], - name: "burn", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "from", - type: "address", - }, - { - internalType: "uint256", - name: "amount", - type: "uint256", - }, - ], - name: "burn", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "account", - type: "address", - }, - { - internalType: "uint256", - name: "amount", - type: "uint256", - }, - ], - name: "burnFrom", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "account", - type: "address", - }, - { - internalType: "uint32", - name: "pos", - type: "uint32", - }, - ], - name: "checkpoints", - outputs: [ - { - components: [ - { - internalType: "uint32", - name: "fromBlock", - type: "uint32", - }, - { - internalType: "uint224", - name: "votes", - type: "uint224", - }, - ], - internalType: "struct ERC20VotesUpgradeable.Checkpoint", - name: "", - type: "tuple", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "decimals", - outputs: [ - { - internalType: "uint8", - name: "", - type: "uint8", - }, - ], - stateMutability: "pure", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "spender", - type: "address", - }, - { - internalType: "uint256", - name: "subtractedValue", - type: "uint256", - }, - ], - name: "decreaseAllowance", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "delegatee", - type: "address", - }, - ], - name: "delegate", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "delegatee", - type: "address", - }, - { - internalType: "uint256", - name: "nonce", - type: "uint256", - }, - { - internalType: "uint256", - name: "expiry", - type: "uint256", - }, - { - internalType: "uint8", - name: "v", - type: "uint8", - }, - { - internalType: "bytes32", - name: "r", - type: "bytes32", - }, - { - internalType: "bytes32", - name: "s", - type: "bytes32", - }, - ], - name: "delegateBySig", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "account", - type: "address", - }, - ], - name: "delegates", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "blockNumber", - type: "uint256", - }, - ], - name: "getPastTotalSupply", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "account", - type: "address", - }, - { - internalType: "uint256", - name: "blockNumber", - type: "uint256", - }, - ], - name: "getPastVotes", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "account", - type: "address", - }, - ], - name: "getVotes", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "spender", - type: "address", - }, - { - internalType: "uint256", - name: "addedValue", - type: "uint256", - }, - ], - name: "increaseAllowance", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "_addressManager", - type: "address", - }, - { - internalType: "string", - name: "_name", - type: "string", - }, - { - internalType: "string", - name: "_symbol", - type: "string", - }, - { - internalType: "address[]", - name: "_premintRecipients", - type: "address[]", - }, - { - internalType: "uint256[]", - name: "_premintAmounts", - type: "uint256[]", - }, - ], - name: "init", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256", - name: "amount", - type: "uint256", - }, - ], - name: "mint", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "name", - outputs: [ - { - internalType: "string", - name: "", - type: "string", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "owner", - type: "address", - }, - ], - name: "nonces", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "account", - type: "address", - }, - ], - name: "numCheckpoints", - outputs: [ - { - internalType: "uint32", - name: "", - type: "uint32", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "owner", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "pause", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "paused", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "owner", - type: "address", - }, - { - internalType: "address", - name: "spender", - type: "address", - }, - { - internalType: "uint256", - name: "value", - type: "uint256", - }, - { - internalType: "uint256", - name: "deadline", - type: "uint256", - }, - { - internalType: "uint8", - name: "v", - type: "uint8", - }, - { - internalType: "bytes32", - name: "r", - type: "bytes32", - }, - { - internalType: "bytes32", - name: "s", - type: "bytes32", - }, - ], - name: "permit", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "renounceOwnership", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "chainId", - type: "uint256", - }, - { - internalType: "bytes32", - name: "name", - type: "bytes32", - }, - { - internalType: "bool", - name: "allowZeroAddress", - type: "bool", - }, - ], - name: "resolve", - outputs: [ - { - internalType: "address payable", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "bytes32", - name: "name", - type: "bytes32", - }, - { - internalType: "bool", - name: "allowZeroAddress", - type: "bool", - }, - ], - name: "resolve", - outputs: [ - { - internalType: "address payable", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "newAddressManager", - type: "address", - }, - ], - name: "setAddressManager", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "snapshot", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "symbol", - outputs: [ - { - internalType: "string", - name: "", - type: "string", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "totalSupply", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "snapshotId", - type: "uint256", - }, - ], - name: "totalSupplyAt", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256", - name: "amount", - type: "uint256", - }, - ], - name: "transfer", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "from", - type: "address", - }, - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256", - name: "amount", - type: "uint256", - }, - ], - name: "transferFrom", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "newOwner", - type: "address", - }, - ], - name: "transferOwnership", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "unpause", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, -]; diff --git a/packages/status-page/src/domain/layer.ts b/packages/status-page/src/domain/layer.ts deleted file mode 100644 index 47935ccc36..0000000000 --- a/packages/status-page/src/domain/layer.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum Layer { - Two, - Three, -} diff --git a/packages/status-page/src/domain/status.ts b/packages/status-page/src/domain/status.ts deleted file mode 100644 index 5610cbbbf9..0000000000 --- a/packages/status-page/src/domain/status.ts +++ /dev/null @@ -1,24 +0,0 @@ -import type { BigNumber, ethers } from "ethers"; - -type Status = string | number | boolean | BigNumber; - -type StatusIndicatorProp = { - statusFunc?: ( - provider: ethers.providers.JsonRpcProvider, - contractAddress: string - ) => Promise; - watchStatusFunc?: ( - provider: ethers.providers.JsonRpcProvider, - contractAddress: string, - onEvent: (value: Status) => void - ) => Promise<() => void>; - provider: ethers.providers.JsonRpcProvider; - contractAddress: string; - header: string; - intervalInMs: number; - colorFunc: (value: Status) => string; - onClick?: (value: Status) => void; - tooltip: string; - status?: Status; -}; -export { Status, StatusIndicatorProp }; diff --git a/packages/status-page/src/i18n.js b/packages/status-page/src/i18n.js deleted file mode 100644 index b2e76cb012..0000000000 --- a/packages/status-page/src/i18n.js +++ /dev/null @@ -1,41 +0,0 @@ -import { _, dictionary, locale } from "svelte-i18n"; - -function setupI18n({ withLocale: _locale } = { withLocale: "en" }) { - dictionary.set({ - en: { - home: { - title: "Taiko Bridge", - selectToken: "Select Token", - to: "To", - bridge: "Bridge", - approve: "Approve", - }, - bridgeForm: { - fieldLabel: "Amount", - maxLabel: "Max:", - processingFeeLabel: "Processing Fee", - bridge: "Bridge", - approve: "Approve", - }, - nav: { - connect: "Connect Wallet", - }, - toast: { - transactionSent: "Transaction sent", - errorSendingTransaction: "Error sending transaction", - errorDisconnecting: "Could not disconnect", - }, - switchChainModal: { - title: "Not on the right network", - subtitle: "Your current network is not supported. Please select one:", - }, - connectModal: { - title: "Connect Wallet", - }, - }, - }); - - locale.set(_locale); -} - -export { _, setupI18n }; diff --git a/packages/status-page/src/main.ts b/packages/status-page/src/main.ts deleted file mode 100644 index 3bbaf7b1fe..0000000000 --- a/packages/status-page/src/main.ts +++ /dev/null @@ -1,12 +0,0 @@ -import "./app.css"; -import App from "./App.svelte"; -import {Buffer} from 'buffer'; - -const app = new App({ - target: document.getElementById("app"), -}); - -// @ts-ignore -window.Buffer = Buffer; - -export default app; diff --git a/packages/status-page/src/pages/home/Home.svelte b/packages/status-page/src/pages/home/Home.svelte deleted file mode 100644 index 910346f938..0000000000 --- a/packages/status-page/src/pages/home/Home.svelte +++ /dev/null @@ -1,129 +0,0 @@ - - -
-

Taiko Protocol Status

-

- {layerToDisplayName($layer)} -

-
-
- {#each statusIndicators as statusIndicator} - - {/each} -
- -{#if proverDetailsOpen} - -
- {#await getNumProvers(config.eventIndexerApiUrl) then provers} - {#each provers.provers as prover} - - {addressSubsection(prover.address)} - -
{prover.count}
- {/each} - {:catch error} -

{error.message}

- {/await} -
-
-{/if} - -{#if proposerDetailsOpen} - -
- {#await getNumProposers(config.eventIndexerApiUrl) then proposers} - {#each proposers.proposers as proposer} - - {addressSubsection(proposer.address)} - -
{proposer.count}
- {/each} - {:catch error} -

{error.message}

- {/await} -
-
-{/if} diff --git a/packages/status-page/src/store/layer.ts b/packages/status-page/src/store/layer.ts deleted file mode 100644 index c8842876b0..0000000000 --- a/packages/status-page/src/store/layer.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { Layer } from "../domain/layer"; -import { writable } from "svelte/store"; - -export const layer = writable(Layer.Two); diff --git a/packages/status-page/src/utils/addressSubsection.ts b/packages/status-page/src/utils/addressSubsection.ts deleted file mode 100644 index 5d4b7e201a..0000000000 --- a/packages/status-page/src/utils/addressSubsection.ts +++ /dev/null @@ -1,4 +0,0 @@ -export const addressSubsection = (address: string) => { - if (!address) return "0x"; - return `${address.substring(0, 5)}...${address.substring(38, 42)}`; -}; diff --git a/packages/status-page/src/utils/buildStatusIndicators.ts b/packages/status-page/src/utils/buildStatusIndicators.ts deleted file mode 100644 index 4c82c0f22b..0000000000 --- a/packages/status-page/src/utils/buildStatusIndicators.ts +++ /dev/null @@ -1,518 +0,0 @@ -import { BigNumber, Contract, ethers } from "ethers"; -import TaikoToken from "../constants/abi/TaikoToken"; -import TaikoL1 from "../constants/abi/TaikoL1"; -import type { Status, StatusIndicatorProp } from "../domain/status"; -import { getAvailableSlots } from "./getAvailableSlots"; -import type { StatsResponse } from "./getAverageProofReward"; -import { getAverageProofTime } from "./getAverageProofTime"; -import { getEthDeposits } from "./getEthDeposits"; -import { getGasPrice } from "./getGasPrice"; -import { getLastVerifiedBlockId } from "./getLastVerifiedBlockId"; -import { getLatestSyncedHeader } from "./getLatestSyncedHeader"; -import { getNextBlockId } from "./getNextBlockId"; -import { getNextEthDepositToProcess } from "./getNextEthDepositToProcess"; -import { getNumProposers } from "./getNumProposers"; -import { getNumProvers } from "./getNumProvers"; -import { getPendingBlocks } from "./getPendingBlocks"; -import { getPendingTransactions } from "./getPendingTransactions"; -import { getQueuedTransactions } from "./getQueuedTransactions"; -import type { initConfig } from "./initConfig"; -import { watchHeaderSynced } from "./watchHeaderSynced"; -import axios from "axios"; -import { getStateVariables } from "./getStateVariables"; - -export async function buildStatusIndicators( - config: ReturnType, - onProverClick: (value: Status) => void, - onProposerClick: (value: Status) => void -) { - const tko: Contract = new Contract( - config.taikoTokenAddress, - TaikoToken, - config.l1Provider - ); - - let decimals: number = 8; - - try { - decimals = await tko.decimals(); - } catch (e) {} - - const indicators: StatusIndicatorProp[] = [ - { - statusFunc: async ( - provider: ethers.providers.JsonRpcProvider, - address: string - ) => (await getNumProvers(config.eventIndexerApiUrl)).uniqueProvers, - provider: config.l1Provider, - contractAddress: config.l1TaikoAddress, - header: "Unique Provers", - intervalInMs: 0, - colorFunc: (value: Status) => { - return "green"; - }, - onClick: onProverClick, - tooltip: - "The number of unique provers who successfully submitted a proof to the TaikoL1 smart contract.", - }, - { - statusFunc: async ( - provider: ethers.providers.JsonRpcProvider, - address: string - ) => (await getNumProposers(config.eventIndexerApiUrl)).uniqueProposers, - provider: config.l1Provider, - contractAddress: config.l1TaikoAddress, - header: "Unique Proposers", - intervalInMs: 0, - colorFunc: (value: Status) => { - return "green"; - }, - onClick: onProposerClick, - tooltip: - "The number of unique proposers who successfully submitted a proposed block to the TaikoL1 smart contract.", - }, - { - statusFunc: getLatestSyncedHeader, - watchStatusFunc: watchHeaderSynced, - provider: config.l1Provider, - contractAddress: config.l1TaikoAddress, - header: "L1 Latest Synced Header", - intervalInMs: 0, - colorFunc: (value: Status) => { - return "green"; - }, - onClick: (value: Status) => { - window.open( - `${config.l2ExplorerUrl}/block/${value.toString()}`, - "_blank" - ); - }, - tooltip: - "The most recent Layer 2 Header that has been synchronized with the TaikoL1 smart contract.", - }, - { - statusFunc: getLatestSyncedHeader, - watchStatusFunc: watchHeaderSynced, - provider: config.l2Provider, - contractAddress: config.l2TaikoAddress, - header: "L2 Latest Synced Header", - intervalInMs: 0, - colorFunc: (value: Status) => { - return "green"; - }, - onClick: (value: Status) => { - window.open( - `${config.l1ExplorerUrl}/block/${value.toString()}`, - "_blank" - ); - }, - tooltip: - "The most recent Layer 1 Header that has been synchronized with the TaikoL2 smart contract. The headers are synchronized with every L2 block.", - }, - { - statusFunc: getPendingTransactions, - watchStatusFunc: null, - provider: config.l2Provider, - contractAddress: "", - header: "Tx Mempool (pending)", - intervalInMs: 20000, - colorFunc: (value: Status) => { - if (BigNumber.from(value).gt(4000)) return "red"; - return "green"; - }, - tooltip: - "The current processable transactions in the mempool that have not been added to a block yet.", - }, - { - statusFunc: getQueuedTransactions, - watchStatusFunc: null, - provider: config.l2Provider, - contractAddress: "", - header: "Tx Mempool (queued)", - intervalInMs: 20000, - colorFunc: (value: Status) => { - if (BigNumber.from(value).gt(4000)) return "red"; - return "green"; - }, - tooltip: - "The current transactions in the mempool where the transaction nonce is not in sequence. They are currently non-processable.", - }, - { - statusFunc: getAvailableSlots, - watchStatusFunc: null, - provider: config.l1Provider, - contractAddress: config.l1TaikoAddress, - header: "Available Slots", - intervalInMs: 20000, - colorFunc: (value: Status) => { - if (BigNumber.from(value).eq(0)) return "red"; - return "green"; - }, - tooltip: - "The amount of slots for proposed blocks on the TaikoL1 smart contract. When this number is 0, no blocks can be proposed until a block has been proven.", - }, - { - statusFunc: getLastVerifiedBlockId, - watchStatusFunc: null, - provider: config.l1Provider, - contractAddress: config.l1TaikoAddress, - header: "Last Verified Block ID", - intervalInMs: 20000, - colorFunc: (value: Status) => { - return "green"; - }, - tooltip: - "The most recently verified Layer 2 block on the TaikoL1 smart contract.", - }, - { - statusFunc: getNextBlockId, - watchStatusFunc: null, - provider: config.l1Provider, - contractAddress: config.l1TaikoAddress, - header: "Next Block ID", - intervalInMs: 20000, - colorFunc: (value: Status) => { - return "green"; - }, - tooltip: - "The ID that the next proposed block on the TaikoL1 smart contract will receive.", - }, - { - statusFunc: getPendingBlocks, - watchStatusFunc: null, - provider: config.l1Provider, - contractAddress: config.l1TaikoAddress, - header: "Unverified Blocks", - intervalInMs: 20000, - colorFunc: (value: Status) => { - if (BigNumber.from(value).eq(0)) { - return "red"; - } else if (BigNumber.from(value).lt(5)) { - return "yellow"; - } else { - return "green"; - } - }, - tooltip: - "The amount of pending proposed blocks that have not been proven on the TaikoL1 smart contract.", - }, - { - statusFunc: getEthDeposits, - watchStatusFunc: null, - provider: config.l1Provider, - contractAddress: config.l1TaikoAddress, - header: "ETH Deposits", - intervalInMs: 20000, - colorFunc: (value: Status) => { - // if (BigNumber.from(value).eq(0)) { - // return "green"; - // } else if (BigNumber.from(value).lt(32)) { - // return "yellow"; - // } else { - // return "red"; - // } - return "green"; - }, - tooltip: "The number of pending ETH deposits for L1 => L2", - }, - { - statusFunc: getNextEthDepositToProcess, - watchStatusFunc: null, - provider: config.l1Provider, - contractAddress: config.l1TaikoAddress, - header: "Next ETH Deposit", - intervalInMs: 20000, - colorFunc: (value: Status) => { - return "green"; - }, - tooltip: "The next ETH deposit that will be processed", - }, - { - statusFunc: getGasPrice, - watchStatusFunc: null, - provider: config.l2Provider, - contractAddress: "", - header: "Gas Price (gwei)", - intervalInMs: 30000, - colorFunc: (value: Status) => { - return "green"; - }, - tooltip: - "The current recommended gas price for a transaction on Layer 2.", - }, - { - statusFunc: async ( - provider: ethers.providers.JsonRpcProvider, - contractAddress: string - ): Promise => { - const latestBlock = await provider.getBlock("latest"); - return `${ethers.utils.formatUnits(latestBlock.baseFeePerGas, "gwei")}`; - }, - watchStatusFunc: null, - provider: config.l2Provider, - contractAddress: config.l2TaikoAddress, - header: "L2 EIP1559 BaseFee (gwei)", - intervalInMs: 30000, - colorFunc: (value: Status) => { - return "green"; - }, - tooltip: - "The current base fee for an L2 transaction with EIP1559-enabled.", - }, - { - statusFunc: async ( - provider: ethers.providers.JsonRpcProvider, - contractAddress: string - ): Promise => { - const feeData = await provider.getFeeData(); - return `${ethers.utils.formatUnits( - feeData.maxPriorityFeePerGas, - "gwei" - )}`; - }, - watchStatusFunc: null, - provider: config.l2Provider, - contractAddress: config.l2TaikoAddress, - header: "L2 EIP1559 Recommended MaxPriorityFeePerGas (gwei)", - intervalInMs: 30000, - colorFunc: (value: Status) => { - return "green"; - }, - tooltip: - "The current recommend max priority fee per gas for a fast transaction.", - }, - ]; - - try { - indicators.push({ - statusFunc: async ( - provider: ethers.providers.JsonRpcProvider, - contractAddress: string - ): Promise => { - const contract: Contract = new Contract( - contractAddress, - TaikoL1, - provider - ); - const fee = await contract.getBlockFee(); - return `${ethers.utils.formatUnits(fee, decimals)} ${ - config.feeTokenSymbol - }`; - }, - watchStatusFunc: null, - provider: config.l1Provider, - contractAddress: config.l1TaikoAddress, - header: "Block Fee", - intervalInMs: 15000, - colorFunc: function (status: Status) { - return "green"; // todo: whats green, yellow, red? - }, - tooltip: - "The current fee to propose a block to the TaikoL1 smart contract.", - }); - indicators.push({ - statusFunc: async ( - provider: ethers.providers.JsonRpcProvider, - contractAddress: string - ): Promise => { - const contract: Contract = new Contract( - contractAddress, - TaikoL1, - provider - ); - const latestBlockNumber = await provider.getBlockNumber(); - const eventFilter = contract.filters.BlockVerified(); - const events = await contract.queryFilter( - eventFilter, - latestBlockNumber - 200, - latestBlockNumber - ); - - if (!events || events.length === 0) { - return `0 ${config.feeTokenSymbol}`; - } - - const event = events[events.length - 1].args as any as { - reward: BigNumber; - }; - - return `${ethers.utils.formatUnits( - event.reward.toString(), - decimals - )} ${config.feeTokenSymbol}`; - }, - watchStatusFunc: async ( - provider: ethers.providers.JsonRpcProvider, - address: string, - onEvent: (value: Status) => void - ) => { - const contract = new Contract(address, TaikoL1, provider); - const listener = (id, blockHash, reward, ...args) => { - onEvent( - `${ethers.utils.formatUnits(reward.toString(), decimals)} ${ - config.feeTokenSymbol - }` - ); - }; - contract.on("BlockVerified", listener); - - return () => contract.off("BlockVerified", listener); - }, - provider: config.l1Provider, - contractAddress: config.l1TaikoAddress, - header: "Latest Proof Reward", - intervalInMs: 0, - colorFunc: function (status: Status) { - return "green"; // todo: whats green, yellow, red? - }, - tooltip: "The most recent proof reward, updated on block being verified.", - }); - indicators.push({ - provider: config.l1Provider, - contractAddress: config.l1TaikoAddress, - header: "Latest Proof Time", - intervalInMs: 0, - status: "0", - watchStatusFunc: async ( - provider: ethers.providers.JsonRpcProvider, - address: string, - onEvent: (value: Status) => void - ) => { - const contract = new Contract(address, TaikoL1, provider); - const listener = async ( - id, - parentHash, - blockHash, - signalRoot, - prover, - parentGasUsed, - event - ) => { - if ( - prover.toLowerCase() !== config.oracleProverAddress.toLowerCase() && - prover.toLowerCase() !== config.systemProverAddress.toLowerCase() - ) { - const proposedBlock = await contract.getBlock(id); - const block = await event.getBlock(); - const proofTime = - block.timestamp - proposedBlock._proposedAt.toNumber(); - - onEvent(`${proofTime} seconds`); - } - }; - contract.on("BlockProven", listener); - - return () => { - contract.off("BlockProven", listener); - }; - }, - colorFunc: function (status: Status) { - return "green"; // todo: whats green, yellow, red? - }, - tooltip: "The most recent block proof submitted on TaikoL1 contract.", - }); - indicators.push({ - provider: config.l1Provider, - contractAddress: config.l1TaikoAddress, - header: "Latest Oracle Proof", - intervalInMs: 0, - status: "0", - watchStatusFunc: async ( - provider: ethers.providers.JsonRpcProvider, - address: string, - onEvent: (value: Status) => void - ) => { - const contract = new Contract(address, TaikoL1, provider); - const listener = async ( - id, - parentHash, - blockHash, - signalRoot, - prover, - parentGasUsed, - event - ) => { - if ( - prover.toLowerCase() === config.systemProverAddress.toLowerCase() - ) { - const block = await event.getBlock(); - - onEvent(`${new Date(block.timestamp * 1000).toUTCString()}`); - } - }; - contract.on("BlockProven", listener); - - return () => { - contract.off("BlockProven", listener); - }; - }, - colorFunc: function (status: Status) { - return "green"; // todo: whats green, yellow, red? - }, - tooltip: "The timestamp of the latest oracle proof", - }); - - indicators.push({ - provider: config.l1Provider, - contractAddress: config.l1TaikoAddress, - statusFunc: async ( - provider: ethers.providers.JsonRpcProvider, - address: string - ) => { - const config = await getStateVariables(provider, address); - return config.proofTimeTarget.toNumber(); - }, - colorFunc: function (status: Status) { - return "green"; - }, - header: "Proof Time Target (seconds)", - intervalInMs: 5 * 1000, - tooltip: - "The proof time target the protocol intends the average proof time to be", - }); - - indicators.push({ - provider: config.l1Provider, - contractAddress: config.l1TaikoAddress, - statusFunc: async ( - provider: ethers.providers.JsonRpcProvider, - address: string - ) => await getAverageProofTime(config.eventIndexerApiUrl), - colorFunc: function (status: Status) { - return "green"; - }, - header: "Average Proof Time (seconds)", - intervalInMs: 5 * 1000, - tooltip: - "The current average proof time, updated when a block is successfully proven.", - }); - - indicators.push({ - provider: config.l1Provider, - contractAddress: config.l1TaikoAddress, - statusFunc: async ( - provider: ethers.providers.JsonRpcProvider, - contractAdress: string - ) => { - const resp = await axios.get( - `${config.eventIndexerApiUrl}/stats` - ); - return `${ethers.utils.formatUnits( - resp.data.averageProofReward, - decimals - )} ${config.feeTokenSymbol}`; - }, - colorFunc: function (status: Status) { - return "green"; - }, - header: "Average Proof Reward", - intervalInMs: 5 * 1000, - tooltip: - "The current average proof reward, updated when a block is successfully verified.", - }); - } catch (e) { - console.error(e); - } - - return indicators; -} diff --git a/packages/status-page/src/utils/displayStatusValue.ts b/packages/status-page/src/utils/displayStatusValue.ts deleted file mode 100644 index ebbd79dd9e..0000000000 --- a/packages/status-page/src/utils/displayStatusValue.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { ethers } from "ethers"; -import type { Status } from "src/domain/status"; - -export const displayStatusValue = (value: Status) => { - if (typeof value === "string") { - if (!value) return "0x"; - if (ethers.utils.isHexString(value)) { - return value.substring(0, 14); - } - return value; - } - - if (typeof value === "number") return value; - if (typeof value === "boolean") return value.toString(); -}; diff --git a/packages/status-page/src/utils/getAvailableSlots.ts b/packages/status-page/src/utils/getAvailableSlots.ts deleted file mode 100644 index 8a03c04c96..0000000000 --- a/packages/status-page/src/utils/getAvailableSlots.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { ethers } from "ethers"; -import { getConfig } from "./getConfig"; -import { getStateVariables } from "./getStateVariables"; - -export const getAvailableSlots = async ( - provider: ethers.providers.JsonRpcProvider, - contractAddress: string -): Promise => { - const stateVariables = await getStateVariables(provider, contractAddress); - const config = await getConfig(provider, contractAddress); - - const nextBlockId = stateVariables.numBlocks; - const latestVerifiedId = stateVariables.lastVerifiedBlockId; - const pendingBlocks = nextBlockId - latestVerifiedId - 1; - - return Math.abs(pendingBlocks - config.maxNumProposedBlocks); -}; diff --git a/packages/status-page/src/utils/getAverageProofReward.ts b/packages/status-page/src/utils/getAverageProofReward.ts deleted file mode 100644 index 6c51612e3c..0000000000 --- a/packages/status-page/src/utils/getAverageProofReward.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type StatsResponse = { - id: number; - averageProofTime: number; - averageProofReward: number; - numProofs: number; -}; diff --git a/packages/status-page/src/utils/getAverageProofTime.ts b/packages/status-page/src/utils/getAverageProofTime.ts deleted file mode 100644 index 8a4b2430e0..0000000000 --- a/packages/status-page/src/utils/getAverageProofTime.ts +++ /dev/null @@ -1,10 +0,0 @@ -import axios from "axios"; -import type { StatsResponse } from "./getAverageProofReward"; - -export const getAverageProofTime = async ( - eventIndexerApiUrl: string -): Promise => { - const resp = await axios.get(`${eventIndexerApiUrl}/stats`); - - return `${resp.data.averageProofTime}`; -}; diff --git a/packages/status-page/src/utils/getConfig.ts b/packages/status-page/src/utils/getConfig.ts deleted file mode 100644 index 4c39f54214..0000000000 --- a/packages/status-page/src/utils/getConfig.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Contract, ethers } from "ethers"; -import TaikoL1 from "../constants/abi/TaikoL1"; - -export const getConfig = async ( - provider: ethers.providers.JsonRpcProvider, - contractAddress: string -) => { - const contract: Contract = new Contract(contractAddress, TaikoL1, provider); - const config = await contract.getConfig(); - return config; -}; diff --git a/packages/status-page/src/utils/getEthDeposits.ts b/packages/status-page/src/utils/getEthDeposits.ts deleted file mode 100644 index 6e132c2e6d..0000000000 --- a/packages/status-page/src/utils/getEthDeposits.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { ethers } from "ethers"; -import { getStateVariables } from "./getStateVariables"; - -export const getEthDeposits = async ( - provider: ethers.providers.JsonRpcProvider, - contractAddress: string -): Promise => { - const stateVariables = await getStateVariables(provider, contractAddress); - return stateVariables.numEthDeposits.toNumber(); -}; diff --git a/packages/status-page/src/utils/getGasPrice.ts b/packages/status-page/src/utils/getGasPrice.ts deleted file mode 100644 index fb29f3ce5a..0000000000 --- a/packages/status-page/src/utils/getGasPrice.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { ethers } from "ethers"; - -export const getGasPrice = async ( - provider: ethers.providers.JsonRpcProvider, - contractAddress: string -): Promise => { - const gasPrice = await provider.getGasPrice(); - return ethers.utils.formatUnits(gasPrice, "gwei"); -}; diff --git a/packages/status-page/src/utils/getLastVerifiedBlockId.ts b/packages/status-page/src/utils/getLastVerifiedBlockId.ts deleted file mode 100644 index 8986cce0f1..0000000000 --- a/packages/status-page/src/utils/getLastVerifiedBlockId.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { BigNumber, ethers } from "ethers"; -import { getStateVariables } from "./getStateVariables"; - -export const getLastVerifiedBlockId = async ( - provider: ethers.providers.JsonRpcProvider, - contractAddress: string -): Promise => { - const stateVariables = await getStateVariables(provider, contractAddress); - const lastBlockId = stateVariables.lastVerifiedBlockId; - return BigNumber.from(lastBlockId).toNumber(); -}; diff --git a/packages/status-page/src/utils/getLatestSyncedHeader.ts b/packages/status-page/src/utils/getLatestSyncedHeader.ts deleted file mode 100644 index b818cbbba2..0000000000 --- a/packages/status-page/src/utils/getLatestSyncedHeader.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Contract, ethers } from "ethers"; -import TaikoL1 from "../constants/abi/TaikoL1"; - -export const getLatestSyncedHeader = async ( - provider: ethers.providers.JsonRpcProvider, - contractAddress: string -): Promise => { - const contract: Contract = new Contract(contractAddress, TaikoL1, provider); - return await contract.getCrossChainBlockHash(0); -}; diff --git a/packages/status-page/src/utils/getNextBlockId.ts b/packages/status-page/src/utils/getNextBlockId.ts deleted file mode 100644 index aac8abc43e..0000000000 --- a/packages/status-page/src/utils/getNextBlockId.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { BigNumber, ethers } from "ethers"; -import { getStateVariables } from "./getStateVariables"; - -export const getNextBlockId = async ( - provider: ethers.providers.JsonRpcProvider, - contractAddress: string -): Promise => { - const stateVariables = await getStateVariables(provider, contractAddress); - const nextBlockId = stateVariables.numBlocks; - return BigNumber.from(nextBlockId).toNumber(); -}; diff --git a/packages/status-page/src/utils/getNextEthDepositToProcess.ts b/packages/status-page/src/utils/getNextEthDepositToProcess.ts deleted file mode 100644 index b74b3b3ee6..0000000000 --- a/packages/status-page/src/utils/getNextEthDepositToProcess.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Contract, ethers } from "ethers"; -import TaikoL1 from "../constants/abi/TaikoL1"; - -export const getNextEthDepositToProcess = async ( - provider: ethers.providers.JsonRpcProvider, - contractAddress: string -): Promise => { - const contract: Contract = new Contract(contractAddress, TaikoL1, provider); - const stateVariables = await contract.getStateVariables(); - return stateVariables.nextEthDepositToProcess.toNumber(); -}; diff --git a/packages/status-page/src/utils/getNumProposers.ts b/packages/status-page/src/utils/getNumProposers.ts deleted file mode 100644 index dabf50415c..0000000000 --- a/packages/status-page/src/utils/getNumProposers.ts +++ /dev/null @@ -1,24 +0,0 @@ -import axios from "axios"; - -export type UniqueProposer = { - address: string; - count: number; -}; -export type UniqueProverResponse = { - uniqueProposers: number; - proposers: UniqueProposer[]; -}; - -export const getNumProposers = async ( - eventIndexerApiUrl: string -): Promise => { - const uniqueProposersResp = await axios.get( - `${eventIndexerApiUrl}/uniqueProposers` - ); - - if (uniqueProposersResp.data) { - uniqueProposersResp.data.proposers.sort((a, b) => b.count - a.count); - } - - return uniqueProposersResp.data || { uniqueProposers: 0, proposers: [] }; -}; diff --git a/packages/status-page/src/utils/getNumProvers.ts b/packages/status-page/src/utils/getNumProvers.ts deleted file mode 100644 index 098d043f07..0000000000 --- a/packages/status-page/src/utils/getNumProvers.ts +++ /dev/null @@ -1,41 +0,0 @@ -import axios from "axios"; - -export type UniqueProver = { - address: string; - count: number; -}; -export type UniqueProverResponse = { - uniqueProvers: number; - provers: UniqueProver[]; -}; -export const getNumProvers = async ( - eventIndexerApiUrl: string -): Promise => { - const uniqueProversResp = await axios.get( - `${eventIndexerApiUrl}/uniqueProvers` - ); - - 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--; - } - // Filter out the oracle prover address since it doesn't submit the actual zk proof - const systemIndex = uniqueProversResp.data.provers.findIndex( - (uniqueProver) => - uniqueProver.address === "0x0000000000000000000000000000000000000001" - ); - if (systemIndex > -1) { - uniqueProversResp.data.provers.splice(systemIndex, 1); - uniqueProversResp.data.uniqueProvers--; - } - } - - return uniqueProversResp.data || { uniqueProvers: 0, provers: [] }; -}; diff --git a/packages/status-page/src/utils/getPendingBlocks.ts b/packages/status-page/src/utils/getPendingBlocks.ts deleted file mode 100644 index 9e0958d83e..0000000000 --- a/packages/status-page/src/utils/getPendingBlocks.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { ethers } from "ethers"; -import TaikoL1 from "../constants/abi/TaikoL1"; -import { getStateVariables } from "./getStateVariables"; - -export const getPendingBlocks = async ( - provider: ethers.providers.JsonRpcProvider, - contractAddress: string -): Promise => { - const stateVariables = await getStateVariables(provider, contractAddress); - const nextBlockId = stateVariables.numBlocks; - const lastBlockId = stateVariables.lastVerifiedBlockId; - return nextBlockId - lastBlockId - 1; -}; diff --git a/packages/status-page/src/utils/getPendingTransactions.ts b/packages/status-page/src/utils/getPendingTransactions.ts deleted file mode 100644 index 87bf317ff8..0000000000 --- a/packages/status-page/src/utils/getPendingTransactions.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { BigNumber, ethers } from "ethers"; - -export const getPendingTransactions = async ( - provider: ethers.providers.JsonRpcProvider, - contractAddress: string -): Promise => { - const mempool = await provider.send("txpool_status", []); - return BigNumber.from(mempool.pending).toNumber(); -}; diff --git a/packages/status-page/src/utils/getProposers.ts b/packages/status-page/src/utils/getProposers.ts deleted file mode 100644 index eecc013cdb..0000000000 --- a/packages/status-page/src/utils/getProposers.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Contract, ethers } from "ethers"; -import TaikoL1 from "../constants/abi/TaikoL1"; - -export const getProposers = async ( - provider: ethers.providers.JsonRpcProvider, - contractAddress: string -): Promise => { - const contract: Contract = new Contract(contractAddress, TaikoL1, provider); - let events = []; - const latestBlock = await provider.getBlockNumber(); - const batchSize = 1000; - for (let i = 0; i < latestBlock; i += batchSize) { - const end = i + batchSize > latestBlock ? latestBlock : i + batchSize; - const e = await contract.queryFilter("BlockProposed", i, end); - events = events.concat(e); - } - - const proposers = []; - events.map((event) => { - if (!proposers.includes(event.args.meta.beneficiary)) { - proposers.push(event.args.meta.beneficiary); - } - }); - - return proposers.length; -}; diff --git a/packages/status-page/src/utils/getQueuedTransactions.ts b/packages/status-page/src/utils/getQueuedTransactions.ts deleted file mode 100644 index 7af83e52e3..0000000000 --- a/packages/status-page/src/utils/getQueuedTransactions.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { BigNumber, ethers } from "ethers"; - -export const getQueuedTransactions = async ( - provider: ethers.providers.JsonRpcProvider, - contractAddress: string -): Promise => { - const mempool = await provider.send("txpool_status", []); - return BigNumber.from(mempool.queued).toNumber(); -}; diff --git a/packages/status-page/src/utils/getStateVariables.ts b/packages/status-page/src/utils/getStateVariables.ts deleted file mode 100644 index 7e45b30db1..0000000000 --- a/packages/status-page/src/utils/getStateVariables.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { BigNumber, Contract, ethers } from "ethers"; -import TaikoL1 from "../constants/abi/TaikoL1"; - -const cacheTime = 1000 * 15; // 15 seconds -type StateVarsCache = { - cachedAt: number; - stateVars: any; - chainId: number; -}; - -let stateVarsCache: StateVarsCache; - -export const getStateVariables = async ( - provider: ethers.providers.JsonRpcProvider, - contractAddress: string -) => { - const { chainId } = await provider.getNetwork(); - if ( - stateVarsCache && - stateVarsCache.chainId === chainId && - stateVarsCache.cachedAt + cacheTime > Date.now() - ) { - return stateVarsCache.stateVars; - } - - const contract: Contract = new Contract(contractAddress, TaikoL1, provider); - const vars = await contract.getStateVariables(); - - stateVarsCache = { - stateVars: vars, - cachedAt: Date.now(), - chainId: chainId, - }; - return vars; -}; diff --git a/packages/status-page/src/utils/initConfig.ts b/packages/status-page/src/utils/initConfig.ts deleted file mode 100644 index 49a48502bb..0000000000 --- a/packages/status-page/src/utils/initConfig.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { ethers } from "ethers"; -import { Layer } from "../domain/layer"; - -export function initConfig(layer: Layer) { - const l1Provider = new ethers.providers.StaticJsonRpcProvider( - layer === Layer.Two - ? import.meta.env.VITE_L1_RPC_URL - : import.meta.env.VITE_L2_RPC_URL - ); - const l2Provider = new ethers.providers.StaticJsonRpcProvider( - layer === Layer.Two - ? import.meta.env.VITE_L2_RPC_URL - : import.meta.env.VITE_L3_RPC_URL - ); - - const l1TaikoAddress = - layer === Layer.Two - ? import.meta.env.VITE_L2_TAIKO_L1_ADDRESS - : import.meta.env.VITE_L3_TAIKO_L1_ADDRESS; - const l2TaikoAddress = - layer === Layer.Two - ? import.meta.env.VITE_L2_TAIKO_L2_ADDRESS - : import.meta.env.VITE_L3_TAIKO_L2_ADDRESS; - const taikoTokenAddress = import.meta.env.VITE_TAIKO_TOKEN_ADDRESS; - const l1ExplorerUrl = import.meta.env.VITE_L1_EXPLORER_URL; - const l2ExplorerUrl = - layer === Layer.Two - ? import.meta.env.VITE_L2_EXPLORER_URL - : import.meta.env.VITE_L3_EXPLORER_URL; - const feeTokenSymbol = import.meta.env.VITE_FEE_TOKEN_SYMBOL || "TKO"; - const oracleProverAddress = - import.meta.env.ORACLE_PROVER_ADDRESS || - "0x0000000000000000000000000000000000000000"; - const systemProverAddress = - import.meta.env.SYSTEM_PROVER_ADDRESS || - "0x0000000000000000000000000000000000000001"; - const eventIndexerApiUrl = - layer === Layer.Two - ? import.meta.env.VITE_L2_EVENT_INDEXER_API_URL - : import.meta.env.VITE_L3_EVENT_INDEXER_API_URL; - return { - l1Provider, - l2Provider, - l1TaikoAddress, - l2TaikoAddress, - taikoTokenAddress, - l1ExplorerUrl, - l2ExplorerUrl, - feeTokenSymbol, - oracleProverAddress, - eventIndexerApiUrl, - systemProverAddress, - }; -} diff --git a/packages/status-page/src/utils/layerToDisplayName.ts b/packages/status-page/src/utils/layerToDisplayName.ts deleted file mode 100644 index 886c0accff..0000000000 --- a/packages/status-page/src/utils/layerToDisplayName.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { Layer } from "../domain/layer"; - -export const layerToDisplayName = (layer: Layer) => - layer === Layer.Two ? "Taiko L2" : "Taiko L3"; diff --git a/packages/status-page/src/utils/truncateString.ts b/packages/status-page/src/utils/truncateString.ts deleted file mode 100644 index 3e969178e2..0000000000 --- a/packages/status-page/src/utils/truncateString.ts +++ /dev/null @@ -1,4 +0,0 @@ -export const truncateString = (str: string, maxLength: number = 10) => { - if (!str) return ""; - return str.length > maxLength ? `${str.substring(0, maxLength)}` : str; -}; diff --git a/packages/status-page/src/utils/watchHeaderSynced.ts b/packages/status-page/src/utils/watchHeaderSynced.ts deleted file mode 100644 index 74bb60ea9e..0000000000 --- a/packages/status-page/src/utils/watchHeaderSynced.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { Contract, ethers } from "ethers"; -import TaikoL1 from "../constants/abi/TaikoL1"; - -export const watchHeaderSynced = async ( - provider: ethers.providers.JsonRpcProvider, - taikoL1Address: string, - onEvent: (value: string | number | boolean) => void -) => { - const contract: Contract = new Contract(taikoL1Address, TaikoL1, provider); - const listener = (lastVerifiedBlockId, blockHash, signalRoot) => { - onEvent(blockHash); - }; - contract.on("CrossChainSynced", listener); - - return () => contract.off("CrossChainSynced", listener); -}; diff --git a/packages/status-page/src/vite-env.d.ts b/packages/status-page/src/vite-env.d.ts deleted file mode 100644 index 4078e7476a..0000000000 --- a/packages/status-page/src/vite-env.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -/// -/// diff --git a/packages/status-page/svelte.config.cjs b/packages/status-page/svelte.config.cjs deleted file mode 100644 index 8bf5d4b3f5..0000000000 --- a/packages/status-page/svelte.config.cjs +++ /dev/null @@ -1,7 +0,0 @@ -const sveltePreprocess = require('svelte-preprocess'); - -module.exports = { - // Consult https://github.com/sveltejs/svelte-preprocess - // for more information about preprocessors - preprocess: sveltePreprocess() -} diff --git a/packages/status-page/tailwind.config.cjs b/packages/status-page/tailwind.config.cjs deleted file mode 100644 index 4de26d4f8a..0000000000 --- a/packages/status-page/tailwind.config.cjs +++ /dev/null @@ -1,53 +0,0 @@ -module.exports = { - content: ["./src/**/*.{html,js,svelte,ts}"], - plugins: [require("daisyui")], - theme: { - extend: { - colors: { - "dark-1": "var(--color-dark-1)", - "dark-2": "var(--color-dark-2)", - "dark-3": "var(--color-dark-3)", - "dark-4": "var(--color-dark-4)", - "dark-5": "var(--color-dark-5)", - "dark-6": "var(--color-dark-6)", - } - } - }, - daisyui: { - styled: true, - themes: true, - base: true, - utils: true, - logs: true, - rtl: false, - prefix: "", - darkTheme: "dark", - themes: [ - { - dark: { - ...require("daisyui/colors/themes")["[data-theme=black]"], - "primary": "#242424", - "secondary": "#181818", - "accent": "#FC0FC0", - "accent-focus": "#B20F89", - "accent-content": "#F3F3F3", - "neutral": "#242424", - "base-100": "#0f0f0f", - "info": "#373737", - "success": "#008000", - "warning": "#FFFF00", - "error": "#FF0000", - "--color-dark-1": "#000000", - "--color-dark-2": "#0F0F0F", - "--color-dark-3": "#181818", - "--color-dark-4": "#242424", - "--color-dark-5": "#373737", - "--color-dark-6": "#4F4F4F", - "--rounded-btn": "1rem", - "--btn-text-case": "capitalize", - "--rounded-box": "18px", - }, - }, - ], - } -}; diff --git a/packages/status-page/tsconfig.json b/packages/status-page/tsconfig.json deleted file mode 100644 index 9094dab45e..0000000000 --- a/packages/status-page/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "@tsconfig/svelte/tsconfig.json", - "compilerOptions": { - "target": "es2022", - "useDefineForClassFields": true, - "module": "es2022", - "resolveJsonModule": true, - "baseUrl": ".", - /** - * Typecheck JS in `.svelte` and `.js` files by default. - * Disable checkJs if you'd like to use dynamic types in JS. - * Note that setting allowJs false does not prevent the use - * of JS in `.svelte` files. - */ - "allowJs": true, - "checkJs": true, - "isolatedModules": false - }, - "include": ["src/**/*.d.ts", "src/**/*.ts", "src/**/*.js", "src/**/*.svelte"], - "references": [{ "path": "./tsconfig.node.json" }] -} diff --git a/packages/status-page/tsconfig.node.json b/packages/status-page/tsconfig.node.json deleted file mode 100644 index 65dbdb96ae..0000000000 --- a/packages/status-page/tsconfig.node.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "compilerOptions": { - "composite": true, - "module": "ESNext", - "moduleResolution": "Node" - }, - "include": ["vite.config.ts"] -} diff --git a/packages/status-page/vite.config.ts b/packages/status-page/vite.config.ts deleted file mode 100644 index 4a02c08cc3..0000000000 --- a/packages/status-page/vite.config.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { defineConfig } from "vite"; -import { svelte } from "@sveltejs/vite-plugin-svelte"; -import polyfillNode from "rollup-plugin-polyfill-node"; -import { viteStaticCopy } from "vite-plugin-static-copy"; - -// https://vitejs.dev/config/ -export default defineConfig({ - build: { - rollupOptions: { - external: ["broadcast-channel"], - }, - }, - define: { - global: "globalThis", - "process.env.NODE_DEBUG": false, - "process.env.LINK_API_URL": false, - "process.env.SDK_VERSION": "'unknown'", - }, - plugins: [ - svelte(), - polyfillNode(), - viteStaticCopy({ - targets: [ - { - src: "src/assets/lottie/loader.json", - dest: "lottie", - }, - ], - }), - ], -}); diff --git a/release-please-config.json b/release-please-config.json index f68bd1c7fb..f357588829 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -5,8 +5,7 @@ "packages/eventindexer": {}, "packages/fork-diff": {}, "packages/protocol": {}, - "packages/relayer": {}, - "packages/status-page": {} + "packages/relayer": {} }, "separate-pull-requests": true } From 3d9f22244ee581b36a98449e27379176000fbe07 Mon Sep 17 00:00:00 2001 From: d1onys1us <13951458+d1onys1us@users.noreply.github.com> Date: Fri, 16 Feb 2024 21:55:49 -0500 Subject: [PATCH 12/47] chore(repo): remove pip from dependabot (#15872) --- .github/dependabot.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index edc8d9ea79..7cb08e48c3 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -26,12 +26,3 @@ updates: time: "04:20" timezone: "America/New_York" open-pull-requests-limit: 10 - - - package-ecosystem: "pip" - directory: "/packages/protocol/simulation" - schedule: - interval: "monthly" - day: "saturday" - time: "04:20" - timezone: "America/New_York" - open-pull-requests-limit: 10 From 58ffe1011a67710277b19d813bd49b530d1ba335 Mon Sep 17 00:00:00 2001 From: Daniel Wang <99078276+dantaik@users.noreply.github.com> Date: Sat, 17 Feb 2024 14:29:20 +0800 Subject: [PATCH 13/47] feat(protocol)!: improve signal service and remove ICrossChainSync (#15859) Co-authored-by: d1onys1us <13951458+d1onys1us@users.noreply.github.com> Co-authored-by: Brecht Devos --- packages/protocol/contracts/L1/TaikoData.sol | 3 + packages/protocol/contracts/L1/TaikoL1.sol | 25 +- .../protocol/contracts/L1/libs/LibUtils.sol | 35 - .../contracts/L1/libs/LibVerifying.sol | 40 +- packages/protocol/contracts/L2/TaikoL2.sol | 74 +- .../contracts/common/ICrossChainSync.sol | 46 -- .../contracts/signal/ISignalService.sol | 70 +- .../contracts/signal/SignalService.sol | 218 +++--- .../docs/multihop_bridging_deployment.md | 10 +- packages/protocol/script/DeployOnL1.s.sol | 2 +- packages/protocol/test/HelperContracts.sol | 15 - packages/protocol/test/L1/TaikoL1.t.sol | 66 -- packages/protocol/test/L1/TaikoL1TestBase.sol | 2 +- packages/protocol/test/L2/TaikoL2.t.sol | 2 +- .../protocol/test/L2/TaikoL2NoFeeCheck.t.sol | 2 +- packages/protocol/test/bridge/Bridge.t.sol | 11 - .../protocol/test/signal/SignalService.t.sol | 110 +-- .../test/tokenvault/ERC1155Vault.t.sol | 3 - .../test/tokenvault/ERC721Vault.t.sol | 3 - .../utils/generate_genesis/taikoL2.ts | 2 +- .../status-page/src/constants/abi/TaikoL2.ts | 670 ++++++++++++++++++ 21 files changed, 991 insertions(+), 418 deletions(-) delete mode 100644 packages/protocol/contracts/common/ICrossChainSync.sol create mode 100644 packages/status-page/src/constants/abi/TaikoL2.ts diff --git a/packages/protocol/contracts/L1/TaikoData.sol b/packages/protocol/contracts/L1/TaikoData.sol index 05fd225770..2330cb0d12 100644 --- a/packages/protocol/contracts/L1/TaikoData.sol +++ b/packages/protocol/contracts/L1/TaikoData.sol @@ -64,6 +64,9 @@ library TaikoData { uint256 ethDepositGas; // The maximum fee allowed for an ETH deposit. uint256 ethDepositMaxFee; + // The max number of L2 blocks that can stay unsynced on L1 (a value of zero disables + // syncing) + uint8 blockSyncThreshold; } /// @dev Struct representing prover assignment diff --git a/packages/protocol/contracts/L1/TaikoL1.sol b/packages/protocol/contracts/L1/TaikoL1.sol index 5270a2a4ad..9b4e9a5494 100644 --- a/packages/protocol/contracts/L1/TaikoL1.sol +++ b/packages/protocol/contracts/L1/TaikoL1.sol @@ -32,14 +32,7 @@ import "./TaikoEvents.sol"; /// layers"). The contract also handles the deposit and withdrawal of Taiko /// tokens and Ether. /// This contract doesn't hold any Ether. Ether deposited to L2 are held by the Bridge contract. -contract TaikoL1 is - EssentialContract, - ITaikoL1, - ICrossChainSync, - ITierProvider, - TaikoEvents, - TaikoErrors -{ +contract TaikoL1 is EssentialContract, ITaikoL1, ITierProvider, TaikoEvents, TaikoErrors { TaikoData.State public state; uint256[100] private __gap; @@ -168,19 +161,6 @@ contract TaikoL1 is return LibUtils.getTransition(state, getConfig(), blockId, parentHash); } - /// @inheritdoc ICrossChainSync - /// @notice Important: as this contract doesn't send each block's state root as a signal when - /// the block is verified, bridging developers should subscribe to CrossChainSynced events - /// to ensure all synced state roots are verifiable using merkle proofs. - function getSyncedSnippet(uint64 blockId) - public - view - override - returns (ICrossChainSync.Snippet memory) - { - return LibUtils.getSyncedSnippet(state, getConfig(), AddressResolver(this), blockId); - } - /// @notice Gets the state variables of the TaikoL1 contract. function getStateVariables() public @@ -247,7 +227,8 @@ contract TaikoL1 is ethDepositMinAmount: 1 ether, ethDepositMaxAmount: 10_000 ether, ethDepositGas: 21_000, - ethDepositMaxFee: 1 ether / 10 + ethDepositMaxFee: 1 ether / 10, + blockSyncThreshold: 16 }); } diff --git a/packages/protocol/contracts/L1/libs/LibUtils.sol b/packages/protocol/contracts/L1/libs/LibUtils.sol index 48873dcf9f..6c6fd8d433 100644 --- a/packages/protocol/contracts/L1/libs/LibUtils.sol +++ b/packages/protocol/contracts/L1/libs/LibUtils.sol @@ -15,7 +15,6 @@ pragma solidity 0.8.24; import "../../common/AddressResolver.sol"; -import "../../common/ICrossChainSync.sol"; import "../../signal/ISignalService.sol"; import "../../signal/LibSignals.sol"; import "../TaikoData.sol"; @@ -57,40 +56,6 @@ library LibUtils { ts = state.transitions[slot][tid]; } - function getSyncedSnippet( - TaikoData.State storage state, - TaikoData.Config memory config, - AddressResolver resolver, - uint64 blockId - ) - external - view - returns (ICrossChainSync.Snippet memory) - { - uint64 _blockId = blockId == 0 ? state.slotB.lastVerifiedBlockId : blockId; - uint64 slot = _blockId % config.blockRingBufferSize; - - TaikoData.Block storage blk = state.blocks[slot]; - - if (blk.blockId != _blockId) revert L1_BLOCK_MISMATCH(); - if (blk.verifiedTransitionId == 0) revert L1_TRANSITION_NOT_FOUND(); - - TaikoData.TransitionState storage ts = state.transitions[slot][blk.verifiedTransitionId]; - - // bool relayed = ISignalService(resolver.resolve("signal_service", - // false)).isChainDataRelayed( - // config.chainId, LibSignals.STATE_ROOT, ts.stateRoot - // ); - // if (!relayed) revert L1_CHAIN_DATA_NOT_RELAYED(); - - return ICrossChainSync.Snippet({ - syncedInBlock: blk.proposedIn, - blockId: blockId, - blockHash: ts.blockHash, - stateRoot: ts.stateRoot - }); - } - /// @dev Retrieves a block based on its ID. function getBlock( TaikoData.State storage state, diff --git a/packages/protocol/contracts/L1/libs/LibVerifying.sol b/packages/protocol/contracts/L1/libs/LibVerifying.sol index cb338f873e..771d43c489 100644 --- a/packages/protocol/contracts/L1/libs/LibVerifying.sol +++ b/packages/protocol/contracts/L1/libs/LibVerifying.sol @@ -39,10 +39,6 @@ library LibVerifying { uint8 contestations ); - event CrossChainSynced( - uint64 indexed syncedInBlock, uint64 indexed blockId, bytes32 blockHash, bytes32 stateRoot - ); - // Warning: Any errors defined here must also be defined in TaikoErrors.sol. error L1_BLOCK_MISMATCH(); error L1_INVALID_CONFIG(); @@ -242,20 +238,30 @@ library LibVerifying { // Update protocol level state variables state.slotB.lastVerifiedBlockId = lastVerifiedBlockId; - // Store the L2's state root as a signal to the local signal - // service to allow for multi-hop bridging. - // - // This also means if we verified more than one block, only the last one's stateRoot - // is sent as a signal and verifiable with merkle proofs, all other blocks' - // stateRoot are not. - ISignalService(resolver.resolve("signal_service", false)).relayChainData( - config.chainId, LibSignals.STATE_ROOT, stateRoot - ); - - emit CrossChainSynced( - uint64(block.number), lastVerifiedBlockId, blockHash, stateRoot - ); + // sync chain data + _syncChainData(config, resolver, lastVerifiedBlockId, stateRoot); } } } + + function _syncChainData( + TaikoData.Config memory config, + AddressResolver resolver, + uint64 lastVerifiedBlockId, + bytes32 stateRoot + ) + private + { + ISignalService signalService = ISignalService(resolver.resolve("signal_service", false)); + + (uint64 lastSyncedBlock,) = signalService.getSyncedChainData( + config.chainId, LibSignals.STATE_ROOT, 0 /* latest block Id*/ + ); + + if (lastVerifiedBlockId > lastSyncedBlock + config.blockSyncThreshold) { + signalService.syncChainData( + config.chainId, LibSignals.STATE_ROOT, lastVerifiedBlockId, stateRoot + ); + } + } } diff --git a/packages/protocol/contracts/L2/TaikoL2.sol b/packages/protocol/contracts/L2/TaikoL2.sol index c70c78c8d4..e8cc9b1256 100644 --- a/packages/protocol/contracts/L2/TaikoL2.sol +++ b/packages/protocol/contracts/L2/TaikoL2.sol @@ -17,11 +17,10 @@ pragma solidity 0.8.24; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; -import "../common/ICrossChainSync.sol"; -import "../signal/ISignalService.sol"; -import "../signal/LibSignals.sol"; import "../libs/LibAddress.sol"; import "../libs/LibMath.sol"; +import "../signal/ISignalService.sol"; +import "../signal/LibSignals.sol"; import "./Lib1559Math.sol"; import "./CrossChainOwned.sol"; @@ -31,7 +30,7 @@ import "./CrossChainOwned.sol"; /// It is used to anchor the latest L1 block details to L2 for cross-layer /// communication, manage EIP-1559 parameters for gas pricing, and store /// verified L1 block information. -contract TaikoL2 is CrossChainOwned, ICrossChainSync { +contract TaikoL2 is CrossChainOwned { using LibAddress for address; using LibMath for uint256; using SafeERC20 for IERC20; @@ -43,18 +42,18 @@ contract TaikoL2 is CrossChainOwned, ICrossChainSync { // Golden touch address address public constant GOLDEN_TOUCH_ADDRESS = 0x0000777735367b36bC9B61C50022d9D0700dB4Ec; + uint8 public constant BLOCK_SYNC_THRESHOLD = 5; // Mapping from L2 block numbers to their block hashes. // All L2 block hashes will be saved in this mapping. mapping(uint256 blockId => bytes32 blockHash) public l2Hashes; - mapping(uint256 l1height => ICrossChainSync.Snippet) public snippets; // A hash to check the integrity of public inputs. - bytes32 public publicInputHash; // slot 3 - uint64 public gasExcess; // slot 4 - uint64 public latestSyncedL1Height; + bytes32 public publicInputHash; // slot 2 + uint64 public gasExcess; // slot 3 + uint64 public lastSyncedBlock; - uint256[146] private __gap; + uint256[147] private __gap; event Anchored(bytes32 parentHash, uint64 gasExcess); @@ -102,19 +101,19 @@ contract TaikoL2 is CrossChainOwned, ICrossChainSync { /// @param l1BlockHash The latest L1 block hash when this block was /// proposed. /// @param l1StateRoot The latest L1 block's state root. - /// @param l1Height The latest L1 block height when this block was proposed. + /// @param l1BlockId The latest L1 block height when this block was proposed. /// @param parentGasUsed The gas used in the parent block. function anchor( bytes32 l1BlockHash, bytes32 l1StateRoot, - uint64 l1Height, + uint64 l1BlockId, uint32 parentGasUsed ) external nonReentrant { if ( - l1BlockHash == 0 || l1StateRoot == 0 || l1Height == 0 + l1BlockHash == 0 || l1StateRoot == 0 || l1BlockId == 0 || (block.number != 1 && parentGasUsed == 0) ) { revert L2_INVALID_PARAM(); @@ -137,29 +136,23 @@ contract TaikoL2 is CrossChainOwned, ICrossChainSync { // Verify the base fee per gas is correct uint256 basefee; - (basefee, gasExcess) = _calc1559BaseFee(config, l1Height, parentGasUsed); + (basefee, gasExcess) = _calc1559BaseFee(config, l1BlockId, parentGasUsed); if (!skipFeeCheck() && block.basefee != basefee) { revert L2_BASEFEE_MISMATCH(); } - // Store the L1's state root as a signal to the local signal service to - // allow for multi-hop bridging. - ISignalService(resolve("signal_service", false)).relayChainData( - ownerChainId, LibSignals.STATE_ROOT, l1StateRoot - ); - - emit CrossChainSynced(uint64(block.number), l1Height, l1BlockHash, l1StateRoot); - + if (l1BlockId > lastSyncedBlock + BLOCK_SYNC_THRESHOLD) { + // Store the L1's state root as a signal to the local signal service to + // allow for multi-hop bridging. + ISignalService(resolve("signal_service", false)).syncChainData( + ownerChainId, LibSignals.STATE_ROOT, l1BlockId, l1StateRoot + ); + lastSyncedBlock = l1BlockId; + } // Update state variables l2Hashes[parentId] = blockhash(parentId); - snippets[l1Height] = ICrossChainSync.Snippet({ - syncedInBlock: uint64(block.number), - blockId: l1Height, - blockHash: l1BlockHash, - stateRoot: l1StateRoot - }); publicInputHash = publicInputHashNew; - latestSyncedL1Height = l1Height; + emit Anchored(blockhash(parentId), gasExcess); } @@ -181,31 +174,20 @@ contract TaikoL2 is CrossChainOwned, ICrossChainSync { } } - /// @inheritdoc ICrossChainSync - function getSyncedSnippet(uint64 blockId) - public - view - override - returns (ICrossChainSync.Snippet memory) - { - uint256 id = blockId == 0 ? latestSyncedL1Height : blockId; - return snippets[id]; - } - /// @notice Gets the basefee and gas excess using EIP-1559 configuration for /// the given parameters. - /// @param l1Height The synced L1 height in the next Taiko block + /// @param l1BlockId The synced L1 height in the next Taiko block /// @param parentGasUsed Gas used in the parent block. /// @return basefee The calculated EIP-1559 base fee per gas. function getBasefee( - uint64 l1Height, + uint64 l1BlockId, uint32 parentGasUsed ) public view returns (uint256 basefee) { - (basefee,) = _calc1559BaseFee(getConfig(), l1Height, parentGasUsed); + (basefee,) = _calc1559BaseFee(getConfig(), l1BlockId, parentGasUsed); } /// @notice Retrieves the block hash for the given L2 block number. @@ -265,7 +247,7 @@ contract TaikoL2 is CrossChainOwned, ICrossChainSync { function _calc1559BaseFee( Config memory config, - uint64 l1Height, + uint64 l1BlockId, uint32 parentGasUsed ) private @@ -281,13 +263,13 @@ contract TaikoL2 is CrossChainOwned, ICrossChainSync { // Calculate how much more gas to issue to offset gas excess. // after each L1 block time, config.gasTarget more gas is issued, // the gas excess will be reduced accordingly. - // Note that when latestSyncedL1Height is zero, we skip this step + // Note that when lastSyncedBlock is zero, we skip this step // because that means this is the first time calculating the basefee // and the difference between the L1 height would be extremely big, // reverting the initial gas excess value back to 0. uint256 numL1Blocks; - if (latestSyncedL1Height > 0 && l1Height > latestSyncedL1Height) { - numL1Blocks = l1Height - latestSyncedL1Height; + if (lastSyncedBlock > 0 && l1BlockId > lastSyncedBlock) { + numL1Blocks = l1BlockId - lastSyncedBlock; } if (numL1Blocks > 0) { diff --git a/packages/protocol/contracts/common/ICrossChainSync.sol b/packages/protocol/contracts/common/ICrossChainSync.sol deleted file mode 100644 index 357dd92305..0000000000 --- a/packages/protocol/contracts/common/ICrossChainSync.sol +++ /dev/null @@ -1,46 +0,0 @@ -// SPDX-License-Identifier: MIT -// _____ _ _ _ _ -// |_ _|_ _(_) |_____ | | __ _| |__ ___ -// | |/ _` | | / / _ \ | |__/ _` | '_ (_-< -// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -// -// Email: security@taiko.xyz -// Website: https://taiko.xyz -// GitHub: https://github.com/taikoxyz -// Discord: https://discord.gg/taikoxyz -// Twitter: https://twitter.com/taikoxyz -// Blog: https://mirror.xyz/labs.taiko.eth -// Youtube: https://www.youtube.com/@taikoxyz - -pragma solidity 0.8.24; - -/// @title ICrossChainSync -/// @dev This interface is implemented by both the TaikoL1 and TaikoL2 -/// contracts. -/// It outlines the essential methods required for synchronizing and accessing -/// block hashes across chains. The core idea is to ensure that data between -/// both chains remain consistent and can be cross-referenced with integrity. -interface ICrossChainSync { - struct Snippet { - uint64 syncedInBlock; - uint64 blockId; - bytes32 blockHash; - bytes32 stateRoot; - } - - /// @dev Emitted when a block has been synced across chains. - /// @param syncedInBlock The ID of this chain's block where the sync - /// happened. - /// @param blockId The ID of the remote block whose block hash are synced. - /// @param blockHash The hash of the synced block. - /// @param stateRoot The block's state root. - event CrossChainSynced( - uint64 indexed syncedInBlock, uint64 indexed blockId, bytes32 blockHash, bytes32 stateRoot - ); - - /// @notice Fetches the hash of a block from the opposite chain. - /// @param blockId The target block id. Specifying 0 retrieves the hash - /// of the latest block. - /// @return snippet The block hash and signal root synced. - function getSyncedSnippet(uint64 blockId) external view returns (Snippet memory snippet); -} diff --git a/packages/protocol/contracts/signal/ISignalService.sol b/packages/protocol/contracts/signal/ISignalService.sol index 3bfd0acfe3..02623fa202 100644 --- a/packages/protocol/contracts/signal/ISignalService.sol +++ b/packages/protocol/contracts/signal/ISignalService.sol @@ -1,9 +1,16 @@ // SPDX-License-Identifier: MIT - // _____ _ _ _ _ // |_ _|_ _(_) |_____ | | __ _| |__ ___ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ +// +// Email: security@taiko.xyz +// Website: https://taiko.xyz +// GitHub: https://github.com/taikoxyz +// Discord: https://discord.gg/taikoxyz +// Twitter: https://twitter.com/taikoxyz +// Blog: https://mirror.xyz/labs.taiko.eth +// Youtube: https://www.youtube.com/@taikoxyz pragma solidity 0.8.24; @@ -16,24 +23,36 @@ pragma solidity 0.8.24; /// a merkle proof. interface ISignalService { + /// @notice Emitted when a remote chain's state root or signal root is + /// synced locally as a signal. + event ChainDataSynced( + uint64 indexed chainid, + uint64 indexed blockId, + bytes32 indexed kind, + bytes32 data, + bytes32 signal + ); + /// @notice Send a signal (message) by setting the storage slot to a value of 1. /// @param signal The signal (message) to send. /// @return slot The location in storage where this signal is stored. function sendSignal(bytes32 signal) external returns (bytes32 slot); - /// @notice Relay a data from a remote chain locally as a signal. The signal is calculated + /// @notice Sync a data from a remote chain locally as a signal. The signal is calculated /// uniquely from chainId, kind, and data. /// @param chainId The remote chainId. /// @param kind A value to mark the data type. - /// @param data The remote data. - /// @return slot The location in storage where this signal is stored. - function relayChainData( + /// @param blockId The chain data's corresponding blockId + /// @param chainData The remote data. + /// @return signal The signal for this chain data. + function syncChainData( uint64 chainId, bytes32 kind, - bytes32 data + uint64 blockId, + bytes32 chainData ) external - returns (bytes32 slot); + returns (bytes32 signal); /// @notice Verifies if a signal has been received on the target chain. /// @param chainId The identifier for the source chain from which the @@ -50,24 +69,41 @@ interface ISignalService { ) external; - /// @notice Checks if a chain data has been relayed. + /// @notice Verifies if a particular signal has already been sent. + /// @param app The address that initiated the signal. + /// @param signal The signal (message) that was sent. + /// @return True if the signal has been sent, otherwise false. + function isSignalSent(address app, bytes32 signal) external view returns (bool); + + /// @notice Checks if a chain data has been synced. /// uniquely from chainId, kind, and data. /// @param chainId The remote chainId. /// @param kind A value to mark the data type. - /// @param data The remote data. - /// @return True if the data has been relayed, otherwise false. - function isChainDataRelayed( + /// @param blockId The chain data's corresponding blockId + /// @param chainData The remote data. + /// @return True if the data has been synced, otherwise false. + function isChainDataSynced( uint64 chainId, bytes32 kind, - bytes32 data + uint64 blockId, + bytes32 chainData ) external view returns (bool); - /// @notice Verifies if a particular signal has already been sent. - /// @param app The address that initiated the signal. - /// @param signal The signal (message) that was sent. - /// @return True if the signal has been sent, otherwise false. - function isSignalSent(address app, bytes32 signal) external view returns (bool); + /// @notice Returns the given block's chain data. + /// @param kind A value to mark the data type. + /// @param blockId The chain data's corresponding block id. If this value is 0, use the top + /// block id. + /// @return _blockId The actual block id. + /// @return _chainData The synced chain data. + function getSyncedChainData( + uint64 chainId, + bytes32 kind, + uint64 blockId + ) + external + view + returns (uint64 _blockId, bytes32 _chainData); } diff --git a/packages/protocol/contracts/signal/SignalService.sol b/packages/protocol/contracts/signal/SignalService.sol index 2281146c11..b5b43af525 100644 --- a/packages/protocol/contracts/signal/SignalService.sol +++ b/packages/protocol/contracts/signal/SignalService.sol @@ -33,61 +33,69 @@ contract SignalService is EssentialContract, ISignalService { struct HopProof { uint64 chainId; - CacheOption cacheOption; + uint64 blockId; bytes32 rootHash; + CacheOption cacheOption; bytes[] accountProof; bytes[] storageProof; } - mapping(address => bool) public isRelayerAuthorized; + mapping(uint64 chainId => mapping(bytes32 kind => uint64 blockId)) public topBlockId; + mapping(address => bool) public isAuthorized; uint256[49] private __gap; - event SnippetRelayed( - uint64 indexed chainid, bytes32 indexed kind, bytes32 data, bytes32 signal - ); - - event RelayerAuthorized(address indexed addr, bool authrized); + event Authorized(address indexed addr, bool authrized); error SS_EMPTY_PROOF(); - error SS_INVALID_APP(); + error SS_INVALID_SENDER(); error SS_INVALID_LAST_HOP_CHAINID(); error SS_INVALID_MID_HOP_CHAINID(); - error SS_INVALID_PARAMS(); - error SS_INVALID_SIGNAL(); - error SS_LOCAL_CHAIN_DATA_NOT_FOUND(); + error SS_INVALID_STATE(); + error SS_INVALID_VALUE(); + error SS_SIGNAL_NOT_FOUND(); error SS_UNAUTHORIZED(); error SS_UNSUPPORTED(); + modifier validSender(address app) { + if (app == address(0)) revert SS_INVALID_SENDER(); + _; + } + + modifier nonZeroValue(bytes32 input) { + if (input == 0) revert SS_INVALID_VALUE(); + _; + } + /// @dev Initializer to be called after being deployed behind a proxy. function init(address _addressManager) external initializer { __Essential_init(_addressManager); } - /// @dev Authorize or deautohrize an address for calling relayChainData + /// @dev Authorize or deautohrize an address for calling syncChainData /// @dev Note that addr is supposed to be TaikoL1 and TaikoL1 contracts deployed locally. - function authorizeRelayer(address addr, bool toAuthorize) external onlyOwner { - if (isRelayerAuthorized[addr] == toAuthorize) revert SS_INVALID_PARAMS(); - isRelayerAuthorized[addr] = toAuthorize; + function authorize(address addr, bool toAuthorize) external onlyOwner { + if (isAuthorized[addr] == toAuthorize) revert SS_INVALID_STATE(); + isAuthorized[addr] = toAuthorize; + emit Authorized(addr, toAuthorize); + } - emit RelayerAuthorized(addr, toAuthorize); + /// @inheritdoc ISignalService + function sendSignal(bytes32 signal) external returns (bytes32 slot) { + return _sendSignal(msg.sender, signal, signal); } /// @inheritdoc ISignalService - function relayChainData( + function syncChainData( uint64 chainId, bytes32 kind, - bytes32 data + uint64 blockId, + bytes32 chainData ) external - returns (bytes32 slot) + returns (bytes32 signal) { - if (!isRelayerAuthorized[msg.sender]) revert SS_UNAUTHORIZED(); - return _relayChainData(chainId, kind, data); - } - - /// @inheritdoc ISignalService - function sendSignal(bytes32 signal) public returns (bytes32 slot) { - return _sendSignal(msg.sender, signal); + if (!isAuthorized[msg.sender]) revert SS_UNAUTHORIZED(); + return _syncChainData(chainId, kind, blockId, chainData); } /// @inheritdoc ISignalService @@ -100,23 +108,26 @@ contract SignalService is EssentialContract, ISignalService { ) public virtual + validSender(app) + nonZeroValue(signal) { - if (app == address(0) || signal == 0) revert SS_INVALID_PARAMS(); - HopProof[] memory _hopProofs = abi.decode(proof, (HopProof[])); if (_hopProofs.length == 0) revert SS_EMPTY_PROOF(); uint64 _chainId = chainId; address _app = app; bytes32 _signal = signal; + bytes32 _value = signal; address _signalService = resolve(_chainId, "signal_service", false); + HopProof memory hop; for (uint256 i; i < _hopProofs.length; ++i) { - HopProof memory hop = _hopProofs[i]; - - bytes32 signalRoot = _verifyHopProof(_chainId, _app, _signal, hop, _signalService); + hop = _hopProofs[i]; + bytes32 signalRoot = + _verifyHopProof(_chainId, _app, _signal, _value, hop, _signalService); bool isLastHop = i == _hopProofs.length - 1; + if (isLastHop) { if (hop.chainId != block.chainid) revert SS_INVALID_LAST_HOP_CHAINID(); _signalService = address(this); @@ -129,109 +140,104 @@ contract SignalService is EssentialContract, ISignalService { bool isFullProof = hop.accountProof.length > 0; - _cacheChainData(hop, _chainId, signalRoot, isFullProof, isLastHop); + _cacheChainData(hop, _chainId, hop.blockId, signalRoot, isFullProof, isLastHop); bytes32 kind = isFullProof ? LibSignals.STATE_ROOT : LibSignals.SIGNAL_ROOT; - _signal = signalForChainData(_chainId, kind, hop.rootHash); + _signal = signalForChainData(_chainId, kind, hop.blockId); + _value = hop.rootHash; _chainId = hop.chainId; _app = _signalService; } - if (!isSignalSent(address(this), _signal)) revert SS_LOCAL_CHAIN_DATA_NOT_FOUND(); + if (_value == 0 || _value != _loadSignalValue(address(this), _signal)) { + revert SS_SIGNAL_NOT_FOUND(); + } } /// @inheritdoc ISignalService - function isChainDataRelayed( + function isChainDataSynced( uint64 chainId, bytes32 kind, - bytes32 data + uint64 blockId, + bytes32 chainData ) public view + nonZeroValue(chainData) returns (bool) { - return isSignalSent(address(this), signalForChainData(chainId, kind, data)); + bytes32 signal = signalForChainData(chainId, kind, blockId); + return _loadSignalValue(address(this), signal) == chainData; } /// @inheritdoc ISignalService function isSignalSent(address app, bytes32 signal) public view returns (bool) { - if (signal == 0) revert SS_INVALID_SIGNAL(); - if (app == address(0)) revert SS_INVALID_APP(); - bytes32 slot = getSignalSlot(uint64(block.chainid), app, signal); - uint256 value; - assembly { - value := sload(slot) - } - return value == 1; + return _loadSignalValue(app, signal) == signal; } - /// @notice Get the storage slot of the signal. - /// @param chainId The address's chainId. - /// @param app The address that initiated the signal. - /// @param signal The signal to get the storage slot of. - /// @return The unique storage slot of the signal which is - /// created by encoding the sender address with the signal (message). - function getSignalSlot( + /// @inheritdoc ISignalService + function getSyncedChainData( uint64 chainId, - address app, - bytes32 signal + bytes32 kind, + uint64 blockId ) public - pure - returns (bytes32) + view + returns (uint64 _blockId, bytes32 _chainData) { - return keccak256(abi.encodePacked("SIGNAL", chainId, app, signal)); + _blockId = blockId != 0 ? blockId : topBlockId[chainId][kind]; + + if (_blockId != 0) { + bytes32 signal = signalForChainData(chainId, kind, _blockId); + _chainData = _loadSignalValue(address(this), signal); + if (_chainData == 0) revert SS_SIGNAL_NOT_FOUND(); + } } function signalForChainData( uint64 chainId, bytes32 kind, - bytes32 data + uint64 blockId ) public pure returns (bytes32) { - return keccak256(abi.encode(chainId, kind, data)); + return keccak256(abi.encode(chainId, kind, blockId)); } - function _relayChainData( + function getSignalSlot( uint64 chainId, - bytes32 kind, - bytes32 data + address app, + bytes32 signal ) - internal - returns (bytes32 slot) + public + pure + returns (bytes32) { - bytes32 signal = signalForChainData(chainId, kind, data); - emit SnippetRelayed(chainId, kind, data, signal); - return _sendSignal(address(this), signal); - } - - function _sendSignal(address sender, bytes32 signal) internal returns (bytes32 slot) { - if (signal == 0) revert SS_INVALID_SIGNAL(); - slot = getSignalSlot(uint64(block.chainid), sender, signal); - assembly { - sstore(slot, 1) - } + return keccak256(abi.encodePacked("SIGNAL", chainId, app, signal)); } function _verifyHopProof( uint64 chainId, address app, bytes32 signal, + bytes32 value, HopProof memory hop, - address relay + address signalService ) internal virtual + validSender(app) + nonZeroValue(signal) + nonZeroValue(value) returns (bytes32 signalRoot) { return LibTrieProof.verifyMerkleProof( hop.rootHash, - relay, + signalService, getSignalSlot(chainId, app, signal), - hex"01", + bytes.concat(value), hop.accountProof, hop.storageProof ); @@ -241,9 +247,45 @@ contract SignalService is EssentialContract, ISignalService { revert SS_UNSUPPORTED(); } + function _syncChainData( + uint64 chainId, + bytes32 kind, + uint64 blockId, + bytes32 chainData + ) + private + returns (bytes32 signal) + { + signal = signalForChainData(chainId, kind, blockId); + _sendSignal(address(this), signal, chainData); + + if (topBlockId[chainId][kind] < blockId) { + topBlockId[chainId][kind] = blockId; + } + emit ChainDataSynced(chainId, blockId, kind, chainData, signal); + } + + function _sendSignal( + address app, + bytes32 signal, + bytes32 value + ) + private + validSender(app) + nonZeroValue(signal) + nonZeroValue(value) + returns (bytes32 slot) + { + slot = getSignalSlot(uint64(block.chainid), app, signal); + assembly { + sstore(slot, value) + } + } + function _cacheChainData( HopProof memory hop, uint64 chainId, + uint64 blockId, bytes32 signalRoot, bool isFullProof, bool isLastHop @@ -255,7 +297,7 @@ contract SignalService is EssentialContract, ISignalService { || hop.cacheOption == CacheOption.CACHE_STATE_ROOT; if (cacheStateRoot && isFullProof && !isLastHop) { - _relayChainData(chainId, LibSignals.STATE_ROOT, hop.rootHash); + _syncChainData(chainId, LibSignals.STATE_ROOT, blockId, hop.rootHash); } // cache signal root @@ -263,7 +305,23 @@ contract SignalService is EssentialContract, ISignalService { || hop.cacheOption == CacheOption.CACHE_SIGNAL_ROOT; if (cacheSignalRoot && (!isLastHop || isFullProof)) { - _relayChainData(chainId, LibSignals.SIGNAL_ROOT, signalRoot); + _syncChainData(chainId, LibSignals.SIGNAL_ROOT, blockId, signalRoot); + } + } + + function _loadSignalValue( + address app, + bytes32 signal + ) + private + view + validSender(app) + nonZeroValue(signal) + returns (bytes32 value) + { + bytes32 slot = getSignalSlot(uint64(block.chainid), app, signal); + assembly { + value := sload(slot) } } } diff --git a/packages/protocol/docs/multihop_bridging_deployment.md b/packages/protocol/docs/multihop_bridging_deployment.md index faa86413c4..6b4ffbf1c0 100644 --- a/packages/protocol/docs/multihop_bridging_deployment.md +++ b/packages/protocol/docs/multihop_bridging_deployment.md @@ -11,7 +11,7 @@ When a signal is sent by the Signal Service, a unique slot in its storage is upd ```solidity function _sendSignal(address sender, bytes32 signal) internal returns (bytes32 slot) { - if (signal == 0) revert SS_INVALID_SIGNAL(); + if (signal == 0) revert SS_INVALID_VALUE(); slot = getSignalSlot(uint64(block.chainid), sender, signal); assembly { sstore(slot, 1) @@ -29,11 +29,11 @@ Merkle proofs can verify signals sent by specific senders when the signal servic Taiko's core protocol code (TaikoL1.sol and TaikoL2.sol) automatically synchronizes or relays the state roots between L1 and L2. -When chainA's state root is relayed to chainB, a special signal is sent in chainB's signal service. This signal is calculated incorporating chainA's block ID. These special signals are always sent by the target chain's signal service. +When chainA's state root is synced to chainB, a special signal is sent in chainB's signal service. This signal is calculated incorporating chainA's block ID. These special signals are always sent by the target chain's signal service. ![L1-L2 Sync](./multihop/l1_l2_sync.png) -If you deploy more chains using Taiko protocol, you can create a chain of relayed state roots between them. +If you deploy more chains using Taiko protocol, you can create a chain of synced state roots between them. ![Three Chains](./multihop/three_chains.png) @@ -42,12 +42,12 @@ If you deploy more chains using Taiko protocol, you can create a chain of relaye ### One-hop bridging Consider the 1-hop example below. -To verify that "some app" has sent a custom message, we verify if the corresponding signal (associated with the message sender, "some app") has been set by the signal service (0x1000A) on L1. After L1's state root is relayed to L2, we need the following info on L2 to verify the message on L1: +To verify that "some app" has sent a custom message, we verify if the corresponding signal (associated with the message sender, "some app") has been set by the signal service (0x1000A) on L1. After L1's state root is synced to L2, we need the following info on L2 to verify the message on L1: 1. Message's signal and its sender, to compute the storage slot now supposed to be 1. 2. A full merkle proof generated by an L1 node for the above slot. 3. L1 signal service's address associated with the merkle proof. -4. L2 signal service's address to verify that L1's state root has been relayed to L2 already. +4. L2 signal service's address to verify that L1's state root has been synced to L2 already. ![1-Hop Bridging](./multihop/bridge_1hop.png) diff --git a/packages/protocol/script/DeployOnL1.s.sol b/packages/protocol/script/DeployOnL1.s.sol index ab9dd07750..c2be1510bb 100644 --- a/packages/protocol/script/DeployOnL1.s.sol +++ b/packages/protocol/script/DeployOnL1.s.sol @@ -92,7 +92,7 @@ contract DeployOnL1 is DeployCapability { TaikoL1 taikoL1 = TaikoL1(payable(taikoL1Addr)); if (vm.envAddress("SHARED_ADDRESS_MANAGER") == address(0)) { - SignalService(signalServiceAddr).authorizeRelayer(taikoL1Addr, true); + SignalService(signalServiceAddr).authorize(taikoL1Addr, true); } uint64 l2ChainId = taikoL1.getConfig().chainId; diff --git a/packages/protocol/test/HelperContracts.sol b/packages/protocol/test/HelperContracts.sol index 0e16cf1ae4..2fc9a4663e 100644 --- a/packages/protocol/test/HelperContracts.sol +++ b/packages/protocol/test/HelperContracts.sol @@ -3,7 +3,6 @@ pragma solidity 0.8.24; import "../contracts/bridge/Bridge.sol"; import "../contracts/signal/SignalService.sol"; -import "../contracts/common/ICrossChainSync.sol"; contract BadReceiver { receive() external payable { @@ -48,17 +47,3 @@ contract SkipProofCheckSignal is SignalService { override { } } - -contract DummyCrossChainSync is EssentialContract, ICrossChainSync { - Snippet private _snippet; - - function setSnippet(uint64 blockId, bytes32 blockHash, bytes32 stateRoot) external { - _snippet.blockId = blockId; - _snippet.blockHash = blockHash; - _snippet.stateRoot = stateRoot; - } - - function getSyncedSnippet(uint64 /*blockId*/ ) public view returns (Snippet memory) { - return _snippet; - } -} diff --git a/packages/protocol/test/L1/TaikoL1.t.sol b/packages/protocol/test/L1/TaikoL1.t.sol index 86ade3ceea..f5ac4fd5e3 100644 --- a/packages/protocol/test/L1/TaikoL1.t.sol +++ b/packages/protocol/test/L1/TaikoL1.t.sol @@ -191,72 +191,6 @@ contract TaikoL1Test is TaikoL1TestBase { console2.log("ethDepositMaxCountPerBlock:", count); } - /// @dev getCrossChainBlockHash tests - function test_L1_getCrossChainBlockHash0() external { - bytes32 genHash = L1.getSyncedSnippet(0).blockHash; - assertEq(GENESIS_BLOCK_HASH, genHash); - - // Reverts if block is not yet verified! - vm.expectRevert(TaikoErrors.L1_BLOCK_MISMATCH.selector); - L1.getSyncedSnippet(1); - } - - /// @dev getSyncedSnippet tests - function test_L1_getSyncedSnippet() external { - uint64 count = 10; - // Declare here so that block prop/prove/verif. can be used in 1 place - TaikoData.BlockMetadata memory meta; - bytes32 blockHash; - bytes32 stateRoot; - bytes32[] memory parentHashes = new bytes32[](count); - parentHashes[0] = GENESIS_BLOCK_HASH; - - giveEthAndTko(Alice, 1e6 ether, 100_000 ether); - console2.log("Alice balance:", tko.balanceOf(Alice)); - giveEthAndTko(Bob, 1e7 ether, 100_000 ether); - console2.log("Bob balance:", tko.balanceOf(Bob)); - - // Propose blocks - for (uint64 blockId = 1; blockId < count; ++blockId) { - printVariables("before propose"); - (meta,) = proposeBlock(Alice, Bob, 1_000_000, 1024); - mine(5); - - blockHash = bytes32(1e10 + uint256(blockId)); - stateRoot = bytes32(1e9 + uint256(blockId)); - - proveBlock( - Bob, Bob, meta, parentHashes[blockId - 1], blockHash, stateRoot, meta.minTier, "" - ); - - vm.roll(block.number + 15 * 12); - uint16 minTier = meta.minTier; - vm.warp(block.timestamp + L1.getTier(minTier).cooldownWindow + 1); - - verifyBlock(Carol, 1); - - // Querying written blockhash - assertEq(L1.getSyncedSnippet(blockId).blockHash, blockHash); - - mine(5); - parentHashes[blockId] = blockHash; - } - - uint64 queriedBlockId = 1; - bytes32 expectedSR = bytes32(1e9 + uint256(queriedBlockId)); - - assertEq(expectedSR, L1.getSyncedSnippet(queriedBlockId).stateRoot); - - // 2nd - queriedBlockId = 2; - expectedSR = bytes32(1e9 + uint256(queriedBlockId)); - assertEq(expectedSR, L1.getSyncedSnippet(queriedBlockId).stateRoot); - - // Not found -> reverts - vm.expectRevert(TaikoErrors.L1_BLOCK_MISMATCH.selector); - L1.getSyncedSnippet((count + 1)); - } - function test_L1_deposit_hash_creation() external { giveEthAndTko(Bob, 1e6 ether, 100 ether); giveEthAndTko(Zachary, 1e6 ether, 0); diff --git a/packages/protocol/test/L1/TaikoL1TestBase.sol b/packages/protocol/test/L1/TaikoL1TestBase.sol index 6156dd54c2..e6b686e641 100644 --- a/packages/protocol/test/L1/TaikoL1TestBase.sol +++ b/packages/protocol/test/L1/TaikoL1TestBase.sol @@ -54,7 +54,7 @@ abstract contract TaikoL1TestBase is TaikoTest { data: abi.encodeCall(SignalService.init, address(addressManager)) }) ); - ss.authorizeRelayer(address(L1), true); + ss.authorize(address(L1), true); pv = PseZkVerifier( deployProxy({ diff --git a/packages/protocol/test/L2/TaikoL2.t.sol b/packages/protocol/test/L2/TaikoL2.t.sol index d53fcd0727..4583c03819 100644 --- a/packages/protocol/test/L2/TaikoL2.t.sol +++ b/packages/protocol/test/L2/TaikoL2.t.sol @@ -57,7 +57,7 @@ contract TestTaikoL2 is TaikoTest { L2.setConfigAndExcess(TaikoL2.Config(gasTarget, quotient), gasExcess); - ss.authorizeRelayer(address(L2), true); + ss.authorize(address(L2), true); gasExcess = 195_420_300_100; diff --git a/packages/protocol/test/L2/TaikoL2NoFeeCheck.t.sol b/packages/protocol/test/L2/TaikoL2NoFeeCheck.t.sol index 777eeff035..4ab4f4e46c 100644 --- a/packages/protocol/test/L2/TaikoL2NoFeeCheck.t.sol +++ b/packages/protocol/test/L2/TaikoL2NoFeeCheck.t.sol @@ -57,7 +57,7 @@ contract TestTaikoL2NoFeeCheck is TaikoTest { L2.setConfigAndExcess(TaikoL2.Config(gasTarget, quotient), gasExcess); - ss.authorizeRelayer(address(L2), true); + ss.authorize(address(L2), true); vm.roll(block.number + 1); vm.warp(block.timestamp + 30); diff --git a/packages/protocol/test/bridge/Bridge.t.sol b/packages/protocol/test/bridge/Bridge.t.sol index 5e3de09379..d9a11499e5 100644 --- a/packages/protocol/test/bridge/Bridge.t.sol +++ b/packages/protocol/test/bridge/Bridge.t.sol @@ -38,7 +38,6 @@ contract BridgeTest is TaikoTest { Bridge destChainBridge; TwoStepBridge dest2StepBridge; SignalService signalService; - DummyCrossChainSync crossChainSync; SkipProofCheckSignal mockProofSignalService; UntrustedSendMessageRelayer untrustedSenderContract; uint64 destChainId = 19_389; @@ -108,8 +107,6 @@ contract BridgeTest is TaikoTest { vm.deal(address(destChainBridge), 100 ether); vm.deal(address(dest2StepBridge), 100 ether); - crossChainSync = new DummyCrossChainSync(); - untrustedSenderContract = new UntrustedSendMessageRelayer(); vm.deal(address(untrustedSenderContract), 10 ether); @@ -638,8 +635,6 @@ contract BridgeTest is TaikoTest { badReceiver = new BadReceiver(); uint64 dest = 1337; - addressManager.setAddress(dest, "taiko", address(crossChainSync)); - addressManager.setAddress(1336, "bridge", 0x564540a26Fb667306b3aBdCB4ead35BEb88698ab); addressManager.setAddress(dest, "bridge", address(destChainBridge)); @@ -648,12 +643,6 @@ contract BridgeTest is TaikoTest { addressManager.setAddress(dest, "signal_service", address(mockProofSignalService)); - crossChainSync.setSnippet( - 123, - 0xd5f5d8ac6bc37139c97389b00e9cf53e89c153ad8a5fc765ffe9f44ea9f3d31e, - 0x631b214fb030d82847224f0b3d3b906a6764dded176ad3c7262630204867ba85 - ); - vm.deal(address(destChainBridge), 1 ether); vm.chainId(dest); diff --git a/packages/protocol/test/signal/SignalService.t.sol b/packages/protocol/test/signal/SignalService.t.sol index b029240a50..5a864e4922 100644 --- a/packages/protocol/test/signal/SignalService.t.sol +++ b/packages/protocol/test/signal/SignalService.t.sol @@ -8,6 +8,7 @@ contract MockSignalService is SignalService { uint64, /*chainId*/ address, /*app*/ bytes32, /*signal*/ + bytes32, /*value*/ HopProof memory, /*hop*/ address /*relay*/ ) @@ -51,22 +52,22 @@ contract TestSignalService is TaikoTest { ); taiko = randAddress(); - signalService.authorizeRelayer(taiko, true); + signalService.authorize(taiko, true); vm.stopPrank(); } function test_SignalService_sendSignal_revert() public { - vm.expectRevert(SignalService.SS_INVALID_SIGNAL.selector); + vm.expectRevert(SignalService.SS_INVALID_VALUE.selector); signalService.sendSignal(0); } function test_SignalService_isSignalSent_revert() public { bytes32 signal = bytes32(uint256(1)); - vm.expectRevert(SignalService.SS_INVALID_APP.selector); + vm.expectRevert(SignalService.SS_INVALID_SENDER.selector); signalService.isSignalSent(address(0), signal); signal = bytes32(uint256(0)); - vm.expectRevert(SignalService.SS_INVALID_SIGNAL.selector); + vm.expectRevert(SignalService.SS_INVALID_VALUE.selector); signalService.isSignalSent(Alice, signal); } @@ -78,21 +79,11 @@ contract TestSignalService is TaikoTest { assertTrue(signalService.isSignalSent(Alice, signal)); } - function test_SignalService_getSignalSlot() public { - vm.startPrank(Alice); - for (uint8 i = 1; i < 100; ++i) { - bytes32 signal = bytes32(block.prevrandao + i); - signalService.sendSignal(signal); - - assertTrue(signalService.isSignalSent(Alice, signal)); - } - } - function test_SignalService_proveSignalReceived_revert_invalid_chainid_or_signal() public { SignalService.HopProof[] memory proofs = new SignalService.HopProof[](1); // app being address(0) will revert - vm.expectRevert(SignalService.SS_INVALID_PARAMS.selector); + vm.expectRevert(SignalService.SS_INVALID_SENDER.selector); signalService.proveSignalReceived({ chainId: 1, app: address(0), @@ -101,7 +92,7 @@ contract TestSignalService is TaikoTest { }); // signal being 0 will revert - vm.expectRevert(SignalService.SS_INVALID_PARAMS.selector); + vm.expectRevert(SignalService.SS_INVALID_VALUE.selector); signalService.proveSignalReceived({ chainId: uint64(block.chainid), app: randAddress(), @@ -175,6 +166,7 @@ contract TestSignalService is TaikoTest { // proofs[0].chainId must be block.chainid in order not to revert proofs[0].chainId = uint64(block.chainid + 1); + proofs[0].blockId = 1; vm.expectRevert(SignalService.SS_INVALID_LAST_HOP_CHAINID.selector); signalService.proveSignalReceived({ @@ -195,6 +187,7 @@ contract TestSignalService is TaikoTest { // proofs[0].chainId must NOT be block.chainid in order not to revert proofs[0].chainId = uint64(block.chainid); + proofs[0].blockId = 1; vm.expectRevert(SignalService.SS_INVALID_MID_HOP_CHAINID.selector); signalService.proveSignalReceived({ @@ -215,6 +208,7 @@ contract TestSignalService is TaikoTest { // proofs[0].chainId must NOT be block.chainid in order not to revert proofs[0].chainId = srcChainId + 1; + proofs[0].blockId = 1; vm.expectRevert( abi.encodeWithSelector( @@ -241,12 +235,13 @@ contract TestSignalService is TaikoTest { SignalService.HopProof[] memory proofs = new SignalService.HopProof[](1); proofs[0].chainId = uint64(block.chainid); + proofs[0].blockId = 1; // the proof is a storage proof proofs[0].accountProof = new bytes[](0); proofs[0].storageProof = new bytes[](10); - vm.expectRevert(SignalService.SS_LOCAL_CHAIN_DATA_NOT_FOUND.selector); + vm.expectRevert(SignalService.SS_SIGNAL_NOT_FOUND.selector); signalService.proveSignalReceived({ chainId: srcChainId, app: randAddress(), @@ -257,7 +252,7 @@ contract TestSignalService is TaikoTest { // the proof is a full proof proofs[0].accountProof = new bytes[](1); - vm.expectRevert(SignalService.SS_LOCAL_CHAIN_DATA_NOT_FOUND.selector); + vm.expectRevert(SignalService.SS_SIGNAL_NOT_FOUND.selector); signalService.proveSignalReceived({ chainId: srcChainId, app: randAddress(), @@ -275,13 +270,14 @@ contract TestSignalService is TaikoTest { SignalService.HopProof[] memory proofs = new SignalService.HopProof[](1); proofs[0].chainId = uint64(block.chainid); + proofs[0].blockId = 1; proofs[0].rootHash = randBytes32(); // the proof is a storage proof proofs[0].accountProof = new bytes[](0); proofs[0].storageProof = new bytes[](10); - vm.expectRevert(SignalService.SS_LOCAL_CHAIN_DATA_NOT_FOUND.selector); + vm.expectRevert(SignalService.SS_SIGNAL_NOT_FOUND.selector); signalService.proveSignalReceived({ chainId: srcChainId, app: randAddress(), @@ -291,7 +287,9 @@ contract TestSignalService is TaikoTest { // relay the signal root vm.prank(taiko); - signalService.relayChainData(srcChainId, LibSignals.SIGNAL_ROOT, proofs[0].rootHash); + signalService.syncChainData( + srcChainId, LibSignals.SIGNAL_ROOT, proofs[0].blockId, proofs[0].rootHash + ); signalService.proveSignalReceived({ chainId: srcChainId, app: randAddress(), @@ -300,11 +298,13 @@ contract TestSignalService is TaikoTest { }); vm.prank(Alice); - signalService.authorizeRelayer(taiko, false); + signalService.authorize(taiko, false); vm.expectRevert(SignalService.SS_UNAUTHORIZED.selector); vm.prank(taiko); - signalService.relayChainData(srcChainId, LibSignals.SIGNAL_ROOT, proofs[0].rootHash); + signalService.syncChainData( + srcChainId, LibSignals.SIGNAL_ROOT, proofs[0].blockId, proofs[0].rootHash + ); } function test_SignalService_proveSignalReceived_one_hop_state_root() public { @@ -316,13 +316,14 @@ contract TestSignalService is TaikoTest { SignalService.HopProof[] memory proofs = new SignalService.HopProof[](1); proofs[0].chainId = uint64(block.chainid); + proofs[0].blockId = 1; proofs[0].rootHash = randBytes32(); // the proof is a full merkle proof proofs[0].accountProof = new bytes[](1); proofs[0].storageProof = new bytes[](10); - vm.expectRevert(SignalService.SS_LOCAL_CHAIN_DATA_NOT_FOUND.selector); + vm.expectRevert(SignalService.SS_SIGNAL_NOT_FOUND.selector); signalService.proveSignalReceived({ chainId: srcChainId, app: randAddress(), @@ -332,7 +333,9 @@ contract TestSignalService is TaikoTest { // relay the state root vm.prank(taiko); - signalService.relayChainData(srcChainId, LibSignals.STATE_ROOT, proofs[0].rootHash); + signalService.syncChainData( + srcChainId, LibSignals.STATE_ROOT, proofs[0].blockId, proofs[0].rootHash + ); // Should not revert signalService.proveSignalReceived({ @@ -343,14 +346,14 @@ contract TestSignalService is TaikoTest { }); assertEq( - signalService.isChainDataRelayed( - srcChainId, LibSignals.SIGNAL_ROOT, bytes32(uint256(789)) + signalService.isChainDataSynced( + srcChainId, LibSignals.SIGNAL_ROOT, proofs[0].blockId, bytes32(uint256(789)) ), false ); } - function test_SignalService_proveSignalReceived_multiple_hops() public { + function test_SignalService_proveSignalReceived_multiple_hops_no_caching() public { uint64 srcChainId = uint64(block.chainid + 1); vm.prank(Alice); @@ -360,18 +363,21 @@ contract TestSignalService is TaikoTest { // first hop with full merkle proof proofs[0].chainId = uint64(block.chainid + 2); + proofs[0].blockId = 1; proofs[0].rootHash = randBytes32(); proofs[0].accountProof = new bytes[](1); proofs[0].storageProof = new bytes[](10); // second hop with storage merkle proof proofs[1].chainId = uint64(block.chainid + 3); + proofs[1].blockId = 2; proofs[1].rootHash = randBytes32(); proofs[1].accountProof = new bytes[](0); proofs[1].storageProof = new bytes[](10); // third/last hop with full merkle proof proofs[2].chainId = uint64(block.chainid); + proofs[2].blockId = 3; proofs[2].rootHash = randBytes32(); proofs[2].accountProof = new bytes[](1); proofs[2].storageProof = new bytes[](10); @@ -384,7 +390,6 @@ contract TestSignalService is TaikoTest { strToBytes32("signal_service") ) ); - signalService.proveSignalReceived({ chainId: srcChainId, app: randAddress(), @@ -398,7 +403,7 @@ contract TestSignalService is TaikoTest { addressManager.setAddress(proofs[1].chainId, "signal_service", randAddress() /*relay2*/ ); vm.stopPrank(); - vm.expectRevert(SignalService.SS_LOCAL_CHAIN_DATA_NOT_FOUND.selector); + vm.expectRevert(SignalService.SS_SIGNAL_NOT_FOUND.selector); signalService.proveSignalReceived({ chainId: srcChainId, app: randAddress(), @@ -407,7 +412,9 @@ contract TestSignalService is TaikoTest { }); vm.prank(taiko); - signalService.relayChainData(proofs[1].chainId, LibSignals.STATE_ROOT, proofs[2].rootHash); + signalService.syncChainData( + proofs[1].chainId, LibSignals.STATE_ROOT, proofs[2].blockId, proofs[2].rootHash + ); signalService.proveSignalReceived({ chainId: srcChainId, @@ -425,6 +432,7 @@ contract TestSignalService is TaikoTest { // hop 1: full merkle proof, CACHE_NOTHING proofs[0].chainId = nextChainId++; + proofs[0].blockId = 1; proofs[0].rootHash = randBytes32(); proofs[0].accountProof = new bytes[](1); proofs[0].storageProof = new bytes[](10); @@ -432,6 +440,7 @@ contract TestSignalService is TaikoTest { // hop 2: full merkle proof, CACHE_STATE_ROOT proofs[1].chainId = nextChainId++; + proofs[1].blockId = 2; proofs[1].rootHash = randBytes32(); proofs[1].accountProof = new bytes[](1); proofs[1].storageProof = new bytes[](10); @@ -439,6 +448,7 @@ contract TestSignalService is TaikoTest { // hop 3: full merkle proof, CACHE_SIGNAL_ROOT proofs[2].chainId = nextChainId++; + proofs[2].blockId = 3; proofs[2].rootHash = randBytes32(); proofs[2].accountProof = new bytes[](1); proofs[2].storageProof = new bytes[](10); @@ -446,6 +456,7 @@ contract TestSignalService is TaikoTest { // hop 4: full merkle proof, CACHE_BOTH proofs[3].chainId = nextChainId++; + proofs[3].blockId = 4; proofs[3].rootHash = randBytes32(); proofs[3].accountProof = new bytes[](1); proofs[3].storageProof = new bytes[](10); @@ -453,6 +464,7 @@ contract TestSignalService is TaikoTest { // hop 5: storage merkle proof, CACHE_NOTHING proofs[4].chainId = nextChainId++; + proofs[4].blockId = 5; proofs[4].rootHash = randBytes32(); proofs[4].accountProof = new bytes[](0); proofs[4].storageProof = new bytes[](10); @@ -460,6 +472,7 @@ contract TestSignalService is TaikoTest { // hop 6: storage merkle proof, CACHE_STATE_ROOT proofs[5].chainId = nextChainId++; + proofs[5].blockId = 6; proofs[5].rootHash = randBytes32(); proofs[5].accountProof = new bytes[](0); proofs[5].storageProof = new bytes[](10); @@ -467,6 +480,7 @@ contract TestSignalService is TaikoTest { // hop 7: storage merkle proof, CACHE_SIGNAL_ROOT proofs[6].chainId = nextChainId++; + proofs[6].blockId = 7; proofs[6].rootHash = randBytes32(); proofs[6].accountProof = new bytes[](0); proofs[6].storageProof = new bytes[](10); @@ -474,6 +488,7 @@ contract TestSignalService is TaikoTest { // hop 8: storage merkle proof, CACHE_BOTH proofs[7].chainId = nextChainId++; + proofs[7].blockId = 8; proofs[7].rootHash = randBytes32(); proofs[7].accountProof = new bytes[](0); proofs[7].storageProof = new bytes[](10); @@ -481,6 +496,7 @@ contract TestSignalService is TaikoTest { // last hop, 9: full merkle proof, CACHE_BOTH proofs[8].chainId = uint64(block.chainid); + proofs[8].blockId = 9; proofs[8].rootHash = randBytes32(); proofs[8].accountProof = new bytes[](1); proofs[8].storageProof = new bytes[](10); @@ -497,7 +513,9 @@ contract TestSignalService is TaikoTest { vm.stopPrank(); vm.prank(taiko); - signalService.relayChainData(proofs[7].chainId, LibSignals.STATE_ROOT, proofs[8].rootHash); + signalService.syncChainData( + proofs[7].chainId, LibSignals.STATE_ROOT, proofs[8].blockId, proofs[8].rootHash + ); signalService.proveSignalReceived({ chainId: srcChainId, @@ -507,33 +525,29 @@ contract TestSignalService is TaikoTest { }); // hop 1: full merkle proof, CACHE_NOTHING - _verifyCache(srcChainId, proofs[0].rootHash, false, false); + _verifyCache(srcChainId, proofs[0].blockId, proofs[0].rootHash, false, false); // hop 2: full merkle proof, CACHE_STATE_ROOT - _verifyCache(proofs[0].chainId, proofs[1].rootHash, true, false); + _verifyCache(proofs[0].chainId, proofs[1].blockId, proofs[1].rootHash, true, false); // hop 3: full merkle proof, CACHE_SIGNAL_ROOT - _verifyCache(proofs[1].chainId, proofs[2].rootHash, false, true); + _verifyCache(proofs[1].chainId, proofs[2].blockId, proofs[2].rootHash, false, true); // hop 4: full merkle proof, CACHE_BOTH - _verifyCache(proofs[2].chainId, proofs[3].rootHash, true, true); - + _verifyCache(proofs[2].chainId, proofs[3].blockId, proofs[3].rootHash, true, true); // hop 5: storage merkle proof, CACHE_NOTHING - _verifyCache(proofs[3].chainId, proofs[4].rootHash, false, false); - + _verifyCache(proofs[3].chainId, proofs[4].blockId, proofs[4].rootHash, false, false); // hop 6: storage merkle proof, CACHE_STATE_ROOT - _verifyCache(proofs[4].chainId, proofs[5].rootHash, false, false); - + _verifyCache(proofs[4].chainId, proofs[5].blockId, proofs[5].rootHash, false, false); // hop 7: storage merkle proof, CACHE_SIGNAL_ROOT - _verifyCache(proofs[5].chainId, proofs[6].rootHash, false, true); - + _verifyCache(proofs[5].chainId, proofs[6].blockId, proofs[6].rootHash, false, true); // hop 8: storage merkle proof, CACHE_BOTH - _verifyCache(proofs[6].chainId, proofs[7].rootHash, false, true); - + _verifyCache(proofs[6].chainId, proofs[7].blockId, proofs[7].rootHash, false, true); // last hop, 9: full merkle proof, CACHE_BOTH // last hop's state root is already cached even before the proveSignalReceived call. - _verifyCache(proofs[7].chainId, proofs[8].rootHash, true, true); + _verifyCache(proofs[7].chainId, proofs[8].blockId, proofs[8].rootHash, true, true); } function _verifyCache( uint64 chainId, + uint64 blockId, bytes32 stateRoot, bool stateRootCached, bool signalRootCached @@ -541,12 +555,14 @@ contract TestSignalService is TaikoTest { private { assertEq( - signalService.isChainDataRelayed(chainId, LibSignals.STATE_ROOT, stateRoot), + signalService.isChainDataSynced(chainId, LibSignals.STATE_ROOT, blockId, stateRoot), stateRootCached ); assertEq( - signalService.isChainDataRelayed(chainId, LibSignals.SIGNAL_ROOT, bytes32(uint256(789))), + signalService.isChainDataSynced( + chainId, LibSignals.SIGNAL_ROOT, blockId, bytes32(uint256(789)) + ), signalRootCached ); } diff --git a/packages/protocol/test/tokenvault/ERC1155Vault.t.sol b/packages/protocol/test/tokenvault/ERC1155Vault.t.sol index e59015104a..f029a0ed36 100644 --- a/packages/protocol/test/tokenvault/ERC1155Vault.t.sol +++ b/packages/protocol/test/tokenvault/ERC1155Vault.t.sol @@ -99,7 +99,6 @@ contract ERC1155VaultTest is TaikoTest { ERC1155Vault destChainErc1155Vault; TestTokenERC1155 ctoken1155; SignalService signalService; - DummyCrossChainSync crossChainSync; uint64 destChainId = 19_389; function setUp() public { @@ -174,8 +173,6 @@ contract ERC1155VaultTest is TaikoTest { }) ); - crossChainSync = new DummyCrossChainSync(); - addressManager.setAddress( uint64(block.chainid), "signal_service", address(mockProofSignalService) ); diff --git a/packages/protocol/test/tokenvault/ERC721Vault.t.sol b/packages/protocol/test/tokenvault/ERC721Vault.t.sol index 1e33cc68df..4329a72e6e 100644 --- a/packages/protocol/test/tokenvault/ERC721Vault.t.sol +++ b/packages/protocol/test/tokenvault/ERC721Vault.t.sol @@ -114,7 +114,6 @@ contract ERC721VaultTest is TaikoTest { ERC721Vault destChainErc721Vault; TestTokenERC721 canonicalToken721; SignalService signalService; - DummyCrossChainSync crossChainSync; uint64 destChainId = 19_389; function setUp() public { @@ -190,8 +189,6 @@ contract ERC721VaultTest is TaikoTest { }) ); - crossChainSync = new DummyCrossChainSync(); - addressManager.setAddress( uint64(block.chainid), "signal_service", address(mockProofSignalService) ); diff --git a/packages/protocol/utils/generate_genesis/taikoL2.ts b/packages/protocol/utils/generate_genesis/taikoL2.ts index b9553bfe69..b1d1c1cc3a 100644 --- a/packages/protocol/utils/generate_genesis/taikoL2.ts +++ b/packages/protocol/utils/generate_genesis/taikoL2.ts @@ -466,7 +466,7 @@ async function generateContractConfigs( _owner: ownerSecurityCouncil, // AddressResolver addressManager: addressMap.SharedAddressManager, - isRelayerAuthorized: { + isAuthorized: { [addressMap.TaikoL2]: true, }, }, diff --git a/packages/status-page/src/constants/abi/TaikoL2.ts b/packages/status-page/src/constants/abi/TaikoL2.ts new file mode 100644 index 0000000000..8368362b8c --- /dev/null +++ b/packages/status-page/src/constants/abi/TaikoL2.ts @@ -0,0 +1,670 @@ +export default [ + { + inputs: [ + { + internalType: "uint64", + name: "expected", + type: "uint64", + }, + { + internalType: "uint64", + name: "actual", + type: "uint64", + }, + ], + name: "L2_BASEFEE_MISMATCH", + type: "error", + }, + { + inputs: [], + name: "L2_INVALID_1559_PARAMS", + type: "error", + }, + { + inputs: [], + name: "L2_INVALID_CHAIN_ID", + type: "error", + }, + { + inputs: [], + name: "L2_INVALID_GOLDEN_TOUCH_K", + type: "error", + }, + { + inputs: [], + name: "L2_INVALID_SENDER", + type: "error", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "expected", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "actual", + type: "bytes32", + }, + ], + name: "L2_PUBLIC_INPUT_HASH_MISMATCH", + type: "error", + }, + { + inputs: [], + name: "L2_TOO_LATE", + type: "error", + }, + { + inputs: [], + name: "M1559_OUT_OF_STOCK", + type: "error", + }, + { + inputs: [], + name: "M1559_OUT_OF_STOCK", + type: "error", + }, + { + inputs: [ + { + internalType: "uint64", + name: "expected", + type: "uint64", + }, + { + internalType: "uint64", + name: "actual", + type: "uint64", + }, + ], + name: "M1559_UNEXPECTED_CHANGE", + type: "error", + }, + { + inputs: [ + { + internalType: "uint64", + name: "expected", + type: "uint64", + }, + { + internalType: "uint64", + name: "actual", + type: "uint64", + }, + ], + name: "M1559_UNEXPECTED_CHANGE", + type: "error", + }, + { + inputs: [], + name: "Overflow", + type: "error", + }, + { + inputs: [], + name: "RESOLVER_DENIED", + type: "error", + }, + { + inputs: [], + name: "RESOLVER_INVALID_ADDR", + type: "error", + }, + { + inputs: [ + { + internalType: "uint256", + name: "chainId", + type: "uint256", + }, + { + internalType: "bytes32", + name: "name", + type: "bytes32", + }, + ], + name: "RESOLVER_ZERO_ADDR", + type: "error", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "addressManager", + type: "address", + }, + ], + name: "AddressManagerChanged", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint64", + name: "number", + type: "uint64", + }, + { + indexed: false, + internalType: "uint64", + name: "basefee", + type: "uint64", + }, + { + indexed: false, + internalType: "uint64", + name: "gaslimit", + type: "uint64", + }, + { + indexed: false, + internalType: "uint64", + name: "timestamp", + type: "uint64", + }, + { + indexed: false, + internalType: "bytes32", + name: "parentHash", + type: "bytes32", + }, + { + indexed: false, + internalType: "uint256", + name: "prevrandao", + type: "uint256", + }, + { + indexed: false, + internalType: "address", + name: "coinbase", + type: "address", + }, + { + indexed: false, + internalType: "uint32", + name: "chainid", + type: "uint32", + }, + ], + name: "Anchored", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "srcHeight", + type: "uint256", + }, + { + indexed: false, + internalType: "bytes32", + name: "blockHash", + type: "bytes32", + }, + { + indexed: false, + internalType: "bytes32", + name: "signalRoot", + type: "bytes32", + }, + ], + name: "CrossChainSynced", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint8", + name: "version", + type: "uint8", + }, + ], + name: "Initialized", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address", + }, + ], + name: "OwnershipTransferred", + type: "event", + }, + { + inputs: [], + name: "GOLDEN_TOUCH_ADDRESS", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "GOLDEN_TOUCH_PRIVATEKEY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "addressManager", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "l1Hash", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "l1SignalRoot", + type: "bytes32", + }, + { + internalType: "uint64", + name: "l1Height", + type: "uint64", + }, + { + internalType: "uint64", + name: "parentGasUsed", + type: "uint64", + }, + ], + name: "anchor", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "gasExcess", + outputs: [ + { + internalType: "uint64", + name: "", + type: "uint64", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint32", + name: "timeSinceParent", + type: "uint32", + }, + { + internalType: "uint64", + name: "gasLimit", + type: "uint64", + }, + { + internalType: "uint64", + name: "parentGasUsed", + type: "uint64", + }, + ], + name: "getBasefee", + outputs: [ + { + internalType: "uint256", + name: "_basefee", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "number", + type: "uint256", + }, + ], + name: "getBlockHash", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "number", + type: "uint256", + }, + ], + name: "getCrossChainBlockHash", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "number", + type: "uint256", + }, + ], + name: "getCrossChainSignalRoot", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getEIP1559Config", + outputs: [ + { + components: [ + { + internalType: "uint128", + name: "yscale", + type: "uint128", + }, + { + internalType: "uint64", + name: "xscale", + type: "uint64", + }, + { + internalType: "uint64", + name: "gasIssuedPerSecond", + type: "uint64", + }, + ], + internalType: "struct TaikoL2.EIP1559Config", + name: "", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_addressManager", + type: "address", + }, + { + components: [ + { + internalType: "uint64", + name: "basefee", + type: "uint64", + }, + { + internalType: "uint64", + name: "gasIssuedPerSecond", + type: "uint64", + }, + { + internalType: "uint64", + name: "gasExcessMax", + type: "uint64", + }, + { + internalType: "uint64", + name: "gasTarget", + type: "uint64", + }, + { + internalType: "uint64", + name: "ratio2x1x", + type: "uint64", + }, + ], + internalType: "struct TaikoL2.EIP1559Params", + name: "_param1559", + type: "tuple", + }, + ], + name: "init", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "latestRelayedL1BlockId", + outputs: [ + { + internalType: "uint64", + name: "", + type: "uint64", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "parentTimestamp", + outputs: [ + { + internalType: "uint64", + name: "", + type: "uint64", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "publicInputHash", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "renounceOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "chainId", + type: "uint256", + }, + { + internalType: "bytes32", + name: "name", + type: "bytes32", + }, + { + internalType: "bool", + name: "allowZeroAddress", + type: "bool", + }, + ], + name: "resolve", + outputs: [ + { + internalType: "address payable", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "name", + type: "bytes32", + }, + { + internalType: "bool", + name: "allowZeroAddress", + type: "bool", + }, + ], + name: "resolve", + outputs: [ + { + internalType: "address payable", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "newAddressManager", + type: "address", + }, + ], + name: "setAddressManager", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "digest", + type: "bytes32", + }, + { + internalType: "uint8", + name: "k", + type: "uint8", + }, + ], + name: "signAnchor", + outputs: [ + { + internalType: "uint8", + name: "v", + type: "uint8", + }, + { + internalType: "uint256", + name: "r", + type: "uint256", + }, + { + internalType: "uint256", + name: "s", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "newOwner", + type: "address", + }, + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, +]; From a48b9c04c9bf1e94a711745206326ae01a16d86d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 17 Feb 2024 19:44:17 +0800 Subject: [PATCH 14/47] chore(deps): bump docker/login-action from 2 to 3 (#15818) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: maskpp --- .github/workflows/eventindexer.yml | 2 +- .github/workflows/guardianproverhealthcheck.yaml | 2 +- .github/workflows/relayer.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/eventindexer.yml b/.github/workflows/eventindexer.yml index d692ed7778..e9b50e5355 100644 --- a/.github/workflows/eventindexer.yml +++ b/.github/workflows/eventindexer.yml @@ -65,7 +65,7 @@ jobs: ref: ${{ github.ref }} - name: Login to GCR - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: gcr.io username: _json_key diff --git a/.github/workflows/guardianproverhealthcheck.yaml b/.github/workflows/guardianproverhealthcheck.yaml index a011ca4f33..82dae9b5a3 100644 --- a/.github/workflows/guardianproverhealthcheck.yaml +++ b/.github/workflows/guardianproverhealthcheck.yaml @@ -65,7 +65,7 @@ jobs: ref: ${{ github.ref }} - name: Login to GCR - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: gcr.io username: _json_key diff --git a/.github/workflows/relayer.yml b/.github/workflows/relayer.yml index 52e1e809db..6348e0b682 100644 --- a/.github/workflows/relayer.yml +++ b/.github/workflows/relayer.yml @@ -65,7 +65,7 @@ jobs: ref: ${{ github.ref }} - name: Login to GCR - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: gcr.io username: _json_key From 3c4d763971f4a3ace581402d4a4d6983c7b66489 Mon Sep 17 00:00:00 2001 From: Daniel Wang <99078276+dantaik@users.noreply.github.com> Date: Sat, 17 Feb 2024 21:38:40 +0800 Subject: [PATCH 15/47] chore(protocol): fix lint issue and ignore some complier errors for test/script files (#15891) Co-authored-by: maskpp --- packages/protocol/foundry.toml | 23 +++++++++++-------- .../test/libs/LibFixedPointMath.t.sol | 6 ++--- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/packages/protocol/foundry.toml b/packages/protocol/foundry.toml index 0ccad3d340..def9be8634 100644 --- a/packages/protocol/foundry.toml +++ b/packages/protocol/foundry.toml @@ -1,17 +1,18 @@ # See more config options https://github.com/foundry-rs/foundry/tree/master/config [profile.default] solc-version = "0.8.24" -src = 'contracts' -out = 'out' -test = 'test' -libs = ['lib'] +src = "contracts" +out = "out" +test = "test" +script = "script" +libs = ["lib"] gas_price = 10000000000 # gas price is 10 Gwei optimizer = true optimizer_runs = 200 ffi = true -gas_limit = '18446744073709551615' +gas_limit = "18446744073709551615" memory_limit = 2073741824 -evm_version = 'cancun' +evm_version = "cancun" # Do not change the block_gas_limit value, TaikoL2.t.sol depends on it. block_gas_limit = 80000000 #80M @@ -26,7 +27,9 @@ fs_permissions = [ ] # 2394: transient storage warning -ignored_error_codes = [2394] +# 3860: Contract initcode size is xxx bytes and exceeds 49152 bytes +# 5574: Contract code size is xxx bytes and exceeds 24576 byte +ignored_error_codes = [ 2394, 3860, 5574] fuzz = { runs = 200 } @@ -38,9 +41,9 @@ seed = 13623721389213 [fmt] bracket_spacing = true line_length = 100 -multiline_func_header = 'all' -number_underscore = 'thousands' +multiline_func_header = "all" +number_underscore = "thousands" wrap_comments = true [profile.genesis] -test = 'genesis' +test = "genesis" diff --git a/packages/protocol/test/libs/LibFixedPointMath.t.sol b/packages/protocol/test/libs/LibFixedPointMath.t.sol index d06b368cb1..73cf16300a 100644 --- a/packages/protocol/test/libs/LibFixedPointMath.t.sol +++ b/packages/protocol/test/libs/LibFixedPointMath.t.sol @@ -10,18 +10,18 @@ contract LibFixedPointMathTest is TaikoTest { assertEq(LibFixedPointMath.exp(-1e18), 367_879_441_171_442_321); } - function testExpSmallest() public view { + function testExpSmallest() public pure { int256 y = LibFixedPointMath.exp(-42_139_678_854_452_767_550); console2.log("LibFixedPointMath.exp(-42139678854452767550)=", uint256(y)); } - function testExpLargest() public view { + function testExpLargest() public pure { int256 y = LibFixedPointMath.exp(int256(uint256(LibFixedPointMath.MAX_EXP_INPUT))); console2.log("LibFixedPointMath.exp(135305999368893231588)=", uint256(y)); } - function testExpSome() public view { + function testExpSome() public pure { int256 y = LibFixedPointMath.exp(5e18); console2.log("LibFixedPointMath.exp(5e18)=", uint256(y)); } From 3233c8adcb7d1de1e1076aebcbb5e2e2c7bdacec Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 17 Feb 2024 21:59:14 +0800 Subject: [PATCH 16/47] chore(deps): bump gorm.io/gorm from 1.24.6 to 1.25.7 (#15836) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: maskpp --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index d6671b6f2e..6bc29f2d18 100644 --- a/go.mod +++ b/go.mod @@ -34,7 +34,7 @@ require ( gopkg.in/yaml.v3 v3.0.1 gorm.io/datatypes v1.0.7 gorm.io/driver/mysql v1.4.3 - gorm.io/gorm v1.24.6 + gorm.io/gorm v1.25.7 gotest.tools v2.2.0+incompatible ) diff --git a/go.sum b/go.sum index 2f0ca3b0f4..c6bd821c2e 100644 --- a/go.sum +++ b/go.sum @@ -998,8 +998,8 @@ gorm.io/gorm v1.21.3/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= gorm.io/gorm v1.23.1/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= gorm.io/gorm v1.23.6/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= gorm.io/gorm v1.23.8/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= -gorm.io/gorm v1.24.6 h1:wy98aq9oFEetsc4CAbKD2SoBCdMzsbSIvSUUFJuHi5s= -gorm.io/gorm v1.24.6/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k= +gorm.io/gorm v1.25.7 h1:VsD6acwRjz2zFxGO50gPO6AkNs7KKnvfzUjHQhZDz/A= +gorm.io/gorm v1.25.7/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= gotest.tools/v3 v3.0.3 h1:4AuOwCGf4lLR9u3YOe2awrHygurzhO/HeQ6laiA6Sx0= From 4b5a95a2aeac13265d362757f8ffcb5ca43a03d8 Mon Sep 17 00:00:00 2001 From: d1onys1us <13951458+d1onys1us@users.noreply.github.com> Date: Sat, 17 Feb 2024 12:08:47 -0500 Subject: [PATCH 17/47] chore(protocol): update open-zeppelin contracts (#15858) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: D <51912515+adaki2004@users.noreply.github.com> Co-authored-by: Keszey Dániel Co-authored-by: Daniel Wang <99078276+dantaik@users.noreply.github.com> --- .../contracts/L1/gov/TaikoGovernor.sol | 27 ++++++++++++++----- packages/protocol/package.json | 4 +-- .../protocol/test/L1/gov/TaikoGovernor.t.sol | 2 +- .../test/common/EssentialContract.t.sol | 21 +++++++-------- pnpm-lock.yaml | 16 +++++------ 5 files changed, 40 insertions(+), 30 deletions(-) diff --git a/packages/protocol/contracts/L1/gov/TaikoGovernor.sol b/packages/protocol/contracts/L1/gov/TaikoGovernor.sol index c146bb42c6..ad2e3d0bc3 100644 --- a/packages/protocol/contracts/L1/gov/TaikoGovernor.sol +++ b/packages/protocol/contracts/L1/gov/TaikoGovernor.sol @@ -14,10 +14,8 @@ pragma solidity 0.8.24; -import "@openzeppelin/contracts-upgradeable/governance/GovernorUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/governance/compatibility/GovernorCompatibilityBravoUpgradeable.sol"; -import "@openzeppelin/contracts-upgradeable/governance/extensions/GovernorVotesUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/governance/extensions/GovernorVotesQuorumFractionUpgradeable.sol"; import @@ -26,9 +24,7 @@ import "../../common/OwnerUUPSUpgradable.sol"; contract TaikoGovernor is OwnerUUPSUpgradable, - GovernorUpgradeable, GovernorCompatibilityBravoUpgradeable, - GovernorVotesUpgradeable, GovernorVotesQuorumFractionUpgradeable, GovernorTimelockControlUpgradeable { @@ -42,8 +38,7 @@ contract TaikoGovernor is initializer { __OwnerUUPSUpgradable_init(); - __Governor_init("TaikoGovernor"); - __GovernorCompatibilityBravo_init(); + __Governor_init("Taiko"); __GovernorVotes_init(_token); __GovernorVotesQuorumFraction_init(4); __GovernorTimelockControl_init(_timelock); @@ -68,7 +63,8 @@ contract TaikoGovernor is override(GovernorUpgradeable, GovernorTimelockControlUpgradeable, IERC165Upgradeable) returns (bool) { - return super.supportsInterface(interfaceId); + return interfaceId == type(IGovernorUpgradeable).interfaceId + || super.supportsInterface(interfaceId); } function state(uint256 proposalId) @@ -96,6 +92,23 @@ contract TaikoGovernor is return 1_000_000_000 ether / 10_000; // 0.01% of Taiko Token } + /** + * @dev See {IGovernor-cancel}. + */ + function cancel( + address[] memory targets, + uint256[] memory values, + bytes[] memory calldatas, + bytes32 descriptionHash + ) + public + virtual + override(IGovernorUpgradeable, GovernorUpgradeable, GovernorCompatibilityBravoUpgradeable) + returns (uint256) + { + return super.cancel(targets, values, calldatas, descriptionHash); + } + function _execute( uint256 proposalId, address[] memory targets, diff --git a/packages/protocol/package.json b/packages/protocol/package.json index 552d105e43..a537bde652 100644 --- a/packages/protocol/package.json +++ b/packages/protocol/package.json @@ -62,8 +62,8 @@ "typescript": "^5.2.2" }, "dependencies": { - "@openzeppelin/contracts-upgradeable": "4.8.2", - "@openzeppelin/contracts": "4.8.2", + "@openzeppelin/contracts-upgradeable": "4.9.5", + "@openzeppelin/contracts": "4.9.5", "forge-std": "github:foundry-rs/forge-std#v1.7.5", "ds-test": "github:dapphub/ds-test#e282159d5170298eb2455a6c05280ab5a73a4ef0", "solady": "github:Vectorized/solady#v0.0.167", diff --git a/packages/protocol/test/L1/gov/TaikoGovernor.t.sol b/packages/protocol/test/L1/gov/TaikoGovernor.t.sol index 1839017ad4..b52a1eb50d 100644 --- a/packages/protocol/test/L1/gov/TaikoGovernor.t.sol +++ b/packages/protocol/test/L1/gov/TaikoGovernor.t.sol @@ -91,7 +91,7 @@ contract TestTaikoGovernor is TaikoL1TestBase { assertEq(taikoGovernor.quorumDenominator(), 100, "Incorrect quorum denominator"); // GovernorUpgradeable - assertEq(taikoGovernor.name(), "TaikoGovernor", "Incorrect name"); + assertEq(taikoGovernor.name(), "Taiko", "Incorrect name"); assertEq(taikoGovernor.version(), "1", "Incorrect version"); // GovernorVotesUpgradeable diff --git a/packages/protocol/test/common/EssentialContract.t.sol b/packages/protocol/test/common/EssentialContract.t.sol index db68fe0381..4a707fb4e8 100644 --- a/packages/protocol/test/common/EssentialContract.t.sol +++ b/packages/protocol/test/common/EssentialContract.t.sol @@ -27,6 +27,11 @@ contract Target2 is Target1 { } contract TestOwnerUUPSUpgradable is TaikoTest { + /// @dev This is how we can query the admin - because from v.4.9.5 external admin() function + /// does not exist anymore. + bytes32 internal constant _ADMIN_SLOT = + 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; + function test_essential_behind_1967_proxy() external { bytes memory data = abi.encodeCall(Target1.init, ()); vm.startPrank(Alice); @@ -80,18 +85,10 @@ contract TestOwnerUUPSUpgradable is TaikoTest { vm.prank(Carol); assertEq(target.owner(), Alice); - // Only Bob can call admin() - vm.prank(Bob); - assertEq(proxy.admin(), Bob); - - // Other people, including Alice, cannot call admin() - vm.prank(Alice); - vm.expectRevert(); - proxy.admin(); - - vm.prank(Carol); - vm.expectRevert(); - proxy.admin(); + // Admin can be queried via storage slot only - no other way. + bytes32 adminSlotValue = vm.load(address(proxy), _ADMIN_SLOT); + address admin = address(uint160(uint256(adminSlotValue))); + assertEq(admin, Bob); // Alice can adjust(); vm.prank(Alice); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 52ce5b6873..d4af2c5f30 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -262,11 +262,11 @@ importers: packages/protocol: dependencies: '@openzeppelin/contracts': - specifier: 4.8.2 - version: 4.8.2 + specifier: 4.9.5 + version: 4.9.5 '@openzeppelin/contracts-upgradeable': - specifier: 4.8.2 - version: 4.8.2 + specifier: 4.9.5 + version: 4.9.5 ds-test: specifier: github:dapphub/ds-test#e282159d5170298eb2455a6c05280ab5a73a4ef0 version: github.com/dapphub/ds-test/e282159d5170298eb2455a6c05280ab5a73a4ef0 @@ -4127,12 +4127,12 @@ packages: rimraf: 3.0.2 dev: true - /@openzeppelin/contracts-upgradeable@4.8.2: - resolution: {integrity: sha512-zIggnBwemUmmt9IS73qxi+tumALxCY4QEs3zLCII78k0Gfse2hAOdAkuAeLUzvWUpneMUfFE5sGHzEUSTvn4Ag==} + /@openzeppelin/contracts-upgradeable@4.9.5: + resolution: {integrity: sha512-f7L1//4sLlflAN7fVzJLoRedrf5Na3Oal5PZfIq55NFcVZ90EpV1q5xOvL4lFvg3MNICSDr2hH0JUBxwlxcoPg==} dev: false - /@openzeppelin/contracts@4.8.2: - resolution: {integrity: sha512-kEUOgPQszC0fSYWpbh2kT94ltOJwj1qfT2DWo+zVttmGmf97JZ99LspePNaeeaLhCImaHVeBbjaQFZQn7+Zc5g==} + /@openzeppelin/contracts@4.9.5: + resolution: {integrity: sha512-ZK+W5mVhRppff9BE6YdR8CC52C8zAvsVAiWhEtQ5+oNxFE6h1WdeWo+FJSF8KKvtxxVYZ7MTP/5KoVpAU3aSWg==} dev: false /@parcel/watcher-android-arm64@2.3.0: From 994e29e67f68b2478c2e79ce28c9542fd048dc3c Mon Sep 17 00:00:00 2001 From: d1onys1us <13951458+d1onys1us@users.noreply.github.com> Date: Sat, 17 Feb 2024 21:25:08 -0500 Subject: [PATCH 18/47] revert(protocol): revert update open-zeppelin contracts (#15896) --- .../contracts/L1/gov/TaikoGovernor.sol | 27 +++++-------------- packages/protocol/package.json | 4 +-- .../protocol/test/L1/gov/TaikoGovernor.t.sol | 2 +- .../test/common/EssentialContract.t.sol | 21 ++++++++------- pnpm-lock.yaml | 16 +++++------ 5 files changed, 30 insertions(+), 40 deletions(-) diff --git a/packages/protocol/contracts/L1/gov/TaikoGovernor.sol b/packages/protocol/contracts/L1/gov/TaikoGovernor.sol index ad2e3d0bc3..c146bb42c6 100644 --- a/packages/protocol/contracts/L1/gov/TaikoGovernor.sol +++ b/packages/protocol/contracts/L1/gov/TaikoGovernor.sol @@ -14,8 +14,10 @@ pragma solidity 0.8.24; +import "@openzeppelin/contracts-upgradeable/governance/GovernorUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/governance/compatibility/GovernorCompatibilityBravoUpgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/governance/extensions/GovernorVotesUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/governance/extensions/GovernorVotesQuorumFractionUpgradeable.sol"; import @@ -24,7 +26,9 @@ import "../../common/OwnerUUPSUpgradable.sol"; contract TaikoGovernor is OwnerUUPSUpgradable, + GovernorUpgradeable, GovernorCompatibilityBravoUpgradeable, + GovernorVotesUpgradeable, GovernorVotesQuorumFractionUpgradeable, GovernorTimelockControlUpgradeable { @@ -38,7 +42,8 @@ contract TaikoGovernor is initializer { __OwnerUUPSUpgradable_init(); - __Governor_init("Taiko"); + __Governor_init("TaikoGovernor"); + __GovernorCompatibilityBravo_init(); __GovernorVotes_init(_token); __GovernorVotesQuorumFraction_init(4); __GovernorTimelockControl_init(_timelock); @@ -63,8 +68,7 @@ contract TaikoGovernor is override(GovernorUpgradeable, GovernorTimelockControlUpgradeable, IERC165Upgradeable) returns (bool) { - return interfaceId == type(IGovernorUpgradeable).interfaceId - || super.supportsInterface(interfaceId); + return super.supportsInterface(interfaceId); } function state(uint256 proposalId) @@ -92,23 +96,6 @@ contract TaikoGovernor is return 1_000_000_000 ether / 10_000; // 0.01% of Taiko Token } - /** - * @dev See {IGovernor-cancel}. - */ - function cancel( - address[] memory targets, - uint256[] memory values, - bytes[] memory calldatas, - bytes32 descriptionHash - ) - public - virtual - override(IGovernorUpgradeable, GovernorUpgradeable, GovernorCompatibilityBravoUpgradeable) - returns (uint256) - { - return super.cancel(targets, values, calldatas, descriptionHash); - } - function _execute( uint256 proposalId, address[] memory targets, diff --git a/packages/protocol/package.json b/packages/protocol/package.json index a537bde652..552d105e43 100644 --- a/packages/protocol/package.json +++ b/packages/protocol/package.json @@ -62,8 +62,8 @@ "typescript": "^5.2.2" }, "dependencies": { - "@openzeppelin/contracts-upgradeable": "4.9.5", - "@openzeppelin/contracts": "4.9.5", + "@openzeppelin/contracts-upgradeable": "4.8.2", + "@openzeppelin/contracts": "4.8.2", "forge-std": "github:foundry-rs/forge-std#v1.7.5", "ds-test": "github:dapphub/ds-test#e282159d5170298eb2455a6c05280ab5a73a4ef0", "solady": "github:Vectorized/solady#v0.0.167", diff --git a/packages/protocol/test/L1/gov/TaikoGovernor.t.sol b/packages/protocol/test/L1/gov/TaikoGovernor.t.sol index b52a1eb50d..1839017ad4 100644 --- a/packages/protocol/test/L1/gov/TaikoGovernor.t.sol +++ b/packages/protocol/test/L1/gov/TaikoGovernor.t.sol @@ -91,7 +91,7 @@ contract TestTaikoGovernor is TaikoL1TestBase { assertEq(taikoGovernor.quorumDenominator(), 100, "Incorrect quorum denominator"); // GovernorUpgradeable - assertEq(taikoGovernor.name(), "Taiko", "Incorrect name"); + assertEq(taikoGovernor.name(), "TaikoGovernor", "Incorrect name"); assertEq(taikoGovernor.version(), "1", "Incorrect version"); // GovernorVotesUpgradeable diff --git a/packages/protocol/test/common/EssentialContract.t.sol b/packages/protocol/test/common/EssentialContract.t.sol index 4a707fb4e8..db68fe0381 100644 --- a/packages/protocol/test/common/EssentialContract.t.sol +++ b/packages/protocol/test/common/EssentialContract.t.sol @@ -27,11 +27,6 @@ contract Target2 is Target1 { } contract TestOwnerUUPSUpgradable is TaikoTest { - /// @dev This is how we can query the admin - because from v.4.9.5 external admin() function - /// does not exist anymore. - bytes32 internal constant _ADMIN_SLOT = - 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; - function test_essential_behind_1967_proxy() external { bytes memory data = abi.encodeCall(Target1.init, ()); vm.startPrank(Alice); @@ -85,10 +80,18 @@ contract TestOwnerUUPSUpgradable is TaikoTest { vm.prank(Carol); assertEq(target.owner(), Alice); - // Admin can be queried via storage slot only - no other way. - bytes32 adminSlotValue = vm.load(address(proxy), _ADMIN_SLOT); - address admin = address(uint160(uint256(adminSlotValue))); - assertEq(admin, Bob); + // Only Bob can call admin() + vm.prank(Bob); + assertEq(proxy.admin(), Bob); + + // Other people, including Alice, cannot call admin() + vm.prank(Alice); + vm.expectRevert(); + proxy.admin(); + + vm.prank(Carol); + vm.expectRevert(); + proxy.admin(); // Alice can adjust(); vm.prank(Alice); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d4af2c5f30..52ce5b6873 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -262,11 +262,11 @@ importers: packages/protocol: dependencies: '@openzeppelin/contracts': - specifier: 4.9.5 - version: 4.9.5 + specifier: 4.8.2 + version: 4.8.2 '@openzeppelin/contracts-upgradeable': - specifier: 4.9.5 - version: 4.9.5 + specifier: 4.8.2 + version: 4.8.2 ds-test: specifier: github:dapphub/ds-test#e282159d5170298eb2455a6c05280ab5a73a4ef0 version: github.com/dapphub/ds-test/e282159d5170298eb2455a6c05280ab5a73a4ef0 @@ -4127,12 +4127,12 @@ packages: rimraf: 3.0.2 dev: true - /@openzeppelin/contracts-upgradeable@4.9.5: - resolution: {integrity: sha512-f7L1//4sLlflAN7fVzJLoRedrf5Na3Oal5PZfIq55NFcVZ90EpV1q5xOvL4lFvg3MNICSDr2hH0JUBxwlxcoPg==} + /@openzeppelin/contracts-upgradeable@4.8.2: + resolution: {integrity: sha512-zIggnBwemUmmt9IS73qxi+tumALxCY4QEs3zLCII78k0Gfse2hAOdAkuAeLUzvWUpneMUfFE5sGHzEUSTvn4Ag==} dev: false - /@openzeppelin/contracts@4.9.5: - resolution: {integrity: sha512-ZK+W5mVhRppff9BE6YdR8CC52C8zAvsVAiWhEtQ5+oNxFE6h1WdeWo+FJSF8KKvtxxVYZ7MTP/5KoVpAU3aSWg==} + /@openzeppelin/contracts@4.8.2: + resolution: {integrity: sha512-kEUOgPQszC0fSYWpbh2kT94ltOJwj1qfT2DWo+zVttmGmf97JZ99LspePNaeeaLhCImaHVeBbjaQFZQn7+Zc5g==} dev: false /@parcel/watcher-android-arm64@2.3.0: From 45aff8e971332fb5145aa0d1ec7a2b7ebd46305b Mon Sep 17 00:00:00 2001 From: David Date: Sun, 18 Feb 2024 17:57:31 +0800 Subject: [PATCH 19/47] feat(protocol): add `AuthorizeTaikoForMultihop ` script (#15888) Co-authored-by: Daniel Wang <99078276+dantaik@users.noreply.github.com> --- .../script/AuthorizeTaikoForMultihop.s.sol | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 packages/protocol/script/AuthorizeTaikoForMultihop.s.sol diff --git a/packages/protocol/script/AuthorizeTaikoForMultihop.s.sol b/packages/protocol/script/AuthorizeTaikoForMultihop.s.sol new file mode 100644 index 0000000000..aace75025a --- /dev/null +++ b/packages/protocol/script/AuthorizeTaikoForMultihop.s.sol @@ -0,0 +1,40 @@ +// SPDX-License-Identifier: MIT +// _____ _ _ _ _ +// |_ _|_ _(_) |_____ | | __ _| |__ ___ +// | |/ _` | | / / _ \ | |__/ _` | '_ (_-< +// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ +// +// Email: security@taiko.xyz +// Website: https://taiko.xyz +// GitHub: https://github.com/taikoxyz +// Discord: https://discord.gg/taikoxyz +// Twitter: https://twitter.com/taikoxyz +// Blog: https://mirror.xyz/labs.taiko.eth +// Youtube: https://www.youtube.com/@taikoxyz + +pragma solidity 0.8.24; + +import "../test/DeployCapability.sol"; +import "../contracts/L1/gov/TaikoTimelockController.sol"; +import "../contracts/signal/SignalService.sol"; + +contract AuthorizeTaikoForMultihop is DeployCapability { + uint256 public privateKey = vm.envUint("PRIVATE_KEY"); + address public sharedSignalService = vm.envAddress("SHARED_SIGNAL_SERVICE"); + address[] public taikoContracts = vm.envAddress("TAIKO_CONTRACTS", ","); // TaikoL1 and TaikoL2 + // contracts + + function run() external { + require(taikoContracts.length != 0, "invalid taiko contracts"); + + vm.startBroadcast(privateKey); + + SignalService signalService = SignalService(sharedSignalService); + + for (uint256 i; i < taikoContracts.length; ++i) { + signalService.authorize(taikoContracts[i], true); + } + + vm.stopBroadcast(); + } +} From ea1bc7e23bf9d19f32633665c2ea6bbd2e8914e1 Mon Sep 17 00:00:00 2001 From: d1onys1us <13951458+d1onys1us@users.noreply.github.com> Date: Sun, 18 Feb 2024 22:09:42 -0500 Subject: [PATCH 20/47] chore(repo): fully remove status page package (#15909) --- .../status-page/src/constants/abi/TaikoL2.ts | 670 ------------------ 1 file changed, 670 deletions(-) delete mode 100644 packages/status-page/src/constants/abi/TaikoL2.ts diff --git a/packages/status-page/src/constants/abi/TaikoL2.ts b/packages/status-page/src/constants/abi/TaikoL2.ts deleted file mode 100644 index 8368362b8c..0000000000 --- a/packages/status-page/src/constants/abi/TaikoL2.ts +++ /dev/null @@ -1,670 +0,0 @@ -export default [ - { - inputs: [ - { - internalType: "uint64", - name: "expected", - type: "uint64", - }, - { - internalType: "uint64", - name: "actual", - type: "uint64", - }, - ], - name: "L2_BASEFEE_MISMATCH", - type: "error", - }, - { - inputs: [], - name: "L2_INVALID_1559_PARAMS", - type: "error", - }, - { - inputs: [], - name: "L2_INVALID_CHAIN_ID", - type: "error", - }, - { - inputs: [], - name: "L2_INVALID_GOLDEN_TOUCH_K", - type: "error", - }, - { - inputs: [], - name: "L2_INVALID_SENDER", - type: "error", - }, - { - inputs: [ - { - internalType: "bytes32", - name: "expected", - type: "bytes32", - }, - { - internalType: "bytes32", - name: "actual", - type: "bytes32", - }, - ], - name: "L2_PUBLIC_INPUT_HASH_MISMATCH", - type: "error", - }, - { - inputs: [], - name: "L2_TOO_LATE", - type: "error", - }, - { - inputs: [], - name: "M1559_OUT_OF_STOCK", - type: "error", - }, - { - inputs: [], - name: "M1559_OUT_OF_STOCK", - type: "error", - }, - { - inputs: [ - { - internalType: "uint64", - name: "expected", - type: "uint64", - }, - { - internalType: "uint64", - name: "actual", - type: "uint64", - }, - ], - name: "M1559_UNEXPECTED_CHANGE", - type: "error", - }, - { - inputs: [ - { - internalType: "uint64", - name: "expected", - type: "uint64", - }, - { - internalType: "uint64", - name: "actual", - type: "uint64", - }, - ], - name: "M1559_UNEXPECTED_CHANGE", - type: "error", - }, - { - inputs: [], - name: "Overflow", - type: "error", - }, - { - inputs: [], - name: "RESOLVER_DENIED", - type: "error", - }, - { - inputs: [], - name: "RESOLVER_INVALID_ADDR", - type: "error", - }, - { - inputs: [ - { - internalType: "uint256", - name: "chainId", - type: "uint256", - }, - { - internalType: "bytes32", - name: "name", - type: "bytes32", - }, - ], - name: "RESOLVER_ZERO_ADDR", - type: "error", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "address", - name: "addressManager", - type: "address", - }, - ], - name: "AddressManagerChanged", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "uint64", - name: "number", - type: "uint64", - }, - { - indexed: false, - internalType: "uint64", - name: "basefee", - type: "uint64", - }, - { - indexed: false, - internalType: "uint64", - name: "gaslimit", - type: "uint64", - }, - { - indexed: false, - internalType: "uint64", - name: "timestamp", - type: "uint64", - }, - { - indexed: false, - internalType: "bytes32", - name: "parentHash", - type: "bytes32", - }, - { - indexed: false, - internalType: "uint256", - name: "prevrandao", - type: "uint256", - }, - { - indexed: false, - internalType: "address", - name: "coinbase", - type: "address", - }, - { - indexed: false, - internalType: "uint32", - name: "chainid", - type: "uint32", - }, - ], - name: "Anchored", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "uint256", - name: "srcHeight", - type: "uint256", - }, - { - indexed: false, - internalType: "bytes32", - name: "blockHash", - type: "bytes32", - }, - { - indexed: false, - internalType: "bytes32", - name: "signalRoot", - type: "bytes32", - }, - ], - name: "CrossChainSynced", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "uint8", - name: "version", - type: "uint8", - }, - ], - name: "Initialized", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "previousOwner", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "newOwner", - type: "address", - }, - ], - name: "OwnershipTransferred", - type: "event", - }, - { - inputs: [], - name: "GOLDEN_TOUCH_ADDRESS", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "GOLDEN_TOUCH_PRIVATEKEY", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "addressManager", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "bytes32", - name: "l1Hash", - type: "bytes32", - }, - { - internalType: "bytes32", - name: "l1SignalRoot", - type: "bytes32", - }, - { - internalType: "uint64", - name: "l1Height", - type: "uint64", - }, - { - internalType: "uint64", - name: "parentGasUsed", - type: "uint64", - }, - ], - name: "anchor", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "gasExcess", - outputs: [ - { - internalType: "uint64", - name: "", - type: "uint64", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint32", - name: "timeSinceParent", - type: "uint32", - }, - { - internalType: "uint64", - name: "gasLimit", - type: "uint64", - }, - { - internalType: "uint64", - name: "parentGasUsed", - type: "uint64", - }, - ], - name: "getBasefee", - outputs: [ - { - internalType: "uint256", - name: "_basefee", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "number", - type: "uint256", - }, - ], - name: "getBlockHash", - outputs: [ - { - internalType: "bytes32", - name: "", - type: "bytes32", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "number", - type: "uint256", - }, - ], - name: "getCrossChainBlockHash", - outputs: [ - { - internalType: "bytes32", - name: "", - type: "bytes32", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "number", - type: "uint256", - }, - ], - name: "getCrossChainSignalRoot", - outputs: [ - { - internalType: "bytes32", - name: "", - type: "bytes32", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "getEIP1559Config", - outputs: [ - { - components: [ - { - internalType: "uint128", - name: "yscale", - type: "uint128", - }, - { - internalType: "uint64", - name: "xscale", - type: "uint64", - }, - { - internalType: "uint64", - name: "gasIssuedPerSecond", - type: "uint64", - }, - ], - internalType: "struct TaikoL2.EIP1559Config", - name: "", - type: "tuple", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "_addressManager", - type: "address", - }, - { - components: [ - { - internalType: "uint64", - name: "basefee", - type: "uint64", - }, - { - internalType: "uint64", - name: "gasIssuedPerSecond", - type: "uint64", - }, - { - internalType: "uint64", - name: "gasExcessMax", - type: "uint64", - }, - { - internalType: "uint64", - name: "gasTarget", - type: "uint64", - }, - { - internalType: "uint64", - name: "ratio2x1x", - type: "uint64", - }, - ], - internalType: "struct TaikoL2.EIP1559Params", - name: "_param1559", - type: "tuple", - }, - ], - name: "init", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "latestRelayedL1BlockId", - outputs: [ - { - internalType: "uint64", - name: "", - type: "uint64", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "owner", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "parentTimestamp", - outputs: [ - { - internalType: "uint64", - name: "", - type: "uint64", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "publicInputHash", - outputs: [ - { - internalType: "bytes32", - name: "", - type: "bytes32", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "renounceOwnership", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "chainId", - type: "uint256", - }, - { - internalType: "bytes32", - name: "name", - type: "bytes32", - }, - { - internalType: "bool", - name: "allowZeroAddress", - type: "bool", - }, - ], - name: "resolve", - outputs: [ - { - internalType: "address payable", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "bytes32", - name: "name", - type: "bytes32", - }, - { - internalType: "bool", - name: "allowZeroAddress", - type: "bool", - }, - ], - name: "resolve", - outputs: [ - { - internalType: "address payable", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "newAddressManager", - type: "address", - }, - ], - name: "setAddressManager", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "bytes32", - name: "digest", - type: "bytes32", - }, - { - internalType: "uint8", - name: "k", - type: "uint8", - }, - ], - name: "signAnchor", - outputs: [ - { - internalType: "uint8", - name: "v", - type: "uint8", - }, - { - internalType: "uint256", - name: "r", - type: "uint256", - }, - { - internalType: "uint256", - name: "s", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "newOwner", - type: "address", - }, - ], - name: "transferOwnership", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, -]; From 0f314c50db866b26998bb35b43d46d15f2083603 Mon Sep 17 00:00:00 2001 From: Daniel Wang <99078276+dantaik@users.noreply.github.com> Date: Mon, 19 Feb 2024 13:07:04 +0800 Subject: [PATCH 21/47] feat(protocol): allow disabling block reuse (#15916) --- packages/protocol/contracts/L1/TaikoData.sol | 2 ++ packages/protocol/contracts/L1/TaikoErrors.sol | 1 + packages/protocol/contracts/L1/TaikoL1.sol | 1 + packages/protocol/contracts/L1/libs/LibProposing.sol | 5 ++++- 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/protocol/contracts/L1/TaikoData.sol b/packages/protocol/contracts/L1/TaikoData.sol index 2330cb0d12..bdf9a1372d 100644 --- a/packages/protocol/contracts/L1/TaikoData.sol +++ b/packages/protocol/contracts/L1/TaikoData.sol @@ -42,6 +42,8 @@ library TaikoData { uint24 blobExpiry; // True if EIP-4844 is enabled for DA bool blobAllowedForDA; + // True if blob can be reused + bool blobReuseEnabled; // --------------------------------------------------------------------- // Group 3: Proof related configs // --------------------------------------------------------------------- diff --git a/packages/protocol/contracts/L1/TaikoErrors.sol b/packages/protocol/contracts/L1/TaikoErrors.sol index 79d3b8c3be..c874b3561c 100644 --- a/packages/protocol/contracts/L1/TaikoErrors.sol +++ b/packages/protocol/contracts/L1/TaikoErrors.sol @@ -28,6 +28,7 @@ abstract contract TaikoErrors { error L1_BLOB_NOT_FOUND(); error L1_BLOB_NOT_REUSEABLE(); error L1_BLOB_NOT_USED(); + error L1_BLOB_REUSE_DISALBED(); error L1_BLOCK_MISMATCH(); error L1_CHAIN_DATA_NOT_RELAYED(); error L1_INVALID_BLOCK_ID(); diff --git a/packages/protocol/contracts/L1/TaikoL1.sol b/packages/protocol/contracts/L1/TaikoL1.sol index 9b4e9a5494..79e6387447 100644 --- a/packages/protocol/contracts/L1/TaikoL1.sol +++ b/packages/protocol/contracts/L1/TaikoL1.sol @@ -219,6 +219,7 @@ contract TaikoL1 is EssentialContract, ITaikoL1, ITierProvider, TaikoEvents, Tai blockMaxTxListBytes: 120_000, blobExpiry: 24 hours, blobAllowedForDA: false, + blobReuseEnabled: false, livenessBond: 250e18, // 250 Taiko token // ETH deposit related. ethDepositRingBufferSize: 1024, diff --git a/packages/protocol/contracts/L1/libs/LibProposing.sol b/packages/protocol/contracts/L1/libs/LibProposing.sol index a4ae28e485..4852521bb5 100644 --- a/packages/protocol/contracts/L1/libs/LibProposing.sol +++ b/packages/protocol/contracts/L1/libs/LibProposing.sol @@ -46,6 +46,7 @@ library LibProposing { error L1_BLOB_FOR_DA_DISABLED(); error L1_BLOB_NOT_FOUND(); error L1_BLOB_NOT_REUSEABLE(); + error L1_BLOB_REUSE_DISALBED(); error L1_INVALID_HOOK(); error L1_INVALID_PARAM(); error L1_INVALID_PROVER(); @@ -139,6 +140,8 @@ library LibProposing { if (!config.blobAllowedForDA) revert L1_BLOB_FOR_DA_DISABLED(); if (params.blobHash != 0) { + if (!config.blobReuseEnabled) revert L1_BLOB_REUSE_DISALBED(); + // We try to reuse an old blob if (!isBlobReusable(state, config, params.blobHash)) { revert L1_BLOB_NOT_REUSEABLE(); @@ -156,7 +159,7 @@ library LibProposing { // Depends on the blob data price, it may not make sense to // cache the blob which costs 20,000 (sstore) + 631 (event) // extra gas. - if (params.cacheBlobForReuse) { + if (config.blobReuseEnabled && params.cacheBlobForReuse) { state.reusableBlobs[meta.blobHash] = block.timestamp; emit BlobCached(meta.blobHash); } From e583d9916378513a17e7b5b06e17a6002ea7f024 Mon Sep 17 00:00:00 2001 From: Daniel Wang <99078276+dantaik@users.noreply.github.com> Date: Mon, 19 Feb 2024 13:17:03 +0800 Subject: [PATCH 22/47] feat(protocol): getBlock also returns the transition used to verify the block (#15917) --- packages/protocol/contracts/L1/TaikoL1.sol | 14 ++++++++++++-- packages/protocol/contracts/L1/libs/LibUtils.sol | 5 +++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/packages/protocol/contracts/L1/TaikoL1.sol b/packages/protocol/contracts/L1/TaikoL1.sol index 79e6387447..df34a0e1b9 100644 --- a/packages/protocol/contracts/L1/TaikoL1.sol +++ b/packages/protocol/contracts/L1/TaikoL1.sol @@ -142,8 +142,18 @@ contract TaikoL1 is EssentialContract, ITaikoL1, ITierProvider, TaikoEvents, Tai /// @notice Gets the details of a block. /// @param blockId Index of the block. /// @return blk The block. - function getBlock(uint64 blockId) public view returns (TaikoData.Block memory blk) { - return LibUtils.getBlock(state, getConfig(), blockId); + /// @return ts The transition used to verify this block. + function getBlock(uint64 blockId) + public + view + returns (TaikoData.Block memory blk, TaikoData.TransitionState memory ts) + { + uint64 slot; + (blk, slot) = LibUtils.getBlock(state, getConfig(), blockId); + + if (blk.verifiedTransitionId != 0) { + ts = state.transitions[slot][blk.verifiedTransitionId]; + } } /// @notice Gets the state transition for a specific block. diff --git a/packages/protocol/contracts/L1/libs/LibUtils.sol b/packages/protocol/contracts/L1/libs/LibUtils.sol index 6c6fd8d433..1f87ae5d82 100644 --- a/packages/protocol/contracts/L1/libs/LibUtils.sol +++ b/packages/protocol/contracts/L1/libs/LibUtils.sol @@ -64,9 +64,10 @@ library LibUtils { ) external view - returns (TaikoData.Block storage blk) + returns (TaikoData.Block storage blk, uint64 slot) { - blk = state.blocks[blockId % config.blockRingBufferSize]; + slot = blockId % config.blockRingBufferSize; + blk = state.blocks[slot]; if (blk.blockId != blockId) { revert L1_INVALID_BLOCK_ID(); } From bfa0ca2a7bc517d10b3eb77962c7a10527f97f14 Mon Sep 17 00:00:00 2001 From: nipun_p Date: Mon, 19 Feb 2024 12:31:55 +0700 Subject: [PATCH 23/47] fix(protocol): update amounts emitted to match length with tokenIds (#15898) Co-authored-by: Daniel Wang <99078276+dantaik@users.noreply.github.com> Co-authored-by: D <51912515+adaki2004@users.noreply.github.com> --- packages/protocol/contracts/tokenvault/ERC721Vault.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/protocol/contracts/tokenvault/ERC721Vault.sol b/packages/protocol/contracts/tokenvault/ERC721Vault.sol index b87663d3fb..92df7884e7 100644 --- a/packages/protocol/contracts/tokenvault/ERC721Vault.sol +++ b/packages/protocol/contracts/tokenvault/ERC721Vault.sol @@ -114,7 +114,7 @@ contract ERC721Vault is BaseNFTVault, IERC721ReceiverUpgradeable { ctoken: ctoken.addr, token: token, tokenIds: tokenIds, - amounts: new uint256[](0) + amounts: new uint256[](tokenIds.length) }); } @@ -143,7 +143,7 @@ contract ERC721Vault is BaseNFTVault, IERC721ReceiverUpgradeable { ctoken: ctoken.addr, token: token, tokenIds: tokenIds, - amounts: new uint256[](0) + amounts: new uint256[](tokenIds.length) }); } From 5a1f671bae14a9e9fbcad368c261f7b1a9872810 Mon Sep 17 00:00:00 2001 From: xiaodino Date: Sun, 18 Feb 2024 22:42:27 -0800 Subject: [PATCH 24/47] chore(relayer): refactor logs and add comments in processor (#15889) Co-authored-by: David --- packages/relayer/.gitignore | 2 ++ packages/relayer/cmd/flags/indexer.go | 3 ++- packages/relayer/event.go | 2 +- packages/relayer/processor/can_process_message.go | 2 +- packages/relayer/processor/process_single.go | 5 +++++ packages/relayer/processor/processor.go | 14 ++++++++++---- 6 files changed, 21 insertions(+), 7 deletions(-) diff --git a/packages/relayer/.gitignore b/packages/relayer/.gitignore index 1e90821859..210208a1b0 100644 --- a/packages/relayer/.gitignore +++ b/packages/relayer/.gitignore @@ -10,8 +10,10 @@ .l1l3processor.env .l2l1processor.env .l1processor.env +.l1indexer.env .l2indexer.env main +relayer coverage.txt # Local .terraform directories diff --git a/packages/relayer/cmd/flags/indexer.go b/packages/relayer/cmd/flags/indexer.go index c29b64a589..a28f2d0a57 100644 --- a/packages/relayer/cmd/flags/indexer.go +++ b/packages/relayer/cmd/flags/indexer.go @@ -57,6 +57,7 @@ var ( filter: only filter the chain, when caught up, exit subscribe: do not filter the chain, only subscribe to new events filter-and-subscribe: the default behavior, filter the chain and subscribe when caught up + crawl-past-blocks: crawl past blocks `, Value: "filter-and-subscribe", Category: indexerCategory, @@ -79,6 +80,7 @@ var ( var IndexerFlags = MergeFlags(CommonFlags, QueueFlags, []cli.Flag{ SrcBridgeAddress, + DestBridgeAddress, // optional SrcTaikoAddress, BlockBatchSize, @@ -86,6 +88,5 @@ var IndexerFlags = MergeFlags(CommonFlags, QueueFlags, []cli.Flag{ SubscriptionBackoff, SyncMode, WatchMode, - DestBridgeAddress, NumLatestBlocksToIgnoreWhenCrawling, }) diff --git a/packages/relayer/event.go b/packages/relayer/event.go index b916f6d8fe..738de65738 100644 --- a/packages/relayer/event.go +++ b/packages/relayer/event.go @@ -24,7 +24,7 @@ const ( EventStatusRetriable EventStatusDone EventStatusFailed - EventStatusNewOnlyOwner + EventStatusNewOnlyOwner // internal used in Relayer only ) type EventType int diff --git a/packages/relayer/processor/can_process_message.go b/packages/relayer/processor/can_process_message.go index 2c2486c19f..39298e8e36 100644 --- a/packages/relayer/processor/can_process_message.go +++ b/packages/relayer/processor/can_process_message.go @@ -28,7 +28,7 @@ func canProcessMessage( return true } - slog.Info("cant process message", "eventStatus", eventStatus.String()) + slog.Info("cant process message due to", "eventStatus", eventStatus.String()) return false } diff --git a/packages/relayer/processor/process_single.go b/packages/relayer/processor/process_single.go index ee73280596..8c220b0eab 100644 --- a/packages/relayer/processor/process_single.go +++ b/packages/relayer/processor/process_single.go @@ -3,14 +3,19 @@ package processor import ( "context" "encoding/json" + "log/slog" "strings" "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/common" + "github.com/taikoxyz/taiko-mono/packages/relayer/bindings/bridge" "github.com/taikoxyz/taiko-mono/packages/relayer/pkg/queue" ) func (p *Processor) processSingle(ctx context.Context) error { + slog.Info("processing tx", "estimateGas", common.Hash(*p.targetTxHash).Hex()) + bridgeAbi, err := abi.JSON(strings.NewReader(bridge.BridgeABI)) if err != nil { return err diff --git a/packages/relayer/processor/processor.go b/packages/relayer/processor/processor.go index d07f4b51a2..b95f610202 100644 --- a/packages/relayer/processor/processor.go +++ b/packages/relayer/processor/processor.go @@ -8,6 +8,7 @@ import ( "fmt" "log/slog" "math/big" + "os" "sync" "time" @@ -362,7 +363,12 @@ func (p *Processor) Start() error { // if a targetTxHash is set, we only want to process that specific one. if p.targetTxHash != nil { - return p.processSingle(ctx) + err := p.processSingle(ctx) + if err != nil { + slog.Error(err.Error()) + } + + os.Exit(0) } // otherwise, we can start the queue, and process messages from it @@ -411,14 +417,14 @@ func (p *Processor) eventLoop(ctx context.Context) { err := p.processMessage(ctx, msg) if err != nil { - slog.Error("err processing message", "err", err.Error()) - if errors.Is(err, errUnprocessable) { if err := p.queue.Ack(ctx, msg); err != nil { slog.Error("Err acking message", "err", err.Error()) } } else { - if err := p.queue.Nack(ctx, msg); err != nil { + slog.Error("process message failed", "err", err.Error()) + + if err = p.queue.Nack(ctx, msg); err != nil { slog.Error("Err nacking message", "err", err.Error()) } } From adf2caab217e059b64fc82a8590cf4c9ba58d2e5 Mon Sep 17 00:00:00 2001 From: d1onys1us <13951458+d1onys1us@users.noreply.github.com> Date: Mon, 19 Feb 2024 11:15:19 -0500 Subject: [PATCH 25/47] chore(repo): remove issue templates (#15926) --- .github/ISSUE_TEMPLATE/add_project.yml | 51 ---------------------- .github/ISSUE_TEMPLATE/bug_report.yml | 28 ------------ .github/ISSUE_TEMPLATE/config.yml | 4 -- .github/ISSUE_TEMPLATE/feature_request.yml | 28 ------------ 4 files changed, 111 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/add_project.yml delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml delete mode 100644 .github/ISSUE_TEMPLATE/config.yml delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml diff --git a/.github/ISSUE_TEMPLATE/add_project.yml b/.github/ISSUE_TEMPLATE/add_project.yml deleted file mode 100644 index 6785ac46eb..0000000000 --- a/.github/ISSUE_TEMPLATE/add_project.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: "Add a project to Taiko's ecosystem 🌐" -description: "Add a project to Taiko's ecosystem" -title: "Add [PROJECT_NAME] to the ecosystem page" -labels: ["area.website", "category.ecosystem"] -body: - - type: markdown - attributes: - value: | - Thanks for taking the time to add your project. You can see existing examples on Taiko's ecosystem page [here](https://taiko.xyz/ecosystem)! NOTE: We can only accept ecosystem projects that have integrated with Taiko or have clear plans to do so in the future. - - type: input - id: title - attributes: - label: Title of your project - validations: - required: true - - type: input - id: description - attributes: - label: Short (1-2 sentence) description of your project - validations: - required: true - - type: input - id: link - attributes: - label: Link to your project - validations: - required: true - - type: dropdown - id: isLive - attributes: - label: Live on Testnet - description: Is your project deployed on one of Taiko's testnets? - multiple: false - options: - - "Yes (default)" - - "No" - validations: - required: true - - type: input - id: evidence - attributes: - label: If your project is live on one of Taiko's testnets, please provide evidence of that here (eg. links, screenshots). If your project is NOT live, please provide your plan for integration here. - validations: - required: true - - type: textarea - id: logo - attributes: - label: Upload a quality logo to your project - description: 512x512 or 1:1 ratio is preferred. If no image is provided we will use a placeholder image. - validations: - required: false diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml deleted file mode 100644 index 7ddc38c358..0000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Bug report 🐛 -description: Report a bug -labels: ["category.bug", "status.needs-triage"] -body: - - type: markdown - attributes: - value: | - Before submitting, please check if an existing issue already exists. Thanks for taking the time to improve Taiko! - - type: textarea - id: description - attributes: - label: Describe the bug - description: A concise description of the problem and what you expected to happen. - value: Description of the bug here. - validations: - required: true - - type: textarea - id: steps-to-reproduce - attributes: - label: Steps to reproduce - description: Steps to reproduce the bug, a numbered list could be good. - value: Steps to reproduce here. - - type: textarea - id: additional-context - attributes: - label: Additional context - description: Provide any additional context, screenshots, etc. - value: Additional context here. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml deleted file mode 100644 index 6165e27904..0000000000 --- a/.github/ISSUE_TEMPLATE/config.yml +++ /dev/null @@ -1,4 +0,0 @@ -contact_links: - - name: Community support - url: https://discord.gg/taikoxyz - about: This issue tracker is only for feature requests and bug reports. Community support is available on Discord! diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml deleted file mode 100644 index 6a0c5f411f..0000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Feature request 💡 -description: Request a feature -labels: ["category.enhancement", "status.needs-triage"] -body: - - type: markdown - attributes: - value: | - Before submitting, please check if an existing issue already exists. Thanks for taking the time to improve Taiko! - - type: textarea - id: description - attributes: - label: Describe the feature request - description: A concise description of what the problem and proposed solution is. - value: Description of the feature request here. - validations: - required: true - - type: textarea - id: alternatives - attributes: - label: Describe alternatives you've considered - description: A concise description of any alternative solutions you've considered. - value: Description of the alternatives you've considered here. - - type: textarea - id: additional-context - attributes: - label: Additional context - description: Provide any additional context, screenshots, etc. - value: Additional context here. From 9704769437a31e9a92ff19c8cab0868eaa28a8cf Mon Sep 17 00:00:00 2001 From: xiaodino Date: Mon, 19 Feb 2024 16:34:02 -0800 Subject: [PATCH 26/47] feat(relayer): add indexer in MySQL (#15927) --- ...8366658_alert_processed_blocks_block_height_index.sql | 9 +++++++++ ..._alert_processed_blocks_chain_id_event_name_index.sql | 9 +++++++++ ...lert_processed_blocks_block_height_chain_id_index.sql | 9 +++++++++ 3 files changed, 27 insertions(+) create mode 100644 packages/relayer/migrations/1708366658_alert_processed_blocks_block_height_index.sql create mode 100644 packages/relayer/migrations/1708366659_alert_processed_blocks_chain_id_event_name_index.sql create mode 100644 packages/relayer/migrations/1708366660_alert_processed_blocks_block_height_chain_id_index.sql diff --git a/packages/relayer/migrations/1708366658_alert_processed_blocks_block_height_index.sql b/packages/relayer/migrations/1708366658_alert_processed_blocks_block_height_index.sql new file mode 100644 index 0000000000..9be0342f42 --- /dev/null +++ b/packages/relayer/migrations/1708366658_alert_processed_blocks_block_height_index.sql @@ -0,0 +1,9 @@ +-- +goose Up +-- +goose StatementBegin +ALTER TABLE `processed_blocks` ADD INDEX `processed_blocks_block_height_index` (`block_height`); + +-- +goose StatementEnd +-- +goose Down +-- +goose StatementBegin +DROP INDEX processed_blocks_block_height_index on processed_blocks; +-- +goose StatementEnd \ No newline at end of file diff --git a/packages/relayer/migrations/1708366659_alert_processed_blocks_chain_id_event_name_index.sql b/packages/relayer/migrations/1708366659_alert_processed_blocks_chain_id_event_name_index.sql new file mode 100644 index 0000000000..e7e855384e --- /dev/null +++ b/packages/relayer/migrations/1708366659_alert_processed_blocks_chain_id_event_name_index.sql @@ -0,0 +1,9 @@ +-- +goose Up +-- +goose StatementBegin +ALTER TABLE `processed_blocks` ADD INDEX `processed_blocks_chain_id_event_name_index` (`chain_id`, `event_name`); + +-- +goose StatementEnd +-- +goose Down +-- +goose StatementBegin +DROP INDEX processed_blocks_chain_id_event_name_index on processed_blocks; +-- +goose StatementEnd \ No newline at end of file diff --git a/packages/relayer/migrations/1708366660_alert_processed_blocks_block_height_chain_id_index.sql b/packages/relayer/migrations/1708366660_alert_processed_blocks_block_height_chain_id_index.sql new file mode 100644 index 0000000000..9f6f22dd4d --- /dev/null +++ b/packages/relayer/migrations/1708366660_alert_processed_blocks_block_height_chain_id_index.sql @@ -0,0 +1,9 @@ +-- +goose Up +-- +goose StatementBegin +ALTER TABLE `processed_blocks` ADD INDEX `processed_blocks_block_height_chain_id_index` (`block_height`, `chain_id`); + +-- +goose StatementEnd +-- +goose Down +-- +goose StatementBegin +DROP INDEX processed_blocks_block_height_chain_id_index on processed_blocks; +-- +goose StatementEnd \ No newline at end of file From 557557643d7746e5ee4fcb694c903aecc745545b Mon Sep 17 00:00:00 2001 From: Roger <50648015+RogerLamTd@users.noreply.github.com> Date: Mon, 19 Feb 2024 16:34:27 -0800 Subject: [PATCH 27/47] chore(fork-diff): update fork-diff (#15929) --- packages/fork-diff/fork.yaml | 4 +- packages/fork-diff/index.html | 5583 +++++++++++++++++++-------------- 2 files changed, 3155 insertions(+), 2432 deletions(-) diff --git a/packages/fork-diff/fork.yaml b/packages/fork-diff/fork.yaml index 2509aca268..ec98cbc136 100644 --- a/packages/fork-diff/fork.yaml +++ b/packages/fork-diff/fork.yaml @@ -4,7 +4,7 @@ footer: | # define the footer with markdown base: name: ethereum/go-ethereum url: https://github.com/ethereum/go-ethereum - ref: refs/tags/v1.11.5 + ref: refs/tags/v1.13.11 fork: name: taikoxyz/taiko-geth url: https://github.com/taikoxyz/taiko-geth @@ -12,7 +12,7 @@ fork: def: title: "taiko-geth" description: | # description in markdown - This is an overview of the changes between [`taiko-geth`](https://github.com/taikoxyz/taiko-geth) (`taiko` branch) and [`go-ethereum`](https://github.com/ethereum/go-ethereum) (`v1.11.5` tag). + This is an overview of the changes between [`taiko-geth`](https://github.com/taikoxyz/taiko-geth) (`taiko` branch) and [`go-ethereum`](https://github.com/ethereum/go-ethereum) (`v1.13.11` tag). sub: # - title: "Changes in accounts" # description: this show mods to accounts files diff --git a/packages/fork-diff/index.html b/packages/fork-diff/index.html index a0864d2b80..40e711853f 100755 --- a/packages/fork-diff/index.html +++ b/packages/fork-diff/index.html @@ -9,6 +9,8 @@ Taiko-Geth Fork Diff + +