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

feat: add name method to builtin enum #288

Merged
merged 1 commit into from
Jul 1, 2024
Merged
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
24 changes: 24 additions & 0 deletions src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -944,3 +944,27 @@ pub enum Builtin {
#[serde(rename = "segment_arena_builtin")]
SegmentArena,
}

const RANGE_CHACK_BUILTIN_NAME: &str = "range_check";
const PEDERSEN_BUILTIN_NAME: &str = "pedersen";
const POSEIDON_BUILTIN_NAME: &str = "poseidon";
const EC_OP_BUILTIN_NAME: &str = "ec_op";
const ECDSA_BUILTIN_NAME: &str = "ecdsa";
const BITWISE_BUILTIN_NAME: &str = "bitwise";
const KECCAK_BUILTIN_NAME: &str = "keccak";
const SEGMENT_ARENA_BUILTIN_NAME: &str = "segment_arena";

impl Builtin {
pub fn name(&self) -> &'static str {
match self {
Builtin::RangeCheck => RANGE_CHACK_BUILTIN_NAME,
Builtin::Pedersen => PEDERSEN_BUILTIN_NAME,
Builtin::Poseidon => POSEIDON_BUILTIN_NAME,
Builtin::EcOp => EC_OP_BUILTIN_NAME,
Builtin::Ecdsa => ECDSA_BUILTIN_NAME,
Builtin::Bitwise => BITWISE_BUILTIN_NAME,
Builtin::Keccak => KECCAK_BUILTIN_NAME,
Builtin::SegmentArena => SEGMENT_ARENA_BUILTIN_NAME,
}
}
}