forked from TrueCloudLab/frostfs-node
[#867] governance: Add more logs of the alphabet and inner ring lists
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
be05bed0b3
commit
e558cdd9dd
2 changed files with 26 additions and 2 deletions
|
@ -2,8 +2,11 @@ package governance
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
"encoding/hex"
|
||||||
"sort"
|
"sort"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -43,7 +46,10 @@ func (gp *Processor) processAlphabetSync() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
gp.log.Info("alphabet list has been changed, starting update")
|
gp.log.Info("alphabet list has been changed, starting update",
|
||||||
|
zap.String("side_chain_alphabet", prettyKeys(sidechainAlphabet)),
|
||||||
|
zap.String("new_alphabet", prettyKeys(newAlphabet)),
|
||||||
|
)
|
||||||
|
|
||||||
// 1. Vote to side chain committee via alphabet contracts.
|
// 1. Vote to side chain committee via alphabet contracts.
|
||||||
err = gp.voter.VoteForSidechainValidator(newAlphabet)
|
err = gp.voter.VoteForSidechainValidator(newAlphabet)
|
||||||
|
@ -65,6 +71,11 @@ func (gp *Processor) processAlphabetSync() {
|
||||||
} else {
|
} else {
|
||||||
sort.Sort(newInnerRing)
|
sort.Sort(newInnerRing)
|
||||||
|
|
||||||
|
gp.log.Info("update of the inner ring list",
|
||||||
|
zap.String("before", prettyKeys(innerRing)),
|
||||||
|
zap.String("after", prettyKeys(newInnerRing)),
|
||||||
|
)
|
||||||
|
|
||||||
if gp.notaryDisabled {
|
if gp.notaryDisabled {
|
||||||
err = gp.netmapClient.UpdateInnerRing(newInnerRing)
|
err = gp.netmapClient.UpdateInnerRing(newInnerRing)
|
||||||
} else {
|
} else {
|
||||||
|
@ -103,3 +114,15 @@ func (gp *Processor) processAlphabetSync() {
|
||||||
|
|
||||||
gp.log.Info("finished alphabet list update")
|
gp.log.Info("finished alphabet list update")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func prettyKeys(keys keys.PublicKeys) string {
|
||||||
|
const delimiter = ","
|
||||||
|
|
||||||
|
sb := strings.Builder{}
|
||||||
|
for _, key := range keys {
|
||||||
|
sb.WriteString(hex.EncodeToString(key.Bytes()))
|
||||||
|
sb.WriteString(delimiter)
|
||||||
|
}
|
||||||
|
|
||||||
|
return strings.TrimRight(sb.String(), delimiter)
|
||||||
|
}
|
||||||
|
|
|
@ -99,7 +99,8 @@ func (s *Server) voteForSidechainValidator(validators keys.PublicKeys) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.log.Warn("can't invoke vote method in alphabet contract",
|
s.log.Warn("can't invoke vote method in alphabet contract",
|
||||||
zap.Int8("alphabet_index", int8(letter)),
|
zap.Int8("alphabet_index", int8(letter)),
|
||||||
zap.Uint64("epoch", epoch))
|
zap.Uint64("epoch", epoch),
|
||||||
|
zap.String("error", err.Error()))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue