sigp / lighthouse

Ethereum consensus client in Rust
https://lighthouse.sigmaprime.io/
Apache License 2.0
2.82k stars 698 forks source link

Blank line at the end of graffiti-file causes error #5880

Open davidcann opened 1 month ago

davidcann commented 1 month ago

Description

A blank line at the end of the graffiti-file causes an error and the entire file to be ignored. There is no mention of blank lines being a problem in the documentation here: https://lighthouse-book.sigmaprime.io/graffiti.html

Version

stable (production release)

Present Behaviour

The entire graffiti-file is ignored when there's a blank line at the end of the text file.

error: InvalidLine("Missing delimiter: "), service: block

Expected Behaviour

Blank lines should be ignored. All valid lines should be read.

Steps to resolve

Add a blank line to the end of the file set via --graffiti-file, then wait for a block proposal or restart the validator client.

davidcann commented 1 month ago

To solve this, add this before /validator_client/src/graffiti_file.rs line 68:

if line.trim().is_empty() {
    continue;
}

https://github.com/sigp/lighthouse/blob/3058b96f2560f1da04ada4f9d8ba8e5651794ff6/validator_client/src/graffiti_file.rs#L68

michaelsproul commented 1 month ago

thanks for the bug report

if you'd like to submit a PR with the fix we can merge it!