diff --git a/.circleci/config.yml b/.circleci/config.yml index 1ce25e34f..a7d175c93 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -86,15 +86,19 @@ workflows: only: /.*/ requires: - blockchain - - contracts + # - contracts (Removed dependency to speed up overall workflow execution) - actors: context: "NuCypher Tests" filters: tags: only: /.*/ - requires: - - blockchain - - contracts + requires: # (Prioritizing this task given that it's awfully slow) + - pip_install_36 + - pipenv_install_36 + - pip_install_37 + - pipenv_install_37 + # - blockchain + # - contracts - deployers: context: "NuCypher Tests" filters: @@ -102,7 +106,7 @@ workflows: only: /.*/ requires: - blockchain - - contracts + # - contracts (Removed dependency to speed up overall workflow execution) - config: context: "NuCypher Tests" filters: @@ -135,6 +139,14 @@ workflows: - deployers - config - character + - heartbeat_demo: + context: "NuCypher Tests" + filters: + tags: + only: /.*/ + requires: + - cli + - ursula_command - mypy: context: "NuCypher Tests" filters: @@ -339,7 +351,7 @@ jobs: agents: <<: *python_36_base - parallelism: 2 + parallelism: 4 steps: - prepare_environment - run: @@ -443,9 +455,33 @@ jobs: command: pipenv run pytest tests/learning - capture_test_results + heartbeat_demo: + <<: *python_36_base + steps: + - checkout + - pip_install + - run: + name: Run demo Ursula fleet, Alicia and the Doctor + command: | + mkdir /tmp/ursulas-logs + export PATH=~/.local/bin:$PATH + source ~/.bashrc + export NUCYPHER_SENTRY_LOGS=0 + export NUCYPHER_FILE_LOGS=0 + python3 examples/run_lonely_demo_ursula.py > /tmp/ursulas-logs/ursula-11500.txt 2>&1 & + sleep 15 + nucypher ursula run --dev --debug --federated-only --teacher-uri localhost:11500 --rest-port 11501 > /tmp/ursulas-logs/ursula-11501.txt 2>&1 & + sleep 15 + nucypher ursula run --dev --debug --federated-only --teacher-uri localhost:11500 --rest-port 11502 > /tmp/ursulas-logs/ursula-11502.txt 2>&1 & + sleep 15 + python3 examples/heartbeat_demo/alicia.py + python3 examples/heartbeat_demo/doctor.py + - store_artifacts: + path: /tmp/ursulas-logs + cli: <<: *python_36_base - parallelism: 4 + parallelism: 6 steps: - prepare_environment - run: @@ -500,7 +536,8 @@ jobs: <<: *python_36_base steps: - checkout - - pip_install + - attach_workspace: + at: ~/.local/share/virtualenvs/ - run: name: Install Documentation Build Dependencies command: pip3 install --user sphinx recommonmark sphinx-rtd-theme diff --git a/docs/source/demos/heartbeat_demo.md b/docs/source/demos/heartbeat_demo.md index 8d313b674..73eefba8e 100644 --- a/docs/source/demos/heartbeat_demo.md +++ b/docs/source/demos/heartbeat_demo.md @@ -10,7 +10,7 @@ Since Alicia knows that she may want to share this data in the future, she uses a _policy public key_ for her Heart Monitor to use, so she can read and delegate access to the encrypted data as she sees fit. -The Heart Monitor uses this public key to produce a file with some amount of encrypted heart rate measurements; +The Heart Monitor uses this public key to produce a file with some amount of encrypted heart rate measurements. This file is uploaded to a storage layer (e.g., IPFS, S3, or whatever you choose). At some future point, she wants to share this information with other people, such as her Doctor. @@ -29,12 +29,13 @@ This simple example showcases many interesting and distinctive aspects of NuCyph ## Install Nucypher -Acquire the nucypher application code and install the dependencies. -For a full installation guide see the [NuCypher Installation Guide](/guides/installation_guide). +Acquire the `nucypher` application code and install the dependencies. +For a full installation guide see the [NuCypher Installation Guide](../guides/installation_guide). ## Run the Demo -Assuming you already have `nucypher` installed with the `demos` extra, running the Heartbeat demo only involves running the `alicia.py` and `doctor.py` scripts; Run `alicia.py` first: +Assuming you already have `nucypher` installed with the `demos` extra and a [local fleet of Ursulas running](local_fleet_demo), running the Heartbeat demo only involves executing the `alicia.py` and `doctor.py` scripts, contained in the `examples/heartbeat_demo` directory. +Run `alicia.py` first: ```bash (nucypher)$ python alicia.py diff --git a/examples/heartbeat_demo/alicia.py b/examples/heartbeat_demo/alicia.py index f4e9369fb..4160ce29c 100644 --- a/examples/heartbeat_demo/alicia.py +++ b/examples/heartbeat_demo/alicia.py @@ -99,6 +99,7 @@ print("The policy public key for " import heart_monitor heart_monitor.generate_heart_rate_samples(policy_pubkey, label=label, + samples=50, save_as_file=True) @@ -122,7 +123,7 @@ doctor_strange = Bob.from_public_keys(powers_and_material=powers_and_material, policy_end_datetime = maya.now() + datetime.timedelta(days=5) # - m-out-of-n: This means Alicia splits the re-encryption key in 5 pieces and # she requires Bob to seek collaboration of at least 3 Ursulas -m, n = 3, 5 +m, n = 2, 3 # With this information, Alicia creates a policy granting access to Bob. diff --git a/examples/heartbeat_demo/heartbeat_demo.md b/examples/heartbeat_demo/heartbeat_demo.md index 426deabc6..43095175b 100644 --- a/examples/heartbeat_demo/heartbeat_demo.md +++ b/examples/heartbeat_demo/heartbeat_demo.md @@ -15,15 +15,15 @@ This simple use case showcases many interesting and distinctive aspects of NuCyp - The Doctor never interacts with Alicia or the Heart Monitor: he only needs the encrypted data and some policy metadata. ### How to run the demo -Assuming you already have `nucypher` installed (specifically, the `federated` branch), running the demo only involves running the `alicia.py` and `doctor.py` scripts. You should run `alicia.py` first: +Assuming you already have `nucypher` installed and a local demo fleet of Ursulas deployed, running the demo only involves running the `alicia.py` and `doctor.py` scripts. You should run `alicia.py` first: ```sh -(nucypher)$ python alicia.py +(nucypher)$ python examples/heartbeat_demo/alicia.py ``` This will create a temporal directory called `alicia-files` that contains the data for making Alicia persistent (i.e., her private keys). Apart from that, it will also generate data and keys for the demo. What's left is running the `doctor.py` script: ```sh -(nucypher)$ python doctor.py +(nucypher)$ python examples/heartbeat_demo/doctor.py ``` This script will read the data generated in the previous step and retrieve re-encrypted ciphertexts by means of the NuCypher network. The result is printed in the console: