feature: rewarding for ticketbook issuance (#5112)

* fixed pagination for querying for validators

* wip: decoupling block signing from ticketbook issuance

* added ecash contract query for latest deposit

* parking the branch: wrappers for merkle tree for issued ticketbooks

* make nym-api store merkle trees of issued ticketbooks

* nym-api route for returning all deposits alongside merkle root

* return index alongside deposit id

* persisting merkle index alongside issued ticketbook details

* wip

* responses for issued deposit challenges

* nym-api cleanup

* verification of issued partial ticketbooks

* cleanup of rewarder code

* make the rest of codebase compile

* updated config file

* improved logging

* fixed division by zero if there were no ticketbooks issued in a day

* using correct budget when rewarding operators

* fixed routes for issued data

* fixed ecash test fixture

* fixed incorrect deserialisation of expiration_date param

* additional bugfixes for ticketbook issuance

* more fixes and updated tests

* fixed formatting after rebasing

* updated schema

* fixed edge case unit test
This commit is contained in:
Jędrzej Stuczyński
2024-11-14 16:55:02 +00:00
committed by GitHub
parent bea4eb5cb0
commit a348ff43b0
72 changed files with 3768 additions and 2811 deletions
+8 -3
View File
@@ -5,6 +5,7 @@ use crate::ecash::error::{EcashError, RedemptionError};
use crate::node_status_api::utils::NodeUptimes;
use crate::storage::models::NodeStatus;
use crate::support::caching::cache::UninitialisedCache;
use nym_api_requests::ecash::models::DepositId;
use nym_api_requests::models::{
HistoricalPerformanceResponse, HistoricalUptimeResponse, NodePerformance,
OldHistoricalUptimeResponse, RequestError,
@@ -437,6 +438,9 @@ pub enum NymApiStorageError {
#[error("could not find gateway {identity} in the storage")]
GatewayNotFound { identity: String },
#[error("could not find ticketbooks corresponding to deposits {deposits:?}")]
UnavailableTicketbooks { deposits: Vec<DepositId> },
// I don't think we want to expose errors to the user about what really happened
#[error("experienced internal database error")]
InternalDatabaseError(sqlx::Error),
@@ -460,8 +464,9 @@ impl From<sqlx::Error> for NymApiStorageError {
impl NymApiStorageError {
pub fn database_inconsistency<S: Into<String>>(reason: S) -> NymApiStorageError {
NymApiStorageError::DatabaseInconsistency {
reason: reason.into(),
}
let reason = reason.into();
error!("experienced database inconsistency: {reason}");
NymApiStorageError::DatabaseInconsistency { reason }
}
}