Etherlink/Kernel/DAL: ignore invalid inputs
What
When parsing the content of a DAL slot, there are currently four possible errors:
- unknown tag,
- failure to compute the length of a blueprint chunk,
- RLP deserialization error of the chunk,
- the total number of chunks for this blueprint is above the limit.
In the three first cases, we don't know where to resume parsing so we simply drop the whole DAL slot. In the last case however, it is possible to drop the invalid chunk and resume parsing after it. This is what this MR does.
Why
When parsing the inbox, the kernel drops invalid messages and resume at the next message. This MR is about increasing the consistency between the DAL and inbox cases. It is also a preparation of !15925 (merged), which adds another failure case from which we want to recover.
How
- To distinguish the failure cases, we reuse the
SequencerBlueprintRestype which is used in the case of signed chunks. (second commit) - But for this to be possible, we first need to drop signatures from the
SequencerBlueprintRes::SequencerBlueprintcase; which is doable because the returned signature was never used. (first commit) - Finally, we add a case in DAL parsed input:
dal::ParsedInput::InvalidInputand use it where appropriate. (third commit)
Manually testing the MR
$ cargo test dal::tests::test_parse_slot_resume_after_invalid_chunk
Checklist
-
Document the interface of any function added or modified (see the coding guidelines) -
Document any change to the user interface, including configuration parameters (see node configuration) -
Provide automatic testing (see the testing guide). -
For new features and bug fixes, add an item in the appropriate changelog ( docs/protocols/alpha.rstfor the protocol and the environment,CHANGES.rstat the root of the repository for everything else). -
Select suitable reviewers using the Reviewersfield below. -
Select as Assigneethe next person who should take action on that MR
Edited by Raphaël Cauderlier