x/inference: validation_sample_size is not bounded; values above 500 make honest PoC validation fail #2210
Problem
poc_params.validation_sample_size has no bound in param validation, while the proof endpoint every participant serves accepts at most 500 leaf indices per request. A governance update to a value above 500 or below 0 passes validation and makes honest participants fail PoC validation.
PocParams.Validatechecksvalidation_vote_threshold_bpsand the PoC schemes, but notvalidation_sample_size(types/params.go:1035-1045). The field is anint32(params.proto:262).- The validator reads it as is and replaces only 0 with 200 (poc/validator.go:317-320, same in poc/challenge_validate.go:31-34).
sampleLeafIndicesreturnsmin(sampleSize, count)indices, and nil for a negative size (poc/validator.go:1033-1046).FetchAndVerifyProofssends all of them in one request (poc/proof_client.go:128-180).- The proof handler answers 400 for an empty list or more than
maxLeafIndicesPerRequest = 500(server/public/poc_handler.go:23, :166-171).
So with validation_sample_size = 501, every validator's proof request to a participant whose commit count is above 500 gets a 400. The validator classifies a non-200 answer as validateFailRetry (poc/validator.go:861-873), and every retry fails the same way, so it votes -1 once attempts run out (poc/validator.go:105). With a negative value the request is empty and fails the same way for every participant. The current mainnet value is 200, so nothing is affected today. upgrade-v0.2.18 and main have the same code.
Expected
A param value that passes Params.Validate should not make honest participants fail validation.
Suggested fix
In PocParams.Validate, reject validation_sample_size < 0 || > 500, with 500 taken from one constant shared with the DAPI handler. This is a chain change and ships with an upgrade. The DAPI can also clamp the sample size to [1, 500] in both readers, which needs no chain upgrade.
🔄 Auto-synced from Issue #2210 every hour.