You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// The effective length of the body, excluding any padding contained
publength:u64,
I think it would be useful to define a simple packed representation of a padded byte array once and for all, and write packers / unpackers for each language.
The simplest solution would be to just concatenate the actual length (as a little endian 32 bit unsigned int), with the actual data, and then finally any remaining padding.
For instance, the input vector (as hex string)
001122334455
would be encoded as a 8-byte padded vector as:
actual length (little endian, 4 bytes)
| actual data (6 bytes)
| |
| | padding (2 bytes)
| | |
06000000 001122334455 0000
Note that 8 bytes refers to the length of the padded data, without the prefix, so this vector is ultimately 12 bytes in total.
Then for instance we could have the following methods in Rust:
Note that these operate on single vectors, therefore there is no need to assemble parameters from different fields in a struct / message (unlike the current mechanism).
Note also that unpad can return a reference to a subslice of the padded data, without reallocations.
The text was updated successfully, but these errors were encountered:
To represent a constant size byte array, we currently use a pair of fields embedded in an object / message, e.g.:
oak/oak_functions/abi/src/lib.rs
Lines 44 to 47 in ed07c0c
I think it would be useful to define a simple packed representation of a padded byte array once and for all, and write packers / unpackers for each language.
The simplest solution would be to just concatenate the actual length (as a little endian 32 bit unsigned int), with the actual data, and then finally any remaining padding.
For instance, the input vector (as hex string)
would be encoded as a 8-byte padded vector as:
Note that 8 bytes refers to the length of the padded data, without the prefix, so this vector is ultimately 12 bytes in total.
Then for instance we could have the following methods in Rust:
Note that these operate on single vectors, therefore there is no need to assemble parameters from different fields in a struct / message (unlike the current mechanism).
Note also that
unpad
can return a reference to a subslice of the padded data, without reallocations.The text was updated successfully, but these errors were encountered: