paritytech / polkadot-sdk

The Parity Polkadot Blockchain SDK
https://polkadot.com/
1.89k stars 696 forks source link

[pallet-revive] write sandbox output according to the provided output buffer length #5743

Closed xermicus closed 1 month ago

xermicus commented 2 months ago

Instead of error out if the provided output buffer is smaller than what we want to write, we can just write what fits into the output buffer instead. We already write back the actual bytes written to the in-out pointer, so contracts can check it anyways.

This in turn introduces the benefit of allowing contracts to implicitly request only a portion of the returned data from calls and incantations. Which is especially beneficial for YUL as the call family opcodes have a return data size argument and this change removes the need to work around it in contract code.