[PR] Address PR comments #3

pull/1850/head
Edgar Aroutiounian 5 years ago
parent ccd0648c73
commit cc8662cb53
  1. 4
      consensus/quorum/one-node-staked-vote.go
  2. 2
      internal/chain/reward.go
  3. 2
      internal/params/config.go
  4. 6
      node/node_handler.go

@ -57,7 +57,7 @@ func (v *stakedVoteWeight) IsQuorumAchieved(p Phase) bool {
// QuorumThreshold ..
func (v *stakedVoteWeight) QuorumThreshold() *big.Int {
return v.total.Mul(twoThirds).RoundInt()
return v.total.Mul(twoThirds).Ceil().RoundInt()
}
// RewardThreshold ..
@ -73,7 +73,6 @@ func (v *stakedVoteWeight) Award(
payout := big.NewInt(0)
last := big.NewInt(0)
count := big.NewInt(int64(len(earners)))
// TODO Finish implementing this logic
proportional := map[common.Address]numeric.Dec{}
for _, details := range v.validatorStakes {
@ -83,6 +82,7 @@ func (v *stakedVoteWeight) Award(
)
}
}
// TODO Finish implementing this logic w/Chao
for i := range earners {
cur := big.NewInt(0)

@ -104,7 +104,7 @@ func AccumulateRewards(
for i := range missing {
w.Add(1)
go func(member int) {
defer w.Add(-1)
defer w.Done()
// Slash if missing block was long enough
if slasher.ShouldSlash(missing[member].BlsPublicKey) {
// TODO Logic

@ -36,7 +36,7 @@ var (
ChainID: TestnetChainID,
CrossTxEpoch: big.NewInt(0),
CrossLinkEpoch: big.NewInt(0),
StakingEpoch: big.NewInt(3),
StakingEpoch: EpochTBD,
EIP155Epoch: big.NewInt(0),
S3Epoch: big.NewInt(0),
}

@ -378,10 +378,9 @@ func (node *Node) PostConsensusProcessing(newBlock *types.Block, commitSigAndBit
}
}
}
next := new(big.Int).Add(newBlock.Epoch(), common.Big1)
// Update consensus keys at last so the change of leader status doesn't mess up normal flow
if shard.Schedule.IsLastBlock(newBlock.Number().Uint64()) {
next := new(big.Int).Add(newBlock.Epoch(), common.Big1)
if node.chainConfig.StakingEpoch.Cmp(next) == 0 &&
node.Consensus.Decider.Policy() != quorum.SuperMajorityStake {
node.Consensus.Decider = quorum.NewDecider(quorum.SuperMajorityStake)
@ -395,7 +394,8 @@ func (node *Node) PostConsensusProcessing(newBlock *types.Block, commitSigAndBit
s.FindCommitteeByID(node.Consensus.ShardID).Slots,
)
}
// TODO Need to refactor UpdateConsensusInformation so can fold the following logic
// into UCI - todo because UCI mutates state & called in overloaded contexts
node.Consensus.UpdateConsensusInformation()
if shard.Schedule.IsLastBlock(newBlock.Number().Uint64()) {

Loading…
Cancel
Save