fix: stackoverflow during proof construction in `grind`

This PR fixes a stackoverflow during proof construction in `grind`.

Closes #11134
4 files changed