lighthouse/beacon_node
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
..
beacon_chain Ensure doppelganger detects attestations in blocks (#2495) 2021-08-09 02:43:03 +00:00
client Bleeding edge discovery (#2435) 2021-07-15 16:43:17 +10:00
eth1 Rust 1.54.0 lints (#2483) 2021-07-30 01:11:47 +00:00
eth2_libp2p Altair networking (#2300) 2021-08-04 01:44:57 +00:00
genesis Rust 1.54.0 lints (#2483) 2021-07-30 01:11:47 +00:00
http_api Altair validator client and HTTP API (#2404) 2021-08-06 00:47:31 +00:00
http_metrics Bleeding edge discovery (#2435) 2021-07-15 16:43:17 +10:00
network Altair validator client and HTTP API (#2404) 2021-08-06 00:47:31 +00:00
operation_pool Rust 1.54.0 lints (#2483) 2021-07-30 01:11:47 +00:00
src Rust 1.54.0 lints (#2483) 2021-07-30 01:11:47 +00:00
store Rust 1.54.0 lints (#2483) 2021-07-30 01:11:47 +00:00
tests Altair consensus changes and refactors (#2279) 2021-07-09 06:15:32 +00:00
timer Bleeding edge discovery (#2435) 2021-07-15 16:43:17 +10:00
websocket_server Server sent events (#1920) 2020-12-04 00:18:58 +00:00
Cargo.toml Bleeding edge discovery (#2435) 2021-07-15 16:43:17 +10:00