build(upgradeable): make the upgradeable transpile pipeline work on the Tron fork#79
Open
luiz-lvj wants to merge 3 commits into
Open
build(upgradeable): make the upgradeable transpile pipeline work on the Tron fork#79luiz-lvj wants to merge 3 commits into
luiz-lvj wants to merge 3 commits into
Conversation
km631
approved these changes
Jun 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-upgradeablefrom our
contracts/. This is the source-repo half of thetron-contracts→tron-contracts-upgradeablemirror, modeled on
openzeppelin-contracts→openzeppelin-contracts-upgradeable.Out of scope (separate follow-ups): the
upgradeable.ymlCI wiring +GH_TOKEN_UPGRADEABLEsecret, npm publishing (
release-upgradeable.yml), and getting the transpiled test suite green.Changes
scripts/upgradeable/transpile.shrm -rf artifacts cache+SKIP_EXPOSED=1 hardhat compile --network hardhat)instead of
npm run compile. Our default compile istron:compile-batches, which splits thecorpus into ~13 build-info files to dodge the tron-solc wasm ceiling — but the transpiler requires
exactly one. Under
--network hardhatthe config routes to stock solc (no wasm limit → onethis is VM-agnostic and correct.
npm run clean(no such script here → would error) withrm -rf artifacts cache.-q '@openzeppelin/': our contracts import via relative paths, so the peer prefix matchednothing (no-op). We transpile self-contained.
alias/*.solcopy: those stubs re-exportInitializable/UUPSUpgradeablefrom a@openzeppelin/contractspeer; in a self-contained build they'd overwrite the real transpiled files.scripts/upgradeable/transpile-onto.shlib/openzeppelin-contracts→lib/tron-contracts(it pins theexact source commit each transpile was generated from).
scripts/upgradeable/upgradeable.patch(rebuilt: 390 → 212 lines)EIP712.sol(drops theShortStringsimmutable cache —also resolves a
ShortStringimport the transpiler over-renames) andReentrancyGuard.sol(explicit ERC-7201 struct, no constructor).
EIP712.test.jshunk (drops a sub-test that can't pass on the upgradeable variant).contracts/package.json(name →@openzeppelin/tron-contracts-upgradeable, repo URL).AccountEIP7702*tests, and cosmeticREADME/issue-template/root-package.json/remappingsedits.Design note: self-contained vs peer
OZ runs the transpiler in "peer" mode (
-q), pulling stateless code (interfaces, libraries,Initializable) from the published@openzeppelin/contractspackage + a submodule. Our contractsuse relative imports, so that prefix matches nothing here — this transpiles self-contained:
every contract, including interfaces/libraries, is emitted with the
Upgradeablesuffix(
ITRC20Upgradeable,MathUpgradeable), with no dependency on a peer package. Simpler for a fork;peer-parity can be a later refinement.