Skip to content

Commit bd905a0

Browse files
perf: replace Symbol::new() with symbol_short!() in history_snapshot.rs (#25)
Closes #15 - Replace runtime Symbol::new(env, "viol") with symbol_short!("viol") - Replace runtime Symbol::new(env, "rew") with symbol_short!("rew") - Drop unused Symbol import, add symbol_short! import - Compile-time validation catches string typos; eliminates runtime allocation
1 parent 399ce08 commit bd905a0

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

apexchainx_calculator/src/history_snapshot.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
//! The normalization is deterministic: identical history inputs always produce
1717
//! identical snapshot outputs.
1818
19-
use soroban_sdk::{Vec, Symbol};
19+
use soroban_sdk::{symbol_short, Vec};
2020
use crate::SLAResult;
2121

2222
/// Summarised view of SLA calculation history.
@@ -42,10 +42,10 @@ pub fn normalize_history(history: &Vec<SLAResult>) -> NormalizedSnapshot {
4242

4343
for i in 0..history.len() {
4444
let entry = history.get(i).unwrap();
45-
if entry.status == Symbol::new(history.env(), "viol") {
45+
if entry.status == symbol_short!("viol") {
4646
has_violations = true;
4747
}
48-
if entry.payment_type == Symbol::new(history.env(), "rew") {
48+
if entry.payment_type == symbol_short!("rew") {
4949
has_rewards = true;
5050
}
5151
}

0 commit comments

Comments
 (0)