-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
85 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,30 @@ | ||
package api | ||
|
||
import "github.com/dappnode/validator-monitoring/listener/src/types" | ||
|
||
// A valid signature is a 0x prefixed hex string of 194 characters (including the prefix) | ||
func validateSignature(signature string) bool { | ||
|
||
// validate the signature | ||
if len(signature) != 194 || signature[:2] != "0x" { | ||
return false | ||
} | ||
return true | ||
} | ||
|
||
// validatePubkeysWithConsensusClient simulates making a bulk request to a consensus client for validating pubkeys. | ||
// It can return a map of validated pubkeys that exist as validators. | ||
func validatePubkeysWithConsensusClient(pubkeys []string) map[string]bool { | ||
validatedPubkeys := make(map[string]bool) | ||
// make api call: GET /eth/v1/beacon/states/{state_id}/validators?id=validator_pubkey1,validator_pubkey2,validator_pubkey3 | ||
|
||
for _, pubkey := range pubkeys { | ||
validatedPubkeys[pubkey] = true // Assuming all given pubkeys are valid | ||
} | ||
return validatedPubkeys | ||
} | ||
|
||
// Dummy implementation of validateSignatureAgainstPayload | ||
func validateSignatureAgainstPayload(signature string, payload types.DecodedPayload) bool { | ||
// signature validation logic here | ||
return true | ||
} |