From 794e6be49f5f40ccdb914ad93f65ee2e61eec885 Mon Sep 17 00:00:00 2001 From: Anton Bukov Date: Tue, 23 Oct 2018 16:00:25 +0300 Subject: [PATCH] Fix short address decoding Example addresses: ``` 0x0014F55A50b281EFD12294f0Cda821Bd8171e920 0x0000000000000000000000000000000000000000 ``` --- plasma_cash/root_chain/contracts/Libraries/RLP.sol | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/plasma_cash/root_chain/contracts/Libraries/RLP.sol b/plasma_cash/root_chain/contracts/Libraries/RLP.sol index cdf5b71..91273ac 100644 --- a/plasma_cash/root_chain/contracts/Libraries/RLP.sol +++ b/plasma_cash/root_chain/contracts/Libraries/RLP.sol @@ -129,10 +129,8 @@ library RLP { uint rStartPos; uint len; (rStartPos, len) = _decode(self); - require(len == 20); - assembly { - data := div(mload(rStartPos), exp(256, 12)) - } + require(len <= 20); + return address(toUint(self)); } /// @dev Return the RLP encoded bytes.