Skip to content

build(upgradeable): make the upgradeable transpile pipeline work on the Tron fork#79

Open
luiz-lvj wants to merge 3 commits into
masterfrom
feat/upgradeable-tooling
Open

build(upgradeable): make the upgradeable transpile pipeline work on the Tron fork#79
luiz-lvj wants to merge 3 commits into
masterfrom
feat/upgradeable-tooling

Conversation

@luiz-lvj
Copy link
Copy Markdown
Collaborator

@luiz-lvj luiz-lvj commented Jun 3, 2026

What

Adapts the upgradeable transpilation tooling (copied verbatim from openzeppelin-contracts)
so it actually runs on this fork and produces a compilable @openzeppelin/tron-contracts-upgradeable
from our contracts/. This is the source-repo half of the tron-contractstron-contracts-upgradeable
mirror, modeled on openzeppelin-contractsopenzeppelin-contracts-upgradeable.

Out of scope (separate follow-ups): the upgradeable.yml CI wiring + GH_TOKEN_UPGRADEABLE
secret, npm publishing (release-upgradeable.yml), and getting the transpiled test suite green.

Changes

scripts/upgradeable/transpile.sh

  • Compile step → single stock-solc pass (rm -rf artifacts cache + SKIP_EXPOSED=1 hardhat compile --network hardhat)
    instead of npm run compile. Our default compile is tron:compile-batches, which splits the
    corpus into ~13 build-info files to dodge the tron-solc wasm ceiling — but the transpiler requires
    exactly one. Under --network hardhat the config routes to stock solc (no wasm limit → one
    this is VM-agnostic and correct.
  • Replaced npm run clean (no such script here → would error) with rm -rf artifacts cache.
  • Dropped -q '@openzeppelin/': our contracts import via relative paths, so the peer prefix matched
    nothing (no-op). We transpile self-contained.
  • Dropped the alias/*.sol copy: those stubs re-export Initializable/UUPSUpgradeable from a
    @openzeppelin/contracts peer; in a self-contained build they'd overwrite the real transpiled files.

scripts/upgradeable/transpile-onto.sh

  • Renamed the provenance submodule lib/openzeppelin-contractslib/tron-contracts (it pins the
    exact source commit each transpile was generated from).

scripts/upgradeable/upgradeable.patch (rebuilt: 390 → 212 lines)

  • Kept the two source-correctness hunks: EIP712.sol (drops the ShortStrings immutable cache —
    also resolves a ShortString import the transpiler over-renames) and ReentrancyGuard.sol
    (explicit ERC-7201 struct, no constructor).
  • Kept the EIP712.test.js hunk (drops a sub-test that can't pass on the upgradeable variant).
  • Fork-adapted contracts/package.json (name → @openzeppelin/tron-contracts-upgradeable, repo URL).
  • Dropped OZ-only hunks that don't apply here: the absent AccountEIP7702* tests, and cosmetic
    README/issue-template/root-package.json/remappings edits.

Design note: self-contained vs peer

OZ runs the transpiler in "peer" mode (-q), pulling stateless code (interfaces, libraries,
Initializable) from the published @openzeppelin/contracts package + a submodule. Our contracts
use relative imports, so that prefix matches nothing here — this transpiles self-contained:
every contract, including interfaces/libraries, is emitted with the Upgradeable suffix
(ITRC20Upgradeable, MathUpgradeable), with no dependency on a peer package. Simpler for a fork;
peer-parity can be a later refinement.

@luiz-lvj luiz-lvj requested a review from km631 June 3, 2026 06:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants