From a32255ffa3512558efecc74d0fa9cf457c7b7eeb Mon Sep 17 00:00:00 2001 From: Jeffery Walsh Date: Sat, 15 Apr 2023 00:02:32 -0700 Subject: [PATCH 1/6] node status page --- packages/eventindexer/event.go | 4 +- .../http/get_count_by_address_and_event.go | 27 + packages/eventindexer/http/routes.go | 1 + .../indexer/filter_then_subscribe.go | 10 + .../indexer/save_block_proposed_event.go | 75 ++ packages/eventindexer/indexer/service.go | 12 +- packages/eventindexer/repo/event.go | 16 + packages/node-status-page/.babelrc | 8 + packages/node-status-page/.default.env | 8 + packages/node-status-page/.gitignore | 30 + packages/node-status-page/CHANGELOG.md | 64 + packages/node-status-page/Dockerfile | 5 + packages/node-status-page/README.md | 3 + packages/node-status-page/index.html | 20 + packages/node-status-page/jest.config.js | 55 + packages/node-status-page/package.json | 74 ++ packages/node-status-page/postcss.config.cjs | 6 + .../node-status-page/public/taiko-favicon.png | Bin 0 -> 7618 bytes packages/node-status-page/src/App.svelte | 62 + packages/node-status-page/src/app.css | 67 + .../src/assets/lottie/loader.json | 1 + .../src/assets/taiko-banner.svg | 15 + .../src/components/DetailsModal.svelte | 17 + .../src/components/Loader.svelte | 16 + .../src/components/Modal.svelte | 47 + .../src/components/Navbar.svelte | 7 + .../src/components/StatusIndicator.svelte | 114 ++ .../src/components/Tooltip.svelte | 11 + .../src/components/TooltipModal.svelte | 17 + .../src/components/details/Node.svelte | 65 + .../src/components/details/Proposer.svelte | 12 + .../src/components/details/Prover.svelte | 78 ++ .../src/components/icons/Loader.svelte | 16 + .../src/components/icons/TaikoLogo.svelte | 62 + .../components/providers/BaseQueries.svelte | 1 + .../components/providers/QueryProvider.svelte | 13 + .../src/constants/abi/Bridge.ts | 726 +++++++++++ .../src/constants/abi/HeaderSync.ts | 53 + .../src/constants/abi/TaikoL1.ts | 1134 +++++++++++++++++ .../node-status-page/src/domain/status.ts | 24 + packages/node-status-page/src/i18n.js | 41 + packages/node-status-page/src/main.ts | 12 + .../src/pages/home/Home.svelte | 50 + .../src/utils/addressSubsection.ts | 4 + .../src/utils/displayStatusValue.ts | 15 + .../node-status-page/src/utils/getConfig.ts | 10 + .../src/utils/getEthBalance.ts | 8 + .../src/utils/getPendingBlocks.ts | 13 + .../src/utils/getPendingTransactions.ts | 9 + .../src/utils/getProofCount.ts | 21 + .../src/utils/getProposalCount.ts | 22 + .../src/utils/getQueuedTransactions.ts | 9 + .../src/utils/getStateVariables.ts | 10 + .../src/utils/truncateString.ts | 4 + packages/node-status-page/src/vite-env.d.ts | 2 + packages/node-status-page/svelte.config.cjs | 7 + packages/node-status-page/tailwind.config.cjs | 53 + packages/node-status-page/tsconfig.json | 21 + packages/node-status-page/tsconfig.node.json | 8 + packages/node-status-page/vite.config.ts | 26 + 60 files changed, 3309 insertions(+), 12 deletions(-) create mode 100644 packages/eventindexer/http/get_count_by_address_and_event.go create mode 100644 packages/eventindexer/indexer/save_block_proposed_event.go create mode 100644 packages/node-status-page/.babelrc create mode 100644 packages/node-status-page/.default.env create mode 100644 packages/node-status-page/.gitignore create mode 100644 packages/node-status-page/CHANGELOG.md create mode 100644 packages/node-status-page/Dockerfile create mode 100644 packages/node-status-page/README.md create mode 100644 packages/node-status-page/index.html create mode 100644 packages/node-status-page/jest.config.js create mode 100644 packages/node-status-page/package.json create mode 100644 packages/node-status-page/postcss.config.cjs create mode 100644 packages/node-status-page/public/taiko-favicon.png create mode 100644 packages/node-status-page/src/App.svelte create mode 100644 packages/node-status-page/src/app.css create mode 100644 packages/node-status-page/src/assets/lottie/loader.json create mode 100644 packages/node-status-page/src/assets/taiko-banner.svg create mode 100644 packages/node-status-page/src/components/DetailsModal.svelte create mode 100644 packages/node-status-page/src/components/Loader.svelte create mode 100644 packages/node-status-page/src/components/Modal.svelte create mode 100644 packages/node-status-page/src/components/Navbar.svelte create mode 100644 packages/node-status-page/src/components/StatusIndicator.svelte create mode 100644 packages/node-status-page/src/components/Tooltip.svelte create mode 100644 packages/node-status-page/src/components/TooltipModal.svelte create mode 100644 packages/node-status-page/src/components/details/Node.svelte create mode 100644 packages/node-status-page/src/components/details/Proposer.svelte create mode 100644 packages/node-status-page/src/components/details/Prover.svelte create mode 100644 packages/node-status-page/src/components/icons/Loader.svelte create mode 100644 packages/node-status-page/src/components/icons/TaikoLogo.svelte create mode 100644 packages/node-status-page/src/components/providers/BaseQueries.svelte create mode 100644 packages/node-status-page/src/components/providers/QueryProvider.svelte create mode 100644 packages/node-status-page/src/constants/abi/Bridge.ts create mode 100644 packages/node-status-page/src/constants/abi/HeaderSync.ts create mode 100644 packages/node-status-page/src/constants/abi/TaikoL1.ts create mode 100644 packages/node-status-page/src/domain/status.ts create mode 100644 packages/node-status-page/src/i18n.js create mode 100644 packages/node-status-page/src/main.ts create mode 100644 packages/node-status-page/src/pages/home/Home.svelte create mode 100644 packages/node-status-page/src/utils/addressSubsection.ts create mode 100644 packages/node-status-page/src/utils/displayStatusValue.ts create mode 100644 packages/node-status-page/src/utils/getConfig.ts create mode 100644 packages/node-status-page/src/utils/getEthBalance.ts create mode 100644 packages/node-status-page/src/utils/getPendingBlocks.ts create mode 100644 packages/node-status-page/src/utils/getPendingTransactions.ts create mode 100644 packages/node-status-page/src/utils/getProofCount.ts create mode 100644 packages/node-status-page/src/utils/getProposalCount.ts create mode 100644 packages/node-status-page/src/utils/getQueuedTransactions.ts create mode 100644 packages/node-status-page/src/utils/getStateVariables.ts create mode 100644 packages/node-status-page/src/utils/truncateString.ts create mode 100644 packages/node-status-page/src/vite-env.d.ts create mode 100644 packages/node-status-page/svelte.config.cjs create mode 100644 packages/node-status-page/tailwind.config.cjs create mode 100644 packages/node-status-page/tsconfig.json create mode 100644 packages/node-status-page/tsconfig.node.json create mode 100644 packages/node-status-page/vite.config.ts diff --git a/packages/eventindexer/event.go b/packages/eventindexer/event.go index 1e0b67bfb6c..aa2c6060582 100644 --- a/packages/eventindexer/event.go +++ b/packages/eventindexer/event.go @@ -8,7 +8,8 @@ import ( ) var ( - EventNameBlockProven = "BlockProven" + EventNameBlockProven = "BlockProven" + EventNameBlockProposed = "BlockProposed" ) // Event represents a stored EVM event. The fields will be serialized @@ -43,4 +44,5 @@ type EventRepository interface { FindUniqueProvers( ctx context.Context, ) ([]UniqueProversResponse, error) + GetCountByAddressAndEventName(ctx context.Context, address string, event string) (int, error) } diff --git a/packages/eventindexer/http/get_count_by_address_and_event.go b/packages/eventindexer/http/get_count_by_address_and_event.go new file mode 100644 index 00000000000..800c2d725e3 --- /dev/null +++ b/packages/eventindexer/http/get_count_by_address_and_event.go @@ -0,0 +1,27 @@ +package http + +import ( + "net/http" + + "github.com/cyberhorsey/webutils" + "github.com/labstack/echo/v4" +) + +type GetCountByAddressAndEventNameResp struct { + Count int `json:"count"` +} + +func (srv *Server) GetCountByAddressAndEventName(c echo.Context) error { + count, err := srv.eventRepo.GetCountByAddressAndEventName( + c.Request().Context(), + c.QueryParam("address"), + c.QueryParam("event"), + ) + if err != nil { + return webutils.LogAndRenderErrors(c, http.StatusUnprocessableEntity, err) + } + + return c.JSON(http.StatusOK, &GetCountByAddressAndEventNameResp{ + Count: count, + }) +} diff --git a/packages/eventindexer/http/routes.go b/packages/eventindexer/http/routes.go index 7e45ea41127..90d9a88574f 100644 --- a/packages/eventindexer/http/routes.go +++ b/packages/eventindexer/http/routes.go @@ -5,4 +5,5 @@ func (srv *Server) configureRoutes() { srv.echo.GET("/", srv.Health) srv.echo.GET("/uniqueProvers", srv.GetUniqueProvers) + srv.echo.GET("/eventByAddress", srv.GetCountByAddressAndEventName) } diff --git a/packages/eventindexer/indexer/filter_then_subscribe.go b/packages/eventindexer/indexer/filter_then_subscribe.go index 5afcbca1897..a623e3cd40a 100644 --- a/packages/eventindexer/indexer/filter_then_subscribe.go +++ b/packages/eventindexer/indexer/filter_then_subscribe.go @@ -69,6 +69,16 @@ func (svc *Service) FilterThenSubscribe( return errors.Wrap(err, "svc.saveBlockProvenEvents") } + blockProposedEvents, err := svc.taikol1.FilterBlockProposed(filterOpts, nil) + if err != nil { + return errors.Wrap(err, "svc.taikol1.FilterBlockProposed") + } + + err = svc.saveBlockProposedEvents(ctx, chainID, blockProposedEvents) + if err != nil { + return errors.Wrap(err, "svc.saveBlockProposedEvents") + } + header, err := svc.ethClient.HeaderByNumber(ctx, big.NewInt(int64(end))) if err != nil { return errors.Wrap(err, "svc.ethClient.HeaderByNumber") diff --git a/packages/eventindexer/indexer/save_block_proposed_event.go b/packages/eventindexer/indexer/save_block_proposed_event.go new file mode 100644 index 00000000000..4a59ec49fca --- /dev/null +++ b/packages/eventindexer/indexer/save_block_proposed_event.go @@ -0,0 +1,75 @@ +package indexer + +import ( + "context" + "encoding/json" + "math/big" + + "github.com/ethereum/go-ethereum/common" + "github.com/pkg/errors" + log "github.com/sirupsen/logrus" + "github.com/taikoxyz/taiko-mono/packages/eventindexer" + "github.com/taikoxyz/taiko-mono/packages/eventindexer/contracts/taikol1" +) + +func (svc *Service) saveBlockProposedEvents( + ctx context.Context, + chainID *big.Int, + events *taikol1.TaikoL1BlockProposedIterator, +) error { + if !events.Next() || events.Event == nil { + log.Infof("no blockProven events") + return nil + } + + for { + event := events.Event + + if event.Raw.Removed { + continue + } + + tx, _, err := svc.ethClient.TransactionByHash(ctx, event.Raw.TxHash) + if err != nil { + return errors.Wrap(err, "svc.ethClient.TransactionByHash") + } + + sender, err := svc.ethClient.TransactionSender(ctx, tx, event.Raw.BlockHash, event.Raw.TxIndex) + if err != nil { + return errors.Wrap(err, "svc.ethClient.TransactionSender") + } + + if err := svc.saveBlockProposedEvent(ctx, chainID, event, sender); err != nil { + return errors.Wrap(err, "svc.saveBlockProposedEvent") + } + + if !events.Next() { + return nil + } + } +} + +func (svc *Service) saveBlockProposedEvent( + ctx context.Context, + chainID *big.Int, + event *taikol1.TaikoL1BlockProposed, + sender common.Address, +) error { + marshaled, err := json.Marshal(event) + if err != nil { + return errors.Wrap(err, "json.Marshal(event)") + } + + _, err = svc.eventRepo.Save(ctx, eventindexer.SaveEventOpts{ + Name: eventindexer.EventNameBlockProposed, + Data: string(marshaled), + ChainID: chainID, + Event: eventindexer.EventNameBlockProposed, + Address: sender.Hex(), + }) + if err != nil { + return errors.Wrap(err, "svc.eventRepo.Save") + } + + return nil +} diff --git a/packages/eventindexer/indexer/service.go b/packages/eventindexer/indexer/service.go index eb9b66c1d18..8788a5fdfd8 100644 --- a/packages/eventindexer/indexer/service.go +++ b/packages/eventindexer/indexer/service.go @@ -1,14 +1,10 @@ package indexer import ( - "context" - "math/big" "time" "github.com/cyberhorsey/errors" - "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethclient" "github.com/ethereum/go-ethereum/rpc" "github.com/taikoxyz/taiko-mono/packages/eventindexer" @@ -19,16 +15,10 @@ var ( ZeroAddress = common.HexToAddress("0x0000000000000000000000000000000000000000") ) -type ethClient interface { - ChainID(ctx context.Context) (*big.Int, error) - HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error) - SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error) -} - type Service struct { eventRepo eventindexer.EventRepository blockRepo eventindexer.BlockRepository - ethClient ethClient + ethClient *ethclient.Client processingBlockHeight uint64 diff --git a/packages/eventindexer/repo/event.go b/packages/eventindexer/repo/event.go index c2a93c14572..82b8af807f1 100644 --- a/packages/eventindexer/repo/event.go +++ b/packages/eventindexer/repo/event.go @@ -51,3 +51,19 @@ func (r *EventRepository) FindUniqueProvers( return addrs, nil } + +func (r *EventRepository) GetCountByAddressAndEventName( + ctx context.Context, + address string, + event string, +) (int, error) { + var count int + + if err := r.db.GormDB(). + Raw("SELECT count(*) AS count FROM events WHERE event = ? AND address = ?", event, address). + FirstOrInit(&count).Error; err != nil { + return 0, errors.Wrap(err, "r.db.FirstOrInit") + } + + return count, nil +} diff --git a/packages/node-status-page/.babelrc b/packages/node-status-page/.babelrc new file mode 100644 index 00000000000..7ae1eb65a8f --- /dev/null +++ b/packages/node-status-page/.babelrc @@ -0,0 +1,8 @@ +{ + "presets": [["@babel/preset-env", {"targets": {"node": "current"}}]], + "env": { + "test": { + "plugins": ["transform-es2015-modules-commonjs"] + } + } + } \ No newline at end of file diff --git a/packages/node-status-page/.default.env b/packages/node-status-page/.default.env new file mode 100644 index 00000000000..5f1af920437 --- /dev/null +++ b/packages/node-status-page/.default.env @@ -0,0 +1,8 @@ +VITE_NODE_ENV=dev +VITE_L1_RPC_URL="https://rpc.sepolia.org" +VITE_L2_RPC_URL="http://localhost:8545" +VITE_TAIKO_L2_ADDRESS="0x0000777700000000000000000000000000000001" +VITE_TAIKO_L1_ADDRESS="0xAC9251ee97Ed8beF31706354310C6b020C35d87b" +VITE_L1_EXPLORER_URL="https://l1explorer.a2.taiko.xyz" +VITE_L2_EXPLORER_URL="https://l2explorer.a2.taiko.xyz" +VITE_EVENT_INDEXER_API_URL="http://localhost:4100" \ No newline at end of file diff --git a/packages/node-status-page/.gitignore b/packages/node-status-page/.gitignore new file mode 100644 index 00000000000..d99f7853c92 --- /dev/null +++ b/packages/node-status-page/.gitignore @@ -0,0 +1,30 @@ +# 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 + +# vite +vite.config.ts.timestamp-*.mjs \ No newline at end of file diff --git a/packages/node-status-page/CHANGELOG.md b/packages/node-status-page/CHANGELOG.md new file mode 100644 index 00000000000..5b90132f80b --- /dev/null +++ b/packages/node-status-page/CHANGELOG.md @@ -0,0 +1,64 @@ +# Changelog + +## [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/node-status-page/Dockerfile b/packages/node-status-page/Dockerfile new file mode 100644 index 00000000000..2f3d0d7c2a0 --- /dev/null +++ b/packages/node-status-page/Dockerfile @@ -0,0 +1,5 @@ +FROM node:16.7 +WORKDIR /app +COPY . . +RUN npm install +RUN npm run dev \ No newline at end of file diff --git a/packages/node-status-page/README.md b/packages/node-status-page/README.md new file mode 100644 index 00000000000..846cde89b70 --- /dev/null +++ b/packages/node-status-page/README.md @@ -0,0 +1,3 @@ +# Node Status Page + +Taiko status page helps to show the current status of your node, intended to be run with `simple-taiko-node`. diff --git a/packages/node-status-page/index.html b/packages/node-status-page/index.html new file mode 100644 index 00000000000..27fc0bed3d8 --- /dev/null +++ b/packages/node-status-page/index.html @@ -0,0 +1,20 @@ + + + + + + + + + + + Taiko Status + + +
+ + + diff --git a/packages/node-status-page/jest.config.js b/packages/node-status-page/jest.config.js new file mode 100644 index 00000000000..7f2d5f3b015 --- /dev/null +++ b/packages/node-status-page/jest.config.js @@ -0,0 +1,55 @@ +/** @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/node-status-page/package.json b/packages/node-status-page/package.json new file mode 100644 index 00000000000..851c985684d --- /dev/null +++ b/packages/node-status-page/package.json @@ -0,0 +1,74 @@ +{ + "name": "@taiko/node-status-page", + "version": "0.5.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": "^3.0.0", + "@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": "^5.16.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": "^6.2.0", + "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.0.0", + "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/node-status-page/postcss.config.cjs b/packages/node-status-page/postcss.config.cjs new file mode 100644 index 00000000000..e2dc47804ed --- /dev/null +++ b/packages/node-status-page/postcss.config.cjs @@ -0,0 +1,6 @@ +module.exports = { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + } +} \ No newline at end of file diff --git a/packages/node-status-page/public/taiko-favicon.png b/packages/node-status-page/public/taiko-favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..28da6ff13433ccad107f8fc90e7003be222957ad GIT binary patch literal 7618 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 + import { wrap } from "svelte-spa-router/wrap"; + import Router from "svelte-spa-router"; + import Home from "./pages/home/Home.svelte"; + import { setupI18n } from "./i18n"; + import Navbar from "./components/Navbar.svelte"; + import { ethers } from "ethers"; + setupI18n({ withLocale: "en" }); + + const l1Provider = new ethers.providers.JsonRpcProvider( + import.meta.env.VITE_L1_RPC_URL + ); + const l2Provider = new ethers.providers.WebSocketProvider( + import.meta.env.VITE_L2_RPC_URL + ); + + const routes = { + "/": wrap({ + component: Home, + props: { + l1Provider: l1Provider, + l1TaikoAddress: import.meta.env.VITE_TAIKO_L1_ADDRESS, + l2Provider: l2Provider, + l2TaikoAddress: import.meta.env.VITE_TAIKO_L2_ADDRESS, + l1ExplorerUrl: import.meta.env.VITE_L1_EXPLORER_URL, + l2ExplorerUrl: import.meta.env.VITE_L2_EXPLORER_URL, + feeTokenSymbol: import.meta.env.VITE_FEE_TOKEN_SYMBOL || "TKO", + eventIndexerApiUrl: import.meta.env.VITE_EVENT_INDEXER_API_URL, + proposerAddress: import.meta.env.VITE_PROPOSER_ADDRESS, + proverAddress: import.meta.env.VITE_PROVER_ADDRESS, + }, + userData: {}, + }), + }; + + +
+ + +
+ + diff --git a/packages/node-status-page/src/app.css b/packages/node-status-page/src/app.css new file mode 100644 index 00000000000..9fd61216e50 --- /dev/null +++ b/packages/node-status-page/src/app.css @@ -0,0 +1,67 @@ +.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/node-status-page/src/assets/lottie/loader.json b/packages/node-status-page/src/assets/lottie/loader.json new file mode 100644 index 00000000000..7c288a43a3d --- /dev/null +++ b/packages/node-status-page/src/assets/lottie/loader.json @@ -0,0 +1 @@ +{"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/node-status-page/src/assets/taiko-banner.svg b/packages/node-status-page/src/assets/taiko-banner.svg new file mode 100644 index 00000000000..e351b7b9ab4 --- /dev/null +++ b/packages/node-status-page/src/assets/taiko-banner.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/packages/node-status-page/src/components/DetailsModal.svelte b/packages/node-status-page/src/components/DetailsModal.svelte new file mode 100644 index 00000000000..a7ea557e7f7 --- /dev/null +++ b/packages/node-status-page/src/components/DetailsModal.svelte @@ -0,0 +1,17 @@ + + + +
+
+ +
+ +
+
diff --git a/packages/node-status-page/src/components/Loader.svelte b/packages/node-status-page/src/components/Loader.svelte new file mode 100644 index 00000000000..70a3a93064c --- /dev/null +++ b/packages/node-status-page/src/components/Loader.svelte @@ -0,0 +1,16 @@ + + + diff --git a/packages/node-status-page/src/components/Modal.svelte b/packages/node-status-page/src/components/Modal.svelte new file mode 100644 index 00000000000..89a1027679d --- /dev/null +++ b/packages/node-status-page/src/components/Modal.svelte @@ -0,0 +1,47 @@ + + + + + + + diff --git a/packages/node-status-page/src/components/Navbar.svelte b/packages/node-status-page/src/components/Navbar.svelte new file mode 100644 index 00000000000..9b4489dd3bc --- /dev/null +++ b/packages/node-status-page/src/components/Navbar.svelte @@ -0,0 +1,7 @@ + + + diff --git a/packages/node-status-page/src/components/StatusIndicator.svelte b/packages/node-status-page/src/components/StatusIndicator.svelte new file mode 100644 index 00000000000..45684ef6e65 --- /dev/null +++ b/packages/node-status-page/src/components/StatusIndicator.svelte @@ -0,0 +1,114 @@ + + +
+ +

+ {header} +

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

+ {tooltip} +

+
+
+{/if} diff --git a/packages/node-status-page/src/components/Tooltip.svelte b/packages/node-status-page/src/components/Tooltip.svelte new file mode 100644 index 00000000000..1ccae3a0157 --- /dev/null +++ b/packages/node-status-page/src/components/Tooltip.svelte @@ -0,0 +1,11 @@ + + + (isOpen = true)} + size="18" + variation="outline" +/> diff --git a/packages/node-status-page/src/components/TooltipModal.svelte b/packages/node-status-page/src/components/TooltipModal.svelte new file mode 100644 index 00000000000..a7ea557e7f7 --- /dev/null +++ b/packages/node-status-page/src/components/TooltipModal.svelte @@ -0,0 +1,17 @@ + + + +
+
+ +
+ +
+
diff --git a/packages/node-status-page/src/components/details/Node.svelte b/packages/node-status-page/src/components/details/Node.svelte new file mode 100644 index 00000000000..54ed36b1010 --- /dev/null +++ b/packages/node-status-page/src/components/details/Node.svelte @@ -0,0 +1,65 @@ + + +
+

Node Details

+
+ +
+ {#each statusIndicators as statusIndicator} + + {/each} +
diff --git a/packages/node-status-page/src/components/details/Proposer.svelte b/packages/node-status-page/src/components/details/Proposer.svelte new file mode 100644 index 00000000000..d6a77de877c --- /dev/null +++ b/packages/node-status-page/src/components/details/Proposer.svelte @@ -0,0 +1,12 @@ + + +
+

Proposer Details

+
diff --git a/packages/node-status-page/src/components/details/Prover.svelte b/packages/node-status-page/src/components/details/Prover.svelte new file mode 100644 index 00000000000..53b25c66f94 --- /dev/null +++ b/packages/node-status-page/src/components/details/Prover.svelte @@ -0,0 +1,78 @@ + + +
+

Prover Details

+ + + + {#if activeTab === "status"} + {#each statusIndicators as statusIndicator} + + {/each} + {:else} +
+
+ Rewards: +

0

+
+ +
+
+
+ {/if} +
diff --git a/packages/node-status-page/src/components/icons/Loader.svelte b/packages/node-status-page/src/components/icons/Loader.svelte new file mode 100644 index 00000000000..a342c73fe82 --- /dev/null +++ b/packages/node-status-page/src/components/icons/Loader.svelte @@ -0,0 +1,16 @@ + + + + diff --git a/packages/node-status-page/src/components/icons/TaikoLogo.svelte b/packages/node-status-page/src/components/icons/TaikoLogo.svelte new file mode 100644 index 00000000000..26595968c90 --- /dev/null +++ b/packages/node-status-page/src/components/icons/TaikoLogo.svelte @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + diff --git a/packages/node-status-page/src/components/providers/BaseQueries.svelte b/packages/node-status-page/src/components/providers/BaseQueries.svelte new file mode 100644 index 00000000000..4fa864ce7aa --- /dev/null +++ b/packages/node-status-page/src/components/providers/BaseQueries.svelte @@ -0,0 +1 @@ + diff --git a/packages/node-status-page/src/components/providers/QueryProvider.svelte b/packages/node-status-page/src/components/providers/QueryProvider.svelte new file mode 100644 index 00000000000..91774c4acb8 --- /dev/null +++ b/packages/node-status-page/src/components/providers/QueryProvider.svelte @@ -0,0 +1,13 @@ + + + + + + + diff --git a/packages/node-status-page/src/constants/abi/Bridge.ts b/packages/node-status-page/src/constants/abi/Bridge.ts new file mode 100644 index 00000000000..34525018b52 --- /dev/null +++ b/packages/node-status-page/src/constants/abi/Bridge.ts @@ -0,0 +1,726 @@ +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/node-status-page/src/constants/abi/HeaderSync.ts b/packages/node-status-page/src/constants/abi/HeaderSync.ts new file mode 100644 index 00000000000..2b47742c0cd --- /dev/null +++ b/packages/node-status-page/src/constants/abi/HeaderSync.ts @@ -0,0 +1,53 @@ +export default [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "srcHeight", + type: "uint256", + }, + { + indexed: false, + internalType: "bytes32", + name: "srcHash", + type: "bytes32", + }, + ], + name: "HeaderSynced", + type: "event", + }, + { + inputs: [], + name: "getLatestSyncedHeader", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "number", + type: "uint256", + }, + ], + name: "getSyncedHeader", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, +]; diff --git a/packages/node-status-page/src/constants/abi/TaikoL1.ts b/packages/node-status-page/src/constants/abi/TaikoL1.ts new file mode 100644 index 00000000000..72b441cd597 --- /dev/null +++ b/packages/node-status-page/src/constants/abi/TaikoL1.ts @@ -0,0 +1,1134 @@ +export default [ + { + inputs: [], + name: "L1_0_FEE_BASE", + type: "error", + }, + { + inputs: [], + name: "L1_0_FEE_BASE", + type: "error", + }, + { + inputs: [], + name: "L1_ALREADY_PROVEN", + type: "error", + }, + { + inputs: [], + name: "L1_ANCHOR_CALLDATA", + type: "error", + }, + { + inputs: [], + name: "L1_ANCHOR_DEST", + type: "error", + }, + { + inputs: [], + name: "L1_ANCHOR_GAS_LIMIT", + type: "error", + }, + { + inputs: [], + name: "L1_ANCHOR_RECEIPT_ADDR", + type: "error", + }, + { + inputs: [], + name: "L1_ANCHOR_RECEIPT_DATA", + type: "error", + }, + { + inputs: [], + name: "L1_ANCHOR_RECEIPT_LOGS", + type: "error", + }, + { + inputs: [], + name: "L1_ANCHOR_RECEIPT_PROOF", + type: "error", + }, + { + inputs: [], + name: "L1_ANCHOR_RECEIPT_STATUS", + type: "error", + }, + { + inputs: [], + name: "L1_ANCHOR_RECEIPT_TOPICS", + type: "error", + }, + { + inputs: [], + name: "L1_ANCHOR_SIG_R", + type: "error", + }, + { + inputs: [], + name: "L1_ANCHOR_SIG_S", + type: "error", + }, + { + inputs: [], + name: "L1_ANCHOR_TX_PROOF", + type: "error", + }, + { + inputs: [], + name: "L1_ANCHOR_TYPE", + type: "error", + }, + { + inputs: [], + name: "L1_BLOCK_NUMBER", + type: "error", + }, + { + inputs: [], + name: "L1_BLOCK_NUMBER", + type: "error", + }, + { + inputs: [], + name: "L1_CANNOT_BE_FIRST_PROVER", + type: "error", + }, + { + inputs: [], + name: "L1_COMMITTED", + type: "error", + }, + { + inputs: [], + name: "L1_CONFLICT_PROOF", + type: "error", + }, + { + inputs: [], + name: "L1_CONTRACT_NOT_ALLOWED", + type: "error", + }, + { + inputs: [], + name: "L1_DUP_PROVERS", + type: "error", + }, + { + inputs: [], + name: "L1_EXTRA_DATA", + type: "error", + }, + { + inputs: [], + name: "L1_GAS_LIMIT", + type: "error", + }, + { + inputs: [], + name: "L1_ID", + type: "error", + }, + { + inputs: [], + name: "L1_ID", + type: "error", + }, + { + inputs: [], + name: "L1_INPUT_SIZE", + type: "error", + }, + { + inputs: [], + name: "L1_INVALID_CONFIG", + type: "error", + }, + { + inputs: [], + name: "L1_INVALID_CONFIG", + type: "error", + }, + { + inputs: [], + name: "L1_INVALID_PARAM", + type: "error", + }, + { + inputs: [], + name: "L1_METADATA_FIELD", + type: "error", + }, + { + inputs: [], + name: "L1_META_MISMATCH", + type: "error", + }, + { + inputs: [], + name: "L1_NOT_COMMITTED", + type: "error", + }, + { + inputs: [], + name: "L1_NOT_ORACLE_PROVER", + type: "error", + }, + { + inputs: [], + name: "L1_PROOF_LENGTH", + type: "error", + }, + { + inputs: [], + name: "L1_PROVER", + type: "error", + }, + { + inputs: [], + name: "L1_SOLO_PROPOSER", + type: "error", + }, + { + inputs: [], + name: "L1_TOO_MANY_BLOCKS", + type: "error", + }, + { + inputs: [], + name: "L1_TX_LIST", + type: "error", + }, + { + inputs: [], + name: "L1_ZKP", + type: "error", + }, + { + inputs: [], + name: "RESOLVER_DENIED", + type: "error", + }, + { + inputs: [], + name: "RESOLVER_INVALID_ADDR", + type: "error", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint64", + name: "commitSlot", + type: "uint64", + }, + { + indexed: false, + internalType: "bytes32", + name: "commitHash", + type: "bytes32", + }, + ], + name: "BlockCommitted", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "id", + type: "uint256", + }, + { + components: [ + { + internalType: "uint256", + name: "id", + type: "uint256", + }, + { + internalType: "uint256", + name: "l1Height", + type: "uint256", + }, + { + internalType: "bytes32", + name: "l1Hash", + type: "bytes32", + }, + { + internalType: "address", + name: "beneficiary", + type: "address", + }, + { + internalType: "bytes32", + name: "txListHash", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "mixHash", + type: "bytes32", + }, + { + internalType: "bytes", + name: "extraData", + type: "bytes", + }, + { + internalType: "uint64", + name: "gasLimit", + type: "uint64", + }, + { + internalType: "uint64", + name: "timestamp", + type: "uint64", + }, + { + internalType: "uint64", + name: "commitHeight", + type: "uint64", + }, + { + internalType: "uint64", + name: "commitSlot", + type: "uint64", + }, + ], + indexed: false, + internalType: "struct TaikoData.BlockMetadata", + name: "meta", + type: "tuple", + }, + ], + 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: "address", + name: "prover", + type: "address", + }, + { + indexed: false, + internalType: "uint64", + name: "provenAt", + type: "uint64", + }, + ], + name: "BlockProven", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "id", + type: "uint256", + }, + { + indexed: false, + internalType: "bytes32", + name: "blockHash", + type: "bytes32", + }, + ], + name: "BlockVerified", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "srcHeight", + type: "uint256", + }, + { + indexed: false, + internalType: "bytes32", + name: "srcHash", + type: "bytes32", + }, + ], + name: "HeaderSynced", + 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: "addressManager", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint64", + name: "commitSlot", + type: "uint64", + }, + { + internalType: "bytes32", + name: "commitHash", + type: "bytes32", + }, + ], + name: "commitBlock", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "getBlockFee", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getConfig", + outputs: [ + { + components: [ + { + internalType: "uint256", + name: "chainId", + type: "uint256", + }, + { + internalType: "uint256", + name: "maxNumBlocks", + type: "uint256", + }, + { + internalType: "uint256", + name: "blockHashHistory", + type: "uint256", + }, + { + internalType: "uint256", + name: "maxVerificationsPerTx", + type: "uint256", + }, + { + internalType: "uint256", + name: "commitConfirmations", + type: "uint256", + }, + { + internalType: "uint256", + name: "blockMaxGasLimit", + type: "uint256", + }, + { + internalType: "uint256", + name: "maxTransactionsPerBlock", + type: "uint256", + }, + { + internalType: "uint256", + name: "maxBytesPerTxList", + type: "uint256", + }, + { + internalType: "uint256", + name: "minTxGasLimit", + type: "uint256", + }, + { + internalType: "uint256", + name: "anchorTxGasLimit", + type: "uint256", + }, + { + internalType: "uint256", + name: "slotSmoothingFactor", + type: "uint256", + }, + { + internalType: "uint256", + name: "rewardBurnBips", + type: "uint256", + }, + { + internalType: "uint256", + name: "proposerDepositPctg", + type: "uint256", + }, + { + internalType: "uint256", + name: "feeBaseMAF", + type: "uint256", + }, + { + internalType: "uint256", + name: "blockTimeMAF", + type: "uint256", + }, + { + internalType: "uint256", + name: "proofTimeMAF", + type: "uint256", + }, + { + internalType: "uint64", + name: "rewardMultiplierPctg", + type: "uint64", + }, + { + internalType: "uint64", + name: "feeGracePeriodPctg", + type: "uint64", + }, + { + internalType: "uint64", + name: "feeMaxPeriodPctg", + type: "uint64", + }, + { + internalType: "uint64", + name: "blockTimeCap", + type: "uint64", + }, + { + internalType: "uint64", + name: "proofTimeCap", + type: "uint64", + }, + { + internalType: "uint64", + name: "bootstrapDiscountHalvingPeriod", + type: "uint64", + }, + { + internalType: "bool", + name: "enableTokenomics", + type: "bool", + }, + { + internalType: "bool", + name: "enablePublicInputsCheck", + type: "bool", + }, + { + internalType: "bool", + name: "enableAnchorValidation", + type: "bool", + }, + ], + internalType: "struct TaikoData.Config", + name: "", + type: "tuple", + }, + ], + stateMutability: "pure", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "id", + type: "uint256", + }, + { + internalType: "bytes32", + name: "parentHash", + type: "bytes32", + }, + ], + name: "getForkChoice", + outputs: [ + { + components: [ + { + internalType: "bytes32", + name: "blockHash", + type: "bytes32", + }, + { + internalType: "address", + name: "prover", + type: "address", + }, + { + internalType: "uint64", + name: "provenAt", + type: "uint64", + }, + ], + internalType: "struct TaikoData.ForkChoice", + name: "", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getLatestSyncedHeader", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint64", + name: "provenAt", + type: "uint64", + }, + { + internalType: "uint64", + name: "proposedAt", + type: "uint64", + }, + ], + name: "getProofReward", + outputs: [ + { + internalType: "uint256", + name: "reward", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "id", + type: "uint256", + }, + ], + name: "getProposedBlock", + outputs: [ + { + components: [ + { + internalType: "bytes32", + name: "metaHash", + type: "bytes32", + }, + { + internalType: "uint256", + name: "deposit", + type: "uint256", + }, + { + internalType: "address", + name: "proposer", + type: "address", + }, + { + internalType: "uint64", + name: "proposedAt", + type: "uint64", + }, + ], + internalType: "struct TaikoData.ProposedBlock", + name: "", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "addr", + type: "address", + }, + ], + name: "getRewardBalance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getStateVariables", + outputs: [ + { + components: [ + { + internalType: "uint256", + name: "feeBase", + type: "uint256", + }, + { + internalType: "uint64", + name: "genesisHeight", + type: "uint64", + }, + { + internalType: "uint64", + name: "genesisTimestamp", + type: "uint64", + }, + { + internalType: "uint64", + name: "nextBlockId", + type: "uint64", + }, + { + internalType: "uint64", + name: "lastProposedAt", + type: "uint64", + }, + { + internalType: "uint64", + name: "avgBlockTime", + type: "uint64", + }, + { + internalType: "uint64", + name: "latestVerifiedHeight", + type: "uint64", + }, + { + internalType: "uint64", + name: "latestVerifiedId", + type: "uint64", + }, + { + internalType: "uint64", + name: "avgProofTime", + type: "uint64", + }, + ], + internalType: "struct LibUtils.StateVariables", + name: "", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "number", + type: "uint256", + }, + ], + name: "getSyncedHeader", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_addressManager", + type: "address", + }, + { + internalType: "bytes32", + name: "_genesisBlockHash", + type: "bytes32", + }, + { + internalType: "uint256", + name: "_feeBase", + type: "uint256", + }, + ], + name: "init", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "commitSlot", + type: "uint256", + }, + { + internalType: "uint256", + name: "commitHeight", + type: "uint256", + }, + { + internalType: "bytes32", + name: "commitHash", + type: "bytes32", + }, + ], + name: "isCommitValid", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes[]", + name: "inputs", + type: "bytes[]", + }, + ], + name: "proposeBlock", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "blockId", + type: "uint256", + }, + { + internalType: "bytes[]", + name: "inputs", + type: "bytes[]", + }, + ], + name: "proveBlock", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "blockId", + type: "uint256", + }, + { + internalType: "bytes[]", + name: "inputs", + type: "bytes[]", + }, + ], + name: "proveBlockInvalid", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "renounceOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "string", + name: "name", + type: "string", + }, + { + internalType: "bool", + name: "allowZeroAddress", + type: "bool", + }, + ], + 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", + }, + { + internalType: "bool", + name: "allowZeroAddress", + type: "bool", + }, + ], + name: "resolve", + outputs: [ + { + internalType: "address payable", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "hash", + type: "bytes32", + }, + { + internalType: "uint8", + name: "k", + type: "uint8", + }, + ], + name: "signWithGoldenTouch", + outputs: [ + { + internalType: "uint8", + name: "v", + type: "uint8", + }, + { + internalType: "uint256", + name: "r", + type: "uint256", + }, + { + internalType: "uint256", + name: "s", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "state", + outputs: [ + { + internalType: "uint64", + name: "genesisHeight", + type: "uint64", + }, + { + internalType: "uint64", + name: "genesisTimestamp", + type: "uint64", + }, + { + internalType: "uint64", + name: "__reservedA1", + type: "uint64", + }, + { + internalType: "uint64", + name: "__reservedA2", + type: "uint64", + }, + { + internalType: "uint256", + name: "feeBase", + type: "uint256", + }, + { + internalType: "uint64", + name: "nextBlockId", + type: "uint64", + }, + { + internalType: "uint64", + name: "lastProposedAt", + type: "uint64", + }, + { + internalType: "uint64", + name: "avgBlockTime", + type: "uint64", + }, + { + internalType: "uint64", + name: "__avgGasLimit", + type: "uint64", + }, + { + internalType: "uint64", + name: "latestVerifiedHeight", + type: "uint64", + }, + { + internalType: "uint64", + name: "latestVerifiedId", + type: "uint64", + }, + { + internalType: "uint64", + name: "avgProofTime", + type: "uint64", + }, + { + internalType: "uint64", + name: "__reservedC1", + 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: [], + name: "withdrawBalance", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, +]; diff --git a/packages/node-status-page/src/domain/status.ts b/packages/node-status-page/src/domain/status.ts new file mode 100644 index 00000000000..972bb73522f --- /dev/null +++ b/packages/node-status-page/src/domain/status.ts @@ -0,0 +1,24 @@ +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 + ) => 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/node-status-page/src/i18n.js b/packages/node-status-page/src/i18n.js new file mode 100644 index 00000000000..b2e76cb012e --- /dev/null +++ b/packages/node-status-page/src/i18n.js @@ -0,0 +1,41 @@ +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/node-status-page/src/main.ts b/packages/node-status-page/src/main.ts new file mode 100644 index 00000000000..3bbaf7b1fe4 --- /dev/null +++ b/packages/node-status-page/src/main.ts @@ -0,0 +1,12 @@ +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/node-status-page/src/pages/home/Home.svelte b/packages/node-status-page/src/pages/home/Home.svelte new file mode 100644 index 00000000000..a2eca10ac6d --- /dev/null +++ b/packages/node-status-page/src/pages/home/Home.svelte @@ -0,0 +1,50 @@ + + +
+

simple-taiko-node dashboard

+
+
+
+ (activeTab = "node")}>Node + {#if proposerAddress} + (activeTab = "proposer")}>Proposer + {/if} + {#if proposerAddress} + (activeTab = "prover")}>Prover + {/if} +
+
+ +{#if activeTab === "prover"} + +{:else if activeTab === "proposer"} + +{:else if activeTab === "node"} + +{/if} diff --git a/packages/node-status-page/src/utils/addressSubsection.ts b/packages/node-status-page/src/utils/addressSubsection.ts new file mode 100644 index 00000000000..5d4b7e201a1 --- /dev/null +++ b/packages/node-status-page/src/utils/addressSubsection.ts @@ -0,0 +1,4 @@ +export const addressSubsection = (address: string) => { + if (!address) return "0x"; + return `${address.substring(0, 5)}...${address.substring(38, 42)}`; +}; diff --git a/packages/node-status-page/src/utils/displayStatusValue.ts b/packages/node-status-page/src/utils/displayStatusValue.ts new file mode 100644 index 00000000000..ebbd79dd9e6 --- /dev/null +++ b/packages/node-status-page/src/utils/displayStatusValue.ts @@ -0,0 +1,15 @@ +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/node-status-page/src/utils/getConfig.ts b/packages/node-status-page/src/utils/getConfig.ts new file mode 100644 index 00000000000..6eb7c4a76b1 --- /dev/null +++ b/packages/node-status-page/src/utils/getConfig.ts @@ -0,0 +1,10 @@ +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); + return await contract.getConfig(); +}; diff --git a/packages/node-status-page/src/utils/getEthBalance.ts b/packages/node-status-page/src/utils/getEthBalance.ts new file mode 100644 index 00000000000..d0346af82a4 --- /dev/null +++ b/packages/node-status-page/src/utils/getEthBalance.ts @@ -0,0 +1,8 @@ +import { ethers } from "ethers"; +export const getEthBalance = async ( + provider: ethers.providers.JsonRpcProvider, + address: string +): Promise => { + const b = await provider.getBalance(address); + return ethers.utils.formatEther(b); +}; diff --git a/packages/node-status-page/src/utils/getPendingBlocks.ts b/packages/node-status-page/src/utils/getPendingBlocks.ts new file mode 100644 index 00000000000..40a22fd064d --- /dev/null +++ b/packages/node-status-page/src/utils/getPendingBlocks.ts @@ -0,0 +1,13 @@ +import { Contract, ethers } from "ethers"; +import TaikoL1 from "../constants/abi/TaikoL1"; + +export const getPendingBlocks = async ( + provider: ethers.providers.JsonRpcProvider, + contractAddress: string +): Promise => { + const contract: Contract = new Contract(contractAddress, TaikoL1, provider); + const stateVariables = await contract.getStateVariables(); + const nextBlockId = stateVariables.nextBlockId; + const latestVerifiedId = stateVariables.latestVerifiedId; + return nextBlockId - latestVerifiedId - 1; +}; diff --git a/packages/node-status-page/src/utils/getPendingTransactions.ts b/packages/node-status-page/src/utils/getPendingTransactions.ts new file mode 100644 index 00000000000..87bf317ff87 --- /dev/null +++ b/packages/node-status-page/src/utils/getPendingTransactions.ts @@ -0,0 +1,9 @@ +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/node-status-page/src/utils/getProofCount.ts b/packages/node-status-page/src/utils/getProofCount.ts new file mode 100644 index 00000000000..d4dd553ce39 --- /dev/null +++ b/packages/node-status-page/src/utils/getProofCount.ts @@ -0,0 +1,21 @@ +import axios from "axios"; + +export type GetProofCountResponse = { + count: number; +}; +export const getProofCount = async ( + eventIndexerApiUrl: string, + address: string +): Promise => { + const getProofCountResp = await axios.get( + `${eventIndexerApiUrl}/eventByAddress`, + { + params: { + address: address, + event: "BlockProven", + }, + } + ); + + return getProofCountResp.data?.count || 0; +}; diff --git a/packages/node-status-page/src/utils/getProposalCount.ts b/packages/node-status-page/src/utils/getProposalCount.ts new file mode 100644 index 00000000000..e5b911908a8 --- /dev/null +++ b/packages/node-status-page/src/utils/getProposalCount.ts @@ -0,0 +1,22 @@ +import axios from "axios"; + +export type GetProposalCountResponse = { + count: number; +}; + +export const getProposalCount = async ( + eventIndexerApiUrl: string, + address: string +): Promise => { + const getProposalCountResp = await axios.get( + `${eventIndexerApiUrl}/eventByAddress`, + { + params: { + address: address, + event: "BlockProposed", + }, + } + ); + + return getProposalCountResp.data?.count || 0; +}; diff --git a/packages/node-status-page/src/utils/getQueuedTransactions.ts b/packages/node-status-page/src/utils/getQueuedTransactions.ts new file mode 100644 index 00000000000..7af83e52e3b --- /dev/null +++ b/packages/node-status-page/src/utils/getQueuedTransactions.ts @@ -0,0 +1,9 @@ +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/node-status-page/src/utils/getStateVariables.ts b/packages/node-status-page/src/utils/getStateVariables.ts new file mode 100644 index 00000000000..8d38c22430e --- /dev/null +++ b/packages/node-status-page/src/utils/getStateVariables.ts @@ -0,0 +1,10 @@ +import { BigNumber, Contract, ethers } from "ethers"; +import TaikoL1 from "../constants/abi/TaikoL1"; + +export const getStateVariables = async ( + provider: ethers.providers.JsonRpcProvider, + contractAddress: string +) => { + const contract: Contract = new Contract(contractAddress, TaikoL1, provider); + return await contract.getStateVariables(); +}; diff --git a/packages/node-status-page/src/utils/truncateString.ts b/packages/node-status-page/src/utils/truncateString.ts new file mode 100644 index 00000000000..3e969178e2d --- /dev/null +++ b/packages/node-status-page/src/utils/truncateString.ts @@ -0,0 +1,4 @@ +export const truncateString = (str: string, maxLength: number = 10) => { + if (!str) return ""; + return str.length > maxLength ? `${str.substring(0, maxLength)}` : str; +}; diff --git a/packages/node-status-page/src/vite-env.d.ts b/packages/node-status-page/src/vite-env.d.ts new file mode 100644 index 00000000000..4078e7476a2 --- /dev/null +++ b/packages/node-status-page/src/vite-env.d.ts @@ -0,0 +1,2 @@ +/// +/// diff --git a/packages/node-status-page/svelte.config.cjs b/packages/node-status-page/svelte.config.cjs new file mode 100644 index 00000000000..8bf5d4b3f50 --- /dev/null +++ b/packages/node-status-page/svelte.config.cjs @@ -0,0 +1,7 @@ +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/node-status-page/tailwind.config.cjs b/packages/node-status-page/tailwind.config.cjs new file mode 100644 index 00000000000..4de26d4f8ab --- /dev/null +++ b/packages/node-status-page/tailwind.config.cjs @@ -0,0 +1,53 @@ +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/node-status-page/tsconfig.json b/packages/node-status-page/tsconfig.json new file mode 100644 index 00000000000..9094dab45e5 --- /dev/null +++ b/packages/node-status-page/tsconfig.json @@ -0,0 +1,21 @@ +{ + "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/node-status-page/tsconfig.node.json b/packages/node-status-page/tsconfig.node.json new file mode 100644 index 00000000000..65dbdb96ae5 --- /dev/null +++ b/packages/node-status-page/tsconfig.node.json @@ -0,0 +1,8 @@ +{ + "compilerOptions": { + "composite": true, + "module": "ESNext", + "moduleResolution": "Node" + }, + "include": ["vite.config.ts"] +} diff --git a/packages/node-status-page/vite.config.ts b/packages/node-status-page/vite.config.ts new file mode 100644 index 00000000000..e90bff74dde --- /dev/null +++ b/packages/node-status-page/vite.config.ts @@ -0,0 +1,26 @@ +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", + }, + ], + }), + ], +}); From 8f4a81d7038c6a7f80931b9d6b2f381a0f721e7e Mon Sep 17 00:00:00 2001 From: Jeffery Walsh Date: Sun, 16 Apr 2023 01:16:13 -0700 Subject: [PATCH 2/6] wip --- .../src/components/details/Node.svelte | 70 +++++++++++++++++++ .../node-status-page/src/domain/syncing.ts | 6 ++ .../node-status-page/src/utils/getSyncing.ts | 19 +++++ 3 files changed, 95 insertions(+) create mode 100644 packages/node-status-page/src/domain/syncing.ts create mode 100644 packages/node-status-page/src/utils/getSyncing.ts diff --git a/packages/node-status-page/src/components/details/Node.svelte b/packages/node-status-page/src/components/details/Node.svelte index 54ed36b1010..999286bbf29 100644 --- a/packages/node-status-page/src/components/details/Node.svelte +++ b/packages/node-status-page/src/components/details/Node.svelte @@ -4,6 +4,8 @@ import { getPendingTransactions } from "../../utils/getPendingTransactions"; import type { Status, StatusIndicatorProp } from "../../domain/status"; import { getQueuedTransactions } from "../../utils/getQueuedTransactions"; + import { getSyncing } from "../../utils/getSyncing"; + import { onMount } from "svelte"; export let l1Provider: ethers.providers.JsonRpcProvider; export let l1TaikoAddress: string; @@ -39,6 +41,74 @@ "The current transactions in the mempool where the transaction nonce is not in sequence. They are currently non-processable.", }, ]; + + onMount(async () => { + const syncing = await getSyncing(l2Provider); + statusIndicators.push({ + status: syncing.synced ? "synced" : "syncing", + statusFunc: async ( + provider: ethers.providers.JsonRpcProvider, + contractAddress: string + ) => { + const s = await getSyncing(l2Provider); + return s.synced ? "synced" : "syncing"; + }, + watchStatusFunc: null, + provider: l2Provider, + contractAddress: "", + header: "Sync Status", + intervalInMs: 5000, + colorFunc: (value: Status) => { + if (value === "synced") return "green"; + return "red"; + }, + tooltip: "Whether the node is currently syncing.", + }); + + if (!syncing.synced) { + statusIndicators.push({ + status: syncing.currentBlock, + statusFunc: async ( + provider: ethers.providers.JsonRpcProvider, + contractAddress: string + ) => { + const s = await getSyncing(l2Provider); + return s.currentBlock; + }, + watchStatusFunc: null, + provider: l2Provider, + contractAddress: "", + header: "Current Block Sync Status", + intervalInMs: 3000, + colorFunc: (value: Status) => { + return "green"; + }, + tooltip: "Current Block Sync Status", + }); + + statusIndicators.push({ + status: syncing.highestBlock, + statusFunc: async ( + provider: ethers.providers.JsonRpcProvider, + contractAddress: string + ) => { + const s = await getSyncing(l2Provider); + return s.currentBlock; + }, + watchStatusFunc: null, + provider: l2Provider, + contractAddress: "", + header: "Highest Block Sync Status", + intervalInMs: 3000, + colorFunc: (value: Status) => { + return "green"; + }, + tooltip: "Highest Block Sync Status", + }); + } + + statusIndicators = statusIndicators; + });
diff --git a/packages/node-status-page/src/domain/syncing.ts b/packages/node-status-page/src/domain/syncing.ts new file mode 100644 index 00000000000..0930615286f --- /dev/null +++ b/packages/node-status-page/src/domain/syncing.ts @@ -0,0 +1,6 @@ +export type Syncing = { + currentBlock?: number; + startingBlock?: number; + highestBlock?: number; + synced: boolean; +}; diff --git a/packages/node-status-page/src/utils/getSyncing.ts b/packages/node-status-page/src/utils/getSyncing.ts new file mode 100644 index 00000000000..c6cc9a4977d --- /dev/null +++ b/packages/node-status-page/src/utils/getSyncing.ts @@ -0,0 +1,19 @@ +import { BigNumber, ethers } from "ethers"; +import type { Syncing } from "src/domain/syncing"; + +export const getSyncing = async ( + provider: ethers.providers.JsonRpcProvider +): Promise => { + const syncing = await provider.send("eth_syncing", []); + console.log(syncing); + if (!syncing) + return { + synced: true, + }; + + return { + synced: false, + currentBlock: BigNumber.from(syncing.currentBlock).toNumber(), + highestBlock: BigNumber.from(syncing.highestBlock).toNumber(), + }; +}; From cf8ce9180788a9e48637599404be02d2bc734dce Mon Sep 17 00:00:00 2001 From: Jeffery Walsh Date: Sun, 16 Apr 2023 01:31:32 -0700 Subject: [PATCH 3/6] listening, net version, peer count --- .../src/components/details/Node.svelte | 44 ++++++++++++++++++- .../src/utils/getListening.ts | 7 +++ .../src/utils/getNetVersion.ts | 8 ++++ .../src/utils/getPeerCount.ts | 8 ++++ 4 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 packages/node-status-page/src/utils/getListening.ts create mode 100644 packages/node-status-page/src/utils/getNetVersion.ts create mode 100644 packages/node-status-page/src/utils/getPeerCount.ts diff --git a/packages/node-status-page/src/components/details/Node.svelte b/packages/node-status-page/src/components/details/Node.svelte index 999286bbf29..c02bec8f64b 100644 --- a/packages/node-status-page/src/components/details/Node.svelte +++ b/packages/node-status-page/src/components/details/Node.svelte @@ -6,6 +6,9 @@ import { getQueuedTransactions } from "../../utils/getQueuedTransactions"; import { getSyncing } from "../../utils/getSyncing"; import { onMount } from "svelte"; + import { getPeers } from "../../utils/getPeerCount"; + import { getListening } from "../../utils/getListening"; + import { getNetVersion } from "../../utils/getNetVersion"; export let l1Provider: ethers.providers.JsonRpcProvider; export let l1TaikoAddress: string; @@ -40,6 +43,45 @@ tooltip: "The current transactions in the mempool where the transaction nonce is not in sequence. They are currently non-processable.", }, + { + statusFunc: getPeers, + watchStatusFunc: null, + provider: l2Provider, + contractAddress: "", + header: "Peers", + intervalInMs: 20000, + colorFunc: (value: Status) => { + if (Number(value) < 2) return "red"; + return "green"; + }, + tooltip: "Currently connected peers to your node", + }, + { + statusFunc: getListening, + watchStatusFunc: null, + provider: l2Provider, + contractAddress: "", + header: "Listening", + intervalInMs: 20000, + colorFunc: (value: Status) => { + if (!Boolean(value)) return "red"; + return "green"; + }, + tooltip: + "Whether your node is actively listening for network connections", + }, + { + statusFunc: getNetVersion, + watchStatusFunc: null, + provider: l2Provider, + contractAddress: "", + header: "Chain ID", + intervalInMs: 0, + colorFunc: (value: Status) => { + return "green"; + }, + tooltip: "Current chain ID of your node", + }, ]; onMount(async () => { @@ -93,7 +135,7 @@ contractAddress: string ) => { const s = await getSyncing(l2Provider); - return s.currentBlock; + return s.highestBlock; }, watchStatusFunc: null, provider: l2Provider, diff --git a/packages/node-status-page/src/utils/getListening.ts b/packages/node-status-page/src/utils/getListening.ts new file mode 100644 index 00000000000..b0df34a31a9 --- /dev/null +++ b/packages/node-status-page/src/utils/getListening.ts @@ -0,0 +1,7 @@ +import type { ethers } from "ethers"; + +export const getListening = async ( + provider: ethers.providers.JsonRpcProvider +): Promise => { + return await provider.send("net_listening", []); +}; diff --git a/packages/node-status-page/src/utils/getNetVersion.ts b/packages/node-status-page/src/utils/getNetVersion.ts new file mode 100644 index 00000000000..cbe58a120ef --- /dev/null +++ b/packages/node-status-page/src/utils/getNetVersion.ts @@ -0,0 +1,8 @@ +import { BigNumber, ethers } from "ethers"; + +export const getNetVersion = async ( + provider: ethers.providers.JsonRpcProvider +): Promise => { + const n = await provider.send("net_version", []); + return BigNumber.from(n).toNumber(); +}; diff --git a/packages/node-status-page/src/utils/getPeerCount.ts b/packages/node-status-page/src/utils/getPeerCount.ts new file mode 100644 index 00000000000..f22d43297c3 --- /dev/null +++ b/packages/node-status-page/src/utils/getPeerCount.ts @@ -0,0 +1,8 @@ +import { BigNumber, ethers } from "ethers"; + +export const getPeers = async ( + provider: ethers.providers.JsonRpcProvider +): Promise => { + const peers = await provider.send("net_peerCount", []); + return BigNumber.from(peers).toNumber(); +}; From 3d5978c26b17a9e9474ae667744fcd2759458e6b Mon Sep 17 00:00:00 2001 From: Jeffery Walsh Date: Tue, 18 Apr 2023 22:23:42 -0700 Subject: [PATCH 4/6] . --- .../src/constants/abi/TaikoL1.ts | 966 ++++++++++++------ .../src/utils/withdrawTaikoTokens.ts | 19 + 2 files changed, 649 insertions(+), 336 deletions(-) create mode 100644 packages/node-status-page/src/utils/withdrawTaikoTokens.ts diff --git a/packages/node-status-page/src/constants/abi/TaikoL1.ts b/packages/node-status-page/src/constants/abi/TaikoL1.ts index 72b441cd597..2d7ba7fd10e 100644 --- a/packages/node-status-page/src/constants/abi/TaikoL1.ts +++ b/packages/node-status-page/src/constants/abi/TaikoL1.ts @@ -1,12 +1,12 @@ export default [ { inputs: [], - name: "L1_0_FEE_BASE", + name: "L1_1559_X_SCALE_TOO_LARGE", type: "error", }, { inputs: [], - name: "L1_0_FEE_BASE", + name: "L1_1559_Y_SCALE_TOO_LARGE", type: "error", }, { @@ -16,177 +16,286 @@ export default [ }, { inputs: [], - name: "L1_ANCHOR_CALLDATA", + name: "L1_ALREADY_PROVEN", type: "error", }, { inputs: [], - name: "L1_ANCHOR_DEST", + name: "L1_BLOCK_ID", type: "error", }, { inputs: [], - name: "L1_ANCHOR_GAS_LIMIT", + name: "L1_BLOCK_ID", type: "error", }, { inputs: [], - name: "L1_ANCHOR_RECEIPT_ADDR", + name: "L1_BLOCK_ID", type: "error", }, { - inputs: [], - name: "L1_ANCHOR_RECEIPT_DATA", + inputs: [ + { + internalType: "uint64", + name: "id", + type: "uint64", + }, + { + internalType: "uint32", + name: "parentGasUsed", + type: "uint32", + }, + { + internalType: "bytes32", + name: "parentHash", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "conflictingBlockHash", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "conflictingSignalRoot", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "blockHash", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "signalRoot", + type: "bytes32", + }, + ], + name: "L1_CONFLICTING_PROOF", + type: "error", + }, + { + inputs: [ + { + internalType: "uint64", + name: "id", + type: "uint64", + }, + { + internalType: "uint32", + name: "parentGasUsed", + type: "uint32", + }, + { + internalType: "bytes32", + name: "parentHash", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "conflictingBlockHash", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "conflictingSignalRoot", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "blockHash", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "signalRoot", + type: "bytes32", + }, + ], + name: "L1_CONFLICTING_PROOF", type: "error", }, { inputs: [], - name: "L1_ANCHOR_RECEIPT_LOGS", + name: "L1_CONTRACT_NOT_ALLOWED", + 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_ANCHOR_RECEIPT_PROOF", + name: "L1_FORK_CHOICE_NOT_FOUND", type: "error", }, { inputs: [], - name: "L1_ANCHOR_RECEIPT_STATUS", + name: "L1_FORK_CHOICE_NOT_FOUND", type: "error", }, { inputs: [], - name: "L1_ANCHOR_RECEIPT_TOPICS", + name: "L1_INSUFFICIENT_ETHER", type: "error", }, { inputs: [], - name: "L1_ANCHOR_SIG_R", + name: "L1_INSUFFICIENT_TOKEN", type: "error", }, { inputs: [], - name: "L1_ANCHOR_SIG_S", + name: "L1_INSUFFICIENT_TOKEN", type: "error", }, { inputs: [], - name: "L1_ANCHOR_TX_PROOF", + name: "L1_INSUFFICIENT_TOKEN", type: "error", }, { inputs: [], - name: "L1_ANCHOR_TYPE", + name: "L1_INVALID_CONFIG", type: "error", }, { inputs: [], - name: "L1_BLOCK_NUMBER", + name: "L1_INVALID_CONFIG", type: "error", }, { inputs: [], - name: "L1_BLOCK_NUMBER", + name: "L1_INVALID_ETH_DEPOSIT", type: "error", }, { inputs: [], - name: "L1_CANNOT_BE_FIRST_PROVER", + name: "L1_INVALID_EVIDENCE", type: "error", }, { inputs: [], - name: "L1_COMMITTED", + name: "L1_INVALID_EVIDENCE", type: "error", }, { inputs: [], - name: "L1_CONFLICT_PROOF", + name: "L1_INVALID_L21559_PARAMS", type: "error", }, { inputs: [], - name: "L1_CONTRACT_NOT_ALLOWED", + name: "L1_INVALID_METADATA", type: "error", }, { inputs: [], - name: "L1_DUP_PROVERS", + name: "L1_INVALID_METADATA", type: "error", }, { inputs: [], - name: "L1_EXTRA_DATA", + name: "L1_INVALID_ORACLE", type: "error", }, { inputs: [], - name: "L1_GAS_LIMIT", + name: "L1_INVALID_ORACLE", type: "error", }, { inputs: [], - name: "L1_ID", + name: "L1_INVALID_PARAM", type: "error", }, { inputs: [], - name: "L1_ID", + name: "L1_INVALID_PARAM", type: "error", }, { inputs: [], - name: "L1_INPUT_SIZE", + name: "L1_INVALID_PROOF", type: "error", }, { inputs: [], - name: "L1_INVALID_CONFIG", + name: "L1_INVALID_PROOF", type: "error", }, { inputs: [], - name: "L1_INVALID_CONFIG", + name: "L1_NOT_ORACLE_PROVEN", type: "error", }, { inputs: [], - name: "L1_INVALID_PARAM", + name: "L1_NOT_ORACLE_PROVEN", type: "error", }, { inputs: [], - name: "L1_METADATA_FIELD", + name: "L1_NOT_ORACLE_PROVER", type: "error", }, { inputs: [], - name: "L1_META_MISMATCH", + name: "L1_NOT_ORACLE_PROVER", type: "error", }, { inputs: [], - name: "L1_NOT_COMMITTED", + name: "L1_NOT_SOLO_PROPOSER", type: "error", }, { inputs: [], - name: "L1_NOT_ORACLE_PROVER", + name: "L1_NOT_SOLO_PROPOSER", type: "error", }, { inputs: [], - name: "L1_PROOF_LENGTH", + name: "L1_ORACLE_DISABLED", type: "error", }, { inputs: [], - name: "L1_PROVER", + name: "L1_ORACLE_DISABLED", type: "error", }, { inputs: [], - name: "L1_SOLO_PROPOSER", + name: "L1_TOO_MANY_BLOCKS", type: "error", }, { @@ -201,37 +310,53 @@ export default [ }, { inputs: [], - name: "L1_ZKP", + name: "L1_TX_LIST", type: "error", }, { inputs: [], - name: "RESOLVER_DENIED", + name: "L1_TX_LIST_HASH", type: "error", }, { inputs: [], - name: "RESOLVER_INVALID_ADDR", + name: "L1_TX_LIST_HASH", type: "error", }, { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "uint64", - name: "commitSlot", - type: "uint64", - }, - { - indexed: false, - internalType: "bytes32", - name: "commitHash", - type: "bytes32", - }, - ], - name: "BlockCommitted", - type: "event", + 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: "L1_UNEXPECTED_FORK_CHOICE_ID", + type: "error", + }, + { + inputs: [], + name: "RESOLVER_DENIED", + type: "error", + }, + { + inputs: [], + name: "RESOLVER_INVALID_ADDR", + type: "error", }, { anonymous: false, @@ -245,14 +370,19 @@ export default [ { components: [ { - internalType: "uint256", + internalType: "uint64", name: "id", - type: "uint256", + type: "uint64", }, { - internalType: "uint256", + internalType: "uint64", + name: "timestamp", + type: "uint64", + }, + { + internalType: "uint64", name: "l1Height", - type: "uint256", + type: "uint64", }, { internalType: "bytes32", @@ -260,44 +390,66 @@ export default [ type: "bytes32", }, { - internalType: "address", - name: "beneficiary", - type: "address", + internalType: "bytes32", + name: "mixHash", + type: "bytes32", }, { internalType: "bytes32", - name: "txListHash", + name: "depositsRoot", type: "bytes32", }, { internalType: "bytes32", - name: "mixHash", + name: "txListHash", type: "bytes32", }, { - internalType: "bytes", - name: "extraData", - type: "bytes", + internalType: "uint24", + name: "txListByteStart", + type: "uint24", }, { - internalType: "uint64", + internalType: "uint24", + name: "txListByteEnd", + type: "uint24", + }, + { + internalType: "uint32", name: "gasLimit", - type: "uint64", + type: "uint32", }, { - internalType: "uint64", - name: "timestamp", - type: "uint64", + internalType: "address", + name: "beneficiary", + type: "address", }, { - internalType: "uint64", - name: "commitHeight", - type: "uint64", + internalType: "uint8", + name: "cacheTxListInfo", + type: "uint8", }, { - internalType: "uint64", - name: "commitSlot", - type: "uint64", + internalType: "address", + name: "treasure", + 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, @@ -332,15 +484,15 @@ export default [ }, { indexed: false, - internalType: "address", - name: "prover", - type: "address", + internalType: "bytes32", + name: "signalRoot", + type: "bytes32", }, { indexed: false, - internalType: "uint64", - name: "provenAt", - type: "uint64", + internalType: "address", + name: "prover", + type: "address", }, ], name: "BlockProven", @@ -369,19 +521,25 @@ export default [ anonymous: false, inputs: [ { - indexed: true, - internalType: "uint256", - name: "srcHeight", - type: "uint256", - }, - { + components: [ + { + internalType: "address", + name: "recipient", + type: "address", + }, + { + internalType: "uint96", + name: "amount", + type: "uint96", + }, + ], indexed: false, - internalType: "bytes32", - name: "srcHash", - type: "bytes32", + internalType: "struct TaikoData.EthDeposit", + name: "deposit", + type: "tuple", }, ], - name: "HeaderSynced", + name: "EthDeposited", type: "event", }, { @@ -416,6 +574,31 @@ export default [ name: "OwnershipTransferred", 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: "XchainSynced", + type: "event", + }, { inputs: [], name: "addressManager", @@ -429,22 +612,77 @@ export default [ 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: "address", + name: "addr", + type: "address", + }, + ], + name: "getBalance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, { inputs: [ { - internalType: "uint64", - name: "commitSlot", - type: "uint64", + internalType: "uint256", + name: "blockId", + type: "uint256", }, + ], + name: "getBlock", + outputs: [ { internalType: "bytes32", - name: "commitHash", + name: "_metaHash", type: "bytes32", }, + { + internalType: "uint256", + name: "_deposit", + type: "uint256", + }, + { + internalType: "address", + name: "_proposer", + type: "address", + }, + { + internalType: "uint64", + name: "_proposedAt", + type: "uint64", + }, ], - name: "commitBlock", - outputs: [], - stateMutability: "nonpayable", + stateMutability: "view", type: "function", }, { @@ -453,7 +691,12 @@ export default [ outputs: [ { internalType: "uint256", - name: "", + name: "feeAmount", + type: "uint256", + }, + { + internalType: "uint256", + name: "depositAmount", type: "uint256", }, ], @@ -473,22 +716,22 @@ export default [ }, { internalType: "uint256", - name: "maxNumBlocks", + name: "maxNumProposedBlocks", type: "uint256", }, { internalType: "uint256", - name: "blockHashHistory", + name: "ringBufferSize", type: "uint256", }, { internalType: "uint256", - name: "maxVerificationsPerTx", + name: "maxNumVerifiedBlocks", type: "uint256", }, { internalType: "uint256", - name: "commitConfirmations", + name: "maxVerificationsPerTx", type: "uint256", }, { @@ -511,11 +754,6 @@ export default [ name: "minTxGasLimit", type: "uint256", }, - { - internalType: "uint256", - name: "anchorTxGasLimit", - type: "uint256", - }, { internalType: "uint256", name: "slotSmoothingFactor", @@ -531,187 +769,153 @@ export default [ name: "proposerDepositPctg", type: "uint256", }, - { - internalType: "uint256", - name: "feeBaseMAF", - type: "uint256", - }, - { - internalType: "uint256", - name: "blockTimeMAF", - type: "uint256", - }, - { - internalType: "uint256", - name: "proofTimeMAF", - type: "uint256", - }, { internalType: "uint64", - name: "rewardMultiplierPctg", + name: "numEthDepositPerBlock", type: "uint64", }, { - internalType: "uint64", - name: "feeGracePeriodPctg", - type: "uint64", + internalType: "uint96", + name: "maxEthDepositAmount", + type: "uint96", }, { - internalType: "uint64", - name: "feeMaxPeriodPctg", - type: "uint64", + internalType: "uint96", + name: "minEthDepositAmount", + type: "uint96", }, { - internalType: "uint64", - name: "blockTimeCap", - type: "uint64", + internalType: "uint256", + name: "feeBaseMAF", + type: "uint256", }, { - internalType: "uint64", - name: "proofTimeCap", - type: "uint64", + internalType: "uint256", + name: "txListCacheExpiry", + type: "uint256", }, { - internalType: "uint64", - name: "bootstrapDiscountHalvingPeriod", - type: "uint64", + internalType: "bool", + name: "relaySignalRoot", + type: "bool", }, { internalType: "bool", - name: "enableTokenomics", + name: "enableSoloProposer", type: "bool", }, { internalType: "bool", - name: "enablePublicInputsCheck", + name: "enableOracleProver", type: "bool", }, { internalType: "bool", - name: "enableAnchorValidation", + name: "enableTokenomics", type: "bool", }, - ], - internalType: "struct TaikoData.Config", - name: "", - type: "tuple", - }, - ], - stateMutability: "pure", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "id", - type: "uint256", - }, - { - internalType: "bytes32", - name: "parentHash", - type: "bytes32", - }, - ], - name: "getForkChoice", - outputs: [ - { - components: [ { - internalType: "bytes32", - name: "blockHash", - type: "bytes32", + internalType: "bool", + name: "skipZKPVerification", + type: "bool", }, { - internalType: "address", - name: "prover", - type: "address", + components: [ + { + internalType: "uint16", + name: "avgTimeMAF", + type: "uint16", + }, + { + internalType: "uint16", + name: "dampingFactorBips", + type: "uint16", + }, + ], + internalType: "struct TaikoData.FeeConfig", + name: "proposingConfig", + type: "tuple", }, { - internalType: "uint64", - name: "provenAt", - type: "uint64", + components: [ + { + internalType: "uint16", + name: "avgTimeMAF", + type: "uint16", + }, + { + internalType: "uint16", + name: "dampingFactorBips", + type: "uint16", + }, + ], + internalType: "struct TaikoData.FeeConfig", + name: "provingConfig", + type: "tuple", }, ], - internalType: "struct TaikoData.ForkChoice", - name: "", - type: "tuple", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "getLatestSyncedHeader", - outputs: [ - { - internalType: "bytes32", + internalType: "struct TaikoData.Config", name: "", - type: "bytes32", + type: "tuple", }, ], - stateMutability: "view", + stateMutability: "pure", type: "function", }, { inputs: [ - { - internalType: "uint64", - name: "provenAt", - type: "uint64", - }, - { - internalType: "uint64", - name: "proposedAt", - type: "uint64", - }, - ], - name: "getProofReward", - outputs: [ { internalType: "uint256", - name: "reward", + name: "blockId", type: "uint256", }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ { - internalType: "uint256", - name: "id", - type: "uint256", + internalType: "bytes32", + name: "parentHash", + type: "bytes32", + }, + { + internalType: "uint32", + name: "parentGasUsed", + type: "uint32", }, ], - name: "getProposedBlock", + name: "getForkChoice", outputs: [ { components: [ { internalType: "bytes32", - name: "metaHash", + name: "key", type: "bytes32", }, { - internalType: "uint256", - name: "deposit", - type: "uint256", + internalType: "bytes32", + name: "blockHash", + type: "bytes32", }, { - internalType: "address", - name: "proposer", - type: "address", + internalType: "bytes32", + name: "signalRoot", + type: "bytes32", }, { internalType: "uint64", - name: "proposedAt", + name: "provenAt", type: "uint64", }, + { + internalType: "address", + name: "prover", + type: "address", + }, + { + internalType: "uint32", + name: "gasUsed", + type: "uint32", + }, ], - internalType: "struct TaikoData.ProposedBlock", + internalType: "struct TaikoData.ForkChoice", name: "", type: "tuple", }, @@ -722,16 +926,21 @@ export default [ { inputs: [ { - internalType: "address", - name: "addr", - type: "address", + internalType: "uint64", + name: "provenAt", + type: "uint64", + }, + { + internalType: "uint64", + name: "proposedAt", + type: "uint64", }, ], - name: "getRewardBalance", + name: "getProofReward", outputs: [ { internalType: "uint256", - name: "", + name: "reward", type: "uint256", }, ], @@ -745,9 +954,9 @@ export default [ { components: [ { - internalType: "uint256", + internalType: "uint64", name: "feeBase", - type: "uint256", + type: "uint64", }, { internalType: "uint64", @@ -761,12 +970,12 @@ export default [ }, { internalType: "uint64", - name: "nextBlockId", + name: "numBlocks", type: "uint64", }, { internalType: "uint64", - name: "lastProposedAt", + name: "lastVerifiedBlockId", type: "uint64", }, { @@ -776,21 +985,26 @@ export default [ }, { internalType: "uint64", - name: "latestVerifiedHeight", + name: "avgProofTime", + type: "uint64", + }, + { + internalType: "uint64", + name: "lastProposedAt", type: "uint64", }, { internalType: "uint64", - name: "latestVerifiedId", + name: "nextEthDepositToProcess", type: "uint64", }, { internalType: "uint64", - name: "avgProofTime", + name: "numEthDeposits", type: "uint64", }, ], - internalType: "struct LibUtils.StateVariables", + internalType: "struct TaikoData.StateVariables", name: "", type: "tuple", }, @@ -802,11 +1016,30 @@ export default [ inputs: [ { internalType: "uint256", - name: "number", + name: "blockId", + type: "uint256", + }, + ], + name: "getXchainBlockHash", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "blockId", type: "uint256", }, ], - name: "getSyncedHeader", + name: "getXchainSignalRoot", outputs: [ { internalType: "bytes32", @@ -824,16 +1057,16 @@ export default [ name: "_addressManager", type: "address", }, + { + internalType: "uint64", + name: "_feeBase", + type: "uint64", + }, { internalType: "bytes32", name: "_genesisBlockHash", type: "bytes32", }, - { - internalType: "uint256", - name: "_feeBase", - type: "uint256", - }, ], name: "init", outputs: [], @@ -844,29 +1077,42 @@ export default [ inputs: [ { internalType: "uint256", - name: "commitSlot", - type: "uint256", - }, - { - internalType: "uint256", - name: "commitHeight", + name: "chainId", type: "uint256", }, { - internalType: "bytes32", - name: "commitHash", - type: "bytes32", + internalType: "string", + name: "name", + type: "string", }, ], - name: "isCommitValid", + name: "keyForName", outputs: [ { - internalType: "bool", + internalType: "string", name: "", - type: "bool", + type: "string", }, ], - stateMutability: "view", + stateMutability: "pure", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "blockId", + type: "uint256", + }, + { + internalType: "bytes", + name: "input", + type: "bytes", + }, + ], + name: "oracleProveBlocks", + outputs: [], + stateMutability: "nonpayable", type: "function", }, { @@ -885,31 +1131,108 @@ export default [ { inputs: [ { - internalType: "bytes[]", - name: "inputs", - type: "bytes[]", + internalType: "bytes", + name: "input", + type: "bytes", }, - ], - name: "proposeBlock", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ { - internalType: "uint256", - name: "blockId", - type: "uint256", + internalType: "bytes", + name: "txList", + type: "bytes", }, + ], + name: "proposeBlock", + outputs: [ { - internalType: "bytes[]", - name: "inputs", - type: "bytes[]", + 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: "depositsRoot", + 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: "uint8", + name: "cacheTxListInfo", + type: "uint8", + }, + { + internalType: "address", + name: "treasure", + 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", }, ], - name: "proveBlock", - outputs: [], stateMutability: "nonpayable", type: "function", }, @@ -921,12 +1244,12 @@ export default [ type: "uint256", }, { - internalType: "bytes[]", - name: "inputs", - type: "bytes[]", + internalType: "bytes", + name: "input", + type: "bytes", }, ], - name: "proveBlockInvalid", + name: "proveBlock", outputs: [], stateMutability: "nonpayable", type: "function", @@ -991,40 +1314,6 @@ export default [ stateMutability: "view", type: "function", }, - { - inputs: [ - { - internalType: "bytes32", - name: "hash", - type: "bytes32", - }, - { - internalType: "uint8", - name: "k", - type: "uint8", - }, - ], - name: "signWithGoldenTouch", - outputs: [ - { - internalType: "uint8", - name: "v", - type: "uint8", - }, - { - internalType: "uint256", - name: "r", - type: "uint256", - }, - { - internalType: "uint256", - name: "s", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, { inputs: [], name: "state", @@ -1041,22 +1330,17 @@ export default [ }, { internalType: "uint64", - name: "__reservedA1", + name: "__reserved1", type: "uint64", }, { internalType: "uint64", - name: "__reservedA2", + name: "__reserved2", type: "uint64", }, - { - internalType: "uint256", - name: "feeBase", - type: "uint256", - }, { internalType: "uint64", - name: "nextBlockId", + name: "numBlocks", type: "uint64", }, { @@ -1071,17 +1355,17 @@ export default [ }, { internalType: "uint64", - name: "__avgGasLimit", + name: "nextEthDepositToProcess", type: "uint64", }, { internalType: "uint64", - name: "latestVerifiedHeight", + name: "lastVerifiedBlockId", type: "uint64", }, { internalType: "uint64", - name: "latestVerifiedId", + name: "__reserved4", type: "uint64", }, { @@ -1091,7 +1375,7 @@ export default [ }, { internalType: "uint64", - name: "__reservedC1", + name: "feeBase", type: "uint64", }, ], @@ -1125,10 +1409,20 @@ export default [ type: "function", }, { - inputs: [], - name: "withdrawBalance", + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "withdrawTaikoToken", outputs: [], stateMutability: "nonpayable", type: "function", }, + { + stateMutability: "payable", + type: "receive", + }, ]; diff --git a/packages/node-status-page/src/utils/withdrawTaikoTokens.ts b/packages/node-status-page/src/utils/withdrawTaikoTokens.ts new file mode 100644 index 00000000000..716df21ed8a --- /dev/null +++ b/packages/node-status-page/src/utils/withdrawTaikoTokens.ts @@ -0,0 +1,19 @@ +import { ethers } from "ethers"; + +export async function withdrawTaikoTokens( + signer: ethers.Signer, + chains: Chains, + providers: Providers +) { + const contract = new ethers.Contract( + chains[transaction.toChainId].bridgeAddress, + BridgeABI, + provider + ); + + const contract = new ethers.Contract( + chains[transaction.toChainId].bridgeAddress, + BridgeABI, + providers[chains[transaction.toChainId].id] + ); +} From 6836871102bba7e18b4388178db4f27a7b94d13b Mon Sep 17 00:00:00 2001 From: Jeffery Walsh Date: Tue, 18 Apr 2023 23:39:20 -0700 Subject: [PATCH 5/6] add tests --- go.mod | 2 + go.sum | 1 + packages/eventindexer/event.go | 8 + .../get_count_by_address_and_event_test.go | 68 + .../eventindexer/http/get_unique_proposers.go | 28 + .../http/get_unique_proposers_test.go | 56 + .../http/get_unique_provers_test.go | 56 + packages/eventindexer/http/routes.go | 1 + packages/eventindexer/http/server_test.go | 125 ++ .../indexer/save_block_proposed_event.go | 4 +- .../eventindexer/mock/block_repository.go | 31 + .../eventindexer/mock/event_repository.go | 59 + packages/eventindexer/mock/types.go | 10 + packages/eventindexer/repo/block_test.go | 99 ++ packages/eventindexer/repo/containers_test.go | 77 + packages/eventindexer/repo/event.go | 18 +- packages/eventindexer/repo/event_test.go | 211 +++ packages/node-status-page/.babelrc | 8 - packages/node-status-page/.default.env | 8 - packages/node-status-page/.gitignore | 30 - packages/node-status-page/CHANGELOG.md | 64 - packages/node-status-page/Dockerfile | 5 - packages/node-status-page/README.md | 3 - packages/node-status-page/index.html | 20 - packages/node-status-page/jest.config.js | 55 - packages/node-status-page/package.json | 74 - packages/node-status-page/postcss.config.cjs | 6 - .../node-status-page/public/taiko-favicon.png | Bin 7618 -> 0 bytes packages/node-status-page/src/App.svelte | 62 - packages/node-status-page/src/app.css | 67 - .../src/assets/lottie/loader.json | 1 - .../src/assets/taiko-banner.svg | 15 - .../src/components/DetailsModal.svelte | 17 - .../src/components/Loader.svelte | 16 - .../src/components/Modal.svelte | 47 - .../src/components/Navbar.svelte | 7 - .../src/components/StatusIndicator.svelte | 114 -- .../src/components/Tooltip.svelte | 11 - .../src/components/TooltipModal.svelte | 17 - .../src/components/details/Node.svelte | 177 -- .../src/components/details/Proposer.svelte | 12 - .../src/components/details/Prover.svelte | 78 - .../src/components/icons/Loader.svelte | 16 - .../src/components/icons/TaikoLogo.svelte | 62 - .../components/providers/BaseQueries.svelte | 1 - .../components/providers/QueryProvider.svelte | 13 - .../src/constants/abi/Bridge.ts | 726 --------- .../src/constants/abi/HeaderSync.ts | 53 - .../src/constants/abi/TaikoL1.ts | 1428 ----------------- .../node-status-page/src/domain/status.ts | 24 - .../node-status-page/src/domain/syncing.ts | 6 - packages/node-status-page/src/i18n.js | 41 - packages/node-status-page/src/main.ts | 12 - .../src/pages/home/Home.svelte | 50 - .../src/utils/addressSubsection.ts | 4 - .../src/utils/displayStatusValue.ts | 15 - .../node-status-page/src/utils/getConfig.ts | 10 - .../src/utils/getEthBalance.ts | 8 - .../src/utils/getListening.ts | 7 - .../src/utils/getNetVersion.ts | 8 - .../src/utils/getPeerCount.ts | 8 - .../src/utils/getPendingBlocks.ts | 13 - .../src/utils/getPendingTransactions.ts | 9 - .../src/utils/getProofCount.ts | 21 - .../src/utils/getProposalCount.ts | 22 - .../src/utils/getQueuedTransactions.ts | 9 - .../src/utils/getStateVariables.ts | 10 - .../node-status-page/src/utils/getSyncing.ts | 19 - .../src/utils/truncateString.ts | 4 - .../src/utils/withdrawTaikoTokens.ts | 19 - packages/node-status-page/src/vite-env.d.ts | 2 - packages/node-status-page/svelte.config.cjs | 7 - packages/node-status-page/tailwind.config.cjs | 53 - packages/node-status-page/tsconfig.json | 21 - packages/node-status-page/tsconfig.node.json | 8 - packages/node-status-page/vite.config.ts | 26 - 76 files changed, 852 insertions(+), 3651 deletions(-) create mode 100644 packages/eventindexer/http/get_count_by_address_and_event_test.go create mode 100644 packages/eventindexer/http/get_unique_proposers.go create mode 100644 packages/eventindexer/http/get_unique_proposers_test.go create mode 100644 packages/eventindexer/http/get_unique_provers_test.go create mode 100644 packages/eventindexer/http/server_test.go create mode 100644 packages/eventindexer/mock/block_repository.go create mode 100644 packages/eventindexer/mock/event_repository.go create mode 100644 packages/eventindexer/mock/types.go create mode 100644 packages/eventindexer/repo/block_test.go create mode 100644 packages/eventindexer/repo/containers_test.go create mode 100644 packages/eventindexer/repo/event_test.go delete mode 100644 packages/node-status-page/.babelrc delete mode 100644 packages/node-status-page/.default.env delete mode 100644 packages/node-status-page/.gitignore delete mode 100644 packages/node-status-page/CHANGELOG.md delete mode 100644 packages/node-status-page/Dockerfile delete mode 100644 packages/node-status-page/README.md delete mode 100644 packages/node-status-page/index.html delete mode 100644 packages/node-status-page/jest.config.js delete mode 100644 packages/node-status-page/package.json delete mode 100644 packages/node-status-page/postcss.config.cjs delete mode 100644 packages/node-status-page/public/taiko-favicon.png delete mode 100644 packages/node-status-page/src/App.svelte delete mode 100644 packages/node-status-page/src/app.css delete mode 100644 packages/node-status-page/src/assets/lottie/loader.json delete mode 100644 packages/node-status-page/src/assets/taiko-banner.svg delete mode 100644 packages/node-status-page/src/components/DetailsModal.svelte delete mode 100644 packages/node-status-page/src/components/Loader.svelte delete mode 100644 packages/node-status-page/src/components/Modal.svelte delete mode 100644 packages/node-status-page/src/components/Navbar.svelte delete mode 100644 packages/node-status-page/src/components/StatusIndicator.svelte delete mode 100644 packages/node-status-page/src/components/Tooltip.svelte delete mode 100644 packages/node-status-page/src/components/TooltipModal.svelte delete mode 100644 packages/node-status-page/src/components/details/Node.svelte delete mode 100644 packages/node-status-page/src/components/details/Proposer.svelte delete mode 100644 packages/node-status-page/src/components/details/Prover.svelte delete mode 100644 packages/node-status-page/src/components/icons/Loader.svelte delete mode 100644 packages/node-status-page/src/components/icons/TaikoLogo.svelte delete mode 100644 packages/node-status-page/src/components/providers/BaseQueries.svelte delete mode 100644 packages/node-status-page/src/components/providers/QueryProvider.svelte delete mode 100644 packages/node-status-page/src/constants/abi/Bridge.ts delete mode 100644 packages/node-status-page/src/constants/abi/HeaderSync.ts delete mode 100644 packages/node-status-page/src/constants/abi/TaikoL1.ts delete mode 100644 packages/node-status-page/src/domain/status.ts delete mode 100644 packages/node-status-page/src/domain/syncing.ts delete mode 100644 packages/node-status-page/src/i18n.js delete mode 100644 packages/node-status-page/src/main.ts delete mode 100644 packages/node-status-page/src/pages/home/Home.svelte delete mode 100644 packages/node-status-page/src/utils/addressSubsection.ts delete mode 100644 packages/node-status-page/src/utils/displayStatusValue.ts delete mode 100644 packages/node-status-page/src/utils/getConfig.ts delete mode 100644 packages/node-status-page/src/utils/getEthBalance.ts delete mode 100644 packages/node-status-page/src/utils/getListening.ts delete mode 100644 packages/node-status-page/src/utils/getNetVersion.ts delete mode 100644 packages/node-status-page/src/utils/getPeerCount.ts delete mode 100644 packages/node-status-page/src/utils/getPendingBlocks.ts delete mode 100644 packages/node-status-page/src/utils/getPendingTransactions.ts delete mode 100644 packages/node-status-page/src/utils/getProofCount.ts delete mode 100644 packages/node-status-page/src/utils/getProposalCount.ts delete mode 100644 packages/node-status-page/src/utils/getQueuedTransactions.ts delete mode 100644 packages/node-status-page/src/utils/getStateVariables.ts delete mode 100644 packages/node-status-page/src/utils/getSyncing.ts delete mode 100644 packages/node-status-page/src/utils/truncateString.ts delete mode 100644 packages/node-status-page/src/utils/withdrawTaikoTokens.ts delete mode 100644 packages/node-status-page/src/vite-env.d.ts delete mode 100644 packages/node-status-page/svelte.config.cjs delete mode 100644 packages/node-status-page/tailwind.config.cjs delete mode 100644 packages/node-status-page/tsconfig.json delete mode 100644 packages/node-status-page/tsconfig.node.json delete mode 100644 packages/node-status-page/vite.config.ts diff --git a/go.mod b/go.mod index 81342e5d8ec..db1eebfc138 100644 --- a/go.mod +++ b/go.mod @@ -23,6 +23,7 @@ require ( gorm.io/datatypes v1.0.7 gorm.io/driver/mysql v1.4.3 gorm.io/gorm v1.24.6 + gotest.tools v2.2.0+incompatible ) require ( @@ -57,6 +58,7 @@ require ( github.com/golang-jwt/jwt/v4 v4.4.3 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.2 // indirect + github.com/google/go-cmp v0.5.9 // indirect github.com/google/uuid v1.3.0 // indirect github.com/gorilla/css v1.0.0 // indirect github.com/gorilla/websocket v1.4.2 // indirect diff --git a/go.sum b/go.sum index de48a670c17..ef02b7d5a32 100644 --- a/go.sum +++ b/go.sum @@ -451,6 +451,7 @@ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-containerregistry v0.5.1/go.mod h1:Ct15B4yir3PLOP5jsy0GNeYVaIZs/MK/Jz5any1wFW0= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= diff --git a/packages/eventindexer/event.go b/packages/eventindexer/event.go index aa2c6060582..750f2a680c2 100644 --- a/packages/eventindexer/event.go +++ b/packages/eventindexer/event.go @@ -38,11 +38,19 @@ type UniqueProversResponse struct { Count int `json:"count"` } +type UniqueProposersResponse struct { + Address string `json:"address"` + Count int `json:"count"` +} + // EventRepository is used to interact with events in the store type EventRepository interface { Save(ctx context.Context, opts SaveEventOpts) (*Event, error) FindUniqueProvers( ctx context.Context, ) ([]UniqueProversResponse, error) + FindUniqueProposers( + ctx context.Context, + ) ([]UniqueProposersResponse, error) GetCountByAddressAndEventName(ctx context.Context, address string, event string) (int, error) } diff --git a/packages/eventindexer/http/get_count_by_address_and_event_test.go b/packages/eventindexer/http/get_count_by_address_and_event_test.go new file mode 100644 index 00000000000..bbcacc9ecfd --- /dev/null +++ b/packages/eventindexer/http/get_count_by_address_and_event_test.go @@ -0,0 +1,68 @@ +package http + +import ( + "context" + "fmt" + "math/big" + "net/http" + "net/http/httptest" + "testing" + + "github.com/cyberhorsey/webutils/testutils" + "github.com/labstack/echo/v4" + "github.com/stretchr/testify/assert" + "github.com/taikoxyz/taiko-mono/packages/eventindexer" +) + +func Test_GetCountByAddressAndEvent(t *testing.T) { + srv := newTestServer("") + + _, err := srv.eventRepo.Save(context.Background(), eventindexer.SaveEventOpts{ + Name: "name", + Data: `{"Owner": "0x0000000000000000000000000000000000000123"}`, + ChainID: big.NewInt(167001), + Address: "0x123", + Event: eventindexer.EventNameBlockProposed, + }) + + assert.Equal(t, nil, err) + + tests := []struct { + name string + address string + event string + wantStatus int + wantBodyRegexpMatches []string + }{ + { + "successZeroCount", + "0xhasntProposedAnything", + eventindexer.EventNameBlockProposed, + http.StatusOK, + []string{`{"count":0`}, + }, + { + "success", + "0x123", + eventindexer.EventNameBlockProposed, + http.StatusOK, + []string{`{"count":1`}, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + req := testutils.NewUnauthenticatedRequest( + echo.GET, + fmt.Sprintf("/eventByAddress?address=%v&event=%v", tt.address, tt.event), + nil, + ) + + rec := httptest.NewRecorder() + + srv.ServeHTTP(rec, req) + + testutils.AssertStatusAndBody(t, rec, tt.wantStatus, tt.wantBodyRegexpMatches) + }) + } +} diff --git a/packages/eventindexer/http/get_unique_proposers.go b/packages/eventindexer/http/get_unique_proposers.go new file mode 100644 index 00000000000..f29f94a466a --- /dev/null +++ b/packages/eventindexer/http/get_unique_proposers.go @@ -0,0 +1,28 @@ +package http + +import ( + "net/http" + + "github.com/cyberhorsey/webutils" + "github.com/labstack/echo/v4" + "github.com/taikoxyz/taiko-mono/packages/eventindexer" +) + +type uniqueProposersResp struct { + Proposers []eventindexer.UniqueProposersResponse `json:"proposers"` + UniqueProposers int `json:"uniqueProposers"` +} + +func (srv *Server) GetUniqueProposers(c echo.Context) error { + proposers, err := srv.eventRepo.FindUniqueProposers( + c.Request().Context(), + ) + if err != nil { + return webutils.LogAndRenderErrors(c, http.StatusUnprocessableEntity, err) + } + + return c.JSON(http.StatusOK, &uniqueProposersResp{ + Proposers: proposers, + UniqueProposers: len(proposers), + }) +} diff --git a/packages/eventindexer/http/get_unique_proposers_test.go b/packages/eventindexer/http/get_unique_proposers_test.go new file mode 100644 index 00000000000..709a9607806 --- /dev/null +++ b/packages/eventindexer/http/get_unique_proposers_test.go @@ -0,0 +1,56 @@ +package http + +import ( + "context" + "math/big" + "net/http" + "net/http/httptest" + "testing" + + "github.com/cyberhorsey/webutils/testutils" + "github.com/labstack/echo/v4" + "github.com/stretchr/testify/assert" + "github.com/taikoxyz/taiko-mono/packages/eventindexer" +) + +func Test_GetUniqueProposers(t *testing.T) { + srv := newTestServer("") + + _, err := srv.eventRepo.Save(context.Background(), eventindexer.SaveEventOpts{ + Name: "name", + Data: `{"Owner": "0x0000000000000000000000000000000000000123"}`, + ChainID: big.NewInt(167001), + Address: "0x123", + Event: eventindexer.EventNameBlockProposed, + }) + + assert.Equal(t, nil, err) + + tests := []struct { + name string + wantStatus int + wantBodyRegexpMatches []string + }{ + { + "successEmptyList", + http.StatusOK, + []string{`\[\]`}, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + req := testutils.NewUnauthenticatedRequest( + echo.GET, + "/uniqueProposers", + nil, + ) + + rec := httptest.NewRecorder() + + srv.ServeHTTP(rec, req) + + testutils.AssertStatusAndBody(t, rec, tt.wantStatus, tt.wantBodyRegexpMatches) + }) + } +} diff --git a/packages/eventindexer/http/get_unique_provers_test.go b/packages/eventindexer/http/get_unique_provers_test.go new file mode 100644 index 00000000000..e6bf5bc426b --- /dev/null +++ b/packages/eventindexer/http/get_unique_provers_test.go @@ -0,0 +1,56 @@ +package http + +import ( + "context" + "math/big" + "net/http" + "net/http/httptest" + "testing" + + "github.com/cyberhorsey/webutils/testutils" + "github.com/labstack/echo/v4" + "github.com/stretchr/testify/assert" + "github.com/taikoxyz/taiko-mono/packages/eventindexer" +) + +func Test_GetUniqueProvers(t *testing.T) { + srv := newTestServer("") + + _, err := srv.eventRepo.Save(context.Background(), eventindexer.SaveEventOpts{ + Name: "name", + Data: `{"Owner": "0x0000000000000000000000000000000000000123"}`, + ChainID: big.NewInt(167001), + Address: "0x123", + Event: eventindexer.EventNameBlockProven, + }) + + assert.Equal(t, nil, err) + + tests := []struct { + name string + wantStatus int + wantBodyRegexpMatches []string + }{ + { + "successEmptyList", + http.StatusOK, + []string{`\[\]`}, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + req := testutils.NewUnauthenticatedRequest( + echo.GET, + "/uniqueProvers", + nil, + ) + + rec := httptest.NewRecorder() + + srv.ServeHTTP(rec, req) + + testutils.AssertStatusAndBody(t, rec, tt.wantStatus, tt.wantBodyRegexpMatches) + }) + } +} diff --git a/packages/eventindexer/http/routes.go b/packages/eventindexer/http/routes.go index 90d9a88574f..18ad1ff48d8 100644 --- a/packages/eventindexer/http/routes.go +++ b/packages/eventindexer/http/routes.go @@ -5,5 +5,6 @@ func (srv *Server) configureRoutes() { srv.echo.GET("/", srv.Health) srv.echo.GET("/uniqueProvers", srv.GetUniqueProvers) + srv.echo.GET("/uniqueProposers", srv.GetUniqueProposers) srv.echo.GET("/eventByAddress", srv.GetCountByAddressAndEventName) } diff --git a/packages/eventindexer/http/server_test.go b/packages/eventindexer/http/server_test.go new file mode 100644 index 00000000000..dd55f0c44c4 --- /dev/null +++ b/packages/eventindexer/http/server_test.go @@ -0,0 +1,125 @@ +package http + +import ( + "context" + "net/http" + "net/http/httptest" + "testing" + + "github.com/joho/godotenv" + echo "github.com/labstack/echo/v4" + "github.com/stretchr/testify/assert" + "github.com/taikoxyz/taiko-mono/packages/eventindexer" + "github.com/taikoxyz/taiko-mono/packages/eventindexer/mock" + "github.com/taikoxyz/taiko-mono/packages/eventindexer/repo" +) + +func newTestServer(url string) *Server { + _ = godotenv.Load("../.test.env") + + srv := &Server{ + echo: echo.New(), + eventRepo: mock.NewEventRepository(), + } + + srv.configureMiddleware([]string{"*"}) + srv.configureRoutes() + srv.configureAndStartPrometheus() + + return srv +} + +func Test_NewServer(t *testing.T) { + tests := []struct { + name string + opts NewServerOpts + wantErr error + }{ + { + "success", + NewServerOpts{ + Echo: echo.New(), + EventRepo: &repo.EventRepository{}, + CorsOrigins: make([]string, 0), + }, + nil, + }, + { + "noEventRepo", + NewServerOpts{ + Echo: echo.New(), + CorsOrigins: make([]string, 0), + }, + eventindexer.ErrNoEventRepository, + }, + { + "noCorsOrigins", + NewServerOpts{ + Echo: echo.New(), + EventRepo: &repo.EventRepository{}, + }, + eventindexer.ErrNoCORSOrigins, + }, + { + "noHttpFramework", + NewServerOpts{ + EventRepo: &repo.EventRepository{}, + CorsOrigins: make([]string, 0), + }, + ErrNoHTTPFramework, + }, + } + + for _, tt := range tests { + _, err := NewServer(tt.opts) + assert.Equal(t, tt.wantErr, err) + } +} + +func Test_Health(t *testing.T) { + srv := newTestServer("") + + req, _ := http.NewRequest(echo.GET, "/healthz", nil) + rec := httptest.NewRecorder() + + srv.ServeHTTP(rec, req) + + if rec.Code != http.StatusOK { + t.Fatalf("Test_Health expected code %v, got %v", http.StatusOK, rec.Code) + } +} + +func Test_Root(t *testing.T) { + srv := newTestServer("") + + req, _ := http.NewRequest(echo.GET, "/", nil) + rec := httptest.NewRecorder() + + srv.ServeHTTP(rec, req) + + if rec.Code != http.StatusOK { + t.Fatalf("Test_Root expected code %v, got %v", http.StatusOK, rec.Code) + } +} + +func Test_Metrics(t *testing.T) { + srv := newTestServer("") + + req, _ := http.NewRequest(echo.GET, "/metrics", nil) + rec := httptest.NewRecorder() + + srv.ServeHTTP(rec, req) + + if rec.Code != http.StatusOK { + t.Fatalf("Test_Metrics expected code %v, got %v", http.StatusOK, rec.Code) + } +} + +func Test_StartShutdown(t *testing.T) { + srv := newTestServer("") + + go func() { + _ = srv.Start(":3928") + }() + assert.Nil(t, srv.Shutdown(context.Background())) +} diff --git a/packages/eventindexer/indexer/save_block_proposed_event.go b/packages/eventindexer/indexer/save_block_proposed_event.go index 4a59ec49fca..a903a7ba019 100644 --- a/packages/eventindexer/indexer/save_block_proposed_event.go +++ b/packages/eventindexer/indexer/save_block_proposed_event.go @@ -18,7 +18,7 @@ func (svc *Service) saveBlockProposedEvents( events *taikol1.TaikoL1BlockProposedIterator, ) error { if !events.Next() || events.Event == nil { - log.Infof("no blockProven events") + log.Infof("no blockProposed events") return nil } @@ -39,6 +39,8 @@ func (svc *Service) saveBlockProposedEvents( return errors.Wrap(err, "svc.ethClient.TransactionSender") } + log.Infof("blockProposed by: %v", sender.Hex()) + if err := svc.saveBlockProposedEvent(ctx, chainID, event, sender); err != nil { return errors.Wrap(err, "svc.saveBlockProposedEvent") } diff --git a/packages/eventindexer/mock/block_repository.go b/packages/eventindexer/mock/block_repository.go new file mode 100644 index 00000000000..0ad40f1e7ff --- /dev/null +++ b/packages/eventindexer/mock/block_repository.go @@ -0,0 +1,31 @@ +package mock + +import ( + "errors" + "math/big" + + "github.com/taikoxyz/taiko-mono/packages/eventindexer" +) + +var ( + LatestBlock = &eventindexer.Block{ + Height: 100, + Hash: "0x", + ChainID: MockChainID.Int64(), + } +) + +type BlockRepository struct { +} + +func (r *BlockRepository) Save(opts eventindexer.SaveBlockOpts) error { + return nil +} + +func (r *BlockRepository) GetLatestBlockProcessedForEvent(chainID *big.Int) (*eventindexer.Block, error) { + if chainID.Int64() != MockChainID.Int64() { + return nil, errors.New("error getting latest block processed for event") + } + + return LatestBlock, nil +} diff --git a/packages/eventindexer/mock/event_repository.go b/packages/eventindexer/mock/event_repository.go new file mode 100644 index 00000000000..9c9fe9a34c9 --- /dev/null +++ b/packages/eventindexer/mock/event_repository.go @@ -0,0 +1,59 @@ +package mock + +import ( + "context" + "math/rand" + + "github.com/taikoxyz/taiko-mono/packages/eventindexer" + "gorm.io/datatypes" +) + +type EventRepository struct { + events []*eventindexer.Event +} + +func NewEventRepository() *EventRepository { + return &EventRepository{ + events: make([]*eventindexer.Event, 0), + } +} +func (r *EventRepository) Save(ctx context.Context, opts eventindexer.SaveEventOpts) (*eventindexer.Event, error) { + r.events = append(r.events, &eventindexer.Event{ + ID: rand.Int(), // nolint: gosec + Data: datatypes.JSON(opts.Data), + ChainID: opts.ChainID.Int64(), + Name: opts.Name, + Event: opts.Event, + Address: opts.Address, + }) + + return nil, nil +} + +func (r *EventRepository) FindUniqueProposers( + ctx context.Context, +) ([]eventindexer.UniqueProposersResponse, error) { + return make([]eventindexer.UniqueProposersResponse, 0), nil +} + +func (r *EventRepository) FindUniqueProvers( + ctx context.Context, +) ([]eventindexer.UniqueProversResponse, error) { + return make([]eventindexer.UniqueProversResponse, 0), nil +} + +func (r *EventRepository) GetCountByAddressAndEventName( + ctx context.Context, + address string, + event string, +) (int, error) { + var count int = 0 + + for _, e := range r.events { + if e.Address == address && e.Event == event { + count++ + } + } + + return count, nil +} diff --git a/packages/eventindexer/mock/types.go b/packages/eventindexer/mock/types.go new file mode 100644 index 00000000000..cb5819b8a90 --- /dev/null +++ b/packages/eventindexer/mock/types.go @@ -0,0 +1,10 @@ +package mock + +import ( + "math/big" +) + +var ( + MockChainID = big.NewInt(167001) + LatestBlockNumber = big.NewInt(10) +) diff --git a/packages/eventindexer/repo/block_test.go b/packages/eventindexer/repo/block_test.go new file mode 100644 index 00000000000..eb25aba9bce --- /dev/null +++ b/packages/eventindexer/repo/block_test.go @@ -0,0 +1,99 @@ +package repo + +import ( + "math/big" + "testing" + + "github.com/ethereum/go-ethereum/common" + "github.com/taikoxyz/taiko-mono/packages/eventindexer" + "github.com/taikoxyz/taiko-mono/packages/eventindexer/db" + "gopkg.in/go-playground/assert.v1" +) + +func Test_NewBlockRepo(t *testing.T) { + tests := []struct { + name string + db eventindexer.DB + wantErr error + }{ + { + "success", + &db.DB{}, + nil, + }, + { + "noDb", + nil, + eventindexer.ErrNoDB, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + _, err := NewBlockRepository(tt.db) + assert.Equal(t, tt.wantErr, err) + }) + } +} + +func TestIntegration_Block_Save(t *testing.T) { + db, close, err := testMysql(t) + assert.Equal(t, nil, err) + + defer close() + + blockRepo, err := NewBlockRepository(db) + assert.Equal(t, nil, err) + tests := []struct { + name string + opts eventindexer.SaveBlockOpts + wantErr error + }{ + { + "success", + eventindexer.SaveBlockOpts{ + ChainID: big.NewInt(1), + Height: 100, + Hash: common.HexToHash("0x1234"), + }, + nil, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err = blockRepo.Save(tt.opts) + assert.Equal(t, tt.wantErr, err) + }) + } +} + +func TestIntegration_Block_GetLatestBlockProcessedForEvent(t *testing.T) { + db, close, err := testMysql(t) + assert.Equal(t, nil, err) + + defer close() + + blockRepo, err := NewBlockRepository(db) + assert.Equal(t, nil, err) + tests := []struct { + name string + eventName string + chainID *big.Int + wantErr error + }{ + { + "success", + eventindexer.EventNameBlockProposed, + big.NewInt(1), + nil, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + _, err := blockRepo.GetLatestBlockProcessed(tt.chainID) + assert.Equal(t, tt.wantErr, err) + }) + } +} diff --git a/packages/eventindexer/repo/containers_test.go b/packages/eventindexer/repo/containers_test.go new file mode 100644 index 00000000000..53eff7bcc84 --- /dev/null +++ b/packages/eventindexer/repo/containers_test.go @@ -0,0 +1,77 @@ +package repo + +import ( + "context" + "fmt" + "testing" + + "github.com/pressly/goose/v3" + "github.com/taikoxyz/taiko-mono/packages/eventindexer" + "github.com/taikoxyz/taiko-mono/packages/eventindexer/db" + "github.com/testcontainers/testcontainers-go" + "github.com/testcontainers/testcontainers-go/wait" + "gorm.io/driver/mysql" + "gorm.io/gorm" + "gorm.io/gorm/logger" +) + +var ( + dbName = "indexer" + dbUsername = "root" + dbPassword = "password" +) + +func testMysql(t *testing.T) (eventindexer.DB, func(), error) { + req := testcontainers.ContainerRequest{ + Image: "mysql:latest", + ExposedPorts: []string{"3306/tcp", "33060/tcp"}, + Env: map[string]string{ + "MYSQL_ROOT_PASSWORD": dbPassword, + "MYSQL_DATABASE": dbName, + }, + WaitingFor: wait.ForLog("port: 3306 MySQL Community Server - GPL"), + } + + ctx := context.Background() + + mysqlC, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{ + ContainerRequest: req, + Started: true, + }) + + if err != nil { + t.Fatal(err) + } + + closeContainer := func() { + err := mysqlC.Terminate(ctx) + if err != nil { + t.Fatal(err) + } + } + + host, _ := mysqlC.Host(ctx) + p, _ := mysqlC.MappedPort(ctx, "3306/tcp") + port := p.Int() + + dsn := fmt.Sprintf("%s:%s@tcp(%s:%d)/%s?tls=skip-verify&parseTime=true&multiStatements=true", + dbUsername, dbPassword, host, port, dbName) + + gormDB, err := gorm.Open(mysql.Open(dsn), &gorm.Config{ + Logger: logger.Default.LogMode(logger.Silent), + }) + if err != nil { + t.Fatal(err) + } + + if err := goose.SetDialect("mysql"); err != nil { + t.Fatal(err) + } + + sqlDB, _ := gormDB.DB() + if err := goose.Up(sqlDB, "../migrations"); err != nil { + t.Fatal(err) + } + + return db.New(gormDB), closeContainer, nil +} diff --git a/packages/eventindexer/repo/event.go b/packages/eventindexer/repo/event.go index 82b8af807f1..fd877465fdd 100644 --- a/packages/eventindexer/repo/event.go +++ b/packages/eventindexer/repo/event.go @@ -44,7 +44,23 @@ func (r *EventRepository) FindUniqueProvers( addrs := make([]eventindexer.UniqueProversResponse, 0) if err := r.db.GormDB(). - Raw("SELECT address, count(*) AS count FROM events GROUP BY address"). + Raw("SELECT address, count(*) AS count FROM events WHERE event = ? GROUP BY address", + eventindexer.EventNameBlockProven). + FirstOrInit(&addrs).Error; err != nil { + return nil, errors.Wrap(err, "r.db.FirstOrInit") + } + + return addrs, nil +} + +func (r *EventRepository) FindUniqueProposers( + ctx context.Context, +) ([]eventindexer.UniqueProposersResponse, error) { + addrs := make([]eventindexer.UniqueProposersResponse, 0) + + if err := r.db.GormDB(). + Raw("SELECT address, count(*) AS count FROM events WHERE event = ? GROUP BY address", + eventindexer.EventNameBlockProposed). FirstOrInit(&addrs).Error; err != nil { return nil, errors.Wrap(err, "r.db.FirstOrInit") } diff --git a/packages/eventindexer/repo/event_test.go b/packages/eventindexer/repo/event_test.go new file mode 100644 index 00000000000..1bdfa17de8a --- /dev/null +++ b/packages/eventindexer/repo/event_test.go @@ -0,0 +1,211 @@ +package repo + +import ( + "context" + "math/big" + "testing" + + "github.com/davecgh/go-spew/spew" + "github.com/taikoxyz/taiko-mono/packages/eventindexer" + "gotest.tools/assert" +) + +var ( + dummyProveEventOpts = eventindexer.SaveEventOpts{ + Name: eventindexer.EventNameBlockProven, + Address: "0x123", + Data: "{\"data\":\"something\"}", + Event: eventindexer.EventNameBlockProven, + ChainID: big.NewInt(1), + } + dummyProposeEventOpts = eventindexer.SaveEventOpts{ + Name: eventindexer.EventNameBlockProposed, + Address: "0x123", + Data: "{\"data\":\"something\"}", + Event: eventindexer.EventNameBlockProposed, + ChainID: big.NewInt(1), + } +) + +func TestIntegration_Event_Save(t *testing.T) { + db, close, err := testMysql(t) + assert.Equal(t, nil, err) + + defer close() + + eventRepo, err := NewEventRepository(db) + assert.Equal(t, nil, err) + tests := []struct { + name string + opts eventindexer.SaveEventOpts + wantErr error + }{ + { + "success", + eventindexer.SaveEventOpts{ + Name: "test", + ChainID: big.NewInt(1), + Data: "{\"data\":\"something\"}", + Event: eventindexer.EventNameBlockProposed, + Address: "0x123", + }, + nil, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + _, err = eventRepo.Save(context.Background(), tt.opts) + assert.Equal(t, tt.wantErr, err) + }) + } +} + +func TestIntegration_Event_FindUniqueProvers(t *testing.T) { + db, close, err := testMysql(t) + assert.Equal(t, nil, err) + + defer close() + + eventRepo, err := NewEventRepository(db) + assert.Equal(t, nil, err) + + _, err = eventRepo.Save(context.Background(), dummyProveEventOpts) + + assert.Equal(t, nil, err) + + _, err = eventRepo.Save(context.Background(), dummyProposeEventOpts) + + assert.Equal(t, nil, err) + + tests := []struct { + name string + wantResp []eventindexer.UniqueProversResponse + wantErr error + }{ + { + "success", + []eventindexer.UniqueProversResponse{ + { + Address: "0x123", + Count: 1, + }, + }, + nil, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + resp, err := eventRepo.FindUniqueProvers(context.Background()) + assert.Equal(t, tt.wantErr, err) + assert.Equal(t, len(tt.wantResp), len(resp)) + for k, v := range resp { + assert.Equal(t, tt.wantResp[k].Address, v.Address) + assert.Equal(t, tt.wantResp[k].Count, v.Count) + } + }) + } +} + +func TestIntegration_Event_FindUniqueProposers(t *testing.T) { + db, close, err := testMysql(t) + assert.Equal(t, nil, err) + + defer close() + + eventRepo, err := NewEventRepository(db) + assert.Equal(t, nil, err) + + _, err = eventRepo.Save(context.Background(), dummyProveEventOpts) + + assert.Equal(t, nil, err) + + _, err = eventRepo.Save(context.Background(), dummyProposeEventOpts) + + assert.Equal(t, nil, err) + + tests := []struct { + name string + wantResp []eventindexer.UniqueProposersResponse + wantErr error + }{ + { + "success", + []eventindexer.UniqueProposersResponse{ + { + Address: dummyProposeEventOpts.Address, + Count: 1, + }, + }, + nil, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + resp, err := eventRepo.FindUniqueProposers(context.Background()) + spew.Dump(resp) + assert.Equal(t, tt.wantErr, err) + assert.Equal(t, len(tt.wantResp), len(resp)) + for k, v := range resp { + assert.Equal(t, tt.wantResp[k].Address, v.Address) + assert.Equal(t, tt.wantResp[k].Count, v.Count) + } + }) + } +} + +func TestIntegration_Event_GetCountByAddressAndEventName(t *testing.T) { + db, close, err := testMysql(t) + assert.Equal(t, nil, err) + + defer close() + + eventRepo, err := NewEventRepository(db) + assert.Equal(t, nil, err) + + _, err = eventRepo.Save(context.Background(), dummyProveEventOpts) + + assert.Equal(t, nil, err) + + _, err = eventRepo.Save(context.Background(), dummyProposeEventOpts) + + assert.Equal(t, nil, err) + + tests := []struct { + name string + address string + event string + wantResp int + wantErr error + }{ + { + "success", + dummyProposeEventOpts.Address, + dummyProposeEventOpts.Event, + 1, + nil, + }, + { + "none", + "0xfake", + dummyProposeEventOpts.Event, + 0, + nil, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + resp, err := eventRepo.GetCountByAddressAndEventName( + context.Background(), + tt.address, + tt.event, + ) + spew.Dump(resp) + assert.Equal(t, tt.wantErr, err) + assert.Equal(t, tt.wantResp, resp) + }) + } +} diff --git a/packages/node-status-page/.babelrc b/packages/node-status-page/.babelrc deleted file mode 100644 index 7ae1eb65a8f..00000000000 --- a/packages/node-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/node-status-page/.default.env b/packages/node-status-page/.default.env deleted file mode 100644 index 5f1af920437..00000000000 --- a/packages/node-status-page/.default.env +++ /dev/null @@ -1,8 +0,0 @@ -VITE_NODE_ENV=dev -VITE_L1_RPC_URL="https://rpc.sepolia.org" -VITE_L2_RPC_URL="http://localhost:8545" -VITE_TAIKO_L2_ADDRESS="0x0000777700000000000000000000000000000001" -VITE_TAIKO_L1_ADDRESS="0xAC9251ee97Ed8beF31706354310C6b020C35d87b" -VITE_L1_EXPLORER_URL="https://l1explorer.a2.taiko.xyz" -VITE_L2_EXPLORER_URL="https://l2explorer.a2.taiko.xyz" -VITE_EVENT_INDEXER_API_URL="http://localhost:4100" \ No newline at end of file diff --git a/packages/node-status-page/.gitignore b/packages/node-status-page/.gitignore deleted file mode 100644 index d99f7853c92..00000000000 --- a/packages/node-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 - -# vite -vite.config.ts.timestamp-*.mjs \ No newline at end of file diff --git a/packages/node-status-page/CHANGELOG.md b/packages/node-status-page/CHANGELOG.md deleted file mode 100644 index 5b90132f80b..00000000000 --- a/packages/node-status-page/CHANGELOG.md +++ /dev/null @@ -1,64 +0,0 @@ -# Changelog - -## [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/node-status-page/Dockerfile b/packages/node-status-page/Dockerfile deleted file mode 100644 index 2f3d0d7c2a0..00000000000 --- a/packages/node-status-page/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM node:16.7 -WORKDIR /app -COPY . . -RUN npm install -RUN npm run dev \ No newline at end of file diff --git a/packages/node-status-page/README.md b/packages/node-status-page/README.md deleted file mode 100644 index 846cde89b70..00000000000 --- a/packages/node-status-page/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Node Status Page - -Taiko status page helps to show the current status of your node, intended to be run with `simple-taiko-node`. diff --git a/packages/node-status-page/index.html b/packages/node-status-page/index.html deleted file mode 100644 index 27fc0bed3d8..00000000000 --- a/packages/node-status-page/index.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - Taiko Status - - -
- - - diff --git a/packages/node-status-page/jest.config.js b/packages/node-status-page/jest.config.js deleted file mode 100644 index 7f2d5f3b015..00000000000 --- a/packages/node-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/node-status-page/package.json b/packages/node-status-page/package.json deleted file mode 100644 index 851c985684d..00000000000 --- a/packages/node-status-page/package.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "name": "@taiko/node-status-page", - "version": "0.5.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": "^3.0.0", - "@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": "^5.16.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": "^6.2.0", - "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.0.0", - "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/node-status-page/postcss.config.cjs b/packages/node-status-page/postcss.config.cjs deleted file mode 100644 index e2dc47804ed..00000000000 --- a/packages/node-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/node-status-page/public/taiko-favicon.png b/packages/node-status-page/public/taiko-favicon.png deleted file mode 100644 index 28da6ff13433ccad107f8fc90e7003be222957ad..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7618 zcmb_hXH*kix1NL^Ku|+(0g>K&2LUNclOk0Ngn*F}dT)Y)iWF%gf>ddOlt>Z8(7OZ# zF*Ji92!eo!givq%zW4p^{c+#>>&}|B=Ik@OJiDASXC7FX88SjRApig{8XM_b0sx5I z1Oc?v0RR+2C~Lbw zJ5v)i1ln857o6RFl8xONra4y3`|*73hCw|=PK{+f{=j8$;in{%aU(pNm*qzIe9f% zRoGvb0NJ3wo4cB&zQJGS$dsnQt-wHEHEHRPkPxX5c`3BNhqSD!s;ab%oV1*rB$-1p zAj~JwB~;QU;KJV;^pODwf0S<^3he{?qtV3`9Tcc3KnDA7FT8#Kqt++juSk(&CLQYH zD=jM}^T(^d8BI<9Z&q*b|8NHcS|a}&@BgYez&gwqDQ$@iKnM9F$hmXB@W+&|nw~$> zB@pdzjYfO@9Y~8?=s+32R=&H!bC@U)%D9K(@F!)_1+8g#SpVd(Rj79z*_5CI5_Rm-p{!vz%3`Y7-X8%W~ z|L!7}&!6UhN|#Lhr}&XR1oAo zP0Ehnnq=p(^_}!9E;e$K=TuhMAEl)9T1*#N=BGD86V zyI>vKB7j*}1i1TukaCw37f&VDe=-CJMqdwVD#zT&3;IZq^xezEB<4#ZS$jYysKnN1aE<08=!LQP59HGHLns=+S`?6tKLYt~NVV60`sL`LqcL<{~GT?n#bI zWm@u!y17rv5vz@~RI!vjVUL}Y$eOu!gM;lJeo{B7H5LH`0p_Y%sowR*^9eLofDtoH zpZHbHiRk7MDnk`JnUBa1s_YK(dymLDCY!lATC>!MbKfH~9;=MmW7V8vcsvd<>>@y^ zmJ_oMXY`P3A&|B^Jw5FXDn$gC(iZ_~dGEreA>>{tsSGm@zJl|~6(R>t)K_alUj!hz znR+Br=SY=4_|gdl7M}(%M41LDy&ogkOFZ}L%(&CgdwbMf)p34+U=c-UBD2#xU>}dc z*;{|1Q^<4Kl?ESNbeX`R^5^OVXe{4KB7ZWow-NsE%c2lM! zfs2OoplxzhemQPB_C&&foQE^R`5_)^ZEcTm^OXgSKpTy`6d7CUt_^x9H_WRlrwHsD~@IvytP)0-p|iXAhwd8bUsf7Ve4QhsLgw9^+rt zV8vc+y{6t=wqO;fip@-1{_+g_n58>{HbvkUjp!%NMcber{g=jM8* zUr9Ja0MTUR0&Zf|`Q?|x7?#;>_$Dv8axQjgovKsq?3vd+TH_OR$wTUh0OQzWLf~HM zodV&HY>psumd@TC;f1emeb9;GfiWGp(^O`8J#&*DXZ+w)hWDYCmE zjfo1*h*f%GD|J#nSO=1~QH^;lt^f15OONv`?_2x;+vaaUR&}aa=+J_-UX1d?8{9Fn z6-U`$I?Ih+8ev7iSI)b~dvvcWKXVUnFT5K)gZOC$?4>yGgwN1AZf*Y+bQhCAHTa zG$0>w-y6TR3jN>}mYl4}L`wyGVn^KzgMUkgemF|NQ?io=D0D#s4328EonwSv(X#m+ z2lZRdv5BM7M)CeQdNkQIP@y`fnFCG}r&gPlEzJnfm4E}l2d7@V8P7b+3^9ku4r`CQv0Kf zAtf%!-m0!`I7H{`>nFOj)hx;?jt>2YB&P{@?^>?mT`==SLlsY%-4IiN==L;$`uzo6 z(EW46b%eH_P1;(AoJtg(Y%19&_PxNSq9W`#X#N?}A9f(VZSyqw7Bsbl?*&j+x5TD0Qo*RF zLYmCKqEGK8F+?$be0u>JYa-t@_DOhDh%&PFyh1Yn3QrMGni7QH%3+wpAUP8~dCx&~ zggV^|cpgQ*4+y?Wy-8v~ndqri)-u%MN zo5t)e*k%73%(B6|v_!)lzhc0RaTrvso_DONM@-pXP-i@r)gZ@TROSbfQ7`5RQie$) zgkh#*+BvdX1hDV)Pi-TpMrg-}Z9gxYhy3wWu2bpub*H>9Z|h7BoBBxPA?{okY1O{E zagX6!FMT+Z7nKFz4?3udAP+RbIF0(ZiS3H1bW|`S3B#A#!Ah!e8l9RZbPB1WzzA4A zJn2X9^^yxi&xRSJ_*1#|Tdo1ROVE1y!~Cs{srx(BUpna@Me?VbuPhmWXdjq~0oP&a zKKA;gUoSB0496}W%PEl?B0y2Bh0RMnNsFKT204b>%FxEm(UcX0A&BYTXTtb!4|d>@m9R)UJ1w9!-wIi{41JNvDOU1 zwev$`go~;J^1~7OpHId4^dLIz?8w!1+~`SWyhgXCLjq0eSA-F$f`&`=FhnngZAD~D zf{pGAl>bkdEc^YT2NWJm-$b@}$0E+uOOR(T(`xhjc8$caTVXhSbPXHdRfvuQdG_>7 z!ORBaBsQEx{bzCo!M^XV$TwGukAlIYV*=b&^KypV@~Bn|l#Se)1}w3!l-9uf0S7w~NsWUa>`3*%8Y(U1MxR?(CRM@B;mCVTSmN zx^?r`3PvB_SyXY0K!Xm6>DRc3$p;iMl)`D=d z0Jv8wGux2(MyP{9)p-2$=19UwU1Byz5s>4ng^5KPfChx4@_2^42DlS%PoIV8nC5+{ z=E3j>6pomAC|LlvT@=5tPTH>sdi;3G2#vk{#!E8eFg zWrP}{a}nM@ed?;D->v`Uk^nRok~8x5!9&IT`EIX5AhR1e+T^CBPa`0$ntv4}GPu`u zyzIIn<#GH+Z}w`1Y0NogCK-AWK+>;vkHvT{(ssuWprQ9D)&W#p5XZ{*7O?5vbDbJh7E>|iu67BS+5>o=cdcKUB zyp;4%9Ry#XFr97Trthe^Q%3Ix^1KEtzUemxl{3wzcxQAEXmtOa1 zFyhU{D;oziSH1W=$O{eS>_d_zK6N2!Ks*L5YI4V+p;l>{pYj>|p-*PlqV& zKgVG|@7}tB6KOoJNsBcqbR4&(qCT$I%72h(0W@?fEqV-XeH(p#Yp;!N^n|dlCR=;H zr5DfV9&&=;2+6q~HKI4Ol}=kuZTnz5I?{yHzPvGc{UrGH&&E12AK$xKd=w4OxDGX5 z>0kA}6ZFZx>$zDOaO-AG0S#8~%Fz#-DD^rPi`Jbv_(s5Ms4LMCJg>l)RKwgX^AOA| zMDw8F_g7(+h}vXaoTZWA!Po5|LfI%C$^#RY z!>GOJZ(cY#?T7@-OUBycr_izyR^$2yp$q^|J7=ss88h`WIZ(p7N@S>`Mv@ zZcJG*&iCFAc;=bPzSY`ec&ilGz=7V_!m(JNG_|5X#`(BIJsA67z=d9O6IJSTR@?o2 zMDhd>bDI98VfsxRtMwa(+U;Lk4+|kiBjIMnyqag-rydeCHn0<- z&1V%I+Wi)};Bgn9@);p}C42N-%M~vstxl~JTh9G3r;Vkv9WN~L_9_8xew<^UGWk}L zi88xH#F8?REqp5gEX~&=^VV}C0PVrVaqvr4@xI47tN3BPS{?fW>b$Q-JJQg@%VNr& zAsrBIcR3}BWdu*}exBbljaC`;*)3n1HXxcqG)h|T^cMt z?v*lCM`*R~kqL>v?^GX$YCdzO3)RQZi;Bv|Zz5w$CUM(&?jsPpM2Dr0`9Ub)IM)1q zs}s%nYn`3D^#fkGjANF@TFY)V;Ay?N^-1sZ2~C1kMwI&Cz$BcN5}vbHQ?1&I_|>4Q z5;E$)%Ns%C%x%Hpf`JYr+6fuEqgO+FCK{zaPC4LB*E`BV<4?M-$gP)@RF@wOfha;l zxDNGU)`J&NeyWF4XXsP93iB*_KCK@*P9*9u*&k z!>9`7#zHuMbk^3|xGcvtZeSUY7@dNN*EYIu*Ozzo2T2qZJSeEV6nK1K0Sxu`D-6*r z#thYRoB8i$6=Bh;>J4XzcWUY-Qk|Za*SrhIU=_TNeW<97ge`%grC?Es=s{h+T25cF zQ4vJJCv`{3-iVIbk?{4Pk)gZ3VjncjP4|9KoNXzj0=`GI&|tOw_S|)dVGp2tSr~9R zN?gMJiS$HPy8)e|9gY^AB)SI27@#WK}PQ92{u=I3WgZri1p8x&q^Z~zxxK>D2@ z^;LCVC3M-mPpkgL>?xINsnp*`@*5ufQ1ni-CCz3X&-TSo68CoK*S}Q$8x#Cd+G*v^7HcZZ9yFibEz8pn)B0K>5?+3r;m%Y z*RAeVn-e<=3CA4bC8uY#IQy!PhIO4)g2E;HVF61BYNr(=uesj~T_3|! z!2{|Ey!3GT%|yXNIQIfIQwq==o`eeDTd`%G6Bx83dbLE5q> zyvcQWGKwmn$w^`?Yq%|wjOw8FJ_*{{wqVQ-?L7GTEjh|(ZDUzU3-d$^pY0{m)L(k9 zFL88Aeved7Q*f{O($GX~hK6;tLIyFTg>;jNr9Ll+Mw#nofYaA3?X#wy)DN*iJe71E zv_B^7;zhBl=d`tz_7d-7$jcTF|DY$AGrCBNqCS3LVnTCY)1eLb6bhJ-ZhWbXIV${0 z;g#mvt}0f>q5gXN@VRTuo`4zAJ~N}Ct9o#P_vqxxuuuSa0WrjMT#OLB3EyhBPdEv0 zv>fMW$o7zdE9d`I6@PiGLCag_D(r3ws4RQ*%hlif9N~;9(=y15SuG;vDz7w+_g1k! zn#q640@6__sTIZAUM!ef-;nOpN>Xlr{W+78t6t;DL_@g6kryc_3!360-y6=!T;8)- zt!74=jt9Mc@+fN2>r!6pQE~lE2_KT<=n3}AzPc=ODxN?va#0e_kp=kL zN^^EY1dzFV1igqQ@6KX-x|>DY=C-qoO}rHBTSYtZQTrROhw4FPYeuYBlVAx;F!DiD zQs*SR1}vk0M7aWs+_lkCuZdFx$Iyys-b#Ph-i^+P5-=kW35}!N7$}S>4!h1fU%AG}`L7o4 z;A~}cY7z>{t5i%rVsX~j9-v4>c~`9bo@-Ro3W+tAsV6#I>SO%b+l6iK?zOF9+kX?B z5BAK&LPKi4-oSsac`9u~yHcrRGI6~(kR|!)OjnMLpx{+9PU`klo8;p~rw2EpQb3Q` zv;%$}PQB4-y`9lkdwqfT;IuSd8EUiFXeVs-LhqV*RgDMw@xx9AmIQk-&Ow}Uh+FH) zW|G?c`44fX-a;IQz2n;|UQHWTdEzM0K3@C`9QA#f_vn?7DTTY{?vK2;FESwcb|J?m z5mU`hb#{(WOj4il%Bo{nZm@RxtA4NJPyLt5ayWO-YG2ziYPsDCXeuDoxP*5_ZE6~* zt`aEcU!Tqy=28zGu-R-szl=^Ejr?rPr~|B2!3CGjPau2myyv*Q1kE~g`yhu?Upb0m zSgJ#iiDfO{Jxd$qL;R?`o9j@NArwj|77At3dLno+osACPkX--JfaR_MDwpmlzbQq2 zvKS|G8g4hjQ8nUffwwp_n{P&@AKXk896NuDI&8p>VREkGX|DCoX5?q1gnqH9YvR3@ zEQw)al+xtY*`kLE?)WazlY?TvtS4-nnm>$V-41oTF1=TWNrs7TP(o!PNVk$H^Blmv zT6gwWTAE3`U(<8Oz4R?fbXji|CN+hfvNW2ABFJ%#wWznO~dr>RRq%zqVvU=??C(OcP!gzY1<-n%UproXK4sH-V)W zWL!7+P`q%E61ZQL3A`OWs(i!oTmo#Ionw|&mMoFpyl-+GcC9C@-opC|N6o{8V!!*& zGv{txJvDVWKiDU}niBZ6y~o(*)@QY&f0ABW}#|LBTy%CRy>Y+877~-%2m~3u31u{ zt%<4F%BKY?rHzRtHQk2l!w)I4Jz0`%6>bd|r=HB3YEMYfkU|O+W*zHae2ld#IC4!u z`$u29mtT?SS5zVfdLr_{Ca9&0RMy0hDHSNnCwXlgha-I>ZvIge~GaVs>_h z`Kz=gzRWWaZu(?V^IJx~UHaN9H)ii#1#j4!Oq{al(wi&6J7I0fxZnvXBf0xeA6*l? zk^cF;eyJmz7;b%4vV2O3@{Lp0rY`P*L)BA)h-pNxa_yWkHli%Eep!~E*D?E7qax|b z16+;ec2qS9r>@hO^tPs-NDo{K>SshbAbFYh#8F<%U~ha~Q6OwZ5^ z%|oGvoG!KtZiiCVGon=qnAfh#-?0IWi%SG#Brk2{Q>mGBBWi{7enzdl6uaNd9EjVC zec!RHAwPYBY~i{_@9gf`>yZBxFq03Q?^*z~ - import { wrap } from "svelte-spa-router/wrap"; - import Router from "svelte-spa-router"; - import Home from "./pages/home/Home.svelte"; - import { setupI18n } from "./i18n"; - import Navbar from "./components/Navbar.svelte"; - import { ethers } from "ethers"; - setupI18n({ withLocale: "en" }); - - const l1Provider = new ethers.providers.JsonRpcProvider( - import.meta.env.VITE_L1_RPC_URL - ); - const l2Provider = new ethers.providers.WebSocketProvider( - import.meta.env.VITE_L2_RPC_URL - ); - - const routes = { - "/": wrap({ - component: Home, - props: { - l1Provider: l1Provider, - l1TaikoAddress: import.meta.env.VITE_TAIKO_L1_ADDRESS, - l2Provider: l2Provider, - l2TaikoAddress: import.meta.env.VITE_TAIKO_L2_ADDRESS, - l1ExplorerUrl: import.meta.env.VITE_L1_EXPLORER_URL, - l2ExplorerUrl: import.meta.env.VITE_L2_EXPLORER_URL, - feeTokenSymbol: import.meta.env.VITE_FEE_TOKEN_SYMBOL || "TKO", - eventIndexerApiUrl: import.meta.env.VITE_EVENT_INDEXER_API_URL, - proposerAddress: import.meta.env.VITE_PROPOSER_ADDRESS, - proverAddress: import.meta.env.VITE_PROVER_ADDRESS, - }, - userData: {}, - }), - }; - - -
- - -
- - diff --git a/packages/node-status-page/src/app.css b/packages/node-status-page/src/app.css deleted file mode 100644 index 9fd61216e50..00000000000 --- a/packages/node-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/node-status-page/src/assets/lottie/loader.json b/packages/node-status-page/src/assets/lottie/loader.json deleted file mode 100644 index 7c288a43a3d..00000000000 --- a/packages/node-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/node-status-page/src/assets/taiko-banner.svg b/packages/node-status-page/src/assets/taiko-banner.svg deleted file mode 100644 index e351b7b9ab4..00000000000 --- a/packages/node-status-page/src/assets/taiko-banner.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/packages/node-status-page/src/components/DetailsModal.svelte b/packages/node-status-page/src/components/DetailsModal.svelte deleted file mode 100644 index a7ea557e7f7..00000000000 --- a/packages/node-status-page/src/components/DetailsModal.svelte +++ /dev/null @@ -1,17 +0,0 @@ - - - -
-
- -
- -
-
diff --git a/packages/node-status-page/src/components/Loader.svelte b/packages/node-status-page/src/components/Loader.svelte deleted file mode 100644 index 70a3a93064c..00000000000 --- a/packages/node-status-page/src/components/Loader.svelte +++ /dev/null @@ -1,16 +0,0 @@ - - - diff --git a/packages/node-status-page/src/components/Modal.svelte b/packages/node-status-page/src/components/Modal.svelte deleted file mode 100644 index 89a1027679d..00000000000 --- a/packages/node-status-page/src/components/Modal.svelte +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - diff --git a/packages/node-status-page/src/components/Navbar.svelte b/packages/node-status-page/src/components/Navbar.svelte deleted file mode 100644 index 9b4489dd3bc..00000000000 --- a/packages/node-status-page/src/components/Navbar.svelte +++ /dev/null @@ -1,7 +0,0 @@ - - - diff --git a/packages/node-status-page/src/components/StatusIndicator.svelte b/packages/node-status-page/src/components/StatusIndicator.svelte deleted file mode 100644 index 45684ef6e65..00000000000 --- a/packages/node-status-page/src/components/StatusIndicator.svelte +++ /dev/null @@ -1,114 +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/node-status-page/src/components/Tooltip.svelte b/packages/node-status-page/src/components/Tooltip.svelte deleted file mode 100644 index 1ccae3a0157..00000000000 --- a/packages/node-status-page/src/components/Tooltip.svelte +++ /dev/null @@ -1,11 +0,0 @@ - - - (isOpen = true)} - size="18" - variation="outline" -/> diff --git a/packages/node-status-page/src/components/TooltipModal.svelte b/packages/node-status-page/src/components/TooltipModal.svelte deleted file mode 100644 index a7ea557e7f7..00000000000 --- a/packages/node-status-page/src/components/TooltipModal.svelte +++ /dev/null @@ -1,17 +0,0 @@ - - - -
-
- -
- -
-
diff --git a/packages/node-status-page/src/components/details/Node.svelte b/packages/node-status-page/src/components/details/Node.svelte deleted file mode 100644 index c02bec8f64b..00000000000 --- a/packages/node-status-page/src/components/details/Node.svelte +++ /dev/null @@ -1,177 +0,0 @@ - - -
-

Node Details

-
- -
- {#each statusIndicators as statusIndicator} - - {/each} -
diff --git a/packages/node-status-page/src/components/details/Proposer.svelte b/packages/node-status-page/src/components/details/Proposer.svelte deleted file mode 100644 index d6a77de877c..00000000000 --- a/packages/node-status-page/src/components/details/Proposer.svelte +++ /dev/null @@ -1,12 +0,0 @@ - - -
-

Proposer Details

-
diff --git a/packages/node-status-page/src/components/details/Prover.svelte b/packages/node-status-page/src/components/details/Prover.svelte deleted file mode 100644 index 53b25c66f94..00000000000 --- a/packages/node-status-page/src/components/details/Prover.svelte +++ /dev/null @@ -1,78 +0,0 @@ - - -
-

Prover Details

- - - - {#if activeTab === "status"} - {#each statusIndicators as statusIndicator} - - {/each} - {:else} -
-
- Rewards: -

0

-
- -
-
-
- {/if} -
diff --git a/packages/node-status-page/src/components/icons/Loader.svelte b/packages/node-status-page/src/components/icons/Loader.svelte deleted file mode 100644 index a342c73fe82..00000000000 --- a/packages/node-status-page/src/components/icons/Loader.svelte +++ /dev/null @@ -1,16 +0,0 @@ - - - - diff --git a/packages/node-status-page/src/components/icons/TaikoLogo.svelte b/packages/node-status-page/src/components/icons/TaikoLogo.svelte deleted file mode 100644 index 26595968c90..00000000000 --- a/packages/node-status-page/src/components/icons/TaikoLogo.svelte +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/packages/node-status-page/src/components/providers/BaseQueries.svelte b/packages/node-status-page/src/components/providers/BaseQueries.svelte deleted file mode 100644 index 4fa864ce7aa..00000000000 --- a/packages/node-status-page/src/components/providers/BaseQueries.svelte +++ /dev/null @@ -1 +0,0 @@ - diff --git a/packages/node-status-page/src/components/providers/QueryProvider.svelte b/packages/node-status-page/src/components/providers/QueryProvider.svelte deleted file mode 100644 index 91774c4acb8..00000000000 --- a/packages/node-status-page/src/components/providers/QueryProvider.svelte +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - diff --git a/packages/node-status-page/src/constants/abi/Bridge.ts b/packages/node-status-page/src/constants/abi/Bridge.ts deleted file mode 100644 index 34525018b52..00000000000 --- a/packages/node-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/node-status-page/src/constants/abi/HeaderSync.ts b/packages/node-status-page/src/constants/abi/HeaderSync.ts deleted file mode 100644 index 2b47742c0cd..00000000000 --- a/packages/node-status-page/src/constants/abi/HeaderSync.ts +++ /dev/null @@ -1,53 +0,0 @@ -export default [ - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "uint256", - name: "srcHeight", - type: "uint256", - }, - { - indexed: false, - internalType: "bytes32", - name: "srcHash", - type: "bytes32", - }, - ], - name: "HeaderSynced", - type: "event", - }, - { - inputs: [], - name: "getLatestSyncedHeader", - outputs: [ - { - internalType: "bytes32", - name: "", - type: "bytes32", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "number", - type: "uint256", - }, - ], - name: "getSyncedHeader", - outputs: [ - { - internalType: "bytes32", - name: "", - type: "bytes32", - }, - ], - stateMutability: "view", - type: "function", - }, -]; diff --git a/packages/node-status-page/src/constants/abi/TaikoL1.ts b/packages/node-status-page/src/constants/abi/TaikoL1.ts deleted file mode 100644 index 2d7ba7fd10e..00000000000 --- a/packages/node-status-page/src/constants/abi/TaikoL1.ts +++ /dev/null @@ -1,1428 +0,0 @@ -export default [ - { - inputs: [], - name: "L1_1559_X_SCALE_TOO_LARGE", - type: "error", - }, - { - inputs: [], - name: "L1_1559_Y_SCALE_TOO_LARGE", - type: "error", - }, - { - 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: "uint64", - name: "id", - type: "uint64", - }, - { - internalType: "uint32", - name: "parentGasUsed", - type: "uint32", - }, - { - internalType: "bytes32", - name: "parentHash", - type: "bytes32", - }, - { - internalType: "bytes32", - name: "conflictingBlockHash", - type: "bytes32", - }, - { - internalType: "bytes32", - name: "conflictingSignalRoot", - type: "bytes32", - }, - { - internalType: "bytes32", - name: "blockHash", - type: "bytes32", - }, - { - internalType: "bytes32", - name: "signalRoot", - type: "bytes32", - }, - ], - name: "L1_CONFLICTING_PROOF", - type: "error", - }, - { - inputs: [ - { - internalType: "uint64", - name: "id", - type: "uint64", - }, - { - internalType: "uint32", - name: "parentGasUsed", - type: "uint32", - }, - { - internalType: "bytes32", - name: "parentHash", - type: "bytes32", - }, - { - internalType: "bytes32", - name: "conflictingBlockHash", - type: "bytes32", - }, - { - internalType: "bytes32", - name: "conflictingSignalRoot", - type: "bytes32", - }, - { - internalType: "bytes32", - name: "blockHash", - type: "bytes32", - }, - { - internalType: "bytes32", - name: "signalRoot", - type: "bytes32", - }, - ], - name: "L1_CONFLICTING_PROOF", - type: "error", - }, - { - inputs: [], - name: "L1_CONTRACT_NOT_ALLOWED", - 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_ETHER", - 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_EVIDENCE", - type: "error", - }, - { - inputs: [], - name: "L1_INVALID_EVIDENCE", - type: "error", - }, - { - inputs: [], - name: "L1_INVALID_L21559_PARAMS", - type: "error", - }, - { - inputs: [], - name: "L1_INVALID_METADATA", - type: "error", - }, - { - inputs: [], - name: "L1_INVALID_METADATA", - type: "error", - }, - { - inputs: [], - name: "L1_INVALID_ORACLE", - type: "error", - }, - { - inputs: [], - name: "L1_INVALID_ORACLE", - type: "error", - }, - { - inputs: [], - name: "L1_INVALID_PARAM", - 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_NOT_ORACLE_PROVEN", - type: "error", - }, - { - inputs: [], - name: "L1_NOT_ORACLE_PROVEN", - type: "error", - }, - { - inputs: [], - name: "L1_NOT_ORACLE_PROVER", - type: "error", - }, - { - inputs: [], - name: "L1_NOT_ORACLE_PROVER", - type: "error", - }, - { - inputs: [], - name: "L1_NOT_SOLO_PROPOSER", - type: "error", - }, - { - inputs: [], - name: "L1_NOT_SOLO_PROPOSER", - type: "error", - }, - { - inputs: [], - name: "L1_ORACLE_DISABLED", - type: "error", - }, - { - inputs: [], - name: "L1_ORACLE_DISABLED", - 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: "L1_UNEXPECTED_FORK_CHOICE_ID", - type: "error", - }, - { - inputs: [], - name: "RESOLVER_DENIED", - type: "error", - }, - { - inputs: [], - name: "RESOLVER_INVALID_ADDR", - type: "error", - }, - { - 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: "depositsRoot", - 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: "uint8", - name: "cacheTxListInfo", - type: "uint8", - }, - { - internalType: "address", - name: "treasure", - 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", - }, - ], - 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", - }, - ], - name: "BlockProven", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "uint256", - name: "id", - type: "uint256", - }, - { - indexed: false, - internalType: "bytes32", - name: "blockHash", - type: "bytes32", - }, - ], - name: "BlockVerified", - 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: true, - internalType: "uint256", - name: "srcHeight", - type: "uint256", - }, - { - indexed: false, - internalType: "bytes32", - name: "blockHash", - type: "bytes32", - }, - { - indexed: false, - internalType: "bytes32", - name: "signalRoot", - type: "bytes32", - }, - ], - name: "XchainSynced", - 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: "address", - name: "addr", - type: "address", - }, - ], - name: "getBalance", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "blockId", - type: "uint256", - }, - ], - name: "getBlock", - outputs: [ - { - internalType: "bytes32", - name: "_metaHash", - type: "bytes32", - }, - { - internalType: "uint256", - name: "_deposit", - type: "uint256", - }, - { - internalType: "address", - name: "_proposer", - type: "address", - }, - { - internalType: "uint64", - name: "_proposedAt", - type: "uint64", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "getBlockFee", - outputs: [ - { - internalType: "uint256", - name: "feeAmount", - type: "uint256", - }, - { - internalType: "uint256", - name: "depositAmount", - type: "uint256", - }, - ], - 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: "maxNumVerifiedBlocks", - type: "uint256", - }, - { - internalType: "uint256", - name: "maxVerificationsPerTx", - type: "uint256", - }, - { - internalType: "uint256", - name: "blockMaxGasLimit", - type: "uint256", - }, - { - internalType: "uint256", - name: "maxTransactionsPerBlock", - type: "uint256", - }, - { - internalType: "uint256", - name: "maxBytesPerTxList", - type: "uint256", - }, - { - internalType: "uint256", - name: "minTxGasLimit", - type: "uint256", - }, - { - internalType: "uint256", - name: "slotSmoothingFactor", - type: "uint256", - }, - { - internalType: "uint256", - name: "rewardBurnBips", - type: "uint256", - }, - { - internalType: "uint256", - name: "proposerDepositPctg", - type: "uint256", - }, - { - internalType: "uint64", - name: "numEthDepositPerBlock", - type: "uint64", - }, - { - internalType: "uint96", - name: "maxEthDepositAmount", - type: "uint96", - }, - { - internalType: "uint96", - name: "minEthDepositAmount", - type: "uint96", - }, - { - internalType: "uint256", - name: "feeBaseMAF", - type: "uint256", - }, - { - internalType: "uint256", - name: "txListCacheExpiry", - type: "uint256", - }, - { - internalType: "bool", - name: "relaySignalRoot", - type: "bool", - }, - { - internalType: "bool", - name: "enableSoloProposer", - type: "bool", - }, - { - internalType: "bool", - name: "enableOracleProver", - type: "bool", - }, - { - internalType: "bool", - name: "enableTokenomics", - type: "bool", - }, - { - internalType: "bool", - name: "skipZKPVerification", - type: "bool", - }, - { - components: [ - { - internalType: "uint16", - name: "avgTimeMAF", - type: "uint16", - }, - { - internalType: "uint16", - name: "dampingFactorBips", - type: "uint16", - }, - ], - internalType: "struct TaikoData.FeeConfig", - name: "proposingConfig", - type: "tuple", - }, - { - components: [ - { - internalType: "uint16", - name: "avgTimeMAF", - type: "uint16", - }, - { - internalType: "uint16", - name: "dampingFactorBips", - type: "uint16", - }, - ], - internalType: "struct TaikoData.FeeConfig", - name: "provingConfig", - type: "tuple", - }, - ], - internalType: "struct TaikoData.Config", - name: "", - type: "tuple", - }, - ], - stateMutability: "pure", - 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: "provenAt", - type: "uint64", - }, - { - internalType: "uint64", - name: "proposedAt", - type: "uint64", - }, - ], - name: "getProofReward", - outputs: [ - { - internalType: "uint256", - name: "reward", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "getStateVariables", - outputs: [ - { - components: [ - { - internalType: "uint64", - name: "feeBase", - type: "uint64", - }, - { - internalType: "uint64", - name: "genesisHeight", - type: "uint64", - }, - { - internalType: "uint64", - name: "genesisTimestamp", - type: "uint64", - }, - { - internalType: "uint64", - name: "numBlocks", - type: "uint64", - }, - { - internalType: "uint64", - name: "lastVerifiedBlockId", - type: "uint64", - }, - { - internalType: "uint64", - name: "avgBlockTime", - type: "uint64", - }, - { - internalType: "uint64", - name: "avgProofTime", - type: "uint64", - }, - { - internalType: "uint64", - name: "lastProposedAt", - 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: "uint256", - name: "blockId", - type: "uint256", - }, - ], - name: "getXchainBlockHash", - outputs: [ - { - internalType: "bytes32", - name: "", - type: "bytes32", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "blockId", - type: "uint256", - }, - ], - name: "getXchainSignalRoot", - outputs: [ - { - internalType: "bytes32", - name: "", - type: "bytes32", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "_addressManager", - type: "address", - }, - { - internalType: "uint64", - name: "_feeBase", - type: "uint64", - }, - { - internalType: "bytes32", - name: "_genesisBlockHash", - type: "bytes32", - }, - ], - name: "init", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "chainId", - type: "uint256", - }, - { - internalType: "string", - name: "name", - type: "string", - }, - ], - name: "keyForName", - outputs: [ - { - internalType: "string", - name: "", - type: "string", - }, - ], - stateMutability: "pure", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "blockId", - type: "uint256", - }, - { - internalType: "bytes", - name: "input", - type: "bytes", - }, - ], - name: "oracleProveBlocks", - 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: "depositsRoot", - 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: "uint8", - name: "cacheTxListInfo", - type: "uint8", - }, - { - internalType: "address", - name: "treasure", - 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: "string", - name: "name", - type: "string", - }, - { - internalType: "bool", - name: "allowZeroAddress", - type: "bool", - }, - ], - 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", - }, - { - internalType: "bool", - name: "allowZeroAddress", - type: "bool", - }, - ], - name: "resolve", - outputs: [ - { - internalType: "address payable", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "state", - outputs: [ - { - internalType: "uint64", - name: "genesisHeight", - type: "uint64", - }, - { - internalType: "uint64", - name: "genesisTimestamp", - type: "uint64", - }, - { - internalType: "uint64", - name: "__reserved1", - type: "uint64", - }, - { - internalType: "uint64", - name: "__reserved2", - type: "uint64", - }, - { - internalType: "uint64", - name: "numBlocks", - type: "uint64", - }, - { - internalType: "uint64", - name: "lastProposedAt", - type: "uint64", - }, - { - internalType: "uint64", - name: "avgBlockTime", - type: "uint64", - }, - { - internalType: "uint64", - name: "nextEthDepositToProcess", - type: "uint64", - }, - { - internalType: "uint64", - name: "lastVerifiedBlockId", - type: "uint64", - }, - { - internalType: "uint64", - name: "__reserved4", - type: "uint64", - }, - { - internalType: "uint64", - name: "avgProofTime", - type: "uint64", - }, - { - internalType: "uint64", - name: "feeBase", - 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/node-status-page/src/domain/status.ts b/packages/node-status-page/src/domain/status.ts deleted file mode 100644 index 972bb73522f..00000000000 --- a/packages/node-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 - ) => 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/node-status-page/src/domain/syncing.ts b/packages/node-status-page/src/domain/syncing.ts deleted file mode 100644 index 0930615286f..00000000000 --- a/packages/node-status-page/src/domain/syncing.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type Syncing = { - currentBlock?: number; - startingBlock?: number; - highestBlock?: number; - synced: boolean; -}; diff --git a/packages/node-status-page/src/i18n.js b/packages/node-status-page/src/i18n.js deleted file mode 100644 index b2e76cb012e..00000000000 --- a/packages/node-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/node-status-page/src/main.ts b/packages/node-status-page/src/main.ts deleted file mode 100644 index 3bbaf7b1fe4..00000000000 --- a/packages/node-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/node-status-page/src/pages/home/Home.svelte b/packages/node-status-page/src/pages/home/Home.svelte deleted file mode 100644 index a2eca10ac6d..00000000000 --- a/packages/node-status-page/src/pages/home/Home.svelte +++ /dev/null @@ -1,50 +0,0 @@ - - -
-

simple-taiko-node dashboard

-
-
-
- (activeTab = "node")}>Node - {#if proposerAddress} - (activeTab = "proposer")}>Proposer - {/if} - {#if proposerAddress} - (activeTab = "prover")}>Prover - {/if} -
-
- -{#if activeTab === "prover"} - -{:else if activeTab === "proposer"} - -{:else if activeTab === "node"} - -{/if} diff --git a/packages/node-status-page/src/utils/addressSubsection.ts b/packages/node-status-page/src/utils/addressSubsection.ts deleted file mode 100644 index 5d4b7e201a1..00000000000 --- a/packages/node-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/node-status-page/src/utils/displayStatusValue.ts b/packages/node-status-page/src/utils/displayStatusValue.ts deleted file mode 100644 index ebbd79dd9e6..00000000000 --- a/packages/node-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/node-status-page/src/utils/getConfig.ts b/packages/node-status-page/src/utils/getConfig.ts deleted file mode 100644 index 6eb7c4a76b1..00000000000 --- a/packages/node-status-page/src/utils/getConfig.ts +++ /dev/null @@ -1,10 +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); - return await contract.getConfig(); -}; diff --git a/packages/node-status-page/src/utils/getEthBalance.ts b/packages/node-status-page/src/utils/getEthBalance.ts deleted file mode 100644 index d0346af82a4..00000000000 --- a/packages/node-status-page/src/utils/getEthBalance.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { ethers } from "ethers"; -export const getEthBalance = async ( - provider: ethers.providers.JsonRpcProvider, - address: string -): Promise => { - const b = await provider.getBalance(address); - return ethers.utils.formatEther(b); -}; diff --git a/packages/node-status-page/src/utils/getListening.ts b/packages/node-status-page/src/utils/getListening.ts deleted file mode 100644 index b0df34a31a9..00000000000 --- a/packages/node-status-page/src/utils/getListening.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { ethers } from "ethers"; - -export const getListening = async ( - provider: ethers.providers.JsonRpcProvider -): Promise => { - return await provider.send("net_listening", []); -}; diff --git a/packages/node-status-page/src/utils/getNetVersion.ts b/packages/node-status-page/src/utils/getNetVersion.ts deleted file mode 100644 index cbe58a120ef..00000000000 --- a/packages/node-status-page/src/utils/getNetVersion.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { BigNumber, ethers } from "ethers"; - -export const getNetVersion = async ( - provider: ethers.providers.JsonRpcProvider -): Promise => { - const n = await provider.send("net_version", []); - return BigNumber.from(n).toNumber(); -}; diff --git a/packages/node-status-page/src/utils/getPeerCount.ts b/packages/node-status-page/src/utils/getPeerCount.ts deleted file mode 100644 index f22d43297c3..00000000000 --- a/packages/node-status-page/src/utils/getPeerCount.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { BigNumber, ethers } from "ethers"; - -export const getPeers = async ( - provider: ethers.providers.JsonRpcProvider -): Promise => { - const peers = await provider.send("net_peerCount", []); - return BigNumber.from(peers).toNumber(); -}; diff --git a/packages/node-status-page/src/utils/getPendingBlocks.ts b/packages/node-status-page/src/utils/getPendingBlocks.ts deleted file mode 100644 index 40a22fd064d..00000000000 --- a/packages/node-status-page/src/utils/getPendingBlocks.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Contract, ethers } from "ethers"; -import TaikoL1 from "../constants/abi/TaikoL1"; - -export const getPendingBlocks = async ( - provider: ethers.providers.JsonRpcProvider, - contractAddress: string -): Promise => { - const contract: Contract = new Contract(contractAddress, TaikoL1, provider); - const stateVariables = await contract.getStateVariables(); - const nextBlockId = stateVariables.nextBlockId; - const latestVerifiedId = stateVariables.latestVerifiedId; - return nextBlockId - latestVerifiedId - 1; -}; diff --git a/packages/node-status-page/src/utils/getPendingTransactions.ts b/packages/node-status-page/src/utils/getPendingTransactions.ts deleted file mode 100644 index 87bf317ff87..00000000000 --- a/packages/node-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/node-status-page/src/utils/getProofCount.ts b/packages/node-status-page/src/utils/getProofCount.ts deleted file mode 100644 index d4dd553ce39..00000000000 --- a/packages/node-status-page/src/utils/getProofCount.ts +++ /dev/null @@ -1,21 +0,0 @@ -import axios from "axios"; - -export type GetProofCountResponse = { - count: number; -}; -export const getProofCount = async ( - eventIndexerApiUrl: string, - address: string -): Promise => { - const getProofCountResp = await axios.get( - `${eventIndexerApiUrl}/eventByAddress`, - { - params: { - address: address, - event: "BlockProven", - }, - } - ); - - return getProofCountResp.data?.count || 0; -}; diff --git a/packages/node-status-page/src/utils/getProposalCount.ts b/packages/node-status-page/src/utils/getProposalCount.ts deleted file mode 100644 index e5b911908a8..00000000000 --- a/packages/node-status-page/src/utils/getProposalCount.ts +++ /dev/null @@ -1,22 +0,0 @@ -import axios from "axios"; - -export type GetProposalCountResponse = { - count: number; -}; - -export const getProposalCount = async ( - eventIndexerApiUrl: string, - address: string -): Promise => { - const getProposalCountResp = await axios.get( - `${eventIndexerApiUrl}/eventByAddress`, - { - params: { - address: address, - event: "BlockProposed", - }, - } - ); - - return getProposalCountResp.data?.count || 0; -}; diff --git a/packages/node-status-page/src/utils/getQueuedTransactions.ts b/packages/node-status-page/src/utils/getQueuedTransactions.ts deleted file mode 100644 index 7af83e52e3b..00000000000 --- a/packages/node-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/node-status-page/src/utils/getStateVariables.ts b/packages/node-status-page/src/utils/getStateVariables.ts deleted file mode 100644 index 8d38c22430e..00000000000 --- a/packages/node-status-page/src/utils/getStateVariables.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { BigNumber, Contract, ethers } from "ethers"; -import TaikoL1 from "../constants/abi/TaikoL1"; - -export const getStateVariables = async ( - provider: ethers.providers.JsonRpcProvider, - contractAddress: string -) => { - const contract: Contract = new Contract(contractAddress, TaikoL1, provider); - return await contract.getStateVariables(); -}; diff --git a/packages/node-status-page/src/utils/getSyncing.ts b/packages/node-status-page/src/utils/getSyncing.ts deleted file mode 100644 index c6cc9a4977d..00000000000 --- a/packages/node-status-page/src/utils/getSyncing.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { BigNumber, ethers } from "ethers"; -import type { Syncing } from "src/domain/syncing"; - -export const getSyncing = async ( - provider: ethers.providers.JsonRpcProvider -): Promise => { - const syncing = await provider.send("eth_syncing", []); - console.log(syncing); - if (!syncing) - return { - synced: true, - }; - - return { - synced: false, - currentBlock: BigNumber.from(syncing.currentBlock).toNumber(), - highestBlock: BigNumber.from(syncing.highestBlock).toNumber(), - }; -}; diff --git a/packages/node-status-page/src/utils/truncateString.ts b/packages/node-status-page/src/utils/truncateString.ts deleted file mode 100644 index 3e969178e2d..00000000000 --- a/packages/node-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/node-status-page/src/utils/withdrawTaikoTokens.ts b/packages/node-status-page/src/utils/withdrawTaikoTokens.ts deleted file mode 100644 index 716df21ed8a..00000000000 --- a/packages/node-status-page/src/utils/withdrawTaikoTokens.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { ethers } from "ethers"; - -export async function withdrawTaikoTokens( - signer: ethers.Signer, - chains: Chains, - providers: Providers -) { - const contract = new ethers.Contract( - chains[transaction.toChainId].bridgeAddress, - BridgeABI, - provider - ); - - const contract = new ethers.Contract( - chains[transaction.toChainId].bridgeAddress, - BridgeABI, - providers[chains[transaction.toChainId].id] - ); -} diff --git a/packages/node-status-page/src/vite-env.d.ts b/packages/node-status-page/src/vite-env.d.ts deleted file mode 100644 index 4078e7476a2..00000000000 --- a/packages/node-status-page/src/vite-env.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -/// -/// diff --git a/packages/node-status-page/svelte.config.cjs b/packages/node-status-page/svelte.config.cjs deleted file mode 100644 index 8bf5d4b3f50..00000000000 --- a/packages/node-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/node-status-page/tailwind.config.cjs b/packages/node-status-page/tailwind.config.cjs deleted file mode 100644 index 4de26d4f8ab..00000000000 --- a/packages/node-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/node-status-page/tsconfig.json b/packages/node-status-page/tsconfig.json deleted file mode 100644 index 9094dab45e5..00000000000 --- a/packages/node-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/node-status-page/tsconfig.node.json b/packages/node-status-page/tsconfig.node.json deleted file mode 100644 index 65dbdb96ae5..00000000000 --- a/packages/node-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/node-status-page/vite.config.ts b/packages/node-status-page/vite.config.ts deleted file mode 100644 index e90bff74dde..00000000000 --- a/packages/node-status-page/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", - }, - ], - }), - ], -}); From 6b73934c9f179f24caa80a32953af7894b9de126 Mon Sep 17 00:00:00 2001 From: Jeffery Walsh Date: Tue, 18 Apr 2023 23:47:10 -0700 Subject: [PATCH 6/6] add proposers to status page --- .../status-page/src/pages/home/Home.svelte | 46 ++++++++++++++++++- .../status-page/src/utils/getNumProposers.ts | 23 ++++++++++ 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 packages/status-page/src/utils/getNumProposers.ts diff --git a/packages/status-page/src/pages/home/Home.svelte b/packages/status-page/src/pages/home/Home.svelte index 7b3ac22c833..0cb3f766e0a 100644 --- a/packages/status-page/src/pages/home/Home.svelte +++ b/packages/status-page/src/pages/home/Home.svelte @@ -18,6 +18,7 @@ import { truncateString } from "../../utils/truncateString"; import TaikoL1 from "../../constants/abi/TaikoL1"; import { getNumProvers } from "../../utils/getNumProvers"; + import { getNumProposers } from "../../utils/getNumProposers"; import DetailsModal from "../../components/DetailsModal.svelte"; import { addressSubsection } from "../../utils/addressSubsection"; @@ -32,6 +33,7 @@ export let eventIndexerApiUrl: string; let proverDetailsOpen: boolean = false; + let proposerDetailsOpen: boolean = false; let statusIndicators: StatusIndicatorProp[] = [ { @@ -52,6 +54,24 @@ 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(eventIndexerApiUrl)).uniqueProposers, + provider: l1Provider, + contractAddress: l1TaikoAddress, + header: "Unique Proposers", + intervalInMs: 0, + colorFunc: (value: Status) => { + return "green"; + }, + onClick: (value: Status) => { + proposerDetailsOpen = true; + }, + tooltip: + "The number of unique proposers who successfully submitted a proposed block to the TaikoL1 smart contract.", + }, { statusFunc: getLatestSyncedHeader, watchStatusFunc: watchHeaderSynced, @@ -256,7 +276,7 @@ (id, parentHash, blockHash, prover, provenAt, ...args) => { // ignore oracle prover if (prover.toLowerCase() !== oracleProverAddress.toLowerCase()) { - if(!provenAt.eq(0)) { + if (!provenAt.eq(0)) { onEvent(new Date(provenAt.toNumber() * 1000).toString()); } } @@ -380,3 +400,27 @@
{/if} + +{#if proposerDetailsOpen} + +
+ {#await getNumProposers(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/utils/getNumProposers.ts b/packages/status-page/src/utils/getNumProposers.ts new file mode 100644 index 00000000000..a37ae0988f6 --- /dev/null +++ b/packages/status-page/src/utils/getNumProposers.ts @@ -0,0 +1,23 @@ +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: [] }; +};