Skip to content
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

Refactor ByzantineAuthoritySuspicion to carry witness of misbehavior #301

Open
huitseeker opened this issue Jan 29, 2022 · 0 comments
Open
Labels
Milestone

Comments

@huitseeker
Copy link
Contributor

The ByzantineAuthoritySuspicion error, for now, does not embed enough data to log or carry proof of misbehavior at the point it's raised. As such, its utility is limited. This issue aims to refactor this error variant to embed a large range of possible errors. Some hints in discussion:

#[derive(Debug, thiserror::Error)]
pub enum FastPayError {
    ....
    #[error("A terrible error showed byzantine behavior {0}")]
    ByzantineError(#[from] EmbeddedError),
}

impl From<FooError> for FastPayError {
    fn from(error: FooError) -> Self {
        Self::ByzantineError(EmbeddedError(error.into()))
    }
}

impl From<BarError> for FastPayError {
    fn from(error: BarError) -> Self {
        Self::ByzantineError(EmbeddedError(error.into()))
    }
}

...

/// An error that occured when checking for correct behavior
#[derive(Debug, thiserror::Error)]
#[error(transparent)]
pub struct EmbeddedError(
    Box<dyn std::error::Error + Send + Sync>,
);

This should cover it for a start, then there's Hash + Eq + Serialize + Deserialize

Originally posted by @huitseeker in #285 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants