Skip to content

Commit 34ca9ba

Browse files
committed
adding codex multicodex
1 parent e68b3ee commit 34ca9ba

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

libp2p/cid.nim

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ type
3131
data*: VBuffer
3232

3333
const
34-
ContentIdsList = [
34+
ContentIdsList* = [
3535
multiCodec("raw"),
3636
multiCodec("dag-pb"),
3737
multiCodec("dag-cbor"),
@@ -58,15 +58,18 @@ const
5858
multiCodec("dash-tx"),
5959
multiCodec("torrent-info"),
6060
multiCodec("torrent-file"),
61-
multiCodec("ed25519-pub")
61+
multiCodec("ed25519-pub"),
62+
multiCodec("codex-manifest"),
63+
multiCodec("codex-block"),
64+
multiCodec("codex-root")
6265
]
6366

6467
proc initCidCodeTable(): Table[int, MultiCodec] {.compileTime.} =
6568
for item in ContentIdsList:
6669
result[int(item)] = item
6770

6871
const
69-
CodeContentIds = initCidCodeTable()
72+
CodeContentIds* = initCidCodeTable()
7073

7174
template orError*(exp: untyped, err: untyped): untyped =
7275
(exp.mapErr do (_: auto) -> auto: err)

libp2p/multicodec.nim

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,9 @@ const MultiCodecList = [
176176
("skein1024-992", 0xB3DC), ("skein1024-1000", 0xB3DD),
177177
("skein1024-1008", 0xB3DE), ("skein1024-1016", 0xB3DF),
178178
("skein1024-1024", 0xB3E0),
179-
("poseidon2-alt_bn_128-a2-cdx1", 0xCD0001),
179+
# poseidon2
180+
("poseidon2-alt_bn_128-sponge-r2", 0xCD10), # bn128 rate 2 sponge
181+
("poseidon2-alt_bn_128-mekle-2kb", 0xCD11), # bn128 2kb compress & merkleize
180182
# multiaddrs
181183
("ip4", 0x04),
182184
("ip6", 0x29),
@@ -234,7 +236,10 @@ const MultiCodecList = [
234236
("dash-tx", 0xF1),
235237
("torrent-info", 0x7B),
236238
("torrent-file", 0x7C),
237-
("ed25519-pub", 0xED)
239+
("ed25519-pub", 0xED),
240+
("codex-manifest", 0xCD01),
241+
("codex-block", 0xCD02),
242+
("codex-root", 0xCD03),
238243
]
239244

240245
type

0 commit comments

Comments
 (0)