Skip to content

Commit 6293f33

Browse files
committed
ledger/account: use from_le_bytes_mod_order instead of FromBytes
1 parent ae49cad commit 6293f33

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

ledger/src/account/account.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,12 @@ impl TokenSymbol {
121121
}
122122

123123
pub fn to_field<F: FieldWitness>(&self) -> F {
124-
use ark_ff::FromBytes;
125-
126124
let mut s = <[u8; 32]>::default();
127125
self.to_bytes(&mut s);
128126

129-
let value = FromBytes::read(&s[..]).expect("Shoudn't fail");
130-
let bigint = BigInteger256::new(value);
131-
F::from(bigint) // Never fail, `self` contain 6 bytes at most
127+
// There is an assumption that a token symbol is on 6 bytes, therefore
128+
// it will be smaller than the order
129+
F::from_le_bytes_mod_order(&s)
132130
}
133131
}
134132

0 commit comments

Comments
 (0)