Skip to content

Deep Project Optimization: Build, Security, Code Quality, Docker, CI/CD#23

Merged
GalaxySciTech merged 16 commits intomasterfrom
cursor/-bc-b7cac5a5-db15-4c6a-90df-f38f9b95064a-82c0
Apr 2, 2026
Merged

Deep Project Optimization: Build, Security, Code Quality, Docker, CI/CD#23
GalaxySciTech merged 16 commits intomasterfrom
cursor/-bc-b7cac5a5-db15-4c6a-90df-f38f9b95064a-82c0

Conversation

@GalaxySciTech
Copy link
Copy Markdown
Owner

@GalaxySciTech GalaxySciTech commented Apr 2, 2026

Summary

Comprehensive deep optimization of the Java-Wallet project addressing build system, security, code quality, infrastructure, and documentation.

Changes

Build System (Gradle 5.3 → 8.5, Java 8 → 17)

  • Upgraded Gradle wrapper from 5.3 to 8.5
  • Upgraded JVM target from 1.8 to 17
  • Replaced deprecated compile with implementation across all modules
  • Upgraded dependency-management-plugin to 1.1.4
  • Removed dead Bintray repository URL

Dependencies

  • Upgraded tokencore to 1.3.0 (com.github.GalaxySciTech:tokencore:1.3.0)
  • Replaced deprecated mysql:mysql-connector-java with com.mysql:mysql-connector-j:8.2.0
  • Replaced Springfox Swagger with SpringDoc OpenAPI 2.3.0
  • Upgraded web3j to 4.10.3, bitcoin-rpc-client to 1.2.4
  • Complete javax.*jakarta.* migration for Spring Boot 3

Security

  • TrxApi: local offline ECDSA signing — private keys no longer sent to hardcoded remote IP
  • Externalized all secrets via environment variables
  • Removed hardcoded keystore password, encryption key, and test password hash from source
  • AES encryption upgraded to random IV per operation
  • Fixed CORS, changed sensitive endpoints from GET to POST

Critical Bug Fixes

  • synETH: returncontinue so empty address map no longer aborts entire sync loop
  • OMNI sync: fixed variable shadowing where confirmations read from own field
  • sendBCHOrFork: fixed hardcoded ChainType
  • ETHUtils: fixed ABI return types for balanceOf / transfer
  • HsmReuqestType: fixed GET_ALL_WALLETS path
  • Thread pool leak in synImportAddress

Code Quality

  • RpcClient: thread-safe fields, removed silent localhost fallback, added logging
  • RestTemplateConfig: added connect/read timeouts
  • DbOp: parameterized query support
  • Replaced deprecated Spring APIs (WebMvcConfigurerAdapter, HandlerInterceptorAdapter)
  • Implemented actual SLF4J logging (was empty no-ops)

Docker & CI/CD

  • Multi-stage Dockerfiles with JDK 17, non-root user, health checks
  • Added docker-compose.yml for local development
  • Added GitHub Actions CI workflow
  • Modernized GitLab CI, removed obsolete Travis CI

Documentation

  • README.md: Full English documentation (primary)
  • README_CN.md: Complete Chinese translation
  • Architecture diagram, full API reference, configuration guide
  • Contact: @GalaxySciTech

Breaking Changes

  • Sensitive API endpoints changed from GET to POST
  • MySQL driver class changed to com.mysql.cj.jdbc.Driver
  • All configuration via environment variables (no hardcoded credentials)
  • Swagger UI at /swagger-ui.html and /v3/api-docs
  • TRX transactions signed locally (no remote signing endpoint)
Open in Web Open in Cursor 

cursoragent and others added 16 commits April 2, 2026 13:20
- Upgrade Gradle wrapper from 5.3 to 8.5
- Upgrade JVM target from 1.8 to 17
- Replace deprecated 'compile' with 'implementation' across all modules
- Replace deprecated 'testCompile' with 'testImplementation'
- Replace 'bootRepackage.enabled=false' with 'bootJar.enabled=false; jar.enabled=true'
- Replace deprecated mysql:mysql-connector-java with com.mysql:mysql-connector-j:8.2.0
- Replace Springfox Swagger with SpringDoc OpenAPI 2.3.0
- Upgrade dependency-management-plugin to 1.1.4
- Upgrade web3j to 4.10.3, bitcoin-rpc-client to 1.2.4
- Upgrade commons-lang3 to 3.14.0, Lombok to 1.18.30
- Remove dead Bintray repository URL
- Remove Android-specific gradle.properties settings
- Configure Jib properly for all deployable modules
- Fix JVM args (remove obsolete MaxPermSize)

Co-authored-by: Galaxy <GalaxySciTech@users.noreply.github.com>
- Replace hardcoded DB credentials with environment variables in all application.yml
- Replace hardcoded RabbitMQ credentials with env vars
- Replace hardcoded xxl-job config with env vars
- Replace hardcoded keystore paths/passwords with env vars
- Fix CORS: replace invalid allowedOrigin('*') + allowCredentials(true) with allowedOriginPatterns('*')
- Replace deprecated WebMvcConfigurerAdapter with WebMvcConfigurer interface
- Externalize PushComponent encryption key via Spring @value
- Fix PushComponent JSON code comparison (use asInt() instead of toString())
- Update MySQL driver class to com.mysql.cj.jdbc.Driver
- Add HikariCP connection pool tuning parameters
- Add JPA configuration (disable open-in-view, set dialect)
- Configure structured logging with file output
- Remove unused imports from CorsConfig and WebMvcConfig

Co-authored-by: Galaxy <GalaxySciTech@users.noreply.github.com>
Critical bugs fixed:
- synETH: 'return' changed to 'continue' so empty address map no longer aborts entire sync loop
- OMNI sync: fix variable shadowing where deposit confirmations were read from own field instead of chain
- sendBCHOrFork: fix hardcoded ChainType.BITCOINCASH to use the chainType parameter
- ethConractBalanceData: fix TypeReference<Bool> to TypeReference<Uint256> for balanceOf return type
- HsmReuqestType: fix GET_ALL_WALLETS path (was pointing to /hsm/remove_useless_wallet)
- RegexType: remove JS-style regex slashes that break Java/Kotlin Pattern

Thread safety & resource management:
- synImportAddress: properly shutdown executor pool after use (was leaking threads)
- Add error logging in thread pool tasks instead of swallowing exceptions

API modernization (javax -> jakarta for Spring Boot 3):
- Migrate all javax.servlet imports to jakarta.servlet
- Replace deprecated HandlerInterceptorAdapter with HandlerInterceptor interface
- Replace deprecated WebMvcConfigurerAdapter with WebMvcConfigurer interface
- Migrate Springfox @Api/@apioperation to SpringDoc @Tag/@operation

Security improvements:
- WalletController: change sensitive endpoints (send, export_wallet, import_wallet) from GET to POST
- Fix deprecated toUpperCase() to uppercase()
- RequestInterceptor: properly use X-Real-IP header for proxy-aware IP whitelisting
- GlobalHandler: stop exposing stack traces and request paths to API clients
- Remove duplicate admin endpoint (get_addr_admin_list)

Cache optimization:
- Increase cache TTL from 3s to 30s to reduce DB thrashing
- Increase max cache size from 1000 to 5000
- Enable cache stats recording

Co-authored-by: Galaxy <GalaxySciTech@users.noreply.github.com>
- Upgrade base image from openjdk:8-jdk-alpine to eclipse-temurin:17
- Implement multi-stage builds (build + runtime stages)
- Add non-root user for security
- Add health checks for all services
- Configure G1GC with tuned pause time settings
- Fix image name mismatches in CI/CD pipeline
- Add docker-compose.yml for local development with MySQL and RabbitMQ
- Use environment variables for all service configuration
- Add proper volume mounts for data persistence

Co-authored-by: Galaxy <GalaxySciTech@users.noreply.github.com>
- Add GitHub Actions CI workflow with JDK 17 + Gradle caching
- Add Docker build job in CI pipeline
- Modernize GitLab CI: upgrade to JDK 17, fix bootRepackage→bootJar
- Fix GitLab CI image name mismatches (docker build/run now use same name)
- Add --restart unless-stopped and env-file to GitLab deploy scripts
- Use docker:dind service properly in GitLab deploy stages
- Remove obsolete Travis CI config (was targeting JDK 8 on Trusty)

Co-authored-by: Galaxy <GalaxySciTech@users.noreply.github.com>
- Add .editorconfig for consistent code style across IDEs
- Implement actual SLF4J logging in LogService (was empty no-ops)
- Improve .gitignore with proper patterns for secrets, logs, and build artifacts
- Add .env.example documenting all required environment variables
- Prevent accidental commit of keystore files and env files

Co-authored-by: Galaxy <GalaxySciTech@users.noreply.github.com>
…I reference

- Replace outdated Travis CI badge with tech stack badges
- Add architecture diagram showing module relationships
- Document all supported blockchain networks
- Add module overview table
- Add complete tech stack listing
- Add Quick Start guide for Docker Compose and manual setup
- Add environment variable configuration reference
- Add complete API endpoint documentation
- Remove references to defunct demo servers

Co-authored-by: Galaxy <GalaxySciTech@users.noreply.github.com>
Replace JPA and Generated annotations for Spring Boot 3. QueryDSL Q* classes unchanged.

Co-authored-by: Galaxy <GalaxySciTech@users.noreply.github.com>
- Update RabbitMqConfig, ScanKeyStoreConfig, CacheServiceImpl: javax.annotation -> jakarta.annotation
- Update all Q* QueryDSL generated files: javax.annotation.Generated -> jakarta.annotation.Generated
- Complete javax->jakarta migration across the entire codebase

Co-authored-by: Galaxy <GalaxySciTech@users.noreply.github.com>
- Fix wallet-task test: move from wrong package com.cl.test to com.wallet.test
- Fix wallet-webapi test: remove entirely commented-out test with leaked private keys
- Replace both tests with proper JUnit 5 context load tests
- Fix directory structure to match package declarations

Co-authored-by: Galaxy <GalaxySciTech@users.noreply.github.com>
- Remove unused RpcClient import and field from RabbitMqConfig
- Remove unused EthRpc import from RabbitMqConfig
- Remove unused PostConstruct import from RabbitMqConfig
- Simplify RabbitMqConfig to only contain bean definitions

Co-authored-by: Galaxy <GalaxySciTech@users.noreply.github.com>
Co-authored-by: Galaxy <GalaxySciTech@users.noreply.github.com>
The 1.3.0 release is published under GalaxySciTech org, not TraderGalax.
Tokencore 1.3.0 includes:
- Modernized Gradle build (8.5)
- Updated dependencies (jackson 2.15, guava 32, protobuf 3.24, grpc 1.58)
- Improved TronTransaction with local offline signing
- Better WalletManager with shared ObjectMapper instances
- JUnit 5 test suite with 96 test cases

Co-authored-by: Galaxy <GalaxySciTech@users.noreply.github.com>
Security (critical):
- TrxApi: implement local offline ECDSA signing, eliminate hardcoded remote IP
  (private keys no longer sent to http://13.127.47.162:8090)
- KeyStoreProperties: remove hardcoded default password from source
- Crypto: use random IV per encryption (backward-compatible decryption for legacy data)
- AdminXServiceImpl: remove leaked main() function with test password hash
- HsmRequest: add null-safety checks and proper error logging

RPC & Network:
- RpcClient: replace mutable global vars with @volatile thread-safe fields
- RpcClient: remove silent localhost fallback (throw explicit errors instead)
- RpcClient: add SLF4J logging for all fallback scenarios
- RestTemplateConfig: add connect/read timeouts (10s/30s)

Code quality:
- ETHUtils: split createContractData into transfer/view variants with correct return types
- ETHUtils: consolidate and fix hex decoding with proper error handling
- OMNIUtils: fix calculateFee to use Long arithmetic (prevent int overflow on large inputs)
- OMNIUtils: remove unused RestTemplate and ObjectMapper fields
- BasicUtils: replace println with SLF4J logger, fix HashSet typing
- HsmXServiceImpl: replace force-unwrap on Identity with lazy safe accessor
- DbOp: add parameterized query support for SQL injection prevention
- AsyncConfig: add missing @configuration annotation
- EosRpc: clean up dead import of non-existent eos4j dependency
- HsmRequest: add null-safety on response body

Co-authored-by: Galaxy <GalaxySciTech@users.noreply.github.com>
…tact info

- Add Telegram contact @GalaxySciTech
- Add CI badge linked to GitHub Actions
- Rewrite introduction in Chinese with English section headers
- Expand architecture diagram with client layer
- Add full tech stack table with version links
- Add complete API reference for all three API groups (Wallet/Blockchain/Admin)
- Add configuration reference table with all env vars
- Add reliability section highlighting production track record
- Add Docker Compose quick-start with service URLs
- Link to tokencore 1.3.0 repo

Co-authored-by: Galaxy <GalaxySciTech@users.noreply.github.com>
- README.md: full English documentation as default
- README_CN.md: complete Chinese translation
- Cross-linked with language switcher at the top of each file
- Both include Telegram contact @GalaxySciTech

Co-authored-by: Galaxy <GalaxySciTech@users.noreply.github.com>
@GalaxySciTech GalaxySciTech marked this pull request as ready for review April 2, 2026 14:03
@GalaxySciTech GalaxySciTech merged commit a004077 into master Apr 2, 2026
1 check failed
@GalaxySciTech GalaxySciTech deleted the cursor/-bc-b7cac5a5-db15-4c6a-90df-f38f9b95064a-82c0 branch April 2, 2026 14:03
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