EIP7549 get_attestation_indices (#5657)

* get attesting indices electra impl

* fmt

* get tests to pass

* fmt

* fix some beacon chain tests

* fmt

* fix slasher test

* fmt got me again

* fix more tests

* fix tests
This commit is contained in:
Eitan Seri-Levi
2024-05-08 09:32:44 -07:00
committed by GitHub
parent 2c2e44c4ed
commit 90179d4a88
33 changed files with 844 additions and 319 deletions

View File

@@ -1,6 +1,6 @@
use clap::ArgMatches;
use clap_utils::parse_required;
use state_processing::common::get_indexed_attestation;
use state_processing::common::{attesting_indices_base, attesting_indices_electra};
use std::fs::File;
use std::io::Read;
use std::path::{Path, PathBuf};
@@ -33,9 +33,14 @@ pub fn run<E: EthSpec>(matches: &ArgMatches) -> Result<(), String> {
let indexed_attestations = attestations
.into_iter()
.map(|att| {
let committee = state.get_beacon_committee(att.data().slot, att.data().index)?;
get_indexed_attestation(committee.committee, att.to_ref())
.map(|att| match att {
Attestation::Base(att) => {
let committee = state.get_beacon_committee(att.data.slot, att.data.index)?;
attesting_indices_base::get_indexed_attestation(committee.committee, &att)
}
Attestation::Electra(att) => {
attesting_indices_electra::get_indexed_attestation_from_state(&state, &att)
}
})
.collect::<Result<Vec<_>, _>>()
.map_err(|e| format!("Error constructing indexed attestation: {:?}", e))?;