From 3f8a4d936a764d14b369dec672bd31b40e319fe9 Mon Sep 17 00:00:00 2001 From: frozen <355847+Frozen@users.noreply.github.com> Date: Mon, 8 Apr 2024 20:35:52 -0400 Subject: [PATCH] logs --- consensus/consensus_v2.go | 2 +- consensus/votepower/roster.go | 6 +++++- crypto/bls/bls.go | 4 ++++ internal/configs/sharding/localnet.go | 4 ++-- internal/params/config.go | 2 +- 5 files changed, 13 insertions(+), 5 deletions(-) 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,