Conversation
| // addition | ||
| if bytes.Equal(attestationDataByts, data) { | ||
| return nil | ||
| } |
There was a problem hiding this comment.
This is a nil or empty check right?
There was a problem hiding this comment.
if the attestation data we got from our own node is the same as the leader's (it should happen if the nodes are synced to the same head) then no need to perform any more validation and we stop
This assumes the operator trusts his beacon node (most of the time they run their own I think).
If the data is nil it should fail I think when we do deocode or validate
| } | ||
| blockEpoch := getBeaconNode().getEpochBySlot(proof.Message.slot) | ||
| domain := GetBeaconNode().DomainData(blockEpoch, spec.DomainProposer) | ||
| root := spec.ComputeEthSigningRoot(beaconRoot, domain) | ||
| validator := GetBeaconNode.GetValidator("HEAD", proof.Message.ProposerIndex) | ||
| return bls.Verify(sig, validator.PubKey, root) |
There was a problem hiding this comment.
With this check, we're sure that the block proposed as head exists. But we, still, can't be sure if a malicious operator is sending us an old block to attest, correct?
Perhaps, if we had some state that persisted through all duties, we could do a lower limit check for the slot/epoch. This is some future discussion but what do you think?
There was a problem hiding this comment.
We can compare against the block we got from our node simply without persisting state.
But I see it as a future improvement outside this SIP
|
I need to add a check that the beaconHeaderProof is assigned by a validator that was assigned the duty |
|
Why can't a local node request the block from the local beacon node and see it exists? |
GalRogozinski
left a comment
There was a problem hiding this comment.
Why can't a local node request the block from the local beacon node and see it exists?
it can but the block may be missing there. We first check the local node and then the proof
| func isSourceJustified(attestationData)) error { | ||
| currentEpoch := network.EstimatedCurrentEpoch() | ||
| // https://ethereum.github.io/beacon-APIs/#/Beacon/getStateFinalityCheckpoints | ||
| checkpoints := getBeaconNode().getFinalityCheckpoints() | ||
| if attestationData.Target.Epoch == currentEpoch { | ||
| if attestationData.Source.Root != checkpoints.data.currentJustifiedRoot { | ||
| return Errors.New("source is not expected currently justified root") | ||
| } | ||
| } else if attestationData.Source.Root!= checkpoints.data.previousJustifiedRoot { | ||
| return Errors.New("source is not expected previously justified root") | ||
| } | ||
|
|
||
| return nil | ||
| } |
Verify that attestation/sync-committee consensus data will be included by beacon chain