Fixed block proposal signature domain

This commit is contained in:
Yuriy Glukhov 2019-02-07 21:36:03 +01:00 committed by zah
parent 1e574cf75a
commit f1f1beb703
2 changed files with 4 additions and 5 deletions

View File

@ -225,7 +225,7 @@ proc proposeBlock(node: BeaconNode,
shard: BEACON_CHAIN_SHARD_NUMBER,
blockRoot: hash_tree_root_final(newBlock))
newBlock.signature = await validator.signBlockProposal(signedData)
newBlock.signature = await validator.signBlockProposal(node.beaconState.fork, signedData)
await node.network.broadcast(topicBeaconBlocks, newBlock)

View File

@ -43,16 +43,15 @@ proc getValidator*(pool: ValidatorPool,
validatorKey: ValidatorPubKey): AttachedValidator =
pool.validators.getOrDefault(validatorKey)
proc signBlockProposal*(v: AttachedValidator,
proc signBlockProposal*(v: AttachedValidator, fork: Fork,
proposal: ProposalSignedData): Future[ValidatorSig] {.async.} =
if v.kind == inProcess:
await sleepAsync(1)
let proposalRoot = hash_tree_root_final(proposal)
# TODO: Should we use proposalRoot as data, or digest in regards to signature?
# TODO: Use `domain` here
let domain = 0'u64
result = bls_sign(v.privKey, proposalRoot.data, domain)
result = bls_sign(v.privKey, proposalRoot.data,
get_domain(fork, proposal.slot, DOMAIN_PROPOSAL))
else:
# TODO:
# send RPC