fix

fix

fix

fix
pull/4377/head
frozen 2 years ago committed by Casey Gardiner
parent 05b423c3c4
commit cd006791c3
  1. 5
      consensus/consensus_service.go
  2. 4
      consensus/leader.go
  3. 9
      internal/params/config.go
  4. 2
      node/node_newblock.go

@ -1,7 +1,6 @@
package consensus package consensus
import ( import (
"fmt"
"math/big" "math/big"
"sync/atomic" "sync/atomic"
"time" "time"
@ -74,10 +73,6 @@ func (consensus *Consensus) signAndMarshalConsensusMessage(message *msg_pb.Messa
// UpdatePublicKeys updates the PublicKeys for // UpdatePublicKeys updates the PublicKeys for
// quorum on current subcommittee, protected by a mutex // quorum on current subcommittee, protected by a mutex
func (consensus *Consensus) UpdatePublicKeys(pubKeys, allowlist []bls_cosi.PublicKeyWrapper) int64 { func (consensus *Consensus) UpdatePublicKeys(pubKeys, allowlist []bls_cosi.PublicKeyWrapper) int64 {
if utils.GetPort() == 9000 {
//utils.Logger().Info().Msg("UpdatePublicKeys")
fmt.Println("UpdatePublicKeys", len(pubKeys), len(allowlist))
}
// TODO: use mutex for updating public keys pointer. No need to lock on all these logic. // TODO: use mutex for updating public keys pointer. No need to lock on all these logic.
consensus.pubKeyLock.Lock() consensus.pubKeyLock.Lock()
consensus.Decider.UpdateParticipants(pubKeys, allowlist) consensus.Decider.UpdateParticipants(pubKeys, allowlist)

@ -199,10 +199,6 @@ func (consensus *Consensus) onPrepare(recvMsg *FBFTMessage) {
} }
func (consensus *Consensus) onCommit(recvMsg *FBFTMessage) { func (consensus *Consensus) onCommit(recvMsg *FBFTMessage) {
// TODO HERE
if recvMsg.ViewID == 21 {
return
}
consensus.mutex.Lock() consensus.mutex.Lock()
defer consensus.mutex.Unlock() defer consensus.mutex.Unlock()
//// Read - Start //// Read - Start

@ -271,7 +271,8 @@ var (
SlotsLimitedEpoch: EpochTBD, // epoch to enable HIP-16 SlotsLimitedEpoch: EpochTBD, // epoch to enable HIP-16
CrossShardXferPrecompileEpoch: big.NewInt(1), CrossShardXferPrecompileEpoch: big.NewInt(1),
AllowlistEpoch: EpochTBD, AllowlistEpoch: EpochTBD,
LeaderRotationEpoch: big.NewInt(1), LeaderRotationEpoch: big.NewInt(4),
LeaderRotationBlocksCount: 5,
TesnetNinetyPercentEpoch: EpochTBD, TesnetNinetyPercentEpoch: EpochTBD,
FeeCollectEpoch: big.NewInt(5), FeeCollectEpoch: big.NewInt(5),
LeaderRotationEpoch: EpochTBD, LeaderRotationEpoch: EpochTBD,
@ -318,6 +319,7 @@ var (
big.NewInt(1), // LeaderRotationEpoch big.NewInt(1), // LeaderRotationEpoch
64, // LeaderRotationBlocksCount 64, // LeaderRotationBlocksCount
big.NewInt(1), // LeaderRotationEpoch big.NewInt(1), // LeaderRotationEpoch
64, // LeaderRotationBlocksCount
big.NewInt(0), // FeeCollectEpoch big.NewInt(0), // FeeCollectEpoch
} }
@ -358,8 +360,9 @@ var (
big.NewInt(0), // SlotsLimitedEpoch big.NewInt(0), // SlotsLimitedEpoch
big.NewInt(1), // CrossShardXferPrecompileEpoch big.NewInt(1), // CrossShardXferPrecompileEpoch
big.NewInt(0), // AllowlistEpoch big.NewInt(0), // AllowlistEpoch
big.NewInt(1), // LeaderRotationEpoch
64, // LeaderRotationBlocksCount big.NewInt(1), // LeaderRotationEpoch
64, // LeaderRotationBlocksCount
big.NewInt(0), // FeeCollectEpoch big.NewInt(0), // FeeCollectEpoch
} }

@ -89,7 +89,7 @@ func (node *Node) WaitForConsensusReadyV2(readySignal chan consensus.ProposalTyp
newBlock, err := node.ProposeNewBlock(newCommitSigsChan) newBlock, err := node.ProposeNewBlock(newCommitSigsChan)
if err == nil { if err == nil {
fmt.Printf("ProposeNewBlock: #%d :%d @%d with leader %s\n", newBlock.NumberU64(), utils.GetPort(), newBlock.Header().ViewID().Int64(), node.Consensus.GetLeaderPubKey().Bytes.Hex()) fmt.Printf("ProposeNewBlock: #%d :%d e:%d, sh:%d with leader %s\n", newBlock.NumberU64(), utils.GetPort(), node.Blockchain().CurrentHeader().Epoch().Uint64(), node.Blockchain().ShardID(), node.Consensus.GetLeaderPubKey().Bytes.Hex())
if blk, ok := node.proposedBlock[newBlock.NumberU64()]; ok { if blk, ok := node.proposedBlock[newBlock.NumberU64()]; ok {
utils.Logger().Info().Uint64("blockNum", newBlock.NumberU64()).Str("blockHash", blk.Hash().Hex()). utils.Logger().Info().Uint64("blockNum", newBlock.NumberU64()).Str("blockHash", blk.Hash().Hex()).

Loading…
Cancel
Save