mirror of https://github.com/nucypher/nucypher.git
BlockchainPolicy now inherits from Policy.
parent
00d0e64c7e
commit
8dc1a37aaf
|
@ -1,7 +1,7 @@
|
|||
from nucypher.blockchain.eth.actors import PolicyAuthor
|
||||
|
||||
from nucypher.blockchain.eth.actors import Miner
|
||||
from nucypher.policy.models import Arrangement
|
||||
from nucypher.policy.models import Arrangement, Policy
|
||||
|
||||
|
||||
class BlockchainArrangement(Arrangement):
|
||||
|
@ -64,7 +64,7 @@ class BlockchainArrangement(Arrangement):
|
|||
return txhash
|
||||
|
||||
|
||||
class BlockchainPolicy:
|
||||
class BlockchainPolicy(Policy):
|
||||
"""
|
||||
A collection of n BlockchainArrangements representing a single Policy
|
||||
"""
|
||||
|
|
|
@ -10,7 +10,6 @@ from umbral.config import default_params
|
|||
from umbral.pre import Capsule
|
||||
|
||||
from nucypher.blockchain.eth.agents import MinerAgent
|
||||
from nucypher.blockchain.eth.policies import BlockchainPolicy
|
||||
from nucypher.characters import Alice
|
||||
from nucypher.characters import Bob, Ursula
|
||||
from nucypher.crypto.api import keccak_digest
|
||||
|
@ -95,7 +94,7 @@ class Arrangement:
|
|||
return bytes(self.kfrag)
|
||||
|
||||
|
||||
class Policy(BlockchainPolicy):
|
||||
class Policy:
|
||||
"""
|
||||
An edict by Alice, arranged with n Ursulas, to perform re-encryption for a specific Bob
|
||||
for a specific path.
|
||||
|
@ -133,8 +132,6 @@ class Policy(BlockchainPolicy):
|
|||
self.alices_signature = alices_signature
|
||||
self.arrangements = dict()
|
||||
|
||||
super().__init__(author=self.alice)
|
||||
|
||||
class MoreKFragsThanArrangements(TypeError):
|
||||
"""
|
||||
Raised when a Policy has been used to generate Arrangements with Ursulas insufficient number
|
||||
|
@ -271,8 +268,9 @@ class Policy(BlockchainPolicy):
|
|||
|
||||
# Cast the miner into an ursula
|
||||
ursula = Ursula(is_me=False, ether_address=miner.ether_address)
|
||||
arrangement = Arrangement(alice=self.alice, ursula=ursula, hrac=self.hrac(), expiration=expiration,
|
||||
deposit=deposit)
|
||||
arrangement = Arrangement(alice=self.alice, ursula=ursula,
|
||||
hrac=self.hrac(),
|
||||
expiration=expiration)
|
||||
|
||||
try:
|
||||
# TODO: check out the response: need to assess the result and see if we're actually good to go.
|
||||
|
|
Loading…
Reference in New Issue