From 9cfac8c2ae34fecdefca52001fdd67948e217860 Mon Sep 17 00:00:00 2001 From: Mario Rugiero Date: Tue, 21 Nov 2023 16:18:27 -0300 Subject: [PATCH] Example --- crates/starknet-types-core/src/felt.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/starknet-types-core/src/felt.rs b/crates/starknet-types-core/src/felt.rs index 8b8470d..9b5f59d 100644 --- a/crates/starknet-types-core/src/felt.rs +++ b/crates/starknet-types-core/src/felt.rs @@ -86,7 +86,8 @@ impl Felt { pub fn from_bytes_be_slice(bytes: &[u8]) -> Self { // NB: lambdaworks ignores the remaining bytes when len > 32, so we loop // multiplying by BASE, effectively decomposing in base 2^256 to build - // digits with a length of 32 bytes. + // digits with a length of 32 bytes. This is analogous to splitting the + // number `xyz` as `x * 10^2 + y * 10^1 + z * 10^0`. const BASE: Felt = Self(FieldElement::::const_from_raw( UnsignedInteger::from_limbs([ 576413109808302096, @@ -129,7 +130,8 @@ impl Felt { pub fn from_bytes_le_slice(bytes: &[u8]) -> Self { // NB: lambdaworks ignores the remaining bytes when len > 32, so we loop // multiplying by BASE, effectively decomposing in base 2^256 to build - // digits with a length of 32 bytes. + // digits with a length of 32 bytes. This is analogous to splitting the + // number `xyz` as `x * 10^2 + y * 10^1 + z * 10^0`. const BASE: Felt = Self(FieldElement::::const_from_raw( UnsignedInteger::from_limbs([ 576413109808302096,