From 754765ba31a58f60f58b4136fde05481812f28ac Mon Sep 17 00:00:00 2001 From: Chrysostomos Nanakos Date: Tue, 23 Dec 2025 23:23:31 +0200 Subject: [PATCH] chore: orc support (#110) Support ORC memory model (https://github.com/logos-storage/logos-storage-nim-dht/issues/109) Signed-off-by: Chrysostomos Nanakos --- codexdht.nimble | 2 +- .../private/eth/p2p/discoveryv5/routing_table.nim | 14 ++++++++++---- config.nims | 3 --- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/codexdht.nimble b/codexdht.nimble index 87504c3..1742ada 100644 --- a/codexdht.nimble +++ b/codexdht.nimble @@ -1,6 +1,6 @@ # Package -version = "0.5.0" +version = "0.6.0" author = "Status Research & Development GmbH" description = "DHT based on Eth discv5 implementation" license = "MIT" diff --git a/codexdht/private/eth/p2p/discoveryv5/routing_table.nim b/codexdht/private/eth/p2p/discoveryv5/routing_table.nim index bd839ad..f4f76e4 100644 --- a/codexdht/private/eth/p2p/discoveryv5/routing_table.nim +++ b/codexdht/private/eth/p2p/discoveryv5/routing_table.nim @@ -524,10 +524,16 @@ proc len*(r: RoutingTable): int = proc moveRight[T](arr: var openArray[T], a, b: int) = ## In `arr` move elements in range [a, b] right by 1. var t: T - shallowCopy(t, arr[b + 1]) - for i in countdown(b, a): - shallowCopy(arr[i + 1], arr[i]) - shallowCopy(arr[a], t) + when declared(shallowCopy): + shallowCopy(t, arr[b + 1]) + for i in countdown(b, a): + shallowCopy(arr[i + 1], arr[i]) + shallowCopy(arr[a], t) + else: + t = move arr[b + 1] + for i in countdown(b, a): + arr[i + 1] = move arr[i] + arr[a] = move t proc setJustSeen*(r: RoutingTable, n: Node, seen = true) = ## If seen, move `n` to the head (most recently seen) of its bucket. diff --git a/config.nims b/config.nims index d816c1a..fb46048 100644 --- a/config.nims +++ b/config.nims @@ -4,6 +4,3 @@ switch("define", "libp2p_pki_schemes=secp256k1") when withDir(thisDir(), system.fileExists("nimble.paths")): include "nimble.paths" # end Nimble config - -when (NimMajor, NimMinor) >= (2, 0): - --mm:refc