diff --git a/nimbus/db/aristo/aristo_blobify.nim b/nimbus/db/aristo/aristo_blobify.nim index 61dcc7421..a2b63cb2c 100644 --- a/nimbus/db/aristo/aristo_blobify.nim +++ b/nimbus/db/aristo/aristo_blobify.nim @@ -133,7 +133,7 @@ proc blobify*(vtx: VertexRef): Result[Blob, AristoError] = ## Variant of `blobify()` var data: Blob ? vtx.blobify data - ok(data) + ok(move(data)) proc blobify*(vGen: openArray[VertexID]; data: var Blob) = ## This function serialises a list of vertex IDs. @@ -251,8 +251,7 @@ proc blobify*(filter: FilterRef): Result[Blob, AristoError] = ## ... var data: Blob ? filter.blobify data - ok data - + ok move(data) proc blobify*(vFqs: openArray[(QueueID,QueueID)]; data: var Blob) = ## This function serialises a list of filter queue IDs. @@ -425,7 +424,7 @@ proc deblobify*(data: openArray[byte]; T: type seq[VertexID]): Result[T,AristoEr ## Variant of `deblobify()` for deserialising the vertex ID generator state var vGen: seq[VertexID] ? data.deblobify vGen - ok vGen + ok move(vGen) proc deblobify*(data: Blob; filter: var FilterRef): Result[void,AristoError] = ## De-serialise an Aristo DB filter object diff --git a/nimbus/db/aristo/aristo_hashify.nim b/nimbus/db/aristo/aristo_hashify.nim index 3d3522239..5cf5121b8 100644 --- a/nimbus/db/aristo/aristo_hashify.nim +++ b/nimbus/db/aristo/aristo_hashify.nim @@ -111,7 +111,7 @@ proc pedigree( wff.rev.withValue(toVid, val): val[].incl fromVid do: - wff.rev[toVid] = @[fromVid].toHashSet + wff.rev[toVid] = [fromVid].toHashSet # Remove unnecessarey sup-trie roots (e.g. for a storage root) wff.root.excl fromVid diff --git a/nimbus/db/aristo/aristo_init/rocks_db/rdb_get.nim b/nimbus/db/aristo/aristo_init/rocks_db/rdb_get.nim index d60595491..bc3c1b8b2 100644 --- a/nimbus/db/aristo/aristo_init/rocks_db/rdb_get.nim +++ b/nimbus/db/aristo/aristo_init/rocks_db/rdb_get.nim @@ -47,7 +47,7 @@ proc getImpl(rdb: RdbInst; key: RdbKey): Result[Blob,(AristoError,string)] = # Correct result if needed if not gotData: res = EmptyBlob - ok res + ok move(res) # ------------------------------------------------------------------------------ # Public functions @@ -64,9 +64,10 @@ proc getKey*(rdb: var RdbInst; xid: uint64): Result[Blob,(AristoError,string)] = # Try LRU cache first let key = xid.toRdbKey KeyPfx + var rc = rdb.rdKeyLru.lruFetch(key) if rc.isOK: - return ok(rc.value) + return ok(move(rc.value)) # Otherwise fetch from backend database let res = ? rdb.getImpl(key) @@ -78,9 +79,10 @@ proc getVtx*(rdb: var RdbInst; xid: uint64): Result[Blob,(AristoError,string)] = # Try LRU cache first let key = xid.toRdbKey VtxPfx + var rc = rdb.rdVtxLru.lruFetch(key) if rc.isOK: - return ok(rc.value) + return ok(move(rc.value)) # Otherwise fetch from backend database let res = ? rdb.getImpl(key) diff --git a/nimbus/db/aristo/aristo_layers.nim b/nimbus/db/aristo/aristo_layers.nim index 0411cc354..f9d9c9517 100644 --- a/nimbus/db/aristo/aristo_layers.nim +++ b/nimbus/db/aristo/aristo_layers.nim @@ -29,13 +29,13 @@ func dup(sTab: Table[VertexID,VertexRef]): Table[VertexID,VertexRef] = # Public getters: lazy value lookup for read only versions # ------------------------------------------------------------------------------ -func dirty*(db: AristoDbRef): HashSet[VertexID] = +func dirty*(db: AristoDbRef): lent HashSet[VertexID] = db.top.final.dirty -func pPrf*(db: AristoDbRef): HashSet[VertexID] = +func pPrf*(db: AristoDbRef): lent HashSet[VertexID] = db.top.final.pPrf -func vGen*(db: AristoDbRef): seq[VertexID] = +func vGen*(db: AristoDbRef): lent seq[VertexID] = db.top.final.vGen # ------------------------------------------------------------------------------ diff --git a/nimbus/db/kvt/kvt_init/memory_db.nim b/nimbus/db/kvt/kvt_init/memory_db.nim index a7578195a..9bc3a8426 100644 --- a/nimbus/db/kvt/kvt_init/memory_db.nim +++ b/nimbus/db/kvt/kvt_init/memory_db.nim @@ -77,9 +77,9 @@ proc getKvpFn(db: MemBackendRef): GetKvpFn = proc(key: openArray[byte]): Result[Blob,KvtError] = if key.len == 0: return err(KeyInvalid) - let data = db.mdb.tab.getOrVoid @key + var data = db.mdb.tab.getOrVoid @key if data.isValid: - return ok(data) + return ok(move(data)) err(GetNotFound) # ------------- diff --git a/nimbus/db/kvt/kvt_init/rocks_db.nim b/nimbus/db/kvt/kvt_init/rocks_db.nim index e132cf19d..35eb09795 100644 --- a/nimbus/db/kvt/kvt_init/rocks_db.nim +++ b/nimbus/db/kvt/kvt_init/rocks_db.nim @@ -84,14 +84,14 @@ proc getKvpFn(db: RdbBackendRef): GetKvpFn = proc(key: openArray[byte]): Result[Blob,KvtError] = # Get data record - let data = db.rdb.get(key).valueOr: + var data = db.rdb.get(key).valueOr: when extraTraceMessages: debug logTxt "getKvpFn() failed", key, error=error[0], info=error[1] return err(error[0]) # Return if non-empty if 0 < data.len: - return ok(data) + return ok(move(data)) err(GetNotFound) diff --git a/nimbus/db/kvt/kvt_init/rocks_db/rdb_get.nim b/nimbus/db/kvt/kvt_init/rocks_db/rdb_get.nim index e4d378c1b..b8404f0e7 100644 --- a/nimbus/db/kvt/kvt_init/rocks_db/rdb_get.nim +++ b/nimbus/db/kvt/kvt_init/rocks_db/rdb_get.nim @@ -51,7 +51,7 @@ proc get*( if not gotData: res = EmptyBlob - ok res + ok move(res) # ------------------------------------------------------------------------------ # End diff --git a/nimbus/db/kvt/kvt_utils.nim b/nimbus/db/kvt/kvt_utils.nim index c208018d4..7acfa060d 100644 --- a/nimbus/db/kvt/kvt_utils.nim +++ b/nimbus/db/kvt/kvt_utils.nim @@ -90,10 +90,10 @@ proc get*( if key.len == 0: return err(KeyInvalid) - let data = db.layersGet(key).valueOr: + var data = db.layersGet(key).valueOr: return db.getBe key - return ok(data) + return ok(move(data)) proc hasKey*( diff --git a/nimbus/db/ledger/distinct_ledgers.nim b/nimbus/db/ledger/distinct_ledgers.nim index c09e8c0e0..37587e527 100644 --- a/nimbus/db/ledger/distinct_ledgers.nim +++ b/nimbus/db/ledger/distinct_ledgers.nim @@ -198,10 +198,10 @@ proc init*( mpt.toPhk.T proc fetch*(sl: StorageLedger, slot: UInt256): Result[Blob,void] = - let rc = sl.distinctBase.fetch(slot.toBytesBE) + var rc = sl.distinctBase.fetch(slot.toBytesBE) if rc.isErr: return err() - ok rc.value + ok move(rc.value) proc merge*(sl: StorageLedger, slot: UInt256, value: openArray[byte]) = const info = "StorageLedger/merge(): "