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

parlia urgent: BEP-131 bug. Cause new validators on blockNumber%Epoch = 11 are slashed often. #1145

Merged
merged 1 commit into from
Oct 28, 2022
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
6 changes: 3 additions & 3 deletions consensus/parlia/parlia.go
Original file line number Diff line number Diff line change
Expand Up @@ -929,8 +929,8 @@ func (p *Parlia) IsLocalBlock(header *types.Header) bool {
return p.val == header.Coinbase
}

func (p *Parlia) SignRecently(chain consensus.ChainReader, parent *types.Header) (bool, error) {
snap, err := p.snapshot(chain, parent.Number.Uint64(), parent.ParentHash, nil)
func (p *Parlia) SignRecently(chain consensus.ChainReader, parent *types.Block) (bool, error) {
snap, err := p.snapshot(chain, parent.NumberU64(), parent.Hash(), nil)
if err != nil {
return true, err
}
Expand All @@ -941,7 +941,7 @@ func (p *Parlia) SignRecently(chain consensus.ChainReader, parent *types.Header)
}

// If we're amongst the recent signers, wait for the next block
number := parent.Number.Uint64() + 1
number := parent.NumberU64() + 1
for seen, recent := range snap.Recents {
if recent == p.val {
// Signer is among recents, only wait if the current block doesn't shift it out
Expand Down
2 changes: 1 addition & 1 deletion miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ func (w *worker) newWorkLoop(recommit time.Duration) {
clearPending(head.Block.NumberU64())
timestamp = time.Now().Unix()
if p, ok := w.engine.(*parlia.Parlia); ok {
signedRecent, err := p.SignRecently(w.chain, head.Block.Header())
signedRecent, err := p.SignRecently(w.chain, head.Block)
if err != nil {
log.Info("Not allowed to propose block", "err", err)
continue
Expand Down