Skip to content

feat: migrate to new rollups-ts libraries - #474

Merged
brunomenezes merged 4 commits into
mainfrom
feat/migrate-rollups-ts-libs
Aug 19, 2026
Merged

feat: migrate to new rollups-ts libraries#474
brunomenezes merged 4 commits into
mainfrom
feat/migrate-rollups-ts-libs

Conversation

@brunomenezes

@brunomenezes brunomenezes commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

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.38

The one non-mechanical part: the generated contract hooks picked up the I interface prefix, so
every Application contract hook was renamed.

-useReadApplicationWasOutputExecuted   → +useReadIApplicationWasOutputExecuted
-useSimulateApplicationExecuteOutput   → +useSimulateIApplicationExecuteOutput
-useWriteApplicationExecuteOutput      → +useWriteIApplicationExecuteOutput
-useReadApplicationIsForeclosed        → +useReadIApplicationIsForeclosed
-useSimulateApplicationForeclose       → +useSimulateIApplicationForeclose
-useWriteApplicationForeclose          → +useWriteIApplicationForeclose

Add type checking

Type checking was not enforced anywhere before this.

Wiring

  • apps/explorer: new check:types (tsc --build tsconfig.json) and typegen (next typegen)
    scripts.
  • turbo.json: new typegen task (outputs .next/types/**) and a check:types task that
    dependsOn: ["codegen", "typegen"] — both generated trees must exist before tsc runs.
  • Root check:types script, and a Check Types step in ci.yml after linting.

tsconfig split — the app and the tooling files were being checked under one config:

  • tsconfig.app.json now excludes .storybook, next.config.ts, vitest.config.ts,
    wagmi.config.ts.
  • tsconfig.node.json picks those up instead, gaining DOM/DOM.Iterable libs,
    "jsx": "react-jsx" and "types": ["node"].

Fixes

  • Real bug: InputCard read input.transactionReference, a field that no longer exists on the
    migrated Input type — corrected to input.transactionHash.
  • Dead code in EliminationTimeoutItem (unused useMantineTheme/useComputedColorScheme and a
    bg that was never applied).
  • verbatimModuleSyntax type-only import fixes across .storybook/preview.tsx and several stories.

Node 24 / pnpm 11, with a supply-chain harness

Runtime bump

  • Node 22.12.024.19.0 in ci.yml, chromatic.yaml, e2e.yml; Docker
    NODE_VERSION=24.19.0-alpine3.23; engines tightened to >=24.19.0 <25 in the root and
    packages/domain.
  • pnpm 10.25.011.21.0 (packageManager), turbo 2.8.112.9.14 in docker-bake.hcl.

Supply-chain settings added to pnpm-workspace.yaml:

Setting Effect
allowBuilds (replaces onlyBuiltDependencies) Build scripts are an explicit allow/deny map — msw: false now denies its install script outright
strictDepBuilds: true Install fails when a dependency requests an unapproved build script, instead of silently skipping it
minimumReleaseAge: 10080 Dependencies must be at least 7 days old, blunting compromised-release windows
trustPolicy: no-downgrade (+ trustPolicyIgnoreAfter: 43200) Rejects versions whose publishing trust evidence is weaker than an earlier release
blockExoticSubdeps: true Transitive dependencies cannot resolve from git repos or direct tarball URLs

Cleanup — 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 policy
above, and pnpm install --frozen-lockfile.

Lockfile — regenerated under pnpm 11.21.0.


Replace hand-rolled output decoding with @cartesi/codec

Adds @cartesi/codec@1.0.0-alpha.1 (deps: abitype only, viem as a peer; its portal addresses
are byte-identical to @cartesi/client/abi's, so both are pinned to the same contracts release).

  • WithdrawalView decoded withdrawal outputs by hand; now it uses the decodeOutput function, eliminating a bunch of boilerplate code.
  • Story fixtures moved to encodeNotice / encodeDelegateCallVoucher — verified byte-identical to
    the previous encodeFunctionData output, so the three WithdrawalCard stories render exactly as
    before.
  • The test's vi.mock("viem") of decodeFunctionData was dropped for real encoded fixtures: it
    would 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-plugin was evaluated and deliberately not adopted. The explorer generates no
Cartesi 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-contracts
tarballs on every run, and give us two independently versioned sources for the same addresses.
wagmi.config.ts is untouched and still generates only ERC-20/721/1155 hooks.


Verification

  • 255 tests pass across 58 files
  • check:types clean — and now enforced in CI
  • lint reports 0 errors

@brunomenezes brunomenezes self-assigned this Aug 11, 2026
@brunomenezes brunomenezes added the apps:explorer New rollups explorer. label Aug 11, 2026
@vercel

vercel Bot commented Aug 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
dave Ready Ready Preview Aug 18, 2026 10:05pm
rollups-explorer-arbitrum-mainnet Ready Ready Preview Aug 18, 2026 10:05pm
rollups-explorer-arbitrum-sepolia Ready Ready Preview Aug 18, 2026 10:05pm
rollups-explorer-base-mainnet Ready Ready Preview Aug 18, 2026 10:05pm
rollups-explorer-base-sepolia Ready Ready Preview Aug 18, 2026 10:05pm
rollups-explorer-mainnet Ready Ready Preview Aug 18, 2026 10:05pm
rollups-explorer-optimism-mainnet Ready Ready Preview Aug 18, 2026 10:05pm
rollups-explorer-optimism-sepolia Ready Ready Preview Aug 18, 2026 10:05pm
rollups-explorer-sepolia Ready Ready Preview Aug 18, 2026 10:05pm
rollups-explorer-workshop Ready Ready Preview Aug 18, 2026 10:05pm

Request Review

@socket-security

socket-security Bot commented Aug 18, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​cartesi/​react@​2.0.0-alpha.38761007092100
Added@​cartesi/​codec@​1.0.0-alpha.1761009994100
Added@​cartesi/​client@​2.0.0-alpha.34781009892100

View full report

- 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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/client and @cartesi/react (including the IApplication* hook renames).
  • Add and enforce type-checking (typegen + check:types) via Turbo pipelines and CI, including a split tsconfig for 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). If decodeOutput() throws a non-Error (string/object), error.message will 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.

Comment thread .github/workflows/ci.yml
Comment on lines 20 to 24
- 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"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@tuler tuler left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think as a next step you should get rid of everything related to rollups v1.

-@cartesi/rollups@^1
-@cartesi/rollups@^2

@brunomenezes brunomenezes moved this from 👁 In Review to 👍 Waiting Merge in Rollups Tooling Aug 19, 2026
@brunomenezes
brunomenezes merged commit 732d4fa into main Aug 19, 2026
21 of 22 checks passed
@brunomenezes
brunomenezes deleted the feat/migrate-rollups-ts-libs branch August 19, 2026 09:59
@github-project-automation github-project-automation Bot moved this from 👍 Waiting Merge to 📦 Done in Rollups Tooling Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

apps:explorer New rollups explorer.

Projects

Status: 📦 Done

Development

Successfully merging this pull request may close these issues.

3 participants