storage: a short delta frame or an undecodable block header still panics a state rebuild
Les mainteneurs répondent en général sous 6 jours
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 48/100
Piste de recherche
Start with beacon_state_delta.rs at unframe and state_writer.rs at reconstruct_beacon_state_bytes and fold_beacon_state_deltas; then trace block slot decoding through store.rs at try_block_slot_in and peek_beacon_block_slot. Check the additional BlockHeader::from_ssz_bytes(..).expect("valid header") reads in store.rs to decide the fix's scope. Done means truncated StateDiffs and BlockHeaders rows read through get_state return errors instead of panicking, with tests covering both cases.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
lambdaclass/ethlambda#788 changed get_state's rebuild to return Error::CorruptState, rather than panic, when a stored state, delta or diff does not decode. A few decodes of disk-sourced bytes on the same path still panic. Line numbers are at #788's head (4fe2f243):
- Delta frame header.
beacon_state_delta::unframe(crates/storage/src/beacon_state_delta.rs:111) slicesbytes[0..32],[32..40]and[40..48]without checking the length. AStateDiffsrow shorter than its 48-byte header therefore panics instead of reading back asCorruptState. On the rebuild path it is called byreconstruct_beacon_state_bytes(crates/storage/src/state_writer.rs:548) andfold_beacon_state_deltas(state_writer.rs:601). The writer'snearest_snapshot_root(state_writer.rs:580) calls it too. - Block slot lookup. Every hop of a rebuild reads its slot through
try_block_slot_in(crates/storage/src/store.rs:1121). Its beacon arm,peek_beacon_block_slot(store.rs:1073), indexes the row by its SSZ offset with no bounds check. Its lean arm.expect("valid header")s (store.rs:1132).reconstruct_state's final header read (state_writer.rs:679) does the same.
This was out of #788's scope because these panics already exist on main and that PR's docs name them. The header decode is also not specific to the rebuild:
block_slot,beacon_block_slotandnearest_snapshot_rootshare it.- Four more
BlockHeader::from_ssz_bytes(..).expect("valid header")reads sit elsewhere instore.rs(2702, 3026, 3074, 3138).
Making only the rebuild tolerate a corrupt header row would leave the next header read panicking. #306 is related but covers backend Results swallowed by .expect(), not bytes that read back fine and then fail to decode.
A fix:
- Add a
try_unframe(split_at_checked(48)) whose error the rebuild maps toCorruptState, and keepunframeas the panicking wrapper for frames the writer just built. - Add a fallible beacon slot peek and lean header decode, so that
try_block_slot_inreturns the crate'sErrorwith a decode failure asCorruptState(or a newCorruptBlockHeader { root }). - Decide whether the other header reads follow.
- Tests: a truncated
StateDiffsrow and a truncatedBlockHeadersrow each read back fromget_stateas an error, not a panic.
- Langage dominant
- Rust
- Étoiles
- 86
- Forks
- 34
- Merge moyen
- 9 j 20 h
- PR mergées (30 j)
- 77
Préparer son environnement
- Fournit un Dockerfile ou un fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de lambdaclass/ethlambda
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
lambdaclass/ethlambda#850 ·
Les mainteneurs répondent en général sous 6 jours
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
lambdaclass/ethlambda#777 · 1 réaction ·
Les mainteneurs répondent en général sous 6 jours
-
Run all gossip validation testsPeut-être à nouveau libre @dicethedev l’a pris il y a 9 jours, et aucune pull request n’est ouverte. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
lambdaclass/ethlambda#725 · 2 commentaires ·
Les mainteneurs répondent en général sous 6 jours
-
Handle malformed DB dataPeut-être à nouveau libre @dicethedev l’a pris il y a 115 jours, et aucune pull request n’est ouverte. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
lambdaclass/ethlambda#529 · 4 commentaires ·
Les mainteneurs répondent en général sous 6 jours
-
Document architectural choicesPeut-être à nouveau libre @dicethedev l’a pris il y a 115 jours, et aucune pull request n’est ouverte. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
lambdaclass/ethlambda#521 · 2 commentaires ·
Les mainteneurs répondent en général sous 6 jours
Toutes les issues de lambdaclass/ethlambda
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
antithesishq/bombadil#473 ·
Les mainteneurs répondent en général sous 2 jours
-
bench/api.sh exec test fails with curl exit 52, and --ignore-failure still records the timingsOuvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
libracoder/kiri#669 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 88/100
Les mainteneurs répondent en général sous 5 jours
-
autofixer: follow-up
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
tursodatabase/turso#12217 ·
Les mainteneurs répondent en général sous 1 jour
-
Declare the CMS schema library in the optional recipients extraPeut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. Ouvertearea:python in-progress
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
yhay81/pyropdf#1005 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour