Fixed block proposal signature domain
This commit is contained in:
parent
1e574cf75a
commit
f1f1beb703
|
@ -225,7 +225,7 @@ proc proposeBlock(node: BeaconNode,
|
||||||
shard: BEACON_CHAIN_SHARD_NUMBER,
|
shard: BEACON_CHAIN_SHARD_NUMBER,
|
||||||
blockRoot: hash_tree_root_final(newBlock))
|
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)
|
await node.network.broadcast(topicBeaconBlocks, newBlock)
|
||||||
|
|
||||||
|
|
|
@ -43,16 +43,15 @@ proc getValidator*(pool: ValidatorPool,
|
||||||
validatorKey: ValidatorPubKey): AttachedValidator =
|
validatorKey: ValidatorPubKey): AttachedValidator =
|
||||||
pool.validators.getOrDefault(validatorKey)
|
pool.validators.getOrDefault(validatorKey)
|
||||||
|
|
||||||
proc signBlockProposal*(v: AttachedValidator,
|
proc signBlockProposal*(v: AttachedValidator, fork: Fork,
|
||||||
proposal: ProposalSignedData): Future[ValidatorSig] {.async.} =
|
proposal: ProposalSignedData): Future[ValidatorSig] {.async.} =
|
||||||
if v.kind == inProcess:
|
if v.kind == inProcess:
|
||||||
await sleepAsync(1)
|
await sleepAsync(1)
|
||||||
let proposalRoot = hash_tree_root_final(proposal)
|
let proposalRoot = hash_tree_root_final(proposal)
|
||||||
|
|
||||||
# TODO: Should we use proposalRoot as data, or digest in regards to signature?
|
# TODO: Should we use proposalRoot as data, or digest in regards to signature?
|
||||||
# TODO: Use `domain` here
|
result = bls_sign(v.privKey, proposalRoot.data,
|
||||||
let domain = 0'u64
|
get_domain(fork, proposal.slot, DOMAIN_PROPOSAL))
|
||||||
result = bls_sign(v.privKey, proposalRoot.data, domain)
|
|
||||||
else:
|
else:
|
||||||
# TODO:
|
# TODO:
|
||||||
# send RPC
|
# send RPC
|
||||||
|
|
Loading…
Reference in New Issue