diff --git a/beacon_chain/beacon_node.nim b/beacon_chain/beacon_node.nim index f5d8dd749..2c98d2f35 100644 --- a/beacon_chain/beacon_node.nim +++ b/beacon_chain/beacon_node.nim @@ -1,7 +1,7 @@ import os, net, sequtils, asyncdispatch2, chronicles, confutils, eth_p2p, eth_keys, - spec/[beaconstate, datatypes, helpers, crypto], conf, time, fork_choice, + spec/[beaconstate, datatypes, helpers, crypto], conf, time, fork_choice, ssz, beacon_chain_db, validator_pool, mainchain_monitor, sync_protocol, gossipsub_protocol, trusted_state_snapshots @@ -139,7 +139,9 @@ proc proposeBlock(node: BeaconNode, # proposal.specials.add r var signedData: ProposalSignedData - # TODO: populate the signed data + signedData.slot = node.beaconState.slot + signedData.shard = BEACON_CHAIN_SHARD_NUMBER + signedData.blockRoot.data = hash_tree_root(proposal) proposal.signature = await validator.signBlockProposal(signedData) await node.network.broadcast(topicBeaconBlocks, proposal) diff --git a/beacon_chain/validator_pool.nim b/beacon_chain/validator_pool.nim index f29cc0ab9..441e16604 100644 --- a/beacon_chain/validator_pool.nim +++ b/beacon_chain/validator_pool.nim @@ -1,7 +1,7 @@ import tables, random, - asyncdispatch2, - spec/[datatypes, crypto, digest], randao + asyncdispatch2, milagro_crypto, + spec/[datatypes, crypto, digest], randao, ssz type ValidatorKind = enum @@ -44,8 +44,10 @@ proc signBlockProposal*(v: AttachedValidator, proposal: ProposalSignedData): Future[ValidatorSig] {.async.} = if v.kind == inProcess: await sleepAsync(1) - # TODO: - # return sign(proposal, v.privKey) + let proposalRoot = hash_tree_root(proposal) + + # TODO: Should we use proposalRoot as data, or digest in regards to signature? + return signMessage(v.privKey, proposalRoot) else: # TODO: # send RPC @@ -56,8 +58,10 @@ proc signAttestation*(v: AttachedValidator, # TODO: implement this if v.kind == inProcess: await sleepAsync(1) - # TODO: - # return sign(proposal, v.privKey) + + let attestationRoot = hash_tree_root(attestation) + # TODO: Should we use attestationRoot as data, or digest in regards to signature? + return signMessage(v.privKey, attestationRoot) else: # TODO: # send RPC