Skip to content

Commit

Permalink
chore: final
Browse files Browse the repository at this point in the history
  • Loading branch information
freak12techno committed Jun 13, 2024
1 parent 50be183 commit ff746a2
Show file tree
Hide file tree
Showing 15 changed files with 170 additions and 190 deletions.
1 change: 0 additions & 1 deletion pkg/converter/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ func (c *Converter) ValidatorFromCosmosValidator(
ConsensusAddressHex: fmt.Sprintf("%x", addr),
ConsensusAddressValcons: addr.String(),
OperatorAddress: validator.OperatorAddress,
Status: int32(validator.Status),
Jailed: validator.Jailed,
SigningInfo: valSigningInfo,
VotingPower: big.NewFloat(0).SetInt(validator.DelegatorShares.BigInt()),
Expand Down
4 changes: 0 additions & 4 deletions pkg/data/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ func (manager *Manager) GetValidators(height int64) (types.Validators, []error)
validators[index] = validator
}

validators.SetVotingPowerPercent()

return validators, nil
}

Expand Down Expand Up @@ -224,8 +222,6 @@ func (manager *Manager) GetValidatorsAndSigningInfoForConsumerChain(height int64
mutex.Unlock()
}

validators.SetVotingPowerPercent()

return validators, errs
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ func (m *Manager) LogNodeReconnect(chain string, node string) {

func (m *Manager) LogValidatorStats(
chain *configPkg.ChainConfig,
entry types.Entry,
entry *types.Entry,
) {
m.missingBlocksGauge.
With(prometheus.Labels{
Expand Down
4 changes: 2 additions & 2 deletions pkg/reporters/discord/missing.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (reporter *Reporter) GetMissingCommand() *Command {
}

validatorEntries := snapshot.Entries.ToSlice()
activeValidatorsEntries := utils.Filter(validatorEntries, func(v types.Entry) bool {
activeValidatorsEntries := utils.Filter(validatorEntries, func(v *types.Entry) bool {
if !v.IsActive {

Check warning on line 32 in pkg/reporters/discord/missing.go

View check run for this annotation

Codecov / codecov/patch

pkg/reporters/discord/missing.go#L31-L32

Added lines #L31 - L32 were not covered by tests
return false
}
Expand All @@ -46,7 +46,7 @@ func (reporter *Reporter) GetMissingCommand() *Command {

render := missingValidatorsRender{
Config: reporter.Config,
Validators: utils.Map(activeValidatorsEntries, func(v types.Entry) missingValidatorsEntry {
Validators: utils.Map(activeValidatorsEntries, func(v *types.Entry) missingValidatorsEntry {

Check warning on line 49 in pkg/reporters/discord/missing.go

View check run for this annotation

Codecov / codecov/patch

pkg/reporters/discord/missing.go#L49

Added line #L49 was not covered by tests
link := reporter.Config.ExplorerConfig.GetValidatorLink(v.Validator)
group, _, _ := reporter.Config.MissedBlocksGroups.GetGroup(v.SignatureInfo.GetNotSigned())
link.Text = fmt.Sprintf("%s %s", group.EmojiEnd, v.Validator.Moniker)
Expand Down
4 changes: 2 additions & 2 deletions pkg/reporters/discord/validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (reporter *Reporter) GetValidatorsCommand() *Command {
}

validatorEntries := snapshot.Entries.ToSlice()
activeValidatorsEntries := utils.Filter(validatorEntries, func(v types.Entry) bool {
activeValidatorsEntries := utils.Filter(validatorEntries, func(v *types.Entry) bool {
return v.IsActive

Check warning on line 32 in pkg/reporters/discord/validators.go

View check run for this annotation

Codecov / codecov/patch

pkg/reporters/discord/validators.go#L31-L32

Added lines #L31 - L32 were not covered by tests
})

Expand All @@ -41,7 +41,7 @@ func (reporter *Reporter) GetValidatorsCommand() *Command {

render := missingValidatorsRender{
Config: reporter.Config,
Validators: utils.Map(activeValidatorsEntries, func(v types.Entry) missingValidatorsEntry {
Validators: utils.Map(activeValidatorsEntries, func(v *types.Entry) missingValidatorsEntry {

Check warning on line 44 in pkg/reporters/discord/validators.go

View check run for this annotation

Codecov / codecov/patch

pkg/reporters/discord/validators.go#L44

Added line #L44 was not covered by tests
link := reporter.Config.ExplorerConfig.GetValidatorLink(v.Validator)
group, _, _ := reporter.Config.MissedBlocksGroups.GetGroup(v.SignatureInfo.GetNotSigned())
link.Text = fmt.Sprintf("%s %s", group.EmojiEnd, v.Validator.Moniker)
Expand Down
4 changes: 2 additions & 2 deletions pkg/reporters/telegram/missing.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (reporter *Reporter) HandleMissingValidators(c tele.Context) error {
}

validatorEntries := snapshot.Entries.ToSlice()
activeValidatorsEntries := utils.Filter(validatorEntries, func(v types.Entry) bool {
activeValidatorsEntries := utils.Filter(validatorEntries, func(v *types.Entry) bool {
if !v.IsActive {

Check warning on line 32 in pkg/reporters/telegram/missing.go

View check run for this annotation

Codecov / codecov/patch

pkg/reporters/telegram/missing.go#L31-L32

Added lines #L31 - L32 were not covered by tests
return false
}
Expand All @@ -46,7 +46,7 @@ func (reporter *Reporter) HandleMissingValidators(c tele.Context) error {

render := missingValidatorsRender{
Config: reporter.Config,
Validators: utils.Map(activeValidatorsEntries, func(v types.Entry) missingValidatorsEntry {
Validators: utils.Map(activeValidatorsEntries, func(v *types.Entry) missingValidatorsEntry {

Check warning on line 49 in pkg/reporters/telegram/missing.go

View check run for this annotation

Codecov / codecov/patch

pkg/reporters/telegram/missing.go#L49

Added line #L49 was not covered by tests
link := reporter.Config.ExplorerConfig.GetValidatorLink(v.Validator)
group, _, _ := reporter.Config.MissedBlocksGroups.GetGroup(v.SignatureInfo.GetNotSigned())
link.Text = fmt.Sprintf("%s %s", group.EmojiEnd, v.Validator.Moniker)
Expand Down
4 changes: 2 additions & 2 deletions pkg/reporters/telegram/validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (reporter *Reporter) HandleListValidators(c tele.Context) error {
}

validatorEntries := snapshot.Entries.ToSlice()
activeValidatorsEntries := utils.Filter(validatorEntries, func(v types.Entry) bool {
activeValidatorsEntries := utils.Filter(validatorEntries, func(v *types.Entry) bool {
return v.IsActive

Check warning on line 32 in pkg/reporters/telegram/validators.go

View check run for this annotation

Codecov / codecov/patch

pkg/reporters/telegram/validators.go#L31-L32

Added lines #L31 - L32 were not covered by tests
})

Expand All @@ -41,7 +41,7 @@ func (reporter *Reporter) HandleListValidators(c tele.Context) error {

render := missingValidatorsRender{
Config: reporter.Config,
Validators: utils.Map(activeValidatorsEntries, func(v types.Entry) missingValidatorsEntry {
Validators: utils.Map(activeValidatorsEntries, func(v *types.Entry) missingValidatorsEntry {

Check warning on line 44 in pkg/reporters/telegram/validators.go

View check run for this annotation

Codecov / codecov/patch

pkg/reporters/telegram/validators.go#L44

Added line #L44 was not covered by tests
link := reporter.Config.ExplorerConfig.GetValidatorLink(v.Validator)
group, _, _ := reporter.Config.MissedBlocksGroups.GetGroup(v.SignatureInfo.GetNotSigned())
link.Text = fmt.Sprintf("%s %s", group.EmojiEnd, v.Validator.Moniker)
Expand Down
6 changes: 3 additions & 3 deletions pkg/snapshot/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ func TestManagerCommitNewSnapshot(t *testing.T) {
manager := NewManager(*log, config, metricsManager)

manager.CommitNewSnapshot(10, Snapshot{
Entries: map[string]types.Entry{
Entries: types.Entries{
"validator": {Validator: &types.Validator{}},
},
})
manager.CommitNewSnapshot(20, Snapshot{
Entries: map[string]types.Entry{
Entries: types.Entries{
"validator": {Validator: &types.Validator{}},
},
})
Expand Down Expand Up @@ -77,7 +77,7 @@ func TestManagerGetNewerSnapshot(t *testing.T) {
assert.Nil(t, firstSnapshot, "Snapshot should not be presented!")

manager.CommitNewSnapshot(20, Snapshot{
Entries: map[string]types.Entry{
Entries: types.Entries{
"validator": {Validator: &types.Validator{}},
},
})
Expand Down
Loading

0 comments on commit ff746a2

Please sign in to comment.