diff --git a/pkg/storagechallenge/deterministic/deterministic.go b/pkg/storagechallenge/deterministic/deterministic.go index 6f9afec3..a0713fc8 100644 --- a/pkg/storagechallenge/deterministic/deterministic.go +++ b/pkg/storagechallenge/deterministic/deterministic.go @@ -27,10 +27,6 @@ func EpochID(height int64, epochZeroHeight uint64, epochLengthBlocks uint64) (ui return uint64(height-int64(epochZeroHeight)) / epochLengthBlocks, true } -func EpochStartHeight(epochID uint64, epochZeroHeight uint64, epochLengthBlocks uint64) int64 { - return int64(epochZeroHeight) + int64(epochID)*int64(epochLengthBlocks) -} - func ComparisonTargetForChallengers(seed []byte, epochID uint64) string { return "sc:challengers:" + hex.EncodeToString(seed) + ":" + strconv.FormatUint(epochID, 10) } diff --git a/pkg/types/healthcheck_challenge.go b/pkg/types/healthcheck_challenge.go index 740a9428..06dc4fa5 100644 --- a/pkg/types/healthcheck_challenge.go +++ b/pkg/types/healthcheck_challenge.go @@ -1,10 +1,7 @@ package types import ( - "encoding/json" "time" - - "github.com/LumeraProtocol/supernode/v2/pkg/utils" ) // HealthCheckMessageType represents the type of message sent in the health-check process @@ -151,14 +148,3 @@ type ProcessBroadcastHealthCheckChallengeMetricsRequest struct { Data []byte `json:"data"` SenderID string `json:"sender_id"` } - -// HealthCheckChallengeMessages represents an array of health-check message -type HealthCheckChallengeMessages []HealthCheckMessage - -// Hash returns the hash of the health-check-challenge challenge log data -func (mdl HealthCheckChallengeMessages) Hash() string { - data, _ := json.Marshal(mdl) - hash, _ := utils.Blake3Hash(data) - - return string(hash) -} diff --git a/pkg/types/storage_challenge.go b/pkg/types/storage_challenge.go index 79f572ac..edcbc911 100644 --- a/pkg/types/storage_challenge.go +++ b/pkg/types/storage_challenge.go @@ -1,11 +1,7 @@ package types import ( - "encoding/json" "time" - - "github.com/LumeraProtocol/supernode/v2/pkg/errors" - "github.com/LumeraProtocol/supernode/v2/pkg/utils" ) // MessageType represents the type of message @@ -40,22 +36,6 @@ func (m MessageType) String() string { } } -// MessageTypeFromString returns the message type from string -func MessageTypeFromString(str string) (MessageType, error) { - switch str { - case "challenge": - return ChallengeMessageType, nil - case "response": - return ResponseMessageType, nil - case "evaluation": - return EvaluationMessageType, nil - case "affirmation": - return AffirmationMessageType, nil - default: - return 0, errors.New("invalid message type string") - } -} - // StorageChallengeSignatures represents the signature struct for broadcasting type StorageChallengeSignatures struct { Challenger map[string]string `json:"challenger,omitempty"` @@ -185,16 +165,6 @@ type ProcessBroadcastChallengeMetricsRequest struct { SenderID string `json:"sender_id"` } -type StorageChallengeMessages []Message - -// Hash returns the hash of the storage-challenge challenge log data -func (mdl StorageChallengeMessages) Hash() string { - data, _ := json.Marshal(mdl) - hash, _ := utils.Blake3Hash(data) - - return string(hash) -} - // NScMetric gets the latest challenge IDs from the DB type NScMetric struct { Count int @@ -232,15 +202,6 @@ type AggregatedScore struct { UpdatedAt time.Time } -type AggregatedScoreList []AggregatedScore - -func (asl AggregatedScoreList) Hash() string { - data, _ := json.Marshal(asl) - hash, _ := utils.Blake3Hash(data) - - return string(hash) -} - type ScoreAggregationEvent struct { ChallengeID string `db:"challenge_id"` IsAggregated bool `db:"is_aggregated"` diff --git a/pkg/utils/healthcheckchallenge/health_check_challenge.go b/pkg/utils/healthcheckchallenge/health_check_challenge.go deleted file mode 100644 index acca1589..00000000 --- a/pkg/utils/healthcheckchallenge/health_check_challenge.go +++ /dev/null @@ -1,30 +0,0 @@ -package storagechallenge - -import ( - "encoding/json" - - "github.com/LumeraProtocol/supernode/v2/pkg/utils" -) - -// HCSummaryStatsRes is the struct for metrics -type HCSummaryStatsRes struct { - HCSummaryStats HCSummaryStats -} - -type HCSummaryStats struct { - TotalChallenges int - TotalChallengesProcessed int - TotalChallengesEvaluatedByChallenger int - TotalChallengesVerified int - SlowResponsesObservedByObservers int - InvalidSignaturesObservedByObservers int - InvalidEvaluationObservedByObservers int -} - -// Hash returns the hash of the SCSummaryStats -func (ss *HCSummaryStatsRes) Hash() string { - data, _ := json.Marshal(ss) - hash, _ := utils.Blake3Hash(data) - - return string(hash) -} diff --git a/pkg/utils/storagechallenge/storage_challenge.go b/pkg/utils/storagechallenge/storage_challenge.go deleted file mode 100644 index 50e9b289..00000000 --- a/pkg/utils/storagechallenge/storage_challenge.go +++ /dev/null @@ -1,30 +0,0 @@ -package storagechallenge - -import ( - "encoding/json" - - "github.com/LumeraProtocol/supernode/v2/pkg/utils" -) - -// SCSummaryStatsRes is the struct for metrics -type SCSummaryStatsRes struct { - SCSummaryStats SCSummaryStats -} - -type SCSummaryStats struct { - TotalChallenges int - TotalChallengesProcessed int - TotalChallengesEvaluatedByChallenger int - TotalChallengesVerified int - SlowResponsesObservedByObservers int - InvalidSignaturesObservedByObservers int - InvalidEvaluationObservedByObservers int -} - -// Hash returns the hash of the SCSummaryStats -func (ss *SCSummaryStatsRes) Hash() string { - data, _ := json.Marshal(ss) - hash, _ := utils.Blake3Hash(data) - - return string(hash) -}