I am exposing some external functions to ink! contracts via a chain-extension in pallet-contracts. I am essentially passing a vector of bytes as a parameter to a contract method and directly forwarding it to the chain-extension method that also accepts a vector. The return value is also a vector of bytes that I encode via the SCALE codec when I write it to the environment.

What I am wondering is how I can increase the maximum allowed input/output sizes such that I can pass in/return bigger vectors. As I increase the vectors, at some point I get OutputBufferTooSmall and I can trace it to:


I tried changing Schedule limits (such as parameter count, memory pages, etc.), but it doesn't have an impact. As far as I see, it is a runtime limitation that is not related to chain-extension (but I might be wrong). How can I increase the sandbox memory size and what is the preferred way of doing so? Maybe via config and not changing code. I couldn't find where the value pointed to by out_len_ptr is set. Any significant side effects of increasing it?

Thank you!

2 Answers 2


The size of the output buffer is defined by the contract calling the chain extension. It passes a pointer to the length of the buffer in the out_len_ptr parameter. The contracts pallet doesn't enforce any limit on this buffer except for the maximum amount of linear memory a contract can have.

ink! uses 16KiB for this buffer. What you probably want is a way to have this buffer configurable in ink!.


This issue has been resolved in https://github.com/paritytech/ink/pull/1869

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.