diff --git a/eth/p2p/rlpx.nim b/eth/p2p/rlpx.nim index 75e3839..5d842dc 100644 --- a/eth/p2p/rlpx.nim +++ b/eth/p2p/rlpx.nim @@ -567,7 +567,7 @@ proc p2pProtocolBackendImpl*(protocol: P2PProtocol): Backend = read = bindSym("read", brForceOpen) checkedRlpRead = bindSym "checkedRlpRead" startList = bindSym "startList" - safeEnterList = bindSym "safeEnterList" + enterList = bindSym "enterList" finish = bindSym "finish" messagePrinter = bindSym "messagePrinter" @@ -677,7 +677,7 @@ proc p2pProtocolBackendImpl*(protocol: P2PProtocol): Backend = let paramCount = paramsToWrite.len - readParamsPrelude = if paramCount > 1: newCall(safeEnterList, receivedRlp) + readParamsPrelude = if paramCount > 1: newCall(enterList, receivedRlp) else: newStmtList() when tracingEnabled: diff --git a/eth/p2p/rlpx_protocols/waku_protocol.nim b/eth/p2p/rlpx_protocols/waku_protocol.nim index 4902723..d2508d1 100644 --- a/eth/p2p/rlpx_protocols/waku_protocol.nim +++ b/eth/p2p/rlpx_protocols/waku_protocol.nim @@ -147,17 +147,9 @@ proc append*(rlpWriter: var RlpWriter, value: StatusOptions) = rlpWriter.append(rlpFromBytes(bytes.toRange)) proc read*(rlp: var Rlp, T: typedesc[StatusOptions]): T = - if not rlp.isList(): - raise newException(RlpTypeMismatch, - "List expected, but the source RLP is not a list.") - let sz = rlp.listLen() rlp.enterList() for i in 0 ..< sz: - if not rlp.isList(): - raise newException(RlpTypeMismatch, - "List expected, but the source RLP is not a list.") - rlp.enterList() var k: KeyKind try: diff --git a/eth/rlp.nim b/eth/rlp.nim index eb86328..627fa7a 100644 --- a/eth/rlp.nim +++ b/eth/rlp.nim @@ -243,13 +243,9 @@ proc currentElemEnd*(self: Rlp): int = result += payloadOffset() + payloadBytesCount() proc enterList*(self: var Rlp) = - doAssert isList() - position += payloadOffset() - -proc safeEnterList*(self: var Rlp) = if not isList(): raise newException(RlpTypeMismatch, "List expected, but source RLP is not a list") - enterList() + position += payloadOffset() proc skipElem*(rlp: var Rlp) = rlp.position = rlp.currentElemEnd diff --git a/eth/trie/hexary.nim b/eth/trie/hexary.nim index 0bb4481..6811171 100644 --- a/eth/trie/hexary.nim +++ b/eth/trie/hexary.nim @@ -384,7 +384,7 @@ proc replaceValue(data: Rlp, key: NibblesRange, value: BytesRange): Bytes = var r = initRlpList(17) - # XXX: This can be optmized to a direct bitwise copy of the source RLP + # XXX: This can be optimized to a direct bitwise copy of the source RLP var iter = data iter.enterList() for i in 0 ..< 16: