Skip to content

refactor(config): extract ConfigKey and remove testnet config#6

Open
vividctrlalt wants to merge 9 commits intodevelopfrom
refactor/remove-testnet
Open

refactor(config): extract ConfigKey and remove testnet config#6
vividctrlalt wants to merge 9 commits intodevelopfrom
refactor/remove-testnet

Conversation

@vividctrlalt
Copy link
Owner

Summary

  • Extract ~232 HOCON config key constants from Constant.java into a new ConfigKey.java, leaving only business constants in Constant.java
  • Remove obsolete testnet configuration and 0xa0 address format
  • Unify all config files and tests to use mainnet address format (T- Base58 / 41 hex)

Changes

  • New ConfigKey.java: All HOCON config path strings (e.g. "node.rpc.port") moved here, organized by config section
  • Cleaned Constant.java: Only ~32 business constants remain, grouped by domain (address, transaction, energy, proposal, etc.)
  • Updated Args.java: References changed from Constant.XXX to ConfigKey.XXX for config keys; address prefix hardcoded to mainnet
  • Config files: Removed testnet addressPrefix setting; net.type marked as deprecated
  • Test configs: Converted all genesis/witness addresses from 27- prefix (testnet) to T- prefix (mainnet) and a0 hex to 41 hex
  • FreezeTest: Fixed CREATE2 factory bytecode magic byte (0xa00x41) to match mainnet prefix
  • IstanbulTest: Updated expected chain ID to match new genesis block hash

Test plan

  • Full test suite: 2326 tests passed, 0 failures, 24 ignored

vividctrlalt and others added 9 commits February 27, 2026 15:46
net.type had no practical effect; add net.addressPrefix to explicitly
set the address prefix for backward compatibility.

- Deprecate net.type, add net.addressPrefix to all .conf files
- Add configFilePath to CommonParameter to store resolved config path
- Simplify DynamicArgs to reuse configFilePath from startup
- Remove unused TESTNET constants and NET_TYPE/NET_CONF constants
….java

Move ~232 HOCON configuration key string constants from Constant.java to a
new package-private ConfigKey.java in org.tron.core.config.args. This separates
config-file keys (used only by Args/DynamicArgs/WitnessInitializer) from
business constants, reducing Constant.java from ~420 lines to ~65 lines.
- Remove net.addressPrefix from all 11 config files, keep net block
  with commented-out type field and deprecation note
- Remove ConfigKey.NET_ADDRESS_PREFIX constant and Args.java parsing
  logic, always use mainnet prefix 0x41
- Fix test addresses: convert 27-prefix Base58 to T-prefix, a0/A0 hex
  to 41 across actuator/servlet/relay/vm tests
- Fix hardcoded hashes: update merkle root in BlockCapsuleTest, chainId
  in AllowTvmCompatibleEvmTest and IstanbulTest
- Fix FreezeTest CREATE2: change FACTORY_CODE bytecode magic byte from
  0xa0 to 0x41 (PUSH1 60a0 -> 6041) to match new runtime prefix
- VMContractTestBase: WITNESS_SR1_ADDRESS "a0" -> "41"
- IsSRCandidateTest: nonexistentAddr hex "A0" -> "41"
- config-test-storagetest.conf: convert 16 genesis 27-prefix addresses
  to T-prefix
- config-test-index.conf: convert genesis 27-prefix address to T-prefix
- .gitignore: broaden bin/ pattern to **/bin/, add *.class
Reverse-engineered the Solidity source from CONTRACT_CODE and
FACTORY_CODE bytecode in FreezeTest.java. Added selector and
opcode comments above each bytecode constant.

Also removed accidental blank lines in pr-check.yml.
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.

1 participant