From 1a3e3a86c317c22a79790cc134102f6dc5b368ff Mon Sep 17 00:00:00 2001 From: Itamar Turner-Trauring Date: Fri, 14 Oct 2022 11:27:04 -0400 Subject: [PATCH 1/2] Require latest pycddl, and work around a regression. --- newsfragments/3938.bugfix | 1 + setup.py | 2 +- src/allmydata/storage/http_client.py | 12 ++++++------ src/allmydata/storage/http_server.py | 12 +++++------- 4 files changed, 13 insertions(+), 14 deletions(-) create mode 100644 newsfragments/3938.bugfix diff --git a/newsfragments/3938.bugfix b/newsfragments/3938.bugfix new file mode 100644 index 000000000..c2778cfdf --- /dev/null +++ b/newsfragments/3938.bugfix @@ -0,0 +1 @@ +Work with (and require) newer versions of pycddl. \ No newline at end of file diff --git a/setup.py b/setup.py index 72478767c..768e44e29 100644 --- a/setup.py +++ b/setup.py @@ -137,7 +137,7 @@ install_requires = [ "werkzeug != 2.2.0", "treq", "cbor2", - "pycddl", + "pycddl >= 0.2", # for pid-file support "psutil", diff --git a/src/allmydata/storage/http_client.py b/src/allmydata/storage/http_client.py index 16d426dda..420d3610f 100644 --- a/src/allmydata/storage/http_client.py +++ b/src/allmydata/storage/http_client.py @@ -83,35 +83,35 @@ _SCHEMAS = { "allocate_buckets": Schema( """ response = { - already-have: #6.258([* uint]) - allocated: #6.258([* uint]) + already-have: #6.258([0*256 uint]) + allocated: #6.258([0*256 uint]) } """ ), "immutable_write_share_chunk": Schema( """ response = { - required: [* {begin: uint, end: uint}] + required: [0* {begin: uint, end: uint}] } """ ), "list_shares": Schema( """ - response = #6.258([* uint]) + response = #6.258([0*256 uint]) """ ), "mutable_read_test_write": Schema( """ response = { "success": bool, - "data": {* share_number: [* bstr]} + "data": {0*256 share_number: [0* bstr]} } share_number = uint """ ), "mutable_list_shares": Schema( """ - response = #6.258([* uint]) + response = #6.258([0*256 uint]) """ ), } diff --git a/src/allmydata/storage/http_server.py b/src/allmydata/storage/http_server.py index eefb9b906..3902976ba 100644 --- a/src/allmydata/storage/http_server.py +++ b/src/allmydata/storage/http_server.py @@ -260,7 +260,7 @@ _SCHEMAS = { "allocate_buckets": Schema( """ request = { - share-numbers: #6.258([*256 uint]) + share-numbers: #6.258([0*256 uint]) allocated-size: uint } """ @@ -276,15 +276,13 @@ _SCHEMAS = { """ request = { "test-write-vectors": { - ; TODO Add length limit here, after - ; https://github.com/anweiss/cddl/issues/128 is fixed - * share_number => { - "test": [*30 {"offset": uint, "size": uint, "specimen": bstr}] - "write": [*30 {"offset": uint, "data": bstr}] + 0*256 share_number : { + "test": [0*30 {"offset": uint, "size": uint, "specimen": bstr}] + "write": [0*30 {"offset": uint, "data": bstr}] "new-length": uint / null } } - "read-vector": [*30 {"offset": uint, "size": uint}] + "read-vector": [0*30 {"offset": uint, "size": uint}] } share_number = uint """ From 46fbe3d0283695dc503fabb0b9f8c4ed9401cdcf Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Tue, 18 Oct 2022 17:32:23 -0400 Subject: [PATCH 2/2] bump pypi-deps-db for new pycddl version --- nix/sources.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nix/sources.json b/nix/sources.json index 79eabe7a1..950151416 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -53,10 +53,10 @@ "homepage": "", "owner": "DavHau", "repo": "pypi-deps-db", - "rev": "76b8f1e44a8ec051b853494bcf3cc8453a294a6a", - "sha256": "18fgqyh4z578jjhk26n1xi2cw2l98vrqp962rgz9a6wa5yh1nm4x", + "rev": "5fe7d2d1c85cd86d64f4f079eef3f1ff5653bcd6", + "sha256": "0pc6mj7rzvmhh303rvj5wf4hrksm4h2rf4fsvqs0ljjdmgxrqm3f", "type": "tarball", - "url": "https://github.com/DavHau/pypi-deps-db/archive/76b8f1e44a8ec051b853494bcf3cc8453a294a6a.tar.gz", + "url": "https://github.com/DavHau/pypi-deps-db/archive/5fe7d2d1c85cd86d64f4f079eef3f1ff5653bcd6.tar.gz", "url_template": "https://github.com///archive/.tar.gz" } }