Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
'multidict>=6.0.5',
'ordered-set>=4.1.0',
'hio==0.6.14',
'multicommand>=1.0.0',
'multicommand==1.0.0',
'jsonschema>=4.21.1',
'falcon>=3.1.3',
'hjson>=3.1.0',
Expand Down
9 changes: 5 additions & 4 deletions src/keri/core/counting.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class CounterCodex_1_0(MapDom):
AttachmentGroup: str = '-V' # Composed Grouped Attached Material Quadlet (4 char each)
BigAttachmentGroup: str = '-0V' # Composed Grouped Attached Material Quadlet (4 char each)
ESSRPayloadGroup: str = '-Z' # ESSR Payload Group, dig of content+Texter group
KERIACDCGenusVersion: str = '--AAA' # KERI ACDC Protocol Stack CESR Version
KERIACDCGenusVersion: str = '-_AAA' # KERI ACDC Protocol Stack CESR Version


def __iter__(self):
Expand Down Expand Up @@ -138,7 +138,7 @@ class CounterCodex_2_0(MapDom):
BigSealSourceLastSingles: str = '-0Y' # Big Seal Source Couple(s), pre of last source sealing or sealed event.
ESSRPayloadGroup: str = '-Z' # ESSR Payload Group.
BigESSRPayloadGroup: str = '-0Z' # Big ESSR Payload Group.
KERIACDCGenusVersion: str = '--AAA' # KERI ACDC Stack CESR Protocol Genus Version (Universal)
KERIACDCGenusVersion: str = '-_AAA' # KERI ACDC Stack CESR Protocol Genus Version (Universal)

def __iter__(self):
return iter(astuple(self)) # enables value not key inclusion test with "in"
Expand Down Expand Up @@ -329,6 +329,7 @@ class Counter:
Hards.update({('-' + chr(c)): 2 for c in range(97, 97 + 26)})
Hards.update([('-0', 3)])
Hards.update([('--', 5)])
Hards.update([('-_', 5)])

# Bards table maps to hard size, hs, of code from bytes holding sextets
# converted from first two code char. Used for ._bexfil.
Expand Down Expand Up @@ -361,7 +362,7 @@ class Counter:
'-V': Cizage(hs=2, ss=2, fs=4),
'-0V': Cizage(hs=3, ss=5, fs=8),
'-Z': Cizage(hs=2, ss=2, fs=4),
'--AAA': Cizage(hs=5, ss=3, fs=8),
'-_AAA': Cizage(hs=5, ss=3, fs=8),
},
},
Vrsn_2_0.major: \
Expand Down Expand Up @@ -420,7 +421,7 @@ class Counter:
'-0Y': Cizage(hs=3, ss=5, fs=8),
'-Z': Cizage(hs=2, ss=2, fs=4),
'-0Z': Cizage(hs=3, ss=5, fs=8),
'--AAA': Cizage(hs=5, ss=3, fs=8),
'-_AAA': Cizage(hs=5, ss=3, fs=8),
},
},
}
Expand Down
17 changes: 14 additions & 3 deletions src/keri/core/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,9 +705,17 @@ def msgParsator(self, ims=None, framed=True, pipeline=False,

cold = sniff(ims) # check for spurious counters at front of stream
if cold in (Colds.txt, Colds.bny): # not message error out to flush stream
# replace with pipelining here once CESR message format supported.
raise kering.ColdStartError("Expecting message counter tritet={}"
"".format(cold))
# strip KERIACDCGenusVersion counter if present (genusify=True); else error
ctr = yield from self._extractor(ims=ims, klas=Counter, cold=cold)
if ctr.code != CtrDex_1_0.KERIACDCGenusVersion:
raise kering.UnexpectedCountCodeError("Expected KERIACDCGenusVersion "
"counter got code={} tritet={}"
"".format(ctr.code, cold))
cold = sniff(ims)
Comment thread
iFergal marked this conversation as resolved.
if cold in (Colds.txt, Colds.bny): # still a counter after genus — malformed
raise kering.ColdStartError("Expecting message after KERIACDCGenusVersion "
"tritet={}"
"".format(cold))
# Otherwise its a message cold start

while True: # extract, deserialize, and strip message from ims
Expand Down Expand Up @@ -966,6 +974,9 @@ def msgParsator(self, ims=None, framed=True, pipeline=False,
essrs.append(texter)


elif ctr.code == CtrDex_1_0.KERIACDCGenusVersion:
pass # genus-version counter carries no following material; discard

else:
raise kering.UnexpectedCountCodeError("Unsupported count"
" code={}.".format(ctr.code))
Expand Down
18 changes: 9 additions & 9 deletions tests/core/test_counting.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def test_codexes_tags():
'AttachmentGroup': '-V',
'ESSRPayloadGroup': '-Z',
'BigAttachmentGroup': '-0V',
'KERIACDCGenusVersion': '--AAA'
'KERIACDCGenusVersion': '-_AAA'
}


Expand Down Expand Up @@ -138,7 +138,7 @@ def test_codexes_tags():
'BigSealSourceLastSingles': '-0Y',
'ESSRPayloadGroup': '-Z',
'BigESSRPayloadGroup': '-0Z',
'KERIACDCGenusVersion': '--AAA'
'KERIACDCGenusVersion': '-_AAA'
}

assert counting.CodeNames == (
Expand Down Expand Up @@ -317,7 +317,7 @@ def test_counter_class():
'-V': 'AttachmentGroup',
'-0V': 'BigAttachmentGroup',
'-Z': 'ESSRPayloadGroup',
'--AAA': 'KERIACDCGenusVersion'
'-_AAA': 'KERIACDCGenusVersion'
}
},
2:
Expand Down Expand Up @@ -375,7 +375,7 @@ def test_counter_class():
'-0Y': 'BigSealSourceLastSingles',
'-Z': 'ESSRPayloadGroup',
'-0Z': 'BigESSRPayloadGroup',
'--AAA': 'KERIACDCGenusVersion'
'-_AAA': 'KERIACDCGenusVersion'
}
}
}
Expand Down Expand Up @@ -404,7 +404,7 @@ def test_counter_class():
'-V': Cizage(hs=2, ss=2, fs=4),
'-0V': Cizage(hs=3, ss=5, fs=8),
'-Z': Cizage(hs=2, ss=2, fs=4),
'--AAA': Cizage(hs=5, ss=3, fs=8)
'-_AAA': Cizage(hs=5, ss=3, fs=8)
}
},
2:
Expand Down Expand Up @@ -463,7 +463,7 @@ def test_counter_class():
'-0Y': Cizage(hs=3, ss=5, fs=8),
'-Z': Cizage(hs=2, ss=2, fs=4),
'-0Z': Cizage(hs=3, ss=5, fs=8),
'--AAA': Cizage(hs=5, ss=3, fs=8)
'-_AAA': Cizage(hs=5, ss=3, fs=8)
}
}
}
Expand Down Expand Up @@ -495,7 +495,7 @@ def test_counter_class():
'-a': 2, '-b': 2, '-c': 2, '-d': 2, '-e': 2, '-f': 2, '-g': 2, '-h': 2, '-i': 2,
'-j': 2, '-k': 2, '-l': 2, '-m': 2, '-n': 2, '-o': 2, '-p': 2, '-q': 2, '-r': 2,
'-s': 2, '-t': 2, '-u': 2, '-v': 2, '-w': 2, '-x': 2, '-y': 2, '-z': 2,
'-0': 3, '--': 5,
'-0': 3, '--': 5, '-_': 5,
}


Expand Down Expand Up @@ -957,7 +957,7 @@ def test_counter_v1():
assert genver == 'AAA'
assert genverint == b64ToInt(genver)
qsc = CtrDex.KERIACDCGenusVersion + genver
assert qsc == '--AAAAAA' # keri Cesr version 0.0.0
assert qsc == '-_AAAAAA' # keri Cesr version 0.0.0
qscb = qsc.encode("utf-8")
qscb2 = decodeB64(qscb)

Expand Down Expand Up @@ -1426,7 +1426,7 @@ def test_counter_v2():
assert genver == 'AAA'
assert genverint == b64ToInt(genver)
qsc = CtrDex.KERIACDCGenusVersion + genver
assert qsc == '--AAAAAA' # keri Cesr version 0.0.0
assert qsc == '-_AAAAAA' # keri Cesr version 0.0.0
qscb = qsc.encode("utf-8")
qscb2 = decodeB64(qscb)

Expand Down
Loading