From d401633100254d8f9503a34f301c75576dc68ef7 Mon Sep 17 00:00:00 2001 From: Jimmy Chen Date: Tue, 8 Aug 2023 17:25:29 +1000 Subject: [PATCH] Add same error handling for blob signing when pubkey is missing --- validator_client/src/block_service.rs | 31 +++++++++++++++++++++------ 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/validator_client/src/block_service.rs b/validator_client/src/block_service.rs index ae08a22d5..e59838991 100644 --- a/validator_client/src/block_service.rs +++ b/validator_client/src/block_service.rs @@ -522,16 +522,33 @@ impl BlockService { }; let maybe_signed_blobs = match maybe_blob_sidecars { - Some(blob_sidecars) => Some( - // TODO(jimmy): add same error handling as block signing, i.e. handle ValidatorStoreError::UnknownPubkey - self_ref + Some(blob_sidecars) => { + match self_ref .validator_store .sign_blobs(*validator_pubkey_ref, blob_sidecars) .await - .map_err(|e| { - BlockError::Recoverable(format!("Unable to sign blob: {:?}", e)) - })?, - ), + { + Ok(signed_blobs) => Some(signed_blobs), + Err(ValidatorStoreError::UnknownPubkey(pubkey)) => { + // A pubkey can be missing when a validator was recently removed + // via the API. + warn!( + log, + "Missing pubkey for blobs"; + "info" => "a validator may have recently been removed from this VC", + "pubkey" => ?pubkey, + "slot" => ?slot + ); + return Ok(()); + } + Err(e) => { + return Err(BlockError::Recoverable(format!( + "Unable to sign blobs: {:?}", + e + ))) + } + } + } None => None, }; let signing_time_ms =