sgns::processing::ProcessingValidationCore¶
#include <processing_validation_core.hpp>
Public Types¶
| Name | |
|---|---|
| enum class | Error { NO_RESULTS_FOR_SUBTASK = 0, WRONG_RESULT_HASHES_LENGTH, DUPLICATE_CHUNK_RESULT_HASH, EMPTY_CHUNK_RESULT_HASH, MISSING_CHUNK_RESULT, INVALID_CHUNK_RESULT_HASH, SUBTASK_ID_MISMATCH, INVALID_RESULTS_BATCH, CHUNK_HASH_MISMATCH_UNTOLERATED, INVALID_PAYOUT_METADATA} Enumeration of error codes used in the processing validation class. |
Public Functions¶
| Name | |
|---|---|
| ProcessingValidationCore() =default | |
| outcome::result< void > | ValidateResults(const SGProcessing::SubTaskCollection & subTasks, const std::map< std::string, SGProcessing::SubTaskResult > & results, std::set< std::string > & invalidSubTaskIds, const std::vector< sgns::Parameter > * jobParameters =nullptr, std::function< outcome::result< std::vector< uint8_t > >(const std::string &outputUri)> fetchOutputData =nullptr) |
| outcome::result< void > | ValidateIndividualResult(const SGProcessing::SubTask & subTask, const SGProcessing::SubTaskResult & result) const |
Public Attributes¶
| Name | |
|---|---|
| constexpr uint64_t | DEVELOPER_CUT_SCALE Scale of SubTaskResult::developer_cut; 1'000'000 == 100%. Mirrors SGProcessing.proto. |
| constexpr size_t | TOKEN_ID_BYTES Exact length of SubTaskResult::token_id in bytes. |
Public Types Documentation¶
enum Error¶
| Enumerator | Value | Description |
|---|---|---|
| NO_RESULTS_FOR_SUBTASK | 0 | a subtask had no result entry |
| WRONG_RESULT_HASHES_LENGTH | number of hashes != number of chunks | |
| DUPLICATE_CHUNK_RESULT_HASH | duplicate hash inside a result | |
| EMPTY_CHUNK_RESULT_HASH | empty hash seen | |
| MISSING_CHUNK_RESULT | a chunk from subtask is missing from results map | |
| INVALID_CHUNK_RESULT_HASH | conflicting/invalid chunk result hash observed | |
| SUBTASK_ID_MISMATCH | subtask id != result id (individual check) | |
| INVALID_RESULTS_BATCH | aggregated invalidities across subtasks | |
| CHUNK_HASH_MISMATCH_UNTOLERATED | a genuine cross-subtask chunk hash mismatch that the tolerance fallback could not resolve | |
| INVALID_PAYOUT_METADATA | peer/developer payout metadata missing or out of range |
Enumeration of error codes used in the processing validation class.
Public Functions Documentation¶
function ProcessingValidationCore¶
function ValidateResults¶
outcome::result< void > ValidateResults(
const SGProcessing::SubTaskCollection & subTasks,
const std::map< std::string, SGProcessing::SubTaskResult > & results,
std::set< std::string > & invalidSubTaskIds,
const std::vector< sgns::Parameter > * jobParameters =nullptr,
std::function< outcome::result< std::vector< uint8_t > >(const std::string &outputUri)> fetchOutputData =nullptr
)
Parameters:
- subTasks The full subtask collection for this job
- results Map of subtaskId -> SubTaskResult received so far
- invalidSubTaskIds Populated with subtask ids found to be invalid
- jobParameters Job schema's generic parameters array (for D-03/D-04 tolerance derivation), or nullptr if unavailable – defaulted so existing call sites keep compiling unchanged
- fetchOutputData Capability to fetch a subtask's full output blob by URI (D-01's ipfs_results_data_id-keyed fetch), or nullptr to skip the tolerance fallback entirely (fail-closed on mismatch, matching pre-XNODE-02 behavior) – defaulted so existing call sites keep compiling unchanged
Return: true if all chunk results are valid
Checks if check result hashes are valid. If invalid chunk hashes found corresponding subtasks are invalidated and returned to processing queue
function ValidateIndividualResult¶
outcome::result< void > ValidateIndividualResult(
const SGProcessing::SubTask & subTask,
const SGProcessing::SubTaskResult & result
) const
Parameters:
- subTask The subtask definition
- result The result to validate
Return: true if the result is valid for the given subtask
Validates a single subtask result against its corresponding subtask
Public Attributes Documentation¶
variable DEVELOPER_CUT_SCALE¶
Scale of SubTaskResult::developer_cut; 1'000'000 == 100%. Mirrors SGProcessing.proto.
variable TOKEN_ID_BYTES¶
Exact length of SubTaskResult::token_id in bytes.
Updated on 2026-10-13 at 16:19:22 +0000