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

StackOverflow error caused by cloning lazyAuthorization #482

Closed
MartinMinkov opened this issue Oct 13, 2022 · 2 comments · Fixed by #484
Closed

StackOverflow error caused by cloning lazyAuthorization #482

MartinMinkov opened this issue Oct 13, 2022 · 2 comments · Fixed by #484
Assignees
Labels
bug Something isn't working

Comments

@MartinMinkov
Copy link
Contributor

Description

When calling this.experimental.authorize(accountUpdate) inside a smart contract method, a stack overflow error occurs. This happens because inside toAuxiliary, the function will call cloneCircuitValue on a.lazyAuthorization and recursively call cloneCircuitValue until it blows up the stack.

See this line here: https://github.com/o1-labs/snarkyjs/blob/ecffd00ecb39f6aa24f2ead47e51eda570ab8071/src/lib/account_update.ts#L1095

This was confirmed by commenting out the cloneCircuitValue call and ensuring that no stack overflow error occurs.

@MartinMinkov MartinMinkov added the bug Something isn't working label Oct 13, 2022
@MartinMinkov
Copy link
Contributor Author

@MartinMinkov MartinMinkov changed the title StackOverflow error caused by cloning lazyAuthorization inside toAuxiliary StackOverflow error caused by cloning lazyAuthorization Oct 13, 2022
@mitschabaude
Copy link
Collaborator

mitschabaude commented Oct 14, 2022

I think the solution might just be to not clone the lazyAuthorization. I can't think of a reason we'd have to clone it.

I didn't investigate the error, but my guess would be that it's something like this: a lazy proof contains everything needed to recreate that proof, including the method arguments. these method arguments can now be account updates themselves. these account updates again contain lazy proofs and children, which both can contain further account updates. Maybe there's some infinite loop of references to account updates occurring there, at least it sounds possible

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

Successfully merging a pull request may close this issue.

2 participants