Skip to content

Commit

Permalink
Merge pull request #53 from derekpierre/node-timeout
Browse files Browse the repository at this point in the history
Allow Porter Operational timeout parameters for `/decrypt`
  • Loading branch information
derekpierre authored Dec 12, 2023
2 parents f82f30a + f6086ad commit 8254bf3
Show file tree
Hide file tree
Showing 12 changed files with 504 additions and 331 deletions.
4 changes: 2 additions & 2 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ name = "pypi"
python_version = "3"

[packages]
nucypher = {git = "https://github.com/nucypher/nucypher.git", ref = "v7.0.0-rc.10"}
nucypher = {git = "https://github.com/nucypher/nucypher.git", ref = "v7.0.3"}
nucypher-core = "==0.13.0" # must be the same as nucypher
flask-cors = "*"
prometheus-flask-exporter = "*"

[dev-packages]
nucypher = {git = "https://github.com/nucypher/nucypher.git", editable = true, ref = "v7.0.0-rc.10", extras = ["dev"]} # needed for testerchain, and must be editable
nucypher = {git = "https://github.com/nucypher/nucypher.git", editable = true, ref = "v7.0.3", extras = ["dev"]} # needed for testerchain, and must be editable
pytest = "<7" # match with nucypher/nucypher
pytest-cov = "*"
pytest-mock = "*"
Expand Down
77 changes: 26 additions & 51 deletions Pipfile.lock

Large diffs are not rendered by default.

254 changes: 127 additions & 127 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,174 +1,174 @@
-i https://pypi.python.org/simple
aiohttp==3.8.2 ; python_version >= '3.6'
aiosignal==1.3.1 ; python_version >= '3.7'
ape-solidity==0.6.9 ; python_version >= '3.8' and python_version < '4'
aiohttp==3.8.2; python_version >= '3.6'
aiosignal==1.3.1; python_version >= '3.7'
ape-solidity==0.6.9
appdirs==1.4.4
appnope==0.1.3 ; sys_platform == 'darwin'
appnope==0.1.3; sys_platform == 'darwin'
asttokens==2.4.0
async-timeout==4.0.3 ; python_version >= '3.7'
attrs==23.1.0 ; python_version >= '3.7'
autobahn==23.6.2 ; python_version >= '3.9'
async-timeout==4.0.3; python_version >= '3.7'
attrs==23.1.0; python_version >= '3.7'
autobahn==23.6.2; python_version >= '3.9'
automat==22.10.0
backcall==0.2.0
base58==1.0.3
bitarray==2.8.2
blinker==1.6.3 ; python_version >= '3.7'
blinker==1.6.3; python_version >= '3.7'
bytestring-splitter==2.4.1
cached-property==1.5.2
certifi==2023.7.22 ; python_version >= '3.6'
cffi==1.16.0 ; python_version >= '3.8'
cfgv==3.4.0 ; python_version >= '3.8'
charset-normalizer==2.1.1 ; python_full_version >= '3.6.0'
click==8.1.7 ; python_version >= '3.7'
colorama==0.4.6 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6'
certifi==2023.7.22; python_version >= '3.6'
cffi==1.16.0; python_version >= '3.8'
cfgv==3.4.0; python_version >= '3.8'
charset-normalizer==2.1.1; python_full_version >= '3.6.0'
click==8.1.7; python_version >= '3.7'
colorama==0.4.6; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6'
commonmark==0.9.1
constant-sorrow==0.1.0a9 ; python_version >= '3'
constant-sorrow==0.1.0a9; python_version >= '3'
constantly==15.1.0
coverage==6.5.0
cryptography==41.0.5 ; python_version >= '3.7'
cytoolz==0.12.2 ; python_version >= '3.6'
dataclassy==0.11.1 ; python_version >= '3.6'
dateparser==1.1.8 ; python_version >= '3.7'
decorator==5.1.1 ; python_version >= '3.5'
deprecated==1.2.14 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
coverage[toml]==6.5.0; python_version >= '3.7'
cryptography==41.0.5; python_version >= '3.7'
cytoolz==0.12.2; implementation_name == 'cpython'
dataclassy==0.11.1
dateparser==1.1.8; python_version >= '3.7'
decorator==5.1.1
deprecated==1.2.14
distlib==0.3.7
eip712==0.2.1 ; python_version >= '3.8' and python_version < '4'
eth-abi==4.2.1 ; python_full_version >= '3.7.2' and python_version < '4'
eth-account==0.8.0 ; python_version >= '3.6' and python_version < '4'
eth-ape==0.6.19 ; python_version >= '3.8' and python_version < '4'
eth-bloom==2.0.0 ; python_version >= '3.7' and python_version < '4'
eth-hash[pycryptodome]==0.5.2 ; python_version >= '3.7' and python_version < '4'
eip712==0.2.1
eth-abi==4.2.1; python_version < '4' and python_full_version >= '3.7.2'
eth-account==0.8.0; python_version >= '3.6' and python_version < '4'
eth-ape==0.6.19
eth-bloom==2.0.0; python_version >= '3.7' and python_version < '4'
eth-hash[pycryptodome]==0.5.2; python_version >= '3.7' and python_version < '4'
eth-keyfile==0.6.1
eth-keys==0.4.0
eth-rlp==0.3.0 ; python_version >= '3.7' and python_version < '4'
eth-tester==0.9.1b1 ; python_full_version >= '3.6.8' and python_version < '4'
eth-typing==3.5.1 ; python_full_version >= '3.7.2' and python_version < '4'
eth-utils==2.3.0 ; python_version >= '3.7' and python_version < '4'
ethpm-types==0.5.8 ; python_version >= '3.8' and python_version < '4'
evm-trace==0.1.0a25 ; python_version >= '3.8' and python_version < '4'
eth-rlp==0.3.0; python_version >= '3.7' and python_version < '4'
eth-tester==0.9.1b1; python_version < '4' and python_full_version >= '3.6.8'
eth-typing==3.5.1; python_version < '4' and python_full_version >= '3.7.2'
eth-utils==2.3.0; python_version >= '3.7' and python_version < '4'
ethpm-types==0.5.8
evm-trace==0.1.0a25
executing==2.0.0
filelock==3.12.4 ; python_version >= '3.8'
flask==3.0.0 ; python_version >= '3.8'
frozenlist==1.4.0 ; python_version >= '3.8'
greenlet==3.0.0 ; python_version >= '3.7'
filelock==3.12.4
flask==3.0.0; python_version >= '3.8'
frozenlist==1.4.0; python_version >= '3.8'
greenlet==3.0.0
hendrix==4.0.0
hexbytes==0.3.1 ; python_version >= '3.7' and python_version < '4'
humanize==4.8.0 ; python_version >= '3.8'
hexbytes==0.3.1; python_version >= '3.7' and python_version < '4'
humanize==4.8.0; python_version >= '3.8'
hyperlink==21.0.0
hypothesis==6.88.1 ; python_version >= '3.8'
identify==2.5.30 ; python_version >= '3.8'
idna==3.4 ; python_version >= '3.5'
hypothesis==6.88.1
identify==2.5.30; python_version >= '3.8'
idna==3.4; python_version >= '3.5'
ijson==3.2.3
importlib-metadata==6.8.0 ; python_version >= '3.8'
importlib-metadata==6.8.0
incremental==22.10.0
iniconfig==2.0.0 ; python_version >= '3.7'
ipython==8.16.1 ; python_version >= '3.9'
itsdangerous==2.1.2 ; python_version >= '3.7'
jedi==0.19.1 ; python_version >= '3.6'
jinja2==3.1.2 ; python_version >= '3.7'
jsonschema==4.19.1 ; python_version >= '3.8'
jsonschema-specifications==2023.7.1 ; python_version >= '3.8'
iniconfig==2.0.0; python_version >= '3.7'
ipython==8.16.1
itsdangerous==2.1.2; python_version >= '3.7'
jedi==0.19.1
jinja2==3.1.2; python_version >= '3.7'
jsonschema==4.19.1; python_version >= '3.8'
jsonschema-specifications==2023.7.1; python_version >= '3.8'
lazyasd==0.1.4
lru-dict==1.2.0
mako==1.2.4 ; python_version >= '3.7'
markupsafe==2.1.3 ; python_version >= '3.7'
marshmallow==3.20.1 ; python_version >= '3.8'
matplotlib-inline==0.1.6 ; python_version >= '3.5'
mako==1.2.4; python_version >= '3.7'
markupsafe==2.1.3; python_version >= '3.7'
marshmallow==3.20.1; python_version >= '3.8'
matplotlib-inline==0.1.6
maya==0.6.1
mnemonic==0.20 ; python_version >= '3.5'
mnemonic==0.20; python_version >= '3.5'
morphys==1.0
msgpack==1.0.7 ; python_version >= '3.8'
msgpack==1.0.7; python_version >= '3.8'
msgpack-python==0.5.6
msgspec==0.18.4 ; python_version >= '3.8'
multidict==5.2.0 ; python_version >= '3.6'
mypy-extensions==1.0.0 ; python_version >= '3.5'
nodeenv==1.8.0 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6'
git+https://github.com/nucypher/nucypher.git@c0d12e14e4526f3fb3549a1176d0b2a79923c5ca#egg=nucypher
msgspec==0.18.4
multidict==5.2.0; python_version >= '3.6'
mypy-extensions==1.0.0; python_version >= '3.5'
nodeenv==1.8.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6'
nucypher@ git+https://github.com/nucypher/nucypher.git@4b029f707c021da8e87f5a753c9eadd86dbe4b30
nucypher-core==0.13.0
numpy==1.26.1 ; python_version < '3.13' and python_version >= '3.9'
packaging==23.2 ; python_version >= '3.7'
pandas==1.5.3 ; python_version >= '3.8'
numpy==1.26.1
packaging==23.2; python_version >= '3.7'
pandas==1.5.3
parsimonious==0.9.0
parso==0.8.3 ; python_version >= '3.6'
pendulum==3.0.0b1 ; python_version >= '3.8'
parso==0.8.3
pendulum==3.0.0b1; python_version >= '3.8'
pexpect==4.8.0
pickleshare==0.7.5
platformdirs==3.11.0 ; python_version >= '3.7'
pluggy==1.3.0 ; python_version >= '3.8'
pre-commit==2.12.1
prometheus-client==0.18.0 ; python_version >= '3.8'
prompt-toolkit==3.0.39 ; python_full_version >= '3.7.0'
protobuf==4.25.0rc2 ; python_version >= '3.8'
platformdirs==3.11.0
pluggy==1.3.0; python_version >= '3.8'
pre-commit==2.12.1; python_full_version >= '3.6.1'
prometheus-client==0.19.0; python_version >= '3.8'
prompt-toolkit==3.0.39
protobuf==4.25.0rc2; python_version >= '3.8'
ptyprocess==0.7.0
pure-eval==0.2.2
py==1.11.0 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
py==1.11.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
py-cid==0.3.0
py-ecc==6.0.0 ; python_version >= '3.6' and python_version < '4'
py-ecc==6.0.0; python_version >= '3.6' and python_version < '4'
py-evm==0.7.0a4
py-geth==3.13.0 ; python_version >= '3.7' and python_version < '4'
py-geth==3.13.0
py-multibase==1.0.3
py-multicodec==0.2.1
py-multihash==0.2.3
py-solc-x==1.1.1 ; python_version >= '3.6' and python_version < '4'
pyasn1==0.5.0 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'
pyasn1-modules==0.3.0 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'
py-solc-x==1.1.1
pyasn1==0.5.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'
pyasn1-modules==0.3.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'
pychalk==2.0.1
pycparser==2.21
pycryptodome==3.19.0 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
pydantic==1.10.13 ; python_version >= '3.7'
pycryptodome==3.19.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
pydantic==1.10.13
pyethash==0.1.27
pygithub==1.59.1 ; python_version >= '3.7'
pygments==2.16.1 ; python_version >= '3.7'
pyjwt[crypto]==2.8.0 ; python_version >= '3.7'
pynacl==1.5.0 ; python_version >= '3.6'
pyopenssl==23.2.0 ; python_version >= '3.6'
pytest==6.2.5
pytest-cov==4.1.0
pytest-mock==3.12.0
pytest-timeout==2.2.0 ; python_version >= '3.7'
pytest-twisted==1.14.0 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
pygithub==1.59.1
pygments==2.16.1
pyjwt[crypto]==2.8.0
pynacl==1.5.0; python_version >= '3.6'
pyopenssl==23.2.0; python_version >= '3.6'
pytest==6.2.5; python_version >= '3.6'
pytest-cov==4.1.0; python_version >= '3.7'
pytest-mock==3.12.0; python_version >= '3.8'
pytest-timeout==2.2.0
pytest-twisted==1.14.0
python-baseconv==1.2.2
python-dateutil==2.8.2 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2'
python-dateutil==2.8.2; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
pytz==2023.3.post1
pyunormalize==15.0.0 ; python_version >= '3.6'
pyyaml==6.0.1 ; python_version >= '3.6'
referencing==0.30.2 ; python_version >= '3.8'
regex==2023.10.3 ; python_version >= '3.7'
requests==2.31.0 ; python_version >= '3.7'
rich==12.6.0 ; python_full_version >= '3.6.3' and python_full_version < '4.0.0'
pyunormalize==15.0.0; python_version >= '3.6'
pyyaml==6.0.1; python_version >= '3.6'
referencing==0.30.2; python_version >= '3.8'
regex==2023.10.3; python_version >= '3.7'
requests==2.31.0; python_version >= '3.7'
rich==12.6.0
rlp==3.0.0
rpds-py==0.10.6 ; python_version >= '3.8'
rpds-py==0.10.6; python_version >= '3.8'
safe-pysha3==1.0.4
semantic-version==2.10.0 ; python_version >= '2.7'
sentry-sdk==1.35.0
service-identity==23.1.0 ; python_version >= '3.8'
setuptools==68.2.2 ; python_version >= '3.8'
six==1.16.0 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2'
semantic-version==2.10.0; python_version >= '2.7'
sentry-sdk==1.39.0
service-identity==23.1.0; python_version >= '3.8'
setuptools==68.2.2; python_version >= '3.8'
six==1.16.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
snaptime==0.2.4
sortedcontainers==2.4.0
sqlalchemy==2.0.22 ; python_version >= '3.7'
sqlalchemy==2.0.22
stack-data==0.6.3
tabulate==0.9.0 ; python_version >= '3.7'
time-machine==2.13.0 ; python_version >= '3.8'
toml==0.10.2 ; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2'
toolz==0.12.0 ; python_version >= '3.5'
tqdm==4.66.1 ; python_version >= '3.7'
traitlets==5.11.2 ; python_version >= '3.8'
trie==2.1.1 ; python_version >= '3.7' and python_version < '4'
twisted==23.8.0 ; python_full_version >= '3.7.1'
txaio==23.1.1 ; python_version >= '3.7'
typing-extensions==4.8.0 ; python_version >= '3.8'
tzdata==2023.3 ; python_version >= '2'
tzlocal==5.2 ; python_version >= '3.8'
urllib3==2.0.7 ; python_version >= '3.7'
tabulate==0.9.0; python_version >= '3.7'
time-machine==2.13.0; implementation_name != 'pypy'
toml==0.10.2; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2'
toolz==0.12.0; python_version >= '3.5'
tqdm==4.66.1
traitlets==5.11.2
trie==2.1.1; python_version >= '3.7' and python_version < '4'
twisted==23.8.0; python_full_version >= '3.7.1'
txaio==23.1.1; python_version >= '3.7'
typing-extensions==4.8.0; python_version >= '3.8'
tzdata==2023.3; python_version >= '2'
tzlocal==5.2; python_version >= '3.8'
urllib3==2.0.7; python_version >= '3.7'
varint==1.0.2
virtualenv==20.24.6 ; python_version >= '3.7'
watchdog==3.0.0 ; python_version >= '3.7'
virtualenv==20.24.6; python_version >= '3.7'
watchdog==3.0.0; python_version >= '3.7'
wcwidth==0.2.8
web3==6.11.1 ; python_full_version >= '3.7.2'
websockets==12.0 ; python_version >= '3.8'
werkzeug==3.0.1 ; python_version >= '3.8'
wrapt==1.16.0rc1 ; python_version >= '3.6'
yarl==1.9.2 ; python_version >= '3.7'
zipp==3.17.0 ; python_version >= '3.8'
zope-interface==6.1 ; python_version >= '3.7'
web3==6.11.1; python_full_version >= '3.7.2'
websockets==12.0; python_version >= '3.8'
werkzeug==3.0.1; python_version >= '3.8'
wrapt==1.16.0rc1
yarl==1.9.2; python_version >= '3.7'
zipp==3.17.0
zope-interface==6.1; python_version >= '3.7'
14 changes: 10 additions & 4 deletions porter/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,18 @@ def __init__(self, porter: "main.Porter" = None, *args, **kwargs):
super().__init__(implementer=porter, *args, **kwargs)

@attach_schema(schema.GetUrsulas)
def get_ursulas(self,
quantity: int,
exclude_ursulas: Optional[List[ChecksumAddress]] = None,
include_ursulas: Optional[List[ChecksumAddress]] = None) -> Dict:
def get_ursulas(
self,
quantity: int,
exclude_ursulas: Optional[List[ChecksumAddress]] = None,
include_ursulas: Optional[List[ChecksumAddress]] = None,
timeout: Optional[int] = None,
) -> Dict:
ursulas_info = self.implementer.get_ursulas(
quantity=quantity,
exclude_ursulas=exclude_ursulas,
include_ursulas=include_ursulas,
timeout=timeout,
)

response_data = {"ursulas": ursulas_info} # list of UrsulaInfo objects
Expand Down Expand Up @@ -80,10 +84,12 @@ def decrypt(
self,
threshold: int,
encrypted_decryption_requests: Dict[ChecksumAddress, bytes],
timeout: Optional[int] = None,
):
decrypt_outcome = self.implementer.decrypt(
threshold=threshold,
encrypted_decryption_requests=encrypted_decryption_requests,
timeout=timeout,
)
response_data = {"decryption_results": decrypt_outcome}
return response_data
Loading

0 comments on commit 8254bf3

Please sign in to comment.