Skip to content

Commit 91def64

Browse files
committed
Add comment to readList and decodeList about aliasing
1 parent 3c063fc commit 91def64

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

contracts/utils/RLP.sol

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,11 @@ library RLP {
346346
return string(readBytes(item));
347347
}
348348

349-
/// @dev Decodes an RLP encoded list into an array of RLP Items.
349+
/**
350+
* @dev Decodes an RLP encoded list in a memory slice into an array of RLP Items.
351+
*
352+
* NOTE: The returned array contains slice references into the original payload, not copied bytes.
353+
*/
350354
function readList(Memory.Slice item) internal pure returns (Memory.Slice[] memory list) {
351355
uint256 itemLength = item.length();
352356

@@ -413,7 +417,11 @@ library RLP {
413417
return readString(item.asSlice());
414418
}
415419

416-
/// @dev Decode an RLP encoded list from bytes. See {readList}
420+
/**
421+
* @dev Decode an RLP encoded list from bytes. See {readList}
422+
*
423+
* NOTE: The returned array contains slice references into the original payload, not copied bytes.
424+
*/
417425
function decodeList(bytes memory value) internal pure returns (Memory.Slice[] memory) {
418426
return readList(value.asSlice());
419427
}

0 commit comments

Comments
 (0)