Skip to content

Commit 6e1c563

Browse files
committed
revise
1 parent 00e0d87 commit 6e1c563

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

beacon_node/beacon_chain/src/graffiti_calculator.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -404,21 +404,21 @@ mod tests {
404404
}
405405

406406
#[tokio::test]
407-
async fn check_append_el_version_graffiti_user_graffiti_less_than_20_characters() {
407+
async fn check_append_el_version_graffiti_various_length() {
408408
let spec = Arc::new(test_spec::<MinimalEthSpec>());
409409
let harness = get_harness(VALIDATOR_COUNT, spec, None);
410410

411411
let graffiti_vec = vec![
412412
// less than 20 characters, example blow is 19 characters
413-
"lido staking pool!!",
413+
"This is my graffiti",
414414
// 20-23 characters, example below is 22 characters
415-
"now this is pod racing",
416-
// 24-27 characters, example below is 27 characters
417-
"This is where the fun begin",
415+
"This is my graffiti yo",
416+
// 24-27 characters, example below is 26 characters
417+
"This is my graffiti string",
418418
// 28-29 characters, example below is 29 characters
419-
"I don't like sand, its coarse",
420-
// 30-32 characters, example below is 30 characters
421-
"I do not like sand, its coarse",
419+
"This is my graffiti string yo",
420+
// 30-32 characters, example below is 32 characters
421+
"This is my graffiti string yo yo",
422422
];
423423
// user graffiti is 19 characters
424424

@@ -439,8 +439,8 @@ mod tests {
439439
.0;
440440

441441
let mock_commit = DEFAULT_CLIENT_VERSION.commit.clone();
442-
let graffiti_length = graffiti.len();
443442

443+
let graffiti_length = graffiti.len();
444444
let append_graffiti_string = match graffiti_length {
445445
0..=19 => format!(
446446
"{}{}{}{}",
@@ -473,12 +473,12 @@ mod tests {
473473
// when user graffiti length is 30-32 characters, append nothing
474474
30..=32 => String::new(),
475475
_ => panic!(
476-
"graffiti length should be less than or equal to GRAFFITI_BYTES_LEN (32)"
476+
"graffiti length should be less than or equal to GRAFFITI_BYTES_LEN (32 characters)"
477477
),
478478
};
479479

480480
let expected_graffiti_string = if append_graffiti_string.is_empty() {
481-
// for the case of empty append_graffiti_string
481+
// for the case of empty append_graffiti_string, i.e., user-specified graffiti is 30-32 characters
482482
graffiti.to_string()
483483
} else {
484484
// There is a space between the client version info and user graffiti

beacon_node/execution_layer/src/engine_api.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ impl ClientVersionV1 {
791791
self.commit
792792
.0
793793
.get(..2)
794-
.map_or_else(|| self.commit.0.as_str(), |s| s)
794+
.unwrap_or(self.commit.0.as_str())
795795
.to_lowercase(),
796796
lighthouse_commit_prefix
797797
.0

0 commit comments

Comments
 (0)