Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hint uuid are prone to change & std.GetHints() triggers duplicate hint; #287

Closed
gbotrel opened this issue Mar 22, 2022 · 0 comments
Closed
Assignees
Labels
bug Something isn't working
Milestone

Comments

@gbotrel
Copy link
Collaborator

gbotrel commented Mar 22, 2022

hint UUID is derived from the function name, using reflect.

func (h StaticFunction) String() string {
	fnptr := reflect.ValueOf(h).Pointer()
	return runtime.FuncForPC(fnptr).Name()
}

However, for package level function (which seem to be a natural way to declare a hint), name is "main.glob..func2" where N in funcN depends of the number of package level declarations... Meaning one constraint system can be compiled, working fine, and changing the order of the hints or adding functions in the circuit, will trigger un-determined behavior (when using a previously compiled circuit).

Also, std.GetHints return the list of hints in std; but adding them to the returned slice, imports the std/ pacakge which in turns register the hints in a package level init() function.

Ideally, we need a deterministic and fixed UUID for the hint, and simply store a map of hint (like in backend/...solution) such that it is not possible for a malicious user to over-hide an existing hint, and duplicate registration mean hints are identical.

@gbotrel gbotrel added the bug Something isn't working label Mar 22, 2022
@gbotrel gbotrel added this to the v0.7.0 milestone Mar 22, 2022
@gbotrel gbotrel self-assigned this Mar 22, 2022
@gbotrel gbotrel closed this as completed Mar 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant