lighthouse/beacon_node/beacon_chain/src
Paul Hauner ceda27371d Ensure doppelganger detects attestations in blocks (#2495)
## Issue Addressed

NA

## Proposed Changes

When testing our (not-yet-released) Doppelganger implementation, I noticed that we aren't detecting attestations included in blocks (only those on the gossip network).

This is because during [block processing](e8c0d1f19b/beacon_node/beacon_chain/src/beacon_chain.rs (L2168)) we only update the `observed_attestations` cache with each attestation, but not the `observed_attesters` cache. This is the correct behaviour when we consider the [p2p spec](https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/specs/phase0/p2p-interface.md):

> [IGNORE] There has been no other valid attestation seen on an attestation subnet that has an identical attestation.data.target.epoch and participating validator index.

We're doing the right thing here and still allowing attestations on gossip that we've seen in a block. However, this doesn't work so nicely for Doppelganger.

To resolve this, I've taken the following steps:

- Add a `observed_block_attesters` cache.
- Rename `observed_attesters` to `observed_gossip_attesters`.

## TODO

- [x] Add a test to ensure a validator that's been seen in a block attestation (but not a gossip attestation) returns `true` for `BeaconChain::validator_seen_at_epoch`.
- [x] Add a test to ensure `observed_block_attesters` isn't polluted via gossip attestations and vice versa. 


Co-authored-by: realbigsean <seananderson33@gmail.com>
2021-08-09 02:43:03 +00:00
..
attestation_verification.rs Ensure doppelganger detects attestations in blocks (#2495) 2021-08-09 02:43:03 +00:00
attester_cache.rs Add AttesterCache for attestation production (#2478) 2021-07-29 04:38:26 +00:00
beacon_chain.rs Ensure doppelganger detects attestations in blocks (#2495) 2021-08-09 02:43:03 +00:00
beacon_fork_choice_store.rs Tree hash caching and optimisations for Altair (#2459) 2021-07-23 00:23:53 +00:00
beacon_proposer_cache.rs Optimize validator duties (#2243) 2021-03-17 05:09:57 +00:00
beacon_snapshot.rs Altair consensus changes and refactors (#2279) 2021-07-09 06:15:32 +00:00
block_verification.rs Rust 1.54.0 lints (#2483) 2021-07-30 01:11:47 +00:00
builder.rs Ensure doppelganger detects attestations in blocks (#2495) 2021-08-09 02:43:03 +00:00
chain_config.rs Implement database temp states to reduce memory usage (#1798) 2020-10-23 01:27:51 +00:00
errors.rs Altair validator client and HTTP API (#2404) 2021-08-06 00:47:31 +00:00
eth1_chain.rs Rust 1.54.0 lints (#2483) 2021-07-30 01:11:47 +00:00
events.rs Reorg events (#2090) 2021-06-17 02:10:46 +00:00
head_tracker.rs Altair consensus changes and refactors (#2279) 2021-07-09 06:15:32 +00:00
lib.rs Add AttesterCache for attestation production (#2478) 2021-07-29 04:38:26 +00:00
metrics.rs Ensure doppelganger detects attestations in blocks (#2495) 2021-08-09 02:43:03 +00:00
migrate.rs Altair consensus changes and refactors (#2279) 2021-07-09 06:15:32 +00:00
naive_aggregation_pool.rs Rust 1.54.0 lints (#2483) 2021-07-30 01:11:47 +00:00
observed_aggregates.rs [Altair] Sync committee pools (#2321) 2021-07-15 00:52:02 +00:00
observed_attesters.rs Ensure doppelganger detects attestations in blocks (#2495) 2021-08-09 02:43:03 +00:00
observed_block_producers.rs Doppelganger detection (#2230) 2021-07-31 03:50:52 +00:00
observed_operations.rs Clippy 1.49.0 updates and dht persistence test fix (#2156) 2021-01-19 00:34:28 +00:00
persisted_beacon_chain.rs Fix head tracker concurrency bugs (#1771) 2020-10-19 05:58:39 +00:00
persisted_fork_choice.rs v0.12 fork choice update (#1229) 2020-06-17 11:10:22 +10:00
schema_change.rs [Altair] Sync committee pools (#2321) 2021-07-15 00:52:02 +00:00
shuffling_cache.rs Advance state to next slot after importing block (#2174) 2021-02-15 07:17:52 +00:00
snapshot_cache.rs Altair consensus changes and refactors (#2279) 2021-07-09 06:15:32 +00:00
state_advance_timer.rs Add AttesterCache for attestation production (#2478) 2021-07-29 04:38:26 +00:00
sync_committee_verification.rs Rust 1.54.0 lints (#2483) 2021-07-30 01:11:47 +00:00
test_utils.rs Altair validator client and HTTP API (#2404) 2021-08-06 00:47:31 +00:00
timeout_rw_lock.rs Add timeouts to canonical head rwlock (#759) 2020-01-06 17:30:37 +11:00
validator_monitor.rs Rust 1.54.0 lints (#2483) 2021-07-30 01:11:47 +00:00
validator_pubkey_cache.rs [Altair] Sync committee pools (#2321) 2021-07-15 00:52:02 +00:00