Skip to content

Casual Alice with Policy and Payment Defaults#984

Merged
KPrasch merged 25 commits intonucypher:masterfrom
KPrasch:casual-geth
Jun 9, 2019
Merged

Casual Alice with Policy and Payment Defaults#984
KPrasch merged 25 commits intonucypher:masterfrom
KPrasch:casual-geth

Conversation

@KPrasch
Copy link
Member

@KPrasch KPrasch commented May 17, 2019

What this does

  • Follow up for [EPIC] Decentralized Characters & Integrated Ethereum Node Providers #951
  • Decentralized Grant
  • Save / Load policy defaults for M, N, duration and value on-disk via AliceConfiguration
  • Allow policy defaults to be used or overridden on Alice APIs
  • Use the CLI to initialize and run an Alice using an internally managed geth process (--geth)
  • Use a common function for making CLI characters (reduces character CLI length)
  • Removes policy mocking from decentralized grant testing
  • Decentralized test_cli_lifecycle test
  • checksum_public_address -> checksum_address
  • Introduces Agency metaclass (makes agent subclasses singletons)
  • Style and convention improvements for character CLI modules

Examples


# Configure a new persistent Alice with an integrated geth node
# using recommended testnet defaults, Save chain syncing for later.
$ nucypher alice init --geth --no-sync

# Run an Alice IPC Control Server using an integrated geth node
$ nucypher alice run --geth

# Use default M, N, and Rate to Grant
$ nucypher alice grant --geth --bob-encrypting-key ... --bob-verifying-key ... --label ...

Fixes #975
Fixes #1015

@KPrasch KPrasch changed the base branch from master to hawksbeard May 17, 2019 01:32
@KPrasch KPrasch changed the title Casual geth Alice's Casual geth with payment May 17, 2019
@KPrasch KPrasch changed the title Alice's Casual geth with payment Alice's Casual geth with payment defaults May 17, 2019
@KPrasch KPrasch force-pushed the hawksbeard branch 2 times, most recently from 7ba150a to b6ba1ff Compare June 3, 2019 19:56
@codecov
Copy link

codecov bot commented Jun 4, 2019

Codecov Report

Merging #984 into master will decrease coverage by 3.29%.
The diff coverage is 73.3%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #984     +/-   ##
=========================================
- Coverage   83.19%   79.89%   -3.3%     
=========================================
  Files          67       67             
  Lines        8663     8754     +91     
=========================================
- Hits         7207     6994    -213     
- Misses       1456     1760    +304
Impacted Files Coverage Δ
nucypher/characters/unlawful.py 96.55% <ø> (ø) ⬆️
nucypher/blockchain/eth/chains.py 74.07% <ø> (ø) ⬆️
nucypher/config/characters.py 98.97% <100%> (+0.22%) ⬆️
nucypher/blockchain/eth/token.py 89.78% <100%> (ø) ⬆️
nucypher/utilities/sandbox/ursula.py 98.07% <100%> (ø) ⬆️
nucypher/network/server.py 85.18% <100%> (-2.78%) ⬇️
nucypher/cli/deploy.py 69.39% <100%> (ø) ⬆️
nucypher/cli/processes.py 72.85% <100%> (ø) ⬆️
nucypher/config/constants.py 100% <100%> (ø) ⬆️
nucypher/crypto/powers.py 92.24% <100%> (-2.59%) ⬇️
... and 46 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9330e69...80057d8. Read the comment docs.

@KPrasch KPrasch self-assigned this Jun 4, 2019
@KPrasch KPrasch added Alice 👩 Effects the "Alice" development area Configuration Node configuration labels Jun 5, 2019
@KPrasch KPrasch changed the base branch from hawksbeard to master June 6, 2019 19:07
@KPrasch KPrasch changed the title Alice's Casual geth with payment defaults Casual Alice with Policy and Payment Defaults Jun 6, 2019
@KPrasch KPrasch marked this pull request as ready for review June 6, 2019 20:19
@cygnusv
Copy link
Member

cygnusv commented Jun 7, 2019

Two questions:

  • Do you want to merge this on master or on [EPIC] Alhambra Verde - Introduce Staker and Worker Roles #1029?
  • Was there a consensus on changing checksum_public_address to checksum_address? It doesn't seem as something critical. Also, I'm not a big fan that this type of renames that impact dozens of files are part of bigger PRs. Now there will be lots of conflicts for all the in-parallel work done in other branches.

@KPrasch KPrasch requested a review from cygnusv June 9, 2019 03:31
# "Formal Geth" - Manual Web3 Provider, We assume is already running and available
else:
self.connect_to_blockchain()
if not self.blockchain.interface.client.accounts:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💥

Copy link
Member

@cygnusv cygnusv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

def is_staking(self) -> bool:
"""Checks if this Miner currently has active stakes / locked tokens."""
return bool(self.locked_tokens > NU.ZERO())
return bool(self.stakes)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious: why bool(self.stakes) is the response here? What's the underlying logic?

Copy link
Member Author

@KPrasch KPrasch Jun 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.__read_stakes() # "load-in": Read on-chain stakes "syncs" the onchain stakes into the local staking cache on Staker, and self.stakes will be set to NO_STAKES.bool_value(False) if there are no active stakes.

class AliceSpecification(CharacterSpecification):

__create_policy = (('bob_encrypting_key', 'bob_verifying_key', 'm', 'n', 'label'), # In
__create_policy = (('bob_encrypting_key', 'bob_verifying_key', 'm', 'n', 'label', 'expiration'), # In
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can we handle conditionally-required inputs in specifications? In this case, value is mandatory when not federated. Seems kind of tricky to do it.

Copy link
Member Author

@KPrasch KPrasch Jun 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good eye! I've been thinking about this too, I think it's possible to allow values to be passed as None all the way into character, with some modification to specification handling seen here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might second Issue, but here's one #1065

@KPrasch KPrasch merged commit fab5b63 into nucypher:master Jun 9, 2019
cygnusv added a commit that referenced this pull request Jun 10, 2019
Co-Authored-By: David Núñez <david@nucypher.com>
Co-Authored-By: Derek Pierre <derek.pierre@gmail.com>
cygnusv pushed a commit that referenced this pull request Jun 10, 2019
Casual Alice with Policy and Payment Defaults
cygnusv pushed a commit that referenced this pull request Jun 11, 2019
Casual Alice with Policy and Payment Defaults
@KPrasch KPrasch deleted the casual-geth branch July 21, 2020 02:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Alice 👩 Effects the "Alice" development area Configuration Node configuration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Policy value can't be 0 NU instance equality

4 participants