Commit Graph

2 Commits

Author SHA1 Message Date
hailin d53203d56e perf(blockchain): 启用 Optimistic Execution + 共识参数调优
性能优化三合一,预计提升单链吞吐 5-10 倍:

1. Optimistic Execution (SDK v0.53 内置):
   - 在 ProcessProposal 阶段预执行下一区块
   - FinalizeBlock 调用时直接复用预执行结果
   - 减少出块延迟约 30-50%

2. 共识参数调优 (init-genesis.sh):
   - timeout_commit: 5s → 1s
   - skip_timeout_commit: true (单节点收到自己投票后立即提交)
   - timeout_propose: 3s → 1.5s
   - timeout_prevote/precommit: 1s → 500ms
   - 实际出块时间预计 500-800ms

3. 存储和内存池调优:
   - IAVL cache: 781,250 → 2,000,000 节点 (适配 16 核 126GB 服务器)
   - Mempool size: 5,000 → 10,000 笔交易
   - Mempool cache: 10,000 → 20,000 (减少重复校验)

技术背景:
- 当前单链 200-800 TPS (串行执行)
- 优化后预计 1,000-3,000 TPS
- 未来 SDK v0.54 将内置 BlockSTM 并行执行 + IAVLx 存储优化
  (Cronos 团队贡献上游化),届时可达 5,000+ TPS

文件变更:
- root.go: 添加 baseapp.SetOptimisticExecution()
- init-genesis.sh: 共识/存储/内存池参数调优
- go.mod/go.sum: go mod tidy 生成完整依赖

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 07:24:21 -08:00
hailin a1293e8445 feat: Genex Chain 区块链完整实现 — cosmos/evm v0.5.1 应用链 + 9合约 + 合规集成
区块链核心 (blockchain/genex-chain/):
- app.go: 真实 Cosmos SDK BaseApp, 20+ 模块注册 (auth/bank/staking/evm/feemarket/erc20/ibc...)
- genesis.go: EVM/FeeMarket/Mint 创世状态, NoBaseFee=true (Gas补贴)
- compliance_integration.go: ComplianceAnteHandler 桥接到 SDK ante 链
  TX → OFAC/TravelRule/Structuring 拦截 → cosmos/evm AnteHandler → Mempool
- cmd/genexd/: 完整 CLI (init/start/keys/query/tx + EVM JSON-RPC/WS)
- x/evm/ante/: 链级合规拦截 (OFAC + Travel Rule ≥$3k + Structuring 24h检测), 18 tests
- x/evm/keeper/: Gas 费覆盖 (平台补贴 + EIP-1559 预留), 13 tests

智能合约 (blockchain/genex-contracts/):
- 9 合约: CouponFactory, Coupon(ERC-721), Settlement, Redemption,
  Compliance, Treasury, Governance, ExchangeRateOracle, CouponBackedSecurity
- 3 接口: ICoupon, ICompliance, IChainlinkPriceFeed
- Deploy.s.sol: Transparent Proxy 部署 + 角色授权
- 102/102 Foundry tests (含 fuzz + 集成)

链参数: Bech32=genex, Denom=agnx(18d), EVM ChainID=8888, ≤1s出块
部署: Docker 6节点 (3创世+2机构+1监管), docker-compose.yml

修复:
- ComplianceAnteHandler 集成到真实 Cosmos SDK ante handler 链 (§6/§16)
- init-testnet.sh denom 从 ugnx 修正为 agnx + 18位精度金额 (§13)

指南符合性: 06-区块链开发指南.md 21节中17节完全符合, 4节偏差已修复/标注

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 23:40:37 -08:00