Skip to content

Sync system-contracts doc with java-tron proto#601

Open
abn2357 wants to merge 7 commits into
tronprotocol:masterfrom
abn2357:fix_system_contract
Open

Sync system-contracts doc with java-tron proto#601
abn2357 wants to merge 7 commits into
tronprotocol:masterfrom
abn2357:fix_system_contract

Conversation

@abn2357
Copy link
Copy Markdown
Contributor

@abn2357 abn2357 commented May 15, 2026

Summary

Brings docs/mechanism-algorithm/system-contracts.md back in sync with the current java-tron source after cross-checking protocol/src/main/protos/core/Tron.proto, the per-contract *.proto files, and each *Actuator.java.

ContractType overview and missing sections (commit b5784bd)

  • Add a ContractType Overview table at the top of system-contracts.md listing every ContractType enum value with its Proto Message, Actuator class, current status, and triggered business; per-contract message definitions stay in the sections below.
  • Fill in previously missing per-contract sections: UpdateEnergyLimitContract, AccountPermissionUpdateContract, MarketSellAssetContract, MarketCancelOrderContract, CancelAllUnfreezeV2Contract.
  • Drop the (Deprecated) prefix from the FreezeBalanceContract heading so it lines up with the other disabled contracts (status is already conveyed in the overview table).
  • Replace the duplicated ContractType table in multi-signatures.md with a link to the new overview section to keep a single source of truth.

Field-name and constraint fixes (commit 08f0d49)

  • Correct field-name mismatches against the proto:
    • ParticipateAssetIssueContract: account_nameasset_name
    • ClearABIContract: account_addresscontract_address
  • Tighten AccountPermissionUpdateContract field constraints to match AccountPermissionUpdateActuator.validate():
    • witness is required for SR accounts and must be empty for non-witness accounts
    • actives is capped at 8 entries

Proto definition sync (commit 63177d2)

  • UnfreezeBalanceContract.receiver_address: field number corrected from 13 to 15.
  • AssetIssueContract: add missing int32 precision = 7; and string id = 41; fields with matching descriptions; update the stale order inline comment to // useless (no business effect in current source).
  • DelegateResourceContract: add the missing int64 lock_period = 6; field with a description covering its semantics and the MAX_DELEGATE_LOCK_PERIOD proposal gating; correct the lock field description (the original "lock for 3 days" is no longer accurate).

Terminology and field-description polish (commit 89e65f0)

  • Per-contract owner_address descriptions. Replace the generic placeholder with contract-specific semantics, cross-checked against the corresponding *Actuator.validate() in java-tron. For example: AssetIssueContract.owner_address → "The address of the account issuing the TRC-10 token."; UnfreezeAssetContract.owner_address → "The address of the token issuer." (validated by accountCapsule.getAssetIssuedName()/getAssetIssuedID() non-empty checks); UpdateSettingContract / UpdateEnergyLimitContract / ClearABIContract → "The address of the contract deployer." (validated by the Arrays.equals(ownerAddress, deployedContractOwnerAddress) check in each actuator). Distinguishes the state-owning account from the signer, which matters under multi-sig.
  • Witness terminology. Rename ParticipateAssetIssueContract.owner_address from "the subscriber account" to "the account participating in the asset issue" to match the proto name. Update the ContractType table entry from Subscribe to Participate.
  • TRC-10 spelling. Standardize TRC10TRC-10 across the ContractType table and prose; fix stray spacing.
  • Token casing. Lowercase Tokentoken in prose (e.g. table cell "TRC-10 token transfer"); proto field names and code blocks remain unchanged.

Test plan

  • mkdocs serve / mkdocs build --strict renders the overview table and new sections without warnings
  • The cross-link from multi-signatures.md (./system-contracts.md#contracttype-overview) resolves
  • Spot-checked each row in the table against Tron.proto and the corresponding *Actuator.java constructor in java-tron
  • Each per-contract owner_address description was cross-checked against the corresponding *Actuator.validate() in java-tron

abn2357 added 2 commits May 13, 2026 17:51
…ctType overview

- Add missing contracts: MarketSellAssetContract, MarketCancelOrderContract, CancelAllUnfreezeV2Contract
- Expand the Account Permission Management link into a full AccountPermissionUpdateContract message section
- Fix ParticipateAssetIssueContract field name: account_name -> asset_name
- Reorder all sections to match the ContractType enum order
- Move the ContractType overview table from multi-signatures.md to system-contracts.md as the canonical index, leaving a link reference behind
- ClearABIContract: rename account_address to contract_address to match proto
- AccountPermissionUpdateContract: clarify that witness permission is required
  for SR accounts and must be empty otherwise; note 8-entry cap on actives
- Drop (Deprecated) prefix from FreezeBalanceContract heading for consistency
  with other disabled contracts (status is already in the overview table)
- AssetIssueContract: add missing precision=7 and id=41 fields; fix the
  order=11 comment ("useless"); document the id field.
- UnfreezeBalanceContract: correct receiver_address field number from 13
  to 15.
- DelegateResourceContract: add missing lock_period=6 field and document
  its interaction with the MAX_DELEGATE_LOCK_PERIOD proposal.
Copy link
Copy Markdown
Contributor

@vivian1912 vivian1912 left a comment

Choose a reason for hiding this comment

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

LGTM

abn2357 added 4 commits May 21, 2026 09:09
…ogy, TRC-10 and token style

- Replace generic owner_address description with per-contract semantics
  (signer vs state-owning account, e.g. token issuer, contract deployer)
- Use Witness in headings and field descriptions; rename participant role
  from subscriber to participating in the asset issue; table Subscribe -> Participate
- Standardize TRC-10 spelling (TRC10 -> TRC-10, fix stray spacing)
- Lowercase token in prose; keep proto field names as-is
- VoteWitness: voter account -> account casting votes for Witnesses
- WitnessUpdate: The Witness account address -> address of the Witness updating its URL
- ExchangeTransaction: trading account -> account exchanging assets via the pair
- UpdateBrokerage: The Witness account address -> address of the Witness adjusting its brokerage ratio
- UnDelegateResource: canceling the delegation -> reclaiming previously delegated resources
- Unify SR to Witness in overview rows (VoteWitness, WitnessCreate,
  WitnessUpdate, ProposalCreate, ProposalApprove, UpdateBrokerage)
- ExchangeWithdraw: redeems -> withdraws
- ExchangeCreate bullet: creating the exchange -> creating the
  exchange pair; add creator-only constraint to ExchangeWithdraw bullet
- VoteWitness vote_address: SR or candidate -> Witness
- AccountPermissionUpdate witness field: SR (witness) accounts -> Witness
- UpdateBrokerage bullet: Commission rate -> Brokerage ratio (typo fix)
The original subjects (Witness/Contract owner/Issuer/Proposal creator/
Exchange pair creator) imply only that specific role can perform the
action. In TRON, the actual signer can be a different account via
AccountPermissionUpdateContract (TIP-16), even though owner_address
must still equal a specific protocol-level address. Drop the subjects
so the table describes the action itself; per-contract owner_address
bullets continue to spell out the address-level constraint.

Also add the 'must be the pair's creator' constraint to the
ExchangeInject owner_address bullet (mirrors ExchangeWithdraw).
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