11# Nimbus
2- # Copyright (c) 2023-2024 Status Research & Development GmbH
2+ # Copyright (c) 2023-2025 Status Research & Development GmbH
33# Licensed under either of
44# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
55# http://www.apache.org/licenses/LICENSE-2.0)
1111# # Aristo (aka Patricia) DB records transaction based merge test
1212
1313import
14- std/ [algorithm, bitops, sequtils, sets, tables],
14+ std/ [algorithm, bitops, sets, tables],
1515 eth/ common,
1616 results,
1717 unittest2,
1818 stew/ endians2,
1919 ../../ nimbus/ db/ opts,
20- ../../ nimbus/ db/ core_db/ backend/ aristo_rocksdb,
2120 ../../ nimbus/ db/ aristo/ [
2221 aristo_check,
23- aristo_debug,
24- aristo_delete,
2522 aristo_desc,
26- aristo_get,
2723 aristo_hike,
2824 aristo_init/ persistent,
2925 aristo_nearby,
30- aristo_part,
3126 aristo_part/ part_debug,
3227 aristo_tx],
3328 ../ replay/ xcheck,
@@ -48,13 +43,13 @@ const
4843# Private helpers
4944# ------------------------------------------------------------------------------
5045
51- proc posixPrngRand (state: var uint32 ): byte =
46+ func posixPrngRand (state: var uint32 ): byte =
5247 # # POSIX.1-2001 example of a rand() implementation, see manual page rand(3).
5348 state = state * 1103515245 + 12345 ;
5449 let val = (state shr 16 ) and 32767 # mod 2^31
5550 (val shr 8 ).byte # Extract second byte
5651
57- proc rand [W: SomeInteger | VertexID ](ap: var PrngDesc ; T: type W): T =
52+ func rand [W: SomeInteger | VertexID ](ap: var PrngDesc ; T: type W): T =
5853 var a: array [sizeof T,byte ]
5954 for n in 0 ..< sizeof T:
6055 a[n] = ap.prng.posixPrngRand ().byte
@@ -73,10 +68,10 @@ proc rand[W: SomeInteger|VertexID](ap: var PrngDesc; T: type W): T =
7368 # That way the result is independent of endianness
7469 (addr result ).copyMem (unsafeAddr w, sizeof w)
7570
76- proc init (T: type PrngDesc ; seed: int ): PrngDesc =
71+ func init (T: type PrngDesc ; seed: int ): PrngDesc =
7772 result .prng = (seed and 0x 7fffffff ).uint32
7873
79- proc rand (td: var PrngDesc ; top: int ): int =
74+ func rand (td: var PrngDesc ; top: int ): int =
8075 if 0 < top:
8176 let mask = (1 shl (8 * sizeof (int ) - top.countLeadingZeroBits)) - 1
8277 for _ in 0 ..< 100 :
0 commit comments