Skip to content

Commit

Permalink
Remove keyed_queue rlp support
Browse files Browse the repository at this point in the history
It's unused and causing trouble because of unhandled exception effects -
if we were to use it, it would need re-implementation such that it
doesn't reallocate the whole queue on writing.
  • Loading branch information
arnetheduck committed Jun 5, 2024
1 parent 8985535 commit 52482ef
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 332 deletions.
25 changes: 3 additions & 22 deletions nimbus/utils/ec_recover.nim
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import
../constants,
./keyed_queue/kq_rlp,
./utils_defs,
eth/[common, common/transaction, keys, rlp],
stew/keyed_queue,
Expand Down Expand Up @@ -156,8 +155,7 @@ proc len*(er: var EcRecover): int =
# Public functions: caching ecRecover version
# ------------------------------------------------------------------------------

proc ecRecover*(er: var EcRecover; header: var BlockHeader): EcAddrResult
=
proc ecRecover*(er: var EcRecover; header: var BlockHeader): EcAddrResult =
## Extract account address from `extraData` field (last 65 bytes) of the
## argument header. The result is kept in a LRU cache to re-purposed for
## improved result delivery avoiding calculations.
Expand All @@ -172,36 +170,19 @@ proc ecRecover*(er: var EcRecover; header: var BlockHeader): EcAddrResult
return ok(er.q.lruAppend(key, rc.value, er.size.int))
err(rc.error)

proc ecRecover*(er: var EcRecover; header: BlockHeader): EcAddrResult
=
proc ecRecover*(er: var EcRecover; header: BlockHeader): EcAddrResult =
## Variant of `ecRecover()` for call-by-value header
var hdr = header
er.ecRecover(hdr)

proc ecRecover*(er: var EcRecover; hash: Hash256): EcAddrResult
=
proc ecRecover*(er: var EcRecover; hash: Hash256): EcAddrResult =
## Variant of `ecRecover()` for hash only. Will only succeed it the
## argument hash is uk the LRU queue.
let rc = er.q.lruFetch(hash.data)
if rc.isOk:
return ok(rc.value)
err((errItemNotFound,""))

# ------------------------------------------------------------------------------
# Public RLP mixin functions for caching version
# ------------------------------------------------------------------------------

proc append*(rw: var RlpWriter; data: EcRecover)
{.raises: [KeyError].} =
## Generic support for `rlp.encode()`
rw.append((data.size,data.q))

proc read*(rlp: var Rlp; Q: type EcRecover): Q
{.raises: [KeyError].} =
## Generic support for `rlp.decode()` for loading the cache from a
## serialised data stream.
(result.size, result.q) = rlp.read((type result.size, type result.q))

# ------------------------------------------------------------------------------
# Debugging
# ------------------------------------------------------------------------------
Expand Down
65 changes: 0 additions & 65 deletions nimbus/utils/keyed_queue/kq_rlp.nim

This file was deleted.

1 change: 0 additions & 1 deletion tests/all_tests.nim
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ cliBuilder:
#./test_graphql, -- fails
./test_pow,
./test_configuration,
./test_keyed_queue_rlp,
#./test_txpool, -- fails
./test_txpool2,
#./test_merge, -- fails
Expand Down
244 changes: 0 additions & 244 deletions tests/test_keyed_queue_rlp.nim

This file was deleted.

0 comments on commit 52482ef

Please sign in to comment.