Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coffee #286

Merged
merged 239 commits into from Jul 10, 2018

Conversation

@jMyles
Copy link
Member

commented Jun 4, 2018

Goals

The initial goals for this PR were as follows:

  • The highest-level goal of this PR is to resolve #295. Doing that also requires:
    -- Ursula becoming "fully available" for Alice to find, as described in #294.
    -- Complete adjustment of Arrangement ID as described in #180
    -- Versioned Arrangements #281
    -- Better node caching on Alice, perhaps sharing logic with #227

We have pushed #180 and #281 down the road a bit, but the rest are closed, along with many others along the way (see the various included PRs for details: #307, #308, #318, #324, #327, #330, #336, #344, #345, #348, and #351).

What this PR represents

Closing the gap between Alice having access to the blockchain and actually being able to create real Policies - the core of the NuCypher offering - is one of the crucial details to work out to realize this project's goals. This PR specifically addresses the portions of that gap involving discovering, remembering, and verifying nodes (especially Ursulas).

As you read this PR and consider it for merge, consider these as the main points of change:

Character

  • All actors now learn about nodes now learn about each other in a uniform fashion.
  • Learning happens off the main thread in a "learning loop."
  • All Characters now have a canonical address.
  • DHT legality logic has blossomed into a full-blown verification scheme for Ursulas, and is used both by other Ursulas when deciding whether to propagate and also by other actors when deciding when to interact with Ursula.

Policy

  • Creates Arrangements and Policies from sampled addresses
  • Deprecate mocked blockchain client
  • Create Arrangements from sampled ursulas
  • Enact and publish policies via rest and blockchain network
  • Invert Arrangement and BlockchainArrangement inheritance order

Network

  • Deprecates NuCypherDHTNode and Capabilities
  • Renames NetworkyStuff -> NetworkMiddleware
  • Eliminates DHT usage entirely for Alice and Bob (although Alice still has some entirely optional DHT capability)

Blockchain

  • New stake logic; stake dividing is possible, unlocking is stepwise.
  • Embed default web3.py providers in Interface
  • Use Interface-style API for Blockchain connection
  • Reduces complexity of ContractAgent API with default values
  • Implements miner's datastore publish and fetch agent methods
  • Uses Ursula's ethereum keypair to sign and verify her other metadata
  • Improves solidity compile-time exception handling
  • Optimzes contract source code
  • Introduce blockchain actors to existing tests, fixtures, and utilities

Configuration

  • Compose NucypherConfiguration and BlockchainConfiguration
  • Decouple configuration: Keep it optional
  • Refactors NucypherMinerConstants into a module that uses constant sorrow + side effects
@codecov

This comment has been minimized.

Copy link

commented Jun 4, 2018

Codecov Report

❗️ No coverage uploaded for pull request base (master@2e14150). Click here to learn what that means.
The diff coverage is 56.47%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #286   +/-   ##
=========================================
  Coverage          ?   55.44%           
=========================================
  Files             ?       33           
  Lines             ?     2514           
  Branches          ?        0           
=========================================
  Hits              ?     1394           
  Misses            ?     1120           
  Partials          ?        0
Impacted Files Coverage Δ
nucypher/data_sources.py 50% <ø> (ø)
nucypher/blockchain/eth/policies.py 0% <0%> (ø)
nucypher/crypto/signing.py 78.78% <100%> (ø)
nucypher/keystore/db/models.py 100% <100%> (ø)
nucypher/keystore/keystore.py 78.31% <100%> (ø)
nucypher/blockchain/eth/deployers.py 77.65% <100%> (ø)
nucypher/network/middleware.py 35.29% <100%> (ø)
nucypher/config/utils.py 27.77% <20%> (ø)
nucypher/policy/models.py 35.32% <31.25%> (ø)
nucypher/blockchain/eth/sol/compile.py 82.6% <40%> (ø)
... and 10 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 2e14150...53d2104. Read the comment docs.

@jMyles jMyles force-pushed the coffee branch from 765c32a to a772c94 Jun 4, 2018
delivered_cleartext = BOB.retrieve(message_kit=message_kit,
data_source=datasource_as_understood_by_bob,
alice_pubkey_sig=alices_pubkey_saved_for_posterity)
alice_pubkey_sig=alice_pubkey_restored_from_ancient_scroll)

This comment has been minimized.

Copy link
@michwill
@KPrasch KPrasch force-pushed the coffee branch from bae32bf to 473c96a Jun 20, 2018
KPrasch and others added 24 commits Jun 1, 2018
…ce class; wrapping the default provider types.
…; Additional high level blockchain setup fixtures.
@jMyles jMyles changed the title [WIP] Evolution of Policy and Arrangement ("Coffee") Evolution of Policy and Arrangement ("Coffee") Jul 10, 2018

@property
def locked_tokens(self,):
def locked_tokens(self, ):

This comment has been minimized.

Copy link
@jMyles

jMyles Jul 10, 2018

Author Member

What ahhh... what are we looking at here?

This comment has been minimized.

Copy link
@michwill
def deposit(self, amount: int, lock_periods: int) -> Tuple[str, str]:
"""Public facing method for token locking."""
approve_txhash = self._approve_escrow(amount=amount)
deposit_txhash = self._send_tokens_to_escrow(amount=amount, lock_periods=lock_periods)
if not self.is_me:

This comment has been minimized.

Copy link
@jMyles

jMyles Jul 10, 2018

Author Member

This is unreachable now because of the decorator.

"""
Select n random staking Ursulas, according to their stake distribution.
The returned addresses are shuffled, so one can request more than needed and
throw away those which do not respond.

This comment has been minimized.

Copy link
@KPrasch

KPrasch Jul 10, 2018

Member

Did we loose this chart?

Copy link
Member

left a comment

Farewell, coffee...

@tuxxy
tuxxy approved these changes Jul 10, 2018
Copy link
Member

left a comment

☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️ ☕️

@szotov
szotov approved these changes Jul 10, 2018
@jMyles jMyles changed the title Evolution of Policy and Arrangement ("Coffee") Coffee Jul 10, 2018
@michwill michwill merged commit 9f8f005 into master Jul 10, 2018
8 checks passed
8 checks passed
ci/circleci: blockchain_interface_unit Your tests passed on CircleCI!
Details
ci/circleci: bundle_dependencies-36 Your tests passed on CircleCI!
Details
ci/circleci: character Your tests passed on CircleCI!
Details
ci/circleci: crypto_unit Your tests passed on CircleCI!
Details
ci/circleci: eth_contract_unit Your tests passed on CircleCI!
Details
ci/circleci: intercontract_integration Your tests passed on CircleCI!
Details
ci/circleci: keystore_unit Your tests passed on CircleCI!
Details
ci/circleci: network_unit Your tests passed on CircleCI!
Details
@jMyles jMyles deleted the coffee branch Jul 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.