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

Fix/consensus lost #4655

Draft
wants to merge 1 commit into
base: fix/backup-initialization
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion consensus/consensus_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (consensus *Consensus) HandleMessageUpdate(ctx context.Context, peer libp2p
// Only validator needs to check whether the message is from the correct leader
if !bytes.Equal(senderKey[:], consensus.LeaderPubKey.Bytes[:]) &&
consensus.current.Mode() == Normal && !consensus.IgnoreViewIDCheck.IsSet() {
return errSenderPubKeyNotLeader
return errors.WithMessagef(errSenderPubKeyNotLeader, "current: %s sender: %s", consensus.LeaderPubKey.Hex(), senderKey.Hex())
}
}

Expand Down
6 changes: 5 additions & 1 deletion consensus/votepower/roster.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,11 @@ func Compute(subComm *shard.Committee, epoch *big.Int) (*Roster, error) {
} else { // Our node
member.IsHarmonyNode = true
member.OverallPercent = harmonyPercent.Quo(asDecHMYSlotCount)
member.GroupPercent = member.OverallPercent.Quo(harmonyPercent)
if harmonyPercent.Equal(numeric.ZeroDec()) {
member.GroupPercent = numeric.ZeroDec()
} else {
member.GroupPercent = numeric.OneDec().Quo(asDecHMYSlotCount)
}
ourPercentage = ourPercentage.Add(member.OverallPercent)
}

Expand Down
4 changes: 4 additions & 0 deletions crypto/bls/bls.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ type PublicKeyWrapper struct {
Object *bls.PublicKey
}

func (a PublicKeyWrapper) Hex() string {
return a.Bytes.Hex()
}

// WrapperFromPrivateKey makes a PrivateKeyWrapper from bls secret key
func WrapperFromPrivateKey(pri *bls.SecretKey) PrivateKeyWrapper {
pub := pri.GetPublicKey()
Expand Down
4 changes: 2 additions & 2 deletions internal/configs/sharding/localnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ const (
localnetV1Epoch = 1

localnetEpochBlock1 = 5
localnetBlocksPerEpoch = 64
localnetBlocksPerEpochV2 = 64
localnetBlocksPerEpoch = 16
localnetBlocksPerEpochV2 = 16

localnetVdfDifficulty = 5000 // This takes about 10s to finish the vdf
)
Expand Down
2 changes: 1 addition & 1 deletion internal/params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ var (
LeaderRotationExternalValidatorsEpoch: big.NewInt(6),
FeeCollectEpoch: big.NewInt(2),
ValidatorCodeFixEpoch: big.NewInt(2),
HIP30Epoch: EpochTBD,
HIP30Epoch: big.NewInt(15),
BlockGas30MEpoch: big.NewInt(0),
MaxRateEpoch: EpochTBD,
DevnetExternalEpoch: EpochTBD,
Expand Down