fixing blocktypes
This commit is contained in:
parent
d9a295c059
commit
bbebc85541
|
@ -63,31 +63,21 @@ proc emptyCid*(version: CidVersion, codex: MultiCodec): ?!Cid =
|
||||||
var
|
var
|
||||||
EmptyDigests {.threadvar.}: array[CIDv0..CIDv1, Table[MultiCodec, MultiHash]]
|
EmptyDigests {.threadvar.}: array[CIDv0..CIDv1, Table[MultiCodec, MultiHash]]
|
||||||
|
|
||||||
proc emptyDigest*(version: CidVersion, codex: MultiCodec): ?!MultiHash =
|
proc emptyDigest*(version: CidVersion, codec: MultiCodec): ?!MultiHash =
|
||||||
|
|
||||||
once:
|
once:
|
||||||
|
let cid0 = emptyCid(CIDv0, multiCodec("sha2-256")).get()
|
||||||
|
let cid1 = emptyCid(CIDv1, multiCodec("sha2-256")).get()
|
||||||
|
let mhash0 = cid0.mhash.get
|
||||||
|
let mhash1 = cid1.mhash.get
|
||||||
|
|
||||||
EmptyDigests = [
|
EmptyDigests = [
|
||||||
CIDv0: {
|
CIDv0: { multiCodec("sha2-256"): mhash0 }.toTable,
|
||||||
multiCodec("sha2-256"): EmptyCid[CIDv0]
|
CIDv1: { multiCodec("sha2-256"): mhash1 }.toTable,
|
||||||
.catch
|
|
||||||
.get()[multiCodec("sha2-256")]
|
|
||||||
.catch
|
|
||||||
.get()
|
|
||||||
.mhash
|
|
||||||
.get()
|
|
||||||
}.toTable,
|
|
||||||
CIDv1: {
|
|
||||||
multiCodec("sha2-256"): EmptyCid[CIDv1]
|
|
||||||
.catch
|
|
||||||
.get()[multiCodec("sha2-256")]
|
|
||||||
.catch
|
|
||||||
.get()
|
|
||||||
.mhash
|
|
||||||
.get()
|
|
||||||
}.toTable,
|
|
||||||
]
|
]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
success EmptyDigests[version][codex]
|
success EmptyDigests[version][codec]
|
||||||
except CatchableError as exc:
|
except CatchableError as exc:
|
||||||
err(exc)
|
err(exc)
|
||||||
|
|
||||||
|
@ -96,13 +86,14 @@ var
|
||||||
|
|
||||||
proc emptyBlock*(version: CidVersion, codex: MultiCodec): ?!Block =
|
proc emptyBlock*(version: CidVersion, codex: MultiCodec): ?!Block =
|
||||||
once:
|
once:
|
||||||
let cid = ? EmptyCid[CIDv0].catch
|
let cid0 = ? emptyCid(CIDv0, multiCodec("sha2-256"))
|
||||||
let sha2 = ? cid[multiCodec("sha2-256")].catch
|
let cid1 = ? emptyCid(CIDv1, multiCodec("sha2-256"))
|
||||||
let blk = Block(cid: sha2)
|
let blk0 = Block(cid: cid0)
|
||||||
|
let blk1 = Block(cid: cid1)
|
||||||
|
|
||||||
EmptyBlock = [
|
EmptyBlock = [
|
||||||
CIDv0: { multiCodec("sha2-256"): blk }.toTable,
|
CIDv0: { multiCodec("sha2-256"): blk0 }.toTable,
|
||||||
CIDv1: { multiCodec("sha2-256"): blk }.toTable,
|
CIDv1: { multiCodec("sha2-256"): blk1 }.toTable,
|
||||||
]
|
]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -190,7 +190,7 @@ proc makeRoot*(self: Manifest): ?!void =
|
||||||
stack.add(mh)
|
stack.add(mh)
|
||||||
|
|
||||||
if stack.len == 1:
|
if stack.len == 1:
|
||||||
let digest = ? emptyDigest(self.version, self.hcodec)
|
let digest = emptyDigest(self.version, self.hcodec).expect("empty manifest")
|
||||||
let cid = ? Cid.init(self.version, self.codec, digest).mapFailure
|
let cid = ? Cid.init(self.version, self.codec, digest).mapFailure
|
||||||
|
|
||||||
self.rootHash = cid.some
|
self.rootHash = cid.some
|
||||||
|
|
|
@ -63,7 +63,10 @@ else:
|
||||||
# ("-fno-asynchronous-unwind-tables" breaks Nim's exception raising, sometimes)
|
# ("-fno-asynchronous-unwind-tables" breaks Nim's exception raising, sometimes)
|
||||||
switch("passC", "-mno-avx512vl")
|
switch("passC", "-mno-avx512vl")
|
||||||
|
|
||||||
# --gc:orc
|
when getEnv("CODEX_USE_ORC", "") in ["true", "1"]:
|
||||||
|
--mm:orc
|
||||||
|
--deepcopy:on
|
||||||
|
|
||||||
--tlsEmulation:off
|
--tlsEmulation:off
|
||||||
--threads:on
|
--threads:on
|
||||||
--opt:speed
|
--opt:speed
|
||||||
|
|
Loading…
Reference in New Issue