Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include consensus halt fix #208

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions consensus/polybft/consensus_runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -1005,6 +1005,11 @@ func (c *consensusRuntime) BuildCommitMessage(proposalHash []byte, view *proto.V
return message
}

// StartRound starts a new round with the specified view
func (c *consensusRuntime) StartRound(view *proto.View) error {
return nil
}

// BuildRoundChangeMessage builds a ROUND_CHANGE message based on the passed in proposal
func (c *consensusRuntime) BuildRoundChangeMessage(
proposal *proto.Proposal,
Expand Down
22 changes: 0 additions & 22 deletions consensus/polybft/polybft.go
Original file line number Diff line number Diff line change
Expand Up @@ -630,16 +630,6 @@ func (p *Polybft) startConsensusProtocol() {
stopSequence func()
)

// check every block time * 1.5, so we don't artificially close a sequence
// before the actual sequence has ended properly
checkOffset := p.config.BlockTime
if checkOffset > 1 {
checkOffset /= 2
}

checkFrequency := time.Duration(p.config.BlockTime + checkOffset)
staleChecker := newStaleSequenceCheck(p.logger, p.blockchain.CurrentHeader, checkFrequency*time.Second)

for {
latestHeader := p.blockchain.CurrentHeader()

Expand All @@ -663,8 +653,6 @@ func (p *Polybft) startConsensusProtocol() {
}

sequenceCh, stopSequence = p.ibft.runSequence(latestHeader.Number + 1)
staleChecker.setSequence(latestHeader.Number + 1)
staleChecker.startChecking()
}

now := time.Now().UTC()
Expand All @@ -675,26 +663,16 @@ func (p *Polybft) startConsensusProtocol() {
stopSequence()
p.logger.Info("canceled sequence", "sequence", latestHeader.Number+1)
}
case <-staleChecker.sequenceShouldStop:
if isValidator {
stopSequence()
p.logger.Info("canceled sequence via stale checker", "sequence", latestHeader.Number+1)
}
case <-sequenceCh:
case <-p.closeCh:
p.logger.Debug("stoping sequence", "block number", latestHeader.Number+1)
if isValidator {
stopSequence()
staleChecker.stopChecking()
}

return
}

if isValidator {
staleChecker.stopChecking()
}

p.logger.Debug("time to run the sequence", "seconds", time.Since(now))
}
}
Expand Down
94 changes: 0 additions & 94 deletions consensus/polybft/stale_sequence_check.go

This file was deleted.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.21

require (
cloud.google.com/go/secretmanager v1.12.0
github.com/0xPolygon/go-ibft v0.4.1-0.20230717081138-628065cf23b6
github.com/0xPolygon/go-ibft v0.4.1-0.20240424093031-00f7637226a6
github.com/Ethernal-Tech/blockchain-event-tracker v0.0.0-20231202204931-b886edca635a
github.com/Ethernal-Tech/merkle-tree v0.0.0-20231213143318-4db9da419e04
github.com/armon/go-metrics v0.4.1
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D
git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg=
github.com/0xPolygon/go-ibft v0.4.1-0.20230717081138-628065cf23b6 h1:EL/37sEjeLmQ2RTd9xMLLOuMXY6fMV/zB8a5X0BJUMM=
github.com/0xPolygon/go-ibft v0.4.1-0.20230717081138-628065cf23b6/go.mod h1:0W1BnkhtXa2K59PzTPoQvbKOnI+G6QliXIHpQWNeiAM=
github.com/0xPolygon/go-ibft v0.4.1-0.20240424093031-00f7637226a6 h1:s8YmD/yvpC2Lu3vSrb0laBThj/YCnQ1dpnVZqf4CfHo=
github.com/0xPolygon/go-ibft v0.4.1-0.20240424093031-00f7637226a6/go.mod h1:FPdz+s0jyQzW4pZK+HMnhz2b8ebsg5FaSVFTjvQi8ls=
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8=
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
Expand Down
Loading