Skip to content

Don't record own computor's duplicated invalid nonce.#813

Open
cyber-pc wants to merge 1 commit intodevelopfrom
bugfix/2026-03-26-ignore-own-computor-dupicated-invalid-nonce
Open

Don't record own computor's duplicated invalid nonce.#813
cyber-pc wants to merge 1 commit intodevelopfrom
bugfix/2026-03-26-ignore-own-computor-dupicated-invalid-nonce

Conversation

@cyber-pc
Copy link
Copy Markdown
Collaborator

This PR fix unvalidated solutions recorded in system.solutions on duplicate submission.

In processTickTransactionSolution, when minerSolutionFlags detects a duplicate (publicKey, miningSeed, nonce), the else branch skips scoring but still records into system.solutions[] if the entry doesn't exist. This allows invalid solutions (rejected on first submission) to be recorded on second submission without any score check.
This bug is limited to the node's own F2 display and solution publication, minerScores are unaffected.

Fix: remove the unconditional add new entry block from the duplicate path. The existing dedup search and SOLUTION_RECORDED_FLAG marking for legitimate entries is preserved.

@cyber-pc cyber-pc requested review from Franziska-Mueller, krypdkat and philippwerner and removed request for philippwerner March 30, 2026 07:30
@krypdkat
Copy link
Copy Markdown
Contributor

we should run the score again and continue the original flow if score is valid:

        unsigned int solutionScore = (*::score)(processorNumber, transaction->sourcePublicKey, transaction->miningSeed, transaction->nonce);
        score_engine::AlgoType selectedAlgo = score_engine::getAlgoType(transaction->nonce.m256i_u8);
        if (score->isValidScore(solutionScore, selectedAlgo))
        {
            resourceTestingDigest ^= solutionScore;
            KangarooTwelve(&resourceTestingDigest, sizeof(resourceTestingDigest), &resourceTestingDigest, sizeof(resourceTestingDigest));
            const int threshold = (system.epoch < MAX_NUMBER_EPOCH) ?
                solutionThreshold[system.epoch][selectedAlgo]
                : score_engine::DEFAUL_SOLUTION_THRESHOLD[selectedAlgo];
            if (score->isGoodScore(solutionScore, threshold, selectedAlgo)) 
            .....

there is (rare) chance that 2 solutions has the same flag.
score engine has cache system, it will not cost any performance.

@cyber-pc cyber-pc added the invalid This doesn't seem right label Mar 30, 2026
@cyber-pc
Copy link
Copy Markdown
Collaborator Author

We will delay this PR for next epoch, I will need to test to make sure it work as expectation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

invalid This doesn't seem right

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants