feat: migrate to new rollups-ts libraries - #474
Conversation
…artesi/wagmi with @cartesi/react.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
7eb41d6 to
9c8fa5f
Compare
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
- Upgrade Node.js to 24.19.0 across CI, Docker, package engines, and documentation. - Upgrade pnpm to 11.21.0 and migrate build-script approvals from onlyBuiltDependencies to allowBuilds. - Add pnpm supply-chain protections: strict dependency builds, release-age gate, trust-downgrade checks, and blocked transitive exotic sources. - Add narrow release-age exceptions for existing locked Turbo/Nanoid versions and block MSW install scripts. - Remove obsolete .npmrc files and ignore the local .pnpm-store. - Document the required toolchain and pnpm security policy.
5523342 to
ab67137
Compare
There was a problem hiding this comment.
Pull request overview
Migrates the Rollups Explorer app from the legacy @cartesi/viem / @cartesi/wagmi stack to the newer @cartesi/client / @cartesi/react libraries, while also tightening the toolchain (Node/pnpm), adding enforced type-checking in CI, and simplifying output decoding via @cartesi/codec.
Changes:
- Migrate explorer runtime + tests + stories to
@cartesi/clientand@cartesi/react(including theIApplication*hook renames). - Add and enforce type-checking (
typegen+check:types) via Turbo pipelines and CI, including a splittsconfigfor app vs tooling/storybook. - Update toolchain/supply-chain posture (Node 24, pnpm 11, pnpm workspace hardening) and replace manual output decoding with
@cartesi/codec.
Reviewed changes
Copilot reviewed 127 out of 130 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| turbo.json | Add typegen/check:types tasks and dependencies. |
| README.md | Document Node/pnpm versions and pnpm supply-chain policy. |
| pnpm-workspace.yaml | Enable stricter pnpm supply-chain settings + allowBuilds. |
| packages/domain/package.json | Tighten Node engine range to Node 24. |
| package.json | Add root check:types, bump engines + pnpm packageManager. |
| docker/Dockerfile | Bump base Node version to 24.19.0-alpine3.23. |
| docker-bake.hcl | Bump build args (Node/Turbo/pnpm) and formatting. |
| apps/web/.npmrc | Remove relaxed strict-peer-dependencies override. |
| apps/explorer/tsconfig.node.json | Split tooling config; add DOM libs, JSX, node types, includes. |
| apps/explorer/tsconfig.app.json | Exclude storybook/config files from app TS project. |
| apps/explorer/test/test-utils.tsx | Switch type imports to @cartesi/client. |
| apps/explorer/test/page/WithdrawalsPage.test.tsx | Switch type imports to @cartesi/client. |
| apps/explorer/test/lib/rollupContractResolver.test.ts | Switch addresses import to @cartesi/react. |
| apps/explorer/test/hooks/useTournamentHierarchy.test.tsx | Switch types/hooks + mocks to @cartesi/client/@cartesi/react. |
| apps/explorer/test/containers/WithdrawalsContainer.test.tsx | Switch types/hooks + mocks to @cartesi/client/@cartesi/react. |
| apps/explorer/test/components/withdrawal/WithdrawalView.test.tsx | Use @cartesi/codec fixtures; update decoding expectations. |
| apps/explorer/test/components/withdrawal/WithdrawalPaginatedList.test.tsx | Switch type imports to @cartesi/client. |
| apps/explorer/test/components/withdrawal/WithdrawalList.test.tsx | Switch type imports to @cartesi/client. |
| apps/explorer/test/components/withdrawal/WithdrawalCard.test.tsx | Switch type imports to @cartesi/client. |
| apps/explorer/test/components/transactions/ForecloseForm/index.test.tsx | Update renamed IApplication* hooks and mocks. |
| apps/explorer/test/components/output/OutputView.test.tsx | Switch type imports to @cartesi/client. |
| apps/explorer/test/components/output/OutputList.test.tsx | Switch type imports to @cartesi/client. |
| apps/explorer/test/components/output/OutputExecution.test.tsx | Update renamed IApplication* hooks and mocks. |
| apps/explorer/test/components/output/OutputContainer.test.tsx | Switch hook mocks to @cartesi/react. |
| apps/explorer/test/components/output/OutputCard.test.tsx | Switch type imports to @cartesi/client. |
| apps/explorer/test/components/application/utils.test.ts | Switch type imports to @cartesi/client. |
| apps/explorer/test/components/Address.test.tsx | Switch addresses import to @cartesi/react. |
| apps/explorer/src/stories/util.ts | Switch story types to @cartesi/client. |
| apps/explorer/src/stories/data.ts | Switch types and ABI address import to @cartesi/client. |
| apps/explorer/src/providers/localdata/helpers.ts | Switch Application type to @cartesi/client. |
| apps/explorer/src/providers/DataProvider.tsx | Switch provider import to @cartesi/react. |
| apps/explorer/src/page/WithdrawalsPage.tsx | Switch types to @cartesi/client. |
| apps/explorer/src/page/TournamentPage.tsx | Switch types to @cartesi/client. |
| apps/explorer/src/page/TournamentPage.stories.tsx | Switch story types to @cartesi/client. |
| apps/explorer/src/page/OutputsPage.tsx | Switch types to @cartesi/client. |
| apps/explorer/src/page/MatchPage.tsx | Switch types to @cartesi/client. |
| apps/explorer/src/page/EpochsPage.tsx | Switch types to @cartesi/client. |
| apps/explorer/src/page/EpochPage.tsx | Switch types to @cartesi/client. |
| apps/explorer/src/page/EpochPage.stories.tsx | Update fixtures for renamed input fields (transactionHash, logIndex, etc.). |
| apps/explorer/src/page/ApplicationSummaryPage.tsx | Switch types to @cartesi/client. |
| apps/explorer/src/page/ApplicationSummaryPage.stories.tsx | Update fixtures for renamed input fields (transactionHash, logIndex). |
| apps/explorer/src/page/ApplicationsPage.tsx | Switch types to @cartesi/client. |
| apps/explorer/src/lib/rollupContractResolver.ts | Switch addresses import to @cartesi/react. |
| apps/explorer/src/hooks/useTournamentHierarchy.ts | Switch types/hooks to @cartesi/client/@cartesi/react. |
| apps/explorer/src/containers/WithdrawalsContainer.tsx | Switch types/hooks to @cartesi/client/@cartesi/react. |
| apps/explorer/src/containers/TournamentContainer.tsx | Switch hooks to @cartesi/react. |
| apps/explorer/src/containers/OutputsContainer.tsx | Switch types/hooks to @cartesi/client/@cartesi/react. |
| apps/explorer/src/containers/MatchContainer.tsx | Switch hooks to @cartesi/react. |
| apps/explorer/src/containers/EpochsContainer.tsx | Switch hooks to @cartesi/react. |
| apps/explorer/src/containers/EpochContainer.tsx | Switch hooks to @cartesi/react. |
| apps/explorer/src/containers/ApplicationSummaryContainer.tsx | Switch hooks to @cartesi/react. |
| apps/explorer/src/containers/ApplicationsContainer.tsx | Switch hooks to @cartesi/react. |
| apps/explorer/src/components/withdrawal/WithdrawalView.tsx | Replace manual output decoding with decodeOutput from @cartesi/codec. |
| apps/explorer/src/components/withdrawal/WithdrawalPaginatedList.tsx | Switch types to @cartesi/client. |
| apps/explorer/src/components/withdrawal/WithdrawalList.tsx | Switch types to @cartesi/client. |
| apps/explorer/src/components/withdrawal/WithdrawalList.stories.tsx | Switch story types to @cartesi/client. |
| apps/explorer/src/components/withdrawal/WithdrawalCard.tsx | Switch types to @cartesi/client. |
| apps/explorer/src/components/withdrawal/WithdrawalCard.stories.tsx | Use @cartesi/codec encoders for output fixtures. |
| apps/explorer/src/components/transactions/GenericInputForm/index.tsx | Switch types + portal address imports to @cartesi/client/@cartesi/react. |
| apps/explorer/src/components/transactions/GenericInputForm/hooks/useInputBoxAddInput.tsx | Switch hooks import to @cartesi/react. |
| apps/explorer/src/components/transactions/ForecloseForm/index.tsx | Switch to renamed IApplication* hooks from @cartesi/react. |
| apps/explorer/src/components/transactions/EtherDepositForm/index.tsx | Switch types + portal address imports to @cartesi/client/@cartesi/react. |
| apps/explorer/src/components/transactions/EtherDepositForm/hooks/useDepositEther.tsx | Switch hooks import to @cartesi/react. |
| apps/explorer/src/components/transactions/ERC721DepositForm/index.tsx | Switch types + portal address imports to @cartesi/client/@cartesi/react. |
| apps/explorer/src/components/transactions/ERC721DepositForm/hooks/useERC721PortalDeposit.tsx | Switch hooks import to @cartesi/react. |
| apps/explorer/src/components/transactions/ERC20DepositForm/index.tsx | Switch types + portal address imports to @cartesi/client/@cartesi/react. |
| apps/explorer/src/components/transactions/ERC20DepositForm/hooks/useERC20PortalDeposit.tsx | Switch hooks import to @cartesi/react. |
| apps/explorer/src/components/transactions/ERC1155DepositForm/types.ts | Switch Application type to @cartesi/client. |
| apps/explorer/src/components/transactions/ERC1155DepositForm/hooks/useERC1155SinglePortalDeposit.tsx | Switch hooks import to @cartesi/react. |
| apps/explorer/src/components/transactions/ERC1155DepositForm/hooks/useERC1155BatchPortalDeposit.tsx | Switch hooks import to @cartesi/react. |
| apps/explorer/src/components/transactions/ERC1155DepositForm/DepositFormSingle.tsx | Switch portal address import to @cartesi/react. |
| apps/explorer/src/components/transactions/ERC1155DepositForm/DepositFormBatch.tsx | Switch portal address import to @cartesi/react. |
| apps/explorer/src/components/tournament/TournamentView.tsx | Switch types to @cartesi/client. |
| apps/explorer/src/components/tournament/TournamentView.stories.ts | Switch story types to @cartesi/client. |
| apps/explorer/src/components/tournament/TournamentTable.tsx | Switch types to @cartesi/client. |
| apps/explorer/src/components/tournament/TournamentRound.tsx | Switch types to @cartesi/client. |
| apps/explorer/src/components/tournament/MatchLoserCard.tsx | Switch types to @cartesi/client. |
| apps/explorer/src/components/tournament/MatchCard.tsx | Switch types to @cartesi/client. |
| apps/explorer/src/components/tournament/MatchCard.stories.ts | Switch story types to @cartesi/client. |
| apps/explorer/src/components/specification/systemSpecs.ts | Switch portal config import to @cartesi/react. |
| apps/explorer/src/components/specification/hooks/useVoucherDecoder.tsx | Switch types to @cartesi/client. |
| apps/explorer/src/components/specification/hooks/useAbiDecodingOnInput.tsx | Switch Input type to @cartesi/client. |
| apps/explorer/src/components/specification/conditionals.ts | Switch Input type to @cartesi/client. |
| apps/explorer/src/components/send/SendModal.tsx | Switch Application type to @cartesi/client. |
| apps/explorer/src/components/send/SendMenu.tsx | Switch Application type to @cartesi/client. |
| apps/explorer/src/components/send/SendContexts.tsx | Switch Application type to @cartesi/client. |
| apps/explorer/src/components/send/hooks.tsx | Switch Application type to @cartesi/client. |
| apps/explorer/src/components/report/ReportView.tsx | Switch types to @cartesi/client. |
| apps/explorer/src/components/report/ReportView.stories.tsx | Update report fixture fields for new client types. |
| apps/explorer/src/components/report/ReportList.tsx | Switch types to @cartesi/client. |
| apps/explorer/src/components/report/ReportList.stories.tsx | Update report fixture fields for new client types. |
| apps/explorer/src/components/report/ReportContainer.tsx | Switch types/hooks to @cartesi/client/@cartesi/react. |
| apps/explorer/src/components/QueryPagination.tsx | Switch pagination type to @cartesi/client. |
| apps/explorer/src/components/output/types.ts | Switch output-related types to @cartesi/client. |
| apps/explorer/src/components/output/OutputView.stories.tsx | Switch types to @cartesi/client. |
| apps/explorer/src/components/output/OutputSearch.tsx | Switch output type to @cartesi/client. |
| apps/explorer/src/components/output/OutputList.tsx | Switch types to @cartesi/client. |
| apps/explorer/src/components/output/OutputList.stories.tsx | Switch story types to @cartesi/client. |
| apps/explorer/src/components/output/OutputExecution.tsx | Switch to renamed IApplication* hooks from @cartesi/react. |
| apps/explorer/src/components/output/OutputContainer.tsx | Switch types/hooks to @cartesi/client/@cartesi/react. |
| apps/explorer/src/components/output/OutputCard.tsx | Switch types to @cartesi/client. |
| apps/explorer/src/components/output/OutputCard.stories.tsx | Update application fixture shape for new client return type. |
| apps/explorer/src/components/navigation/TournamentBreadcrumbs.tsx | Switch Match type to @cartesi/client. |
| apps/explorer/src/components/navigation/NextPagination.tsx | Switch pagination type to @cartesi/client. |
| apps/explorer/src/components/navigation/MatchBreadcrumbSegment.tsx | Switch Match type to @cartesi/client. |
| apps/explorer/src/components/navigation/MatchBreadcrumbs.tsx | Switch Match type to @cartesi/client. |
| apps/explorer/src/components/match/SubTournamentItem.tsx | Switch Tournament type to @cartesi/client. |
| apps/explorer/src/components/match/MatchView.tsx | Switch types to @cartesi/client. |
| apps/explorer/src/components/match/MatchActions.tsx | Switch types to @cartesi/client. |
| apps/explorer/src/components/match/EliminationTimeoutItem.tsx | Remove unused theme/scheme code. |
| apps/explorer/src/components/input/InputList.tsx | Switch Input type to @cartesi/client. |
| apps/explorer/src/components/input/InputCard.tsx | Fix input tx field rename (transactionHash). |
| apps/explorer/src/components/input/InputCard.stories.tsx | Update input fixtures for renamed fields (transactionHash, logIndex). |
| apps/explorer/src/components/epoch/useEpochStatusColor.tsx | Switch epoch types to @cartesi/client. |
| apps/explorer/src/components/epoch/EpochList.tsx | Switch epoch types to @cartesi/client. |
| apps/explorer/src/components/epoch/EpochCard.tsx | Switch epoch types to @cartesi/client. |
| apps/explorer/src/components/connection/functions.ts | Switch client factory import to @cartesi/client. |
| apps/explorer/src/components/application/utils.ts | Switch Application type to @cartesi/client. |
| apps/explorer/src/components/application/ApplicationList.tsx | Switch Application type to @cartesi/client. |
| apps/explorer/src/components/application/ApplicationForecloseStatus.tsx | Switch Application type to @cartesi/client. |
| apps/explorer/src/components/application/ApplicationCard.tsx | Switch Application types to @cartesi/client. |
| apps/explorer/package.json | Add typegen/check:types; migrate Cartesi deps to new packages. |
| apps/explorer/.storybook/preview.tsx | Fix type-only imports under verbatimModuleSyntax. |
| .vscode/settings.json | Add HCL formatter settings. |
| .npmrc | Remove empty root npm config (per PR summary). |
| .gitignore | Ignore .pnpm-store/. |
| .github/workflows/e2e.yml | Bump Node to 24.19.0 for e2e workflow. |
| .github/workflows/ci.yml | Bump Node to 24.19.0; add type-check step. |
| .github/workflows/chromatic.yaml | Bump Node to 24.19.0 for Chromatic workflow. |
Suppressed comments (1)
apps/explorer/src/components/withdrawal/WithdrawalView.tsx:63
- In the decodeOutputData catch block, the thrown value is cast to Error (
error as Error). IfdecodeOutput()throws a non-Error (string/object),error.messagewill be undefined and the warning UI may render an unhelpful/empty message. Consider normalizing to an Error instance.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| - name: Setup Node.js environment | ||
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e #v6.4.0 | ||
| with: | ||
| node-version: 22.12.0 | ||
| node-version: 24.19.0 | ||
| cache: "pnpm" |
There was a problem hiding this comment.
For the record: It was removed in the past because by default, it will read the package.json reference: https://github.com/pnpm/action-setup#package_json_file
Summary
Migrate the explorer to the new libraries published by cartesi/rollups-ts, and bring the toolchain, CI and supply-chain posture along with it.
@cartesi/viem→@cartesi/client,@cartesi/wagmi→@cartesi/react@cartesi/viem@2.0.0-alpha.31→@cartesi/client@2.0.0-alpha.34@cartesi/wagmi@2.0.0-alpha.35→@cartesi/react@2.0.0-alpha.38The one non-mechanical part: the generated contract hooks picked up the
Iinterface prefix, soevery
Applicationcontract hook was renamed.Add type checking
Type checking was not enforced anywhere before this.
Wiring
apps/explorer: newcheck:types(tsc --build tsconfig.json) andtypegen(next typegen)scripts.
turbo.json: newtypegentask (outputs.next/types/**) and acheck:typestask thatdependsOn: ["codegen", "typegen"]— both generated trees must exist beforetscruns.check:typesscript, and a Check Types step inci.ymlafter linting.tsconfig split — the app and the tooling files were being checked under one config:
tsconfig.app.jsonnow excludes.storybook,next.config.ts,vitest.config.ts,wagmi.config.ts.tsconfig.node.jsonpicks those up instead, gainingDOM/DOM.Iterablelibs,"jsx": "react-jsx"and"types": ["node"].Fixes
InputCardreadinput.transactionReference, a field that no longer exists on themigrated
Inputtype — corrected toinput.transactionHash.EliminationTimeoutItem(unuseduseMantineTheme/useComputedColorSchemeand abgthat was never applied).verbatimModuleSyntaxtype-only import fixes across.storybook/preview.tsxand several stories.Node 24 / pnpm 11, with a supply-chain harness
Runtime bump
22.12.0→24.19.0inci.yml,chromatic.yaml,e2e.yml; DockerNODE_VERSION=24.19.0-alpine3.23;enginestightened to>=24.19.0 <25in the root andpackages/domain.10.25.0→11.21.0(packageManager), turbo2.8.11→2.9.14indocker-bake.hcl.Supply-chain settings added to
pnpm-workspace.yaml:allowBuilds(replacesonlyBuiltDependencies)msw: falsenow denies its install script outrightstrictDepBuilds: trueminimumReleaseAge: 10080trustPolicy: no-downgrade(+trustPolicyIgnoreAfter: 43200)blockExoticSubdeps: trueCleanup — removed
apps/web/.npmrc(strict-peer-dependencies = false) and the empty root.npmrc;.pnpm-store/is now gitignored. The README documents the required toolchain, the policyabove, and
pnpm install --frozen-lockfile.Lockfile — regenerated under pnpm 11.21.0.
Replace hand-rolled output decoding with
@cartesi/codecAdds
@cartesi/codec@1.0.0-alpha.1(deps:abitypeonly,viemas a peer; its portal addressesare byte-identical to
@cartesi/client/abi's, so both are pinned to the same contracts release).WithdrawalViewdecoded withdrawal outputs by hand; now it uses thedecodeOutputfunction, eliminating a bunch of boilerplate code.encodeNotice/encodeDelegateCallVoucher— verified byte-identical tothe previous
encodeFunctionDataoutput, so the threeWithdrawalCardstories render exactly asbefore.
vi.mock("viem")ofdecodeFunctionDatawas dropped for real encoded fixtures: itwould no longer intercept, since the codec is externalised from Vitest's mock registry. Added a case
for an undecodable output, which that mock had been hiding.
@cartesi/wagmi-pluginwas evaluated and deliberately not adopted. The explorer generates noCartesi ABIs of its own — every one arrives pre-generated from
@cartesi/react/@cartesi/client/abi, and no contract it uses is missing there. Adopting it would duplicate them,make
pnpm codegen(and a cold build) require network access to download rollups-contractstarballs on every run, and give us two independently versioned sources for the same addresses.
wagmi.config.tsis untouched and still generates only ERC-20/721/1155 hooks.Verification
check:typesclean — and now enforced in CIlintreports 0 errors