This workspace is built around protocol parity. Favor small, well-tested changes that preserve byte-level compatibility with java-tron.
cargo fmt --all
cargo check --workspace
cargo test --workspaceFor documentation-only changes, a Markdown/source-link review is usually enough unless command examples or generated API docs changed.
For release-only or heavy coverage:
cargo test --workspace --release -- --ignoredUse narrower package tests while iterating:
cargo test -p tron-types
cargo test -p tron-tvm
cargo test -p tron-node synctron-crypto: base58check, hashes, secp256k1, SM2, RLP, Merkle helpers.tron-proto: generated TRON protobuf messages.tron-types: block/tx wrappers, ID and root conventions.tron-chainbase: store codecs, RocksDB backend, sessions, snapshots, rollback primitives.tron-actuator: per-contract validation and execution.tron-executor: block validation/application and serial vs parallel execution orchestration.tron-tvm: TRON VM host, energy model, precompiles, TRC-10 behavior, shielded support.tron-consensus: DPoS and fork-choice helpers.tron-net: wire framing, TRON P2P messages, discovery helpers.tron-node: daemon runtime, config, sync, inbound serving, snapshots, admin, index hooks, SR/PBFT runtimes.tron-rpcandtron-grpc: client-facing APIs.tron-index: address history, archive rows, query engine, firehose log.tron-mempool: transaction admission, deduplication, persistence, relay feed.tron-eventer: java-tron logsfilter-compatible event emission.tron-wallet: key, keystore, mnemonic, signing, broadcast CLI.tron-state-diff: RPC-level state parity verifier against java-tron.tron-snapshot-convert: standalone binary converting a java-tron LevelDB snapshot into this node's RocksDB format (per-store convert-and-delete, crash-safe resume, optional tar streaming). Kept separate fromtron-nodeso its LevelDB reader dependency never ships in the node binary.
Block hashes prove transaction ordering and transaction Merkle root parity, but not full state parity because TRON headers lack a state root. Use layered verification:
- Unit tests for deterministic codecs, hashes, actuators, and store behavior.
- Integration tests for sync, reorgs, RPC, index, and archive paths.
- Serial-vs-parallel executor equivalence tests for Block-STM changes.
tron-state-diffagainst a java-tron reference node for account/resource, contract, and constant-call state checks.- Mainnet soak tests for peer churn, long catch-up, API behavior, and resource usage.
Build:
cargo build --release -p tron-state-diffCompare recent touched accounts against a java-tron node:
./target/release/tron-state-diff \
--a http://127.0.0.1:8090 \
--b http://<java-tron-host>:8090 \
--from-recent-blocks 200Validate TVM constant-call behavior:
./target/release/tron-state-diff \
--b http://<java-tron-host>:8090 \
--from-recent-blocks 200 \
--constantBoth nodes need constant-call support enabled for constant-call probes.
- Preserve store key/value encodings. Compatibility with java-tron snapshots is a core feature.
- Keep state mutation paths session-oriented so rollback and reorg logic can remain atomic.
- When touching execution, add tests that compare serial and parallel behavior if the code can affect committed state.
- When adding RPC fields, check protobuf JSON default omission behavior. Missing default-valued fields may be compatibility-correct.
- Treat config parsing as a compatibility surface. Maintain snake_case and existing accepted aliases when adding fields.
- Avoid adding sink dependencies to
tron-nodefor optional external pipelines; firehose consumers are intentionally out-of-process. - Keep docs close to the code: when changing a command, config field, endpoint,
or crate responsibility, update
docs/andconfig.example.tomlas needed.
- Vendored
crates/revm-*are intentional forks. Avoid broad mechanical changes there unless the task is specifically about VM interpreter/context behavior. - Generated protobuf output should be changed through the proto/build path, not by editing generated code.
- Consensus stores and key encodings are compatibility boundaries; changing them can make existing java-tron snapshots unreadable.
- Node CLI: crates/tron-node/src/main.rs
- Node config: crates/tron-node/src/config.rs
- Runtime orchestration: crates/tron-node/src/runtime.rs
- Sync: crates/tron-node/src/sync.rs
- Storage API: crates/tron-chainbase/src/lib.rs
- Executor: crates/tron-executor/src/lib.rs
- TVM execution: crates/tron-tvm/src/execute.rs
- RPC methods: crates/tron-rpc/src/methods.rs
- Index engine: crates/tron-index/src/engine.rs