-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add recursion limit for 0.5.2 #64
Conversation
Deserializer { | ||
slice, | ||
index: 0, | ||
remaining_depth: 128, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this a bit high for inside of a contract?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but it's already nowhere near the number that could cause a stack overflow. Is there a reason to lower it further?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both stack overflow and OOM in Wasm can be at a very different point than the stack overflow when running natively on some modern dev machine. Also memory limit is configurable and may just be a few megabytes. Did you test this in Wasm too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With a test like the one in this PR, but as wasm code, it hits stack overflow somewhere between AMOUNT = 4000 and 4500. Memory didn't seem to be a problem. I tested with the make_testing_options()
in cosmwasm-vm, so 16MB.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. Alright then, let's keep the value. Thanks for the confirmation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for asking 👍
I created the release/0.5 branch for this, as it didn't exist yet.
This is a simplified version of the check serde-json does