Skip to content

feat: ser/deser BuilderPermissionError, improve error msgs #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/perms/builders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@ use crate::{
from_env::{FromEnv, FromEnvErr, FromEnvVar},
},
};
use serde::{Deserialize, Deserializer};
use serde::{Deserialize, Deserializer, Serialize};

fn now() -> u64 {
chrono::Utc::now().timestamp().try_into().unwrap()
}

/// Possible errors when permissioning a builder.
#[derive(Debug, thiserror::Error, Clone, Copy, PartialEq, Eq)]
#[derive(Debug, thiserror::Error, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum BuilderPermissionError {
/// Action attempt too early.
#[error("action attempt too early")]
/// Permission requested too early in the block slot.
#[error("permission requested too early in slot")]
ActionAttemptTooEarly,

/// Action attempt too late.
#[error("action attempt too late")]
/// Permission requested too late in the block slot.
#[error("permission requested too late in slot")]
ActionAttemptTooLate,

/// Builder not permissioned for this slot.
Expand Down