RLPEncoder
Author: Matter Labs
This library provides RLP encoding functionality.
Note: security-contact: security@matterlabs.dev
Functions
encodeAddress
function encodeAddress(address _val)
internal
pure
returns (bytes memory encoded);
encodeUint256
function encodeUint256(uint256 _val)
internal
pure
returns (bytes memory encoded);
encodeNonSingleBytesLen
Encodes the size of bytes in RLP format.
function encodeNonSingleBytesLen(uint64 _len)
internal
pure
returns (bytes memory);
Parameters
Name | Type | Description |
---|---|---|
_len | uint64 | The length of the bytes to encode. It has a uint64 type since as larger values are not supported. NOTE: panics if the length is 1 since the length encoding is ambiguous in this case. |
encodeListLen
Encodes the size of list items in RLP format.
function encodeListLen(uint64 _len) internal pure returns (bytes memory);
Parameters
Name | Type | Description |
---|---|---|
_len | uint64 | The length of the bytes to encode. It has a uint64 type since as larger values are not supported. |
_encodeLength
function _encodeLength(uint64 _len, uint256 _offset)
private
pure
returns (bytes memory encoded);
_highestByteSet
Computes the index of the highest byte set in number.
Uses little endian ordering (The least significant byte has index 0
).
NOTE: returns 0
for 0
function _highestByteSet(uint256 _number) private pure returns (uint256 hbs);