mirror of https://github.com/nucypher/nucypher.git
Defining some TODOs for later PRs
parent
bf9e8f5239
commit
cd8b265917
|
@ -133,6 +133,8 @@ contract MiningAdjudicator {
|
||||||
UmbralDeserializer.CapsuleFrag memory _cFrag = _cFragBytes.toCapsuleFrag();
|
UmbralDeserializer.CapsuleFrag memory _cFrag = _cFragBytes.toCapsuleFrag();
|
||||||
UmbralDeserializer.PreComputedData memory _precomputed = _precomputedBytes.toPreComputedData();
|
UmbralDeserializer.PreComputedData memory _precomputed = _precomputedBytes.toPreComputedData();
|
||||||
|
|
||||||
|
// TODO: Check KFrag signature by Alice. Depends on using ECDSA+SHA256 in umbral and nucypher
|
||||||
|
|
||||||
uint256 h = computeProofChallengeScalar(_capsuleBytes, _cFragBytes);
|
uint256 h = computeProofChallengeScalar(_capsuleBytes, _cFragBytes);
|
||||||
|
|
||||||
//////
|
//////
|
||||||
|
|
|
@ -307,11 +307,10 @@ def make_rest_app(
|
||||||
with ThreadedSession(db_engine) as session:
|
with ThreadedSession(db_engine) as session:
|
||||||
policy_arrangement = datastore.get_policy_arrangement(arrangement_id=id_as_hex.encode(),
|
policy_arrangement = datastore.get_policy_arrangement(arrangement_id=id_as_hex.encode(),
|
||||||
session=session)
|
session=session)
|
||||||
|
|
||||||
kfrag_bytes = policy_arrangement.kfrag # Careful! :-)
|
kfrag_bytes = policy_arrangement.kfrag # Careful! :-)
|
||||||
verifying_key_bytes = policy_arrangement.alice_pubkey_sig.key_data
|
verifying_key_bytes = policy_arrangement.alice_pubkey_sig.key_data
|
||||||
|
|
||||||
# TODO: Push this to a lower level.
|
# TODO: Push this to a lower level. Perhaps to Ursula character? #619
|
||||||
kfrag = KFrag.from_bytes(kfrag_bytes)
|
kfrag = KFrag.from_bytes(kfrag_bytes)
|
||||||
alices_verifying_key = UmbralPublicKey.from_bytes(verifying_key_bytes)
|
alices_verifying_key = UmbralPublicKey.from_bytes(verifying_key_bytes)
|
||||||
cfrag_byte_stream = b""
|
cfrag_byte_stream = b""
|
||||||
|
|
|
@ -59,7 +59,7 @@ def make_recoverable_signature(data_hash, signature, umbral_pubkey_bytes):
|
||||||
recoverable_signature = bytes(signature) + bytes([1])
|
recoverable_signature = bytes(signature) + bytes([1])
|
||||||
return recoverable_signature
|
return recoverable_signature
|
||||||
|
|
||||||
|
# TODO: Obtain real re-encryption metadata. Maybe constructing a WorkOrder and obtaining a response.
|
||||||
def fragments(metadata):
|
def fragments(metadata):
|
||||||
delegating_privkey = UmbralPrivateKey.gen_key()
|
delegating_privkey = UmbralPrivateKey.gen_key()
|
||||||
_symmetric_key, capsule = pre._encapsulate(delegating_privkey.get_pubkey())
|
_symmetric_key, capsule = pre._encapsulate(delegating_privkey.get_pubkey())
|
||||||
|
@ -83,7 +83,7 @@ def fragments(metadata):
|
||||||
def test_evaluate_cfrag(testerchain, escrow, adjudicator_contract):
|
def test_evaluate_cfrag(testerchain, escrow, adjudicator_contract):
|
||||||
creator, miner, wrong_miner, *everyone_else = testerchain.interface.w3.eth.accounts
|
creator, miner, wrong_miner, *everyone_else = testerchain.interface.w3.eth.accounts
|
||||||
|
|
||||||
# TODO: Move this to an integration test
|
# TODO: Move this to an integration test?
|
||||||
umbral_params = default_params()
|
umbral_params = default_params()
|
||||||
u_xcoord, u_ycoord = umbral_params.u.to_affine()
|
u_xcoord, u_ycoord = umbral_params.u.to_affine()
|
||||||
u_sign = 2 + (u_ycoord % 2)
|
u_sign = 2 + (u_ycoord % 2)
|
||||||
|
@ -91,14 +91,12 @@ def test_evaluate_cfrag(testerchain, escrow, adjudicator_contract):
|
||||||
assert u_xcoord == adjudicator_contract.functions.UMBRAL_PARAMETER_U_XCOORD().call()
|
assert u_xcoord == adjudicator_contract.functions.UMBRAL_PARAMETER_U_XCOORD().call()
|
||||||
assert u_ycoord == adjudicator_contract.functions.UMBRAL_PARAMETER_U_YCOORD().call()
|
assert u_ycoord == adjudicator_contract.functions.UMBRAL_PARAMETER_U_YCOORD().call()
|
||||||
|
|
||||||
# TODO: Move this to an integration test
|
# TODO: Move this to an integration test?
|
||||||
test_data = os.urandom(40)
|
test_data = os.urandom(40)
|
||||||
h = hash_to_curvebn(test_data,
|
h = hash_to_curvebn(test_data,
|
||||||
params=umbral_params,
|
params=umbral_params,
|
||||||
hash_class=ExtendedKeccak)
|
hash_class=ExtendedKeccak)
|
||||||
h = int(h)
|
assert int(h) == adjudicator_contract.functions.extendedKeccakToBN(test_data).call()
|
||||||
h2 = adjudicator_contract.functions.extendedKeccakToBN(test_data).call()
|
|
||||||
assert h == h2
|
|
||||||
|
|
||||||
# Prepare one miner
|
# Prepare one miner
|
||||||
tx = escrow.functions.setMinerInfo(miner, 1000).transact()
|
tx = escrow.functions.setMinerInfo(miner, 1000).transact()
|
||||||
|
|
Loading…
Reference in New Issue