Sign block proposal and attestation
This commit is contained in:
parent
34f7254c61
commit
a7ee8a71bb
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue