mirror of https://github.com/status-im/nim-eth.git
Address review comments from Enterlist PR
This commit is contained in:
parent
0d63ff4db4
commit
b951ec45dc
|
@ -229,7 +229,7 @@ proc fromBytesAux(r: var Record): bool =
|
|||
return false
|
||||
|
||||
# We already know we are working with a list
|
||||
discard rlp.enterList()
|
||||
doAssert rlp.enterList()
|
||||
rlp.skipElem() # Skip signature
|
||||
|
||||
r.seqNum = rlp.read(uint64)
|
||||
|
|
|
@ -153,11 +153,9 @@ proc read*(rlp: var Rlp, T: typedesc[StatusOptions]): T =
|
|||
|
||||
let sz = rlp.listLen()
|
||||
# We already know that we are working with a list
|
||||
discard rlp.enterList()
|
||||
doAssert rlp.enterList()
|
||||
for i in 0 ..< sz:
|
||||
if not rlp.enterList():
|
||||
raise newException(RlpTypeMismatch,
|
||||
"List expected, but the source RLP is not a list.")
|
||||
rlp.tryEnterList()
|
||||
|
||||
var k: KeyKind
|
||||
try:
|
||||
|
|
|
@ -387,7 +387,7 @@ proc replaceValue(data: Rlp, key: NibblesRange, value: BytesRange): Bytes =
|
|||
# XXX: This can be optimized to a direct bitwise copy of the source RLP
|
||||
var iter = data
|
||||
# We already know that we are working with a list
|
||||
discard iter.enterList()
|
||||
doAssert iter.enterList()
|
||||
for i in 0 ..< 16:
|
||||
r.append iter
|
||||
iter.skipElem
|
||||
|
@ -513,7 +513,7 @@ proc deleteAt(self: var HexaryTrie;
|
|||
var rlpRes = initRlpList(17)
|
||||
var iter = origRlp
|
||||
# We already know that we are working with a list
|
||||
discard iter.enterList
|
||||
doAssert iter.enterList
|
||||
for i in 0 ..< 16:
|
||||
rlpRes.append iter
|
||||
iter.skipElem
|
||||
|
|
|
@ -102,7 +102,7 @@ test "encode and decode lists":
|
|||
var list = rlpFromBytes encodeList(rlp.listELem(1), rlp.listELem(0)).toRange
|
||||
|
||||
# test that iteration with enterList/skipElem works as expected
|
||||
discard list.enterList # We alreay know that we are working with a list
|
||||
doAssert list.enterList # We already know that we are working with a list
|
||||
check list.toString == "Lorem ipsum dolor sit amet"
|
||||
list.skipElem
|
||||
|
||||
|
|
Loading…
Reference in New Issue