Skip to content
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
49 changes: 0 additions & 49 deletions blocksync/reactor.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package blocksync

import (
"bytes"
"errors"
"fmt"
"reflect"
"time"
Expand Down Expand Up @@ -555,53 +553,6 @@ FOR_LOOP:
err = bcR.blockExec.ValidateBlock(state, first)
}

// make sure the block has valid batchHash and batchHeader, and has the enough valid BLS signatures if it is a batch point
if err == nil {
err = func() error {
// check the correctness of the relation of batchHash and batchHeader
if len(first.L2BatchHeader) > 0 {
batchHash, hashErr := bcR.l2Node.BatchHash(first.L2BatchHeader)
if hashErr != nil {
return hashErr
}
if !bytes.Equal(first.BatchHash, batchHash) {
return fmt.Errorf("wrong batchHash. expectedHash: %x, actualHash: %x, batchHeader: %x", batchHash, first.BatchHash, first.L2BatchHeader)
}
} else if len(first.BatchHash) > 0 {
return errors.New("batch hash can not exist when batchHeader is empty")
}

blsDatas, err := l2node.GetBLSDatas(second.LastCommit, state.Validators)
if err != nil {
return err
}
var validVotingPowers int64
if len(blsDatas) > 0 {
if len(first.BatchHash) == 0 {
return errors.New("should not have bls signatures when batchHash is empty")
}
for _, blsData := range blsDatas {
// todo currently can not ensure the l2node has the corresponding bls public key of the signer
//valid, err := bcR.l2Node.VerifySignature(blsData.Signer, first.BatchHash, blsData.Signature)
//if err != nil {
// return err
//}
//if valid {
// validVotingPowers += blsData.VotingPower
//}
validVotingPowers += blsData.VotingPower
}
quorum := state.Validators.TotalVotingPower()*2/3 + 1
if validVotingPowers < quorum {
return fmt.Errorf("not enough votingPowers of valid bls signature. quorum: %d, valid votingPower: %d", quorum, validVotingPowers)
}
} else if len(first.BatchHash) > 0 {
return errors.New("must have bls signatures when batchHash is not empty")
}
return nil
}()
}

if err != nil {
bcR.Logger.Error("Error in validation", "err", err)
peerID := bcR.pool.RedoRequest(first.Height)
Expand Down
258 changes: 0 additions & 258 deletions blssignatures/bls_signatures.go

This file was deleted.

Loading
Loading