Skip to content

Commit

Permalink
remove proto abci codes
Browse files Browse the repository at this point in the history
  • Loading branch information
noot committed Apr 3, 2024
1 parent 1a55c1a commit ce1fb2f
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 69 deletions.
38 changes: 0 additions & 38 deletions crates/astria-core/src/generated/astria.sequencer.v1.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 1 addition & 19 deletions crates/astria-core/src/sequencer/v1/abci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ use std::{
num::NonZeroU32,
};

use super::raw;

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[allow(clippy::module_name_repetitions)]
pub struct AbciErrorCode(u32);
Expand Down Expand Up @@ -34,23 +32,6 @@ impl AbciErrorCode {
other => format!("unknown non-zero abci error code: {other}").into(),
}
}

/// Converts from the rust representation of the abci error code.
///
/// Note that by convention unknown protobuf enum variants are mapped to
/// the default enum variant with value 0.
#[must_use]
pub fn from_raw(raw: raw::AbciErrorCode) -> Option<Self> {
let code = match raw {
raw::AbciErrorCode::Unspecified => Self::UNSPECIFIED,
raw::AbciErrorCode::UnknownPath => Self::UNKNOWN_PATH,
raw::AbciErrorCode::InvalidParameter => Self::INVALID_PARAMETER,
raw::AbciErrorCode::InternalError => Self::INTERNAL_ERROR,
raw::AbciErrorCode::InvalidNonce => Self::INVALID_NONCE,
raw::AbciErrorCode::TransactionTooLarge => Self::TRANSACTION_TOO_LARGE,
};
Some(code)
}
}

impl std::fmt::Display for AbciErrorCode {
Expand All @@ -73,6 +54,7 @@ impl From<NonZeroU32> for AbciErrorCode {
3 => Self::INTERNAL_ERROR,
4 => Self::INVALID_NONCE,
5 => Self::TRANSACTION_TOO_LARGE,
6 => Self::INSUFFICIENT_FUNDS,
other => Self(other),
}
}
Expand Down
12 changes: 0 additions & 12 deletions proto/sequencerapis/astria/sequencer/v1/abci.proto

This file was deleted.

0 comments on commit ce1fb2f

Please sign in to comment.