Skip to content

Commit

Permalink
fix(constraints): verify constraints logic
Browse files Browse the repository at this point in the history
Co-authored-by: benhenryhunter <[email protected]>
  • Loading branch information
thedevbirb and benhenryhunter committed Nov 12, 2024
1 parent eca6ad5 commit 322fdc2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,12 +378,12 @@ func (b *Builder) subscribeToRelayForConstraints(relayBaseEndpoint string) error
log.Info(fmt.Sprintf("Received %d new constraints", len(constraintsSigned)))

for _, constraint := range constraintsSigned {
if !slices.Contains(b.slotConstraintsPubkeys, constraint.Message.Pubkey) {
log.Warn("Received constraint from unauthorized pubkey", "pubkey", constraint.Message.Pubkey)
continue
}

if b.verifyConstraints {
if !slices.Contains(b.slotConstraintsPubkeys, constraint.Message.Pubkey) {
log.Warn("Received constraint from unauthorized pubkey", "pubkey", constraint.Message.Pubkey)
continue
}

valid, err := constraint.VerifySignature(constraint.Message.Pubkey, b.GetConstraintsDomain())
if err != nil || !valid {
log.Error("Failed to verify constraint signature", "err", err)
Expand Down

0 comments on commit 322fdc2

Please sign in to comment.