Skip to content

Commit

Permalink
evm: add missing revert reasons (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
facuspagnuolo authored Apr 10, 2019
1 parent 0dcd540 commit 36b3f33
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/evm/contracts/lib/RLP.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ library RLP {
* @param item RLP encoded list in bytes
*/
function toList(RLPItem memory item) internal pure returns (RLPItem[] memory result) {
require(isList(item));
require(isList(item), "Cannot convert to list a non-list RLPItem.");

uint items = numItems(item);
result = new RLPItem[](items);
Expand Down
6 changes: 3 additions & 3 deletions packages/evm/contracts/lib/TrieProofs.sol
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,16 @@ library TrieProofs {
* Nibble is extracted as the least significant nibble in the returned byte
*/
function extractNibble(bytes32 path, uint256 position) internal pure returns (uint8 nibble) {
require(position < 64);
require(position < 64, "Invalid nibble position");
byte shifted = position == 0 ? byte(path >> 4) : byte(path << ((position - 1) * 4));
return uint8(byte(shifted & 0xF));
}

function decodeNibbles(bytes memory compact, uint skipNibbles) internal pure returns (bytes memory nibbles) {
require(compact.length > 0);
require(compact.length > 0, "Empty bytes array");

uint length = compact.length * 2;
require(skipNibbles <= length);
require(skipNibbles <= length, "Skip nibbles amount too large");
length -= skipNibbles;

nibbles = new bytes(length);
Expand Down

0 comments on commit 36b3f33

Please sign in to comment.