Assessment reports>Brevis>Low findings>Prover assignment will fail for custom inputs
Category: Coding Mistakes

Prover assignment will fail for custom inputs

Low Severity
Low Impact
Medium Likelihood

Description

In sdk/prover/assign.go, the assignCustomInput function does not work correctly for input not being nil. The function is passed the argument input of type *sdkproto.CustomInput. The struct sdkproto.CustomInput has a field JsonBytes that contains the data to be used as custom input. It should also be possible to pass nil as input when there is no custom input. For this, the function contains the following snippet,

// Support empty customInput
jsonBytes := ""
if input == nil {
	jsonBytes = "{}"
}

where jsonBytes is set to "{}" when input is nil. After this, input is not used anymore, and in particular jsonBytes is not updated to use input.JsonBytes if input was not nil. Because of this, the TestAssignCustomInput test in assign_test.go fails.

Impact

The function assignCustomInput will not work correctly when custom inputs are used. Ultimately, this function is used for assignments by Prove and ProveAsync in sdk/prover/server.go, and so proving circuits with custom inputs will fail.

Recommendations

To fix this, an else branch should be added to use the jsonBytes from input if input is not nil:

// Support empty customInput
jsonBytes := ""
if input == nil {
	jsonBytes = "{}"
+	} else {
+		jsonBytes = input.JsonBytes
}

Remediation

This issue has been acknowledged by Brevis, and a fix was implemented in commit 90248b80.

Zellic © 2025Back to top ↑