Skip to content

fix(codegen): clean up dead code and order-fragile assertion in TRON paths#122

Merged
CodeNinjaEvan merged 1 commit into
tronprotocol:release_0.8.28from
yanghang8612:fix/tron-codegen-cleanup
Jun 25, 2026
Merged

fix(codegen): clean up dead code and order-fragile assertion in TRON paths#122
CodeNinjaEvan merged 1 commit into
tronprotocol:release_0.8.28from
yanghang8612:fix/tron-codegen-cleanup

Conversation

@yanghang8612

@yanghang8612 yanghang8612 commented Jun 25, 2026

Copy link
Copy Markdown

Summary

Three zero-impact clean-ups in the TRON code paths of the legacy (ExpressionCompiler) and IR (IRGeneratorForStatements) code generators. None of these change the generated bytecode for any valid input.

Changes

  • Drop dead member names (legacy). The address member-access read-set still listed totalFrozenBalance / frozenBalance / frozenBalanceUsage, removed years ago in the V1→V2 stake refactor — unreachable dead code (the IR backend was already clean).
  • Remove no-op expression().accept() (legacy). The zero-argument magic builtins withdrawreward / cancelAllUnfreezeV2 / withdrawExpireUnfreeze each ran _functionCall.expression().accept(*this), a no-op for a magic variable (cf. gasleft, which does not).
  • Make the IR bound-first-argument assertion order-independent. The shared precompile-read block asserted !hasBoundFirstArgument() via kind < AvailableUnfreezeV2Size, relying on the declaration order of FunctionType::Kind. Replaced with an explicit set of the bound (address-member-read) kinds, so reordering the enum can no longer silently invalidate the check.

Verification

solc builds cleanly; withdrawreward runtime bytecode is byte-identical before and after (the clean-ups are genuine no-ops); vote and ordinary contracts compile on both the legacy and via-IR pipelines.

Targets release_0.8.28.

🤖 Generated with Claude Code

@github-actions

Copy link
Copy Markdown

Thank you for your contribution to the Solidity compiler! A team member will follow up shortly.

If you haven't read our contributing guidelines and our review checklist before, please do it now, this makes the reviewing process and accepting your contribution smoother.

If you have any questions or need our help, feel free to post them in the PR or talk to us directly on the #solidity-dev channel on Matrix.

@yanghang8612 yanghang8612 changed the title fix(codegen): clean up dead code and order-fragile assertion in TRON paths fix(codegen): fix legacy ICE on getchainparameter; minor TRON clean-ups Jun 25, 2026
Remove no-op expression accepts and stale V1-stake member names in legacy;
replace the IR bound-first-argument check that depended on FunctionType::Kind
ordering.
@yanghang8612 yanghang8612 force-pushed the fix/tron-codegen-cleanup branch from 4d9882c to fa77fc9 Compare June 25, 2026 11:19
@yanghang8612 yanghang8612 changed the title fix(codegen): fix legacy ICE on getchainparameter; minor TRON clean-ups fix(codegen): clean up dead code and order-fragile assertion in TRON paths Jun 25, 2026
@yanghang8612 yanghang8612 marked this pull request as ready for review June 25, 2026 11:21
@CodeNinjaEvan CodeNinjaEvan merged commit b9629ab into tronprotocol:release_0.8.28 Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants