Merged
Conversation
tzemanovic
added a commit
that referenced
this pull request
Jul 11, 2025
yito88
approved these changes
Jul 14, 2025
Collaborator
|
quick review of |
sug0
reviewed
Jul 15, 2025
Collaborator
Author
it doesn't matter, it doesn't affect the generated code as it's panic-free |
sug0
approved these changes
Jul 16, 2025
8b83686 to
8b782fb
Compare
tzemanovic
added a commit
that referenced
this pull request
Jul 16, 2025
* tomas/fix-wasm-alloc: changelog: add #4729 avoid growing memory if the initial data fits current mem size increase the wasm memory limits Fix wasm host-in-guest alloc by injecting, exporting and using fn
tzemanovic
added a commit
that referenced
this pull request
Jul 17, 2025
* tomas/fix-wasm-alloc: changelog: add #4729 avoid growing memory if the initial data fits current mem size increase the wasm memory limits Fix wasm host-in-guest alloc by injecting, exporting and using fn
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your changes
This fixes an issue with tx and VP WASM inputs that are larger than the initial WASM memory and hence require to grow memory. It turned out that simply calling
memory.growfor this (as performed bymemory::write_memory_bytesfrom host didn't update the guest properly which was then overriding the already used memory ranges from the initial data and hence corrupting the memory, leading to WASM runtime memory errors.To fix this, we're now injecting and exporting a simple alloc fn into WASMs and calling it from host to write the initial data.
Additionally, the max WASM memory size is increased as with the current limit it was not possible to decode a tx with 2 MiB of data (the newly added
wasm::run::tests::test_tx_alloctest would fail with unreachable when it runs out of memory).For a tx with data that fits in the initial memory size there is no change in WASM execution (the alloc call will return early).
The Rust src for the alloc fn that's being injected is here https://github.com/namada-net/namada-wasm-min-alloc
Checklist before merging
breaking::labelsnamada-docsreponamada-indexerornamada-masp-indexer, a corresponding PR is opened in that repo