don't lag aggregated attestations by a slot (#2150)
* don't lag aggregated attestations by a slot * don't use aggregation topic at all * use aggregates again, but with aggressively low ATTESTATION_PROPAGATION_SLOT_RANGE; seems to hold on to LH 1.0 nodes * clean up scaffolding and double ATTESTATION_PROPAGATION_SLOT_RANGE to 16 * increase ATTESTATION_PROPAGATION_SLOT_RANGE to 24 * increase ATTESTATION_PROPAGATION_SLOT_RANGE to 28 and isolate in only used function due to customization; remove TRAILING_DISTANCE machinery
This commit is contained in:
parent
eff98e6550
commit
26ea76bbdf
|
@ -89,6 +89,12 @@ func check_propagation_slot_range(
|
|||
let
|
||||
pastSlot = (wallTime - MAXIMUM_GOSSIP_CLOCK_DISPARITY).toSlot()
|
||||
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/specs/phase0/p2p-interface.md#configuration
|
||||
# The spec value of ATTESTATION_PROPAGATION_SLOT_RANGE is 32, but it can
|
||||
# retransmit attestations on the cusp of being out of spec, and which by
|
||||
# the time they reach their destination might be out of spec.
|
||||
const ATTESTATION_PROPAGATION_SLOT_RANGE = 28
|
||||
|
||||
if pastSlot.afterGenesis and
|
||||
data.slot + ATTESTATION_PROPAGATION_SLOT_RANGE < pastSlot.slot:
|
||||
const err_str: cstring = "Attestation slot in the past"
|
||||
|
|
|
@ -63,7 +63,6 @@ const
|
|||
MAX_GRAFFITI_SIZE = 32
|
||||
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/specs/phase0/p2p-interface.md#configuration
|
||||
ATTESTATION_PROPAGATION_SLOT_RANGE* = 32
|
||||
MAXIMUM_GOSSIP_CLOCK_DISPARITY* = 500.millis
|
||||
|
||||
SLOTS_PER_ETH1_VOTING_PERIOD* =
|
||||
|
|
|
@ -513,7 +513,6 @@ proc broadcastAggregatedAttestations(
|
|||
curr[1].read)
|
||||
|
||||
# Don't broadcast when, e.g., this node isn't aggregator
|
||||
# TODO verify there is only one isSome() with test.
|
||||
if aggregateAndProof.isSome:
|
||||
let sig = await signAggregateAndProof(curr[0].v,
|
||||
aggregateAndProof.get, fork, genesis_validators_root)
|
||||
|
@ -523,7 +522,8 @@ proc broadcastAggregatedAttestations(
|
|||
node.network.broadcast(node.topicAggregateAndProofs, signedAP)
|
||||
notice "Aggregated attestation sent",
|
||||
attestation = shortLog(signedAP.message.aggregate),
|
||||
validator = shortLog(curr[0].v)
|
||||
validator = shortLog(curr[0].v),
|
||||
aggregationSlot
|
||||
|
||||
proc getSlotTimingEntropy(): int64 =
|
||||
# Ensure SECONDS_PER_SLOT / ATTESTATION_PRODUCTION_DIVISOR >
|
||||
|
@ -683,16 +683,8 @@ proc handleValidatorDuties*(node: BeaconNode, lastSlot, slot: Slot) {.async.} =
|
|||
seconds(int64(SECONDS_PER_SLOT * 2) div 3),
|
||||
"Waiting to aggregate attestations")
|
||||
|
||||
const TRAILING_DISTANCE = 1
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/specs/phase0/p2p-interface.md#configuration
|
||||
static:
|
||||
doAssert TRAILING_DISTANCE <= ATTESTATION_PROPAGATION_SLOT_RANGE
|
||||
|
||||
let
|
||||
aggregationSlot = slot - TRAILING_DISTANCE
|
||||
aggregationHead = get_ancestor(head, aggregationSlot)
|
||||
|
||||
await broadcastAggregatedAttestations(node, aggregationHead, aggregationSlot)
|
||||
let aggregationHead = get_ancestor(head, slot)
|
||||
await broadcastAggregatedAttestations(node, aggregationHead, slot)
|
||||
|
||||
if node.eth1Monitor != nil and (slot mod SLOTS_PER_EPOCH) == 0:
|
||||
let finalizedEpochRef = node.chainDag.getFinalizedEpochRef()
|
||||
|
|
Loading…
Reference in New Issue