Skip to content

Conversation

@chipshort
Copy link

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

Deserializer {
slice,
index: 0,
remaining_depth: 128,
Copy link
Member

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?

Copy link
Author

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?

Copy link
Member

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?

Copy link
Author

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.

Copy link
Member

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for asking 👍

@webmaster128 webmaster128 merged commit f86de19 into release/0.5 Jan 23, 2024
@webmaster128 webmaster128 deleted the recursion-limit-0.5 branch January 23, 2024 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants