Skip to content

Commit f0f08c4

Browse files
committed
fix: temp fix for flare 366
1 parent cf1fcdf commit f0f08c4

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

client/manager/manager.go

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package manager
33
import (
44
"context"
55
"fmt"
6+
"math/big"
67
"time"
78

89
"github.com/flare-foundation/go-flare-common/pkg/database"
@@ -68,6 +69,10 @@ func (m *Manager) Run(ctx context.Context) {
6869
}
6970

7071
for i := range signingPolicies {
72+
if signingPolicies[i].Policy.RewardEpochId.Cmp(big.NewInt(366)) == 0 {
73+
continue
74+
}
75+
7176
if err := m.OnSigningPolicy(signingPolicies[i]); err != nil {
7277
logger.Panic("signing policy error:", err)
7378
}
@@ -79,6 +84,10 @@ func (m *Manager) Run(ctx context.Context) {
7984
logger.Debug("New signing policy received")
8085

8186
for i := range signingPolicies {
87+
if signingPolicies[i].Policy.RewardEpochId.Cmp(big.NewInt(366)) == 0 {
88+
continue
89+
}
90+
8291
err := m.OnSigningPolicy(signingPolicies[i])
8392
if err != nil {
8493
logger.Error("signing policy error:", err)
@@ -222,14 +231,13 @@ func (m *Manager) OnSigningPolicy(data shared.VotersData) error {
222231

223232
// VotersDataCheck checks consistency of votersData.
224233
func VotersDataCheck(data shared.VotersData) error {
225-
if len(data.Policy.Voters) != len(data.Policy.Weights) {
226-
return errors.New("policy error: signing addresses and weights do not match")
227-
}
228-
if len(data.SubmitToSigningAddress) != len(data.Policy.Voters) {
229-
return errors.New("policy error: submit to signing addresses map incomplete or matching submission addresses")
230-
}
231-
if len(utils.Invert(data.SubmitToSigningAddress)) != len(data.Policy.Voters) {
232-
return errors.New("policy error: matching signing policy addresses")
234+
sigToSubmit := utils.Invert(data.SubmitToSigningAddress)
235+
236+
for _, voter := range data.Policy.Voters {
237+
_, ok := sigToSubmit[voter]
238+
if !ok {
239+
return errors.New("policy error: submit to signing addresses map incomplete")
240+
}
233241
}
234242

235243
return nil

0 commit comments

Comments
 (0)