Skip to content

refactor(crypto): remove unused SM2 and SM3 - #6999

Merged
kuny0707 merged 3 commits into
tronprotocol:release_v4.8.3from
Federico2014:refactor/remove-sm2-sm3-v4.8.3
Oct 10, 2026
Merged

kuny0707 merged 3 commits into
tronprotocol:release_v4.8.3from
Federico2014:refactor/remove-sm2-sm3-v4.8.3

Conversation

@Federico2014

Copy link
Copy Markdown
Collaborator

What does this PR do?

Remove SM2/SM3 implementations, runtime engine selection, and Toolkit --sm2 options. Simplify signing and hashing APIs to ECKey/secp256k1 and SHA-256, and update their callers and tests across the dependent modules.

Retain a startup-only compatibility check before storage or keystore initialization: an absent crypto.engine uses the default suite; explicit eckey is accepted with a deprecation warning; all other values, including sm2, null, and non-string values, fail with migration guidance. Add configuration and FullNode startup regression tests and document the migration requirements.

Why are these changes required?

The unused engine switch spans consensus-critical hashes, signatures, addresses, and Merkle roots. Removing it simplifies the cryptographic path, while the startup check prevents an existing SM2 deployment from silently switching algorithms against incompatible chain data. Implements the compatibility requirements discussed in #6959.

This PR has been tested by:

  • Focused configuration and FullNode startup tests passed, covering default startup, explicit eckey, unsupported values, and rejection before database-directory creation or keystore initialization.
  • ./gradlew test :framework:checkstyleMain :framework:checkstyleTest --continue --console=plain passed: 3,437 tests passed, 27 skipped, zero failures; both framework Checkstyle tasks passed.
  • Manual live-node testing was not performed.

Follow up

Existing SM2/SM3 deployments must remain on a compatible release until a separate migration is completed. Changing the configuration does not convert chain data or keys.

Extra details

The cross-module changes are required by the removal of shared engine-selecting APIs. This breaks those Java APIs and removes SM2/SM3 support; the default ECKey/SHA-256 path is retained.

Remove SM2/SM3 implementations and runtime engine selection, simplify cryptographic APIs and update their callers and tests. Reject unsupported legacy crypto.engine settings before storage or keystore initialization, with migration guidance and startup regression coverage.
@github-actions
github-actions Bot requested a review from 3for September 24, 2026 03:16
@Federico2014 Federico2014 linked an issue Sep 24, 2026 that may be closed by this pull request
@317787106

This comment was marked as resolved.

@317787106

This comment was marked as resolved.

Comment thread common/src/main/java/org/tron/core/config/args/MiscConfig.java Outdated
@halibobo1205 halibobo1205 added this to the GreatVoyage-v4.8.3 milestone Sep 24, 2026
Comment thread common/src/main/java/org/tron/core/config/args/MiscConfig.java Outdated
Comment thread crypto/src/main/java/org/tron/common/crypto/SignUtils.java Outdated

@3for 3for left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. Please be mindful of the conflicts with PR #6996 when merging.

@kuny0707
kuny0707 merged commit f62b25f into tronprotocol:release_v4.8.3 Oct 10, 2026
10 checks passed
Little-Peony added a commit to Little-Peony/java-tron that referenced this pull request Oct 12, 2026
* release_v4.8.3:
  feat(framework): remove --keystore-factory support from FullNode (tronprotocol#6978)
  refactor(proto): remove unused proto discover definition (tronprotocol#7014)
  fix(config): close resource streams (tronprotocol#7002)
  refactor(crypto): remove unused SM2 and SM3 (tronprotocol#6999)
  feat(plugins): backfill section bloom (tronprotocol#6973)
  refactor(api): remove dead WalletExtension gRPC service and config (tronprotocol#6975)
  refactor(framework): decouple Manager from TronJsonRpcImpl (tronprotocol#6990)
  refactor(api): replace response copy wrappers with Jetty content count (tronprotocol#6982)
  update a new version. version name:GreatVoyage-v4.8.2.2-1-gf3e81404fe,version code:18830 (tronprotocol#7008)
  feat: improve node stability and execution efficiency (tronprotocol#7007)
warku123 added a commit to warku123/java-tron that referenced this pull request Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Feature] Remove unused SM2/SM3 crypto engine

6 participants