From 261f6f8ac0c33fcfffcdfeb632a74076c720b8ad Mon Sep 17 00:00:00 2001 From: Philippe Camacho Date: Wed, 29 Jun 2022 18:34:03 -0400 Subject: [PATCH 1/2] Check if storage is working when returning the response to a faucet healthcheck request. --- contracts/rust/src/bin/gen-vk-libraries.rs | 2 +- faucet/src/faucet.rs | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/contracts/rust/src/bin/gen-vk-libraries.rs b/contracts/rust/src/bin/gen-vk-libraries.rs index d12ca7c3..f6c5f37d 100644 --- a/contracts/rust/src/bin/gen-vk-libraries.rs +++ b/contracts/rust/src/bin/gen-vk-libraries.rs @@ -18,7 +18,7 @@ use std::{fs::OpenOptions, io::prelude::*, path::PathBuf}; // depth of the record merkle tree const TREE_DEPTH: u8 = 24; -// list of supported tranaction types, each would result in a different verifying key +// list of supported transaction types, each would result in a different verifying key const SUPPORTED_VKS: [(NoteType, u8, u8, u8); 7] = [ (NoteType::Transfer, 1, 2, TREE_DEPTH), (NoteType::Transfer, 2, 2, TREE_DEPTH), diff --git a/faucet/src/faucet.rs b/faucet/src/faucet.rs index 9609a365..203a5932 100644 --- a/faucet/src/faucet.rs +++ b/faucet/src/faucet.rs @@ -478,6 +478,13 @@ pub struct HealthCheck { /// normally, a response with status 503 and payload {"status": /// "unavailable"} should be added. async fn healthcheck(req: tide::Request) -> Result { + // Ensure we can write to storage. + let mut index = req.state().queue.index.lock().await; + let default_user_pub_key = UserPubKey::default(); + index.insert(default_user_pub_key.clone())?; + index.remove(&default_user_pub_key)?; + + // Return healthcheck response response( &req, &HealthCheck { From 5b62743c00d27e0cf92e0bafafebb9ab58ab6a4d Mon Sep 17 00:00:00 2001 From: Philippe Camacho Date: Thu, 30 Jun 2022 12:35:52 -0400 Subject: [PATCH 2/2] Log errors in Faucet healthcheck. --- faucet/src/faucet.rs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/faucet/src/faucet.rs b/faucet/src/faucet.rs index 203a5932..74f7a740 100644 --- a/faucet/src/faucet.rs +++ b/faucet/src/faucet.rs @@ -481,8 +481,23 @@ async fn healthcheck(req: tide::Request) -> Result