From 1a3be0549e04e7bddd1c3bb43a899f9554cd3d9d Mon Sep 17 00:00:00 2001 From: David Palm Date: Tue, 21 May 2019 22:10:22 +0200 Subject: [PATCH 1/2] Don't panic if extra_data is longer than VANITY_LENGTH Seems like `extra_data().len()` can be longer than 32 (was 39 here) so this fixes that panic. --- ethcore/src/engines/clique/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethcore/src/engines/clique/mod.rs b/ethcore/src/engines/clique/mod.rs index 1ae30905e0e..149434d67e2 100644 --- a/ethcore/src/engines/clique/mod.rs +++ b/ethcore/src/engines/clique/mod.rs @@ -713,7 +713,7 @@ impl Engine for Clique { } } - let zero_padding_len = VANITY_LENGTH - header.extra_data().len(); + let zero_padding_len = VANITY_LENGTH.checked_sub(header.extra_data().len()).unwrap_or(0); if zero_padding_len > 0 { let mut resized_extra_data = header.extra_data().clone(); resized_extra_data.resize(VANITY_LENGTH, 0); From 6272498b47cd8dd5b79f708320d6bed0f5757300 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 22 May 2019 09:28:05 +0200 Subject: [PATCH 2/2] Update ethcore/src/engines/clique/mod.rs --- ethcore/src/engines/clique/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethcore/src/engines/clique/mod.rs b/ethcore/src/engines/clique/mod.rs index 149434d67e2..38a27e58dcc 100644 --- a/ethcore/src/engines/clique/mod.rs +++ b/ethcore/src/engines/clique/mod.rs @@ -713,7 +713,7 @@ impl Engine for Clique { } } - let zero_padding_len = VANITY_LENGTH.checked_sub(header.extra_data().len()).unwrap_or(0); + let zero_padding_len = VANITY_LENGTH.saturating_sub(header.extra_data().len()); if zero_padding_len > 0 { let mut resized_extra_data = header.extra_data().clone(); resized_extra_data.resize(VANITY_LENGTH, 0);