MCPcopy
hub / github.com/canopy-network/canopy / SetFSMInConsensusModeForProposals

Method SetFSMInConsensusModeForProposals

controller/block.go:635–654  ·  view source on GitHub ↗

SetFSMInConsensusModeForProposals() is how the Validator is configured for `base chain` specific parameter upgrades

()

Source from the content-addressed store, hash-verified

633
634// SetFSMInConsensusModeForProposals() is how the Validator is configured for `base chain` specific parameter upgrades
635func (c *Controller) SetFSMInConsensusModeForProposals() (reset func()) {
636 elapsed := time.Since(c.Consensus.BFTStartTime).Milliseconds()
637 // if consensus is below round 3 AND it hasn't been more than 3 minutes since the last block
638 if c.Consensus.GetRound() < 3 && elapsed < int64(c.Config.BlockTimeMS()*3) {
639 // if the node is not having 'consensus issues' refer to the approve list
640 c.FSM.SetProposalVoteConfig(fsm.GovProposalVoteConfig_APPROVE_LIST)
641 c.Mempool.FSM.SetProposalVoteConfig(fsm.GovProposalVoteConfig_APPROVE_LIST)
642 } else {
643 // if the node is exhibiting 'chain halt' like behavior, reject all proposals
644 c.FSM.SetProposalVoteConfig(fsm.GovProposalVoteConfig_REJECT_ALL)
645 c.Mempool.FSM.SetProposalVoteConfig(fsm.GovProposalVoteConfig_REJECT_ALL)
646 }
647 // a callback that resets the configuration back to default
648 reset = func() {
649 // the default is to accept all except in 'Consensus mode'
650 c.FSM.SetProposalVoteConfig(fsm.AcceptAllProposals)
651 c.Mempool.FSM.SetProposalVoteConfig(fsm.AcceptAllProposals)
652 }
653 return
654}
655
656// UpdateTelemetry() updates the prometheus metrics after 'committing' a block
657func (c *Controller) UpdateTelemetry(qc *lib.QuorumCertificate, block *lib.Block, blockProcessingTime time.Duration) {

Callers 2

CheckMempoolMethod · 0.95
ValidateProposalMethod · 0.95

Calls 3

GetRoundMethod · 0.80
BlockTimeMSMethod · 0.80
SetProposalVoteConfigMethod · 0.80

Tested by

no test coverage detected