diff --git a/consensus/consensus_v2.go b/consensus/consensus_v2.go index 91a568b969..5a96fff919 100644 --- a/consensus/consensus_v2.go +++ b/consensus/consensus_v2.go @@ -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()) } } diff --git a/consensus/votepower/roster.go b/consensus/votepower/roster.go index bebd90bbaa..ef19fd8ff7 100644 --- a/consensus/votepower/roster.go +++ b/consensus/votepower/roster.go @@ -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) } diff --git a/crypto/bls/bls.go b/crypto/bls/bls.go index 7a8159ef87..a94c3c05e3 100644 --- a/crypto/bls/bls.go +++ b/crypto/bls/bls.go @@ -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() diff --git a/internal/configs/sharding/localnet.go b/internal/configs/sharding/localnet.go index fb6050b1de..6dcfce8ce6 100644 --- a/internal/configs/sharding/localnet.go +++ b/internal/configs/sharding/localnet.go @@ -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 ) diff --git a/internal/params/config.go b/internal/params/config.go index f1b747f6dd..09d06001c3 100644 --- a/internal/params/config.go +++ b/internal/params/config.go @@ -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,