Merge pull request #196 from jMyles/unification-aftermath

Unification aftermath Part 1
pull/216/head
Justin Holmes 2018-04-10 18:40:54 -07:00 committed by GitHub
commit 55b11dcc3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 20 additions and 31 deletions

View File

@ -21,8 +21,6 @@ requests = "*"
hendrix = {git = "https://github.com/hendrix/hendrix", ref = "tags/3.0.0rc1"}
constantSorrow = {git = "https://github.com/nucypher/constantSorrow.git", ref = "kms-depend"}
bytestringSplitter = {git = "https://github.com/nucypher/byteStringSplitter.git", ref = "eaa1df2433362190f30bc6e400570f0331980ebb"}
eth-account = "*"
"web3" = "*"
appdirs = "*"
populus = {git = "https://github.com/nucypher/Bropulus.git"}

View File

View File

View File

@ -3,7 +3,7 @@ from collections import OrderedDict
from datetime import datetime
from typing import Tuple, List, Union
from nkms_eth.agents import NuCypherKMSTokenAgent
from nkms.blockchain.eth.agents import NuCypherKMSTokenAgent
class TokenActor(ABC):

View File

@ -7,7 +7,7 @@ from typing import Set, Generator, List
from web3.contract import Contract
from nkms_eth.deployers import MinerEscrowDeployer, NuCypherKMSTokenDeployer, PolicyManagerDeployer, ContractDeployer
from nkms.blockchain.eth.deployers import MinerEscrowDeployer, NuCypherKMSTokenDeployer, PolicyManagerDeployer, ContractDeployer
class EthereumContractAgent(ABC):

View File

@ -1,6 +1,6 @@
from abc import ABC
from nkms_eth.config import EthereumConfig
from nkms.blockchain.eth.config import EthereumConfig
class TheBlockchain(ABC):

View File

@ -1,13 +1,8 @@
import os
from enum import Enum
from pathlib import Path
from os.path import dirname, join, abspath
import appdirs
import populus
import nkms_eth
from nkms.blockchain import eth
class NuCypherTokenConfig:
@ -70,7 +65,7 @@ class EthereumConfig:
self._registrar_path = registrar_path
# Populus project config
self._project_dir = join(dirname(abspath(nkms_eth.__file__)), 'project')
self._project_dir = join(dirname(abspath(eth.__file__)), 'project')
self._populus_project = populus.Project(self._project_dir)
self.project.config['chains.mainnetrpc.contracts.backends.JSONFile.settings.file_path'] = self._registrar_path

View File

@ -1,9 +1,7 @@
from typing import Tuple, Dict
from populus.contracts.contract import PopulusContract
from web3.contract import Contract
from nkms_eth.config import NuCypherMinerConfig, NuCypherTokenConfig
from nkms.blockchain.eth.config import NuCypherMinerConfig, NuCypherTokenConfig
from .blockchain import TheBlockchain

View File

@ -1,4 +1,4 @@
from nkms_eth.actors import Miner
from nkms.blockchain.eth.actors import Miner
class BlockchainArrangement:

View File

@ -1,11 +1,11 @@
import random
from typing import List
from nkms_eth.actors import Miner
from nkms_eth.agents import MinerAgent, EthereumContractAgent
from nkms_eth.blockchain import TheBlockchain
from nkms_eth.config import NuCypherMinerConfig
from nkms_eth.deployers import MinerEscrowDeployer, NuCypherKMSTokenDeployer
from nkms.blockchain.eth.actors import Miner
from nkms.blockchain.eth.agents import MinerAgent
from nkms.blockchain.eth.blockchain import TheBlockchain
from nkms.blockchain.eth.config import NuCypherMinerConfig
from nkms.blockchain.eth.deployers import MinerEscrowDeployer, NuCypherKMSTokenDeployer
class TesterBlockchain(TheBlockchain):

View File

@ -11,6 +11,7 @@ from typing import Dict
from typing import Union, List
from constant_sorrow import constants, default_constant_splitter
from nkms.blockchain.eth.actors import PolicyAuthor
from nkms.config.config import KMSConfig
from nkms.crypto.api import secure_random, keccak_digest
from nkms.crypto.constants import PUBLIC_KEY_LENGTH
@ -22,8 +23,6 @@ from nkms.network import blockchain_client
from nkms.network.protocols import dht_value_splitter
from nkms.network.server import NuCypherDHTServer, NuCypherSeedOnlyDHTServer, ProxyRESTServer
from nkms_eth.actors import PolicyAuthor
from umbral import pre
from umbral.keys import UmbralPublicKey
from nkms.crypto.signature import Signature
@ -357,7 +356,7 @@ class Alice(Character, PolicyAuthor):
if not default_deposit:
deposit = networky_stuff.get_competitive_rate()
if deposit == NotImplemented:
deposit = constants.NON_PAYMENT
deposit = constants.NON_PAYMENT(b"0000000")
policy = self.create_policy(bob, uri, m, n)

View File

@ -15,7 +15,7 @@ from nkms.crypto.powers import SigningPower
from nkms.crypto.signature import Signature
from nkms.crypto.splitters import key_splitter
from bytestring_splitter import BytestringSplitter
from nkms_eth.policies import BlockchainArrangement
from nkms.blockchain.eth.policies import BlockchainArrangement
from umbral.pre import Capsule
from constant_sorrow import constants
@ -67,12 +67,12 @@ class Arrangement(BlockchainArrangement):
@classmethod
def from_bytes(cls, arrangement_as_bytes):
arrangement_splitter = key_splitter + BytestringSplitter((bytes, KECCAK_DIGEST_LENGTH),
(bytes, 26))
(bytes, 27))
alice_pubkey_sig, hrac, expiration_bytes, deposit_bytes = arrangement_splitter(
arrangement_as_bytes, return_remainder=True)
expiration = maya.parse(expiration_bytes.decode())
alice = Alice.from_public_keys({SigningPower: alice_pubkey_sig})
return cls(alice=alice, hrac=hrac, expiration=expiration)
return cls(alice=alice, hrac=hrac, expiration=expiration, deposit=int(deposit_bytes))
def publish(self, kfrag, ursula, negotiation_result):
self.kfrag = kfrag

View File

@ -1,8 +1,8 @@
import pytest
from nkms_eth import utilities as utils
from nkms_eth.blockchain import TheBlockchain
from nkms_eth.agents import NuCypherKMSTokenAgent, MinerAgent
from nkms.blockchain.eth import utilities as utils
from nkms.blockchain.eth.blockchain import TheBlockchain
from nkms.blockchain.eth.agents import NuCypherKMSTokenAgent, MinerAgent
@pytest.fixture(scope='function')

View File

@ -11,7 +11,6 @@ from nkms.network import blockchain_client
from nkms.network.protocols import dht_value_splitter
from tests.utilities import MockNetworkyStuff, EVENT_LOOP, URSULA_PORT, NUMBER_OF_URSULAS_IN_NETWORK
from nkms_eth.utilities import spawn_miners
def test_all_ursulas_know_about_all_other_ursulas(ursulas):