diff --git a/setup.py b/setup.py index c616f392a..06e9ed5cc 100644 --- a/setup.py +++ b/setup.py @@ -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', diff --git a/src/keri/core/counting.py b/src/keri/core/counting.py index 4fc8774df..7ab4fe20d 100644 --- a/src/keri/core/counting.py +++ b/src/keri/core/counting.py @@ -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): @@ -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" @@ -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. @@ -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: \ @@ -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), }, }, } diff --git a/src/keri/core/parsing.py b/src/keri/core/parsing.py index db0a86fa5..64fceb665 100644 --- a/src/keri/core/parsing.py +++ b/src/keri/core/parsing.py @@ -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) + 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 @@ -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)) diff --git a/tests/core/test_counting.py b/tests/core/test_counting.py index 7ec6cfbea..9bfe69b4a 100644 --- a/tests/core/test_counting.py +++ b/tests/core/test_counting.py @@ -80,7 +80,7 @@ def test_codexes_tags(): 'AttachmentGroup': '-V', 'ESSRPayloadGroup': '-Z', 'BigAttachmentGroup': '-0V', - 'KERIACDCGenusVersion': '--AAA' + 'KERIACDCGenusVersion': '-_AAA' } @@ -138,7 +138,7 @@ def test_codexes_tags(): 'BigSealSourceLastSingles': '-0Y', 'ESSRPayloadGroup': '-Z', 'BigESSRPayloadGroup': '-0Z', - 'KERIACDCGenusVersion': '--AAA' + 'KERIACDCGenusVersion': '-_AAA' } assert counting.CodeNames == ( @@ -317,7 +317,7 @@ def test_counter_class(): '-V': 'AttachmentGroup', '-0V': 'BigAttachmentGroup', '-Z': 'ESSRPayloadGroup', - '--AAA': 'KERIACDCGenusVersion' + '-_AAA': 'KERIACDCGenusVersion' } }, 2: @@ -375,7 +375,7 @@ def test_counter_class(): '-0Y': 'BigSealSourceLastSingles', '-Z': 'ESSRPayloadGroup', '-0Z': 'BigESSRPayloadGroup', - '--AAA': 'KERIACDCGenusVersion' + '-_AAA': 'KERIACDCGenusVersion' } } } @@ -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: @@ -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) } } } @@ -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, } @@ -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) @@ -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)