OpenAtomFoundation / xupercore

The kernel of xuperchain.
Apache License 2.0
61 stars 47 forks source link

Fixed the poa and pos consensus stopped producing blocks after operations such as proposal changes #324

Closed wangchao0222 closed 2 years ago

wangchao0222 commented 2 years ago

Description

通过系统合约进行共识提案投票或者变更候选人集合后,poa和pos类共识偶现停止出块

Fixes # (issue)

Type of change

Please delete options that are not relevant.

Brief of your solution

  1. miner中添加同步最长链检查,如果CompeteMaster后链高度变化,则需要重新计算CompeteMaster
  2. tdpos中计算calHisValidators时获取上一轮term的最后一个区块
  3. tdpos和chained-bft中添加部分日志

How Has This Been Tested?

codecov-commenter commented 2 years ago

Codecov Report

Merging #324 (a621c91) into master (52b1682) will increase coverage by 0.04%. The diff coverage is 83.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #324      +/-   ##
==========================================
+ Coverage   45.73%   45.77%   +0.04%     
==========================================
  Files         138      138              
  Lines       12272    12284      +12     
==========================================
+ Hits         5612     5623      +11     
  Misses       5506     5506              
- Partials     1154     1155       +1     
Impacted Files Coverage Δ
bcs/consensus/tdpos/schedule.go 42.98% <71.42%> (+0.32%) :arrow_up:
kernel/consensus/base/driver/chained-bft/smr.go 40.59% <85.71%> (+0.89%) :arrow_up:
bcs/consensus/tdpos/tdpos.go 48.82% <100.00%> (+0.48%) :arrow_up:
...el/consensus/base/driver/chained-bft/saftyrules.go 42.85% <100.00%> (+1.03%) :arrow_up:
bcs/contract/xvm/code_manager.go 63.63% <0.00%> (-2.73%) :arrow_down:
bcs/network/p2pv2/server.go 51.33% <0.00%> (-1.07%) :arrow_down:
bcs/consensus/xpoa/xpoa.go 52.28% <0.00%> (+1.01%) :arrow_up:
bcs/consensus/pow/pow.go 42.96% <0.00%> (+1.14%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 52b1682...a621c91. Read the comment docs.