chore: add logs, fix EpochBlocks

This commit is contained in:
MiniFrenchBread 2024-08-10 10:14:18 +08:00
parent 645729fa89
commit 8e433c1557
2 changed files with 4 additions and 1 deletions

View File

@ -2,6 +2,7 @@ package keeper
import ( import (
"bytes" "bytes"
"fmt"
"math/big" "math/big"
"sort" "sort"
@ -33,6 +34,7 @@ func (k Keeper) generateOneEpoch(ctx sdk.Context) bool {
} }
expectedEpoch = epochNumber + 1 expectedEpoch = epochNumber + 1
// new epoch // new epoch
k.Logger(ctx).Info(fmt.Sprintf("[BeginBlock] generating epoch %v", expectedEpoch))
registrations := []Ballot{} registrations := []Ballot{}
k.IterateRegistrations(ctx, expectedEpoch, func(account string, signature []byte) (stop bool) { k.IterateRegistrations(ctx, expectedEpoch, func(account string, signature []byte) (stop bool) {
registrations = append(registrations, Ballot{ registrations = append(registrations, Ballot{
@ -108,6 +110,7 @@ func (k Keeper) generateOneEpoch(ctx sdk.Context) bool {
// save to store // save to store
k.SetEpochQuorums(ctx, expectedEpoch, quorums) k.SetEpochQuorums(ctx, expectedEpoch, quorums)
k.SetEpochNumber(ctx, expectedEpoch) k.SetEpochNumber(ctx, expectedEpoch)
k.Logger(ctx).Info(fmt.Sprintf("[BeginBlock] epoch %v generated, with %v quorums", expectedEpoch, len(quorums.Quorums)))
return true return true
} }

View File

@ -18,7 +18,7 @@ func DefaultGenesisState() *GenesisState {
TokensPerVote: 10, TokensPerVote: 10,
MaxVotesPerSigner: 1024, MaxVotesPerSigner: 1024,
MaxQuorums: 10, MaxQuorums: 10,
EpochBlocks: 2, EpochBlocks: 5760,
EncodedSlices: 3072, EncodedSlices: 3072,
}, 0, make([]*Signer, 0), []*Quorums{{ }, 0, make([]*Signer, 0), []*Quorums{{
Quorums: make([]*Quorum, 0), Quorums: make([]*Quorum, 0),