refactor: update repo to be compatible with Winterfell 0.8 (#275)

This commit is contained in:
Andrey Khmuro
2024-02-14 21:30:35 +02:00
committed by Bobbin Threadbare
parent 552d90429b
commit cd4525c7ad
15 changed files with 49 additions and 56 deletions

View File

@@ -4,7 +4,7 @@ use super::{
};
#[cfg(feature = "std")]
use super::{ffi, NonceBytes, StarkField, NONCE_LEN, PK_LEN, SIG_LEN, SK_LEN};
use super::{ffi, NonceBytes, NONCE_LEN, PK_LEN, SIG_LEN, SK_LEN};
// PUBLIC KEY
// ================================================================================================

View File

@@ -4,7 +4,7 @@ use crate::{
collections::Vec, ByteReader, ByteWriter, Deserializable, DeserializationError,
Serializable,
},
Felt, StarkField, Word, ZERO,
Felt, Word, ZERO,
};
#[cfg(feature = "std")]

View File

@@ -1,6 +1,6 @@
use super::{
ByteReader, ByteWriter, Deserializable, DeserializationError, NonceBytes, NonceElements,
Polynomial, PublicKeyBytes, Rpo256, Serializable, SignatureBytes, StarkField, Word, MODULUS, N,
ByteReader, ByteWriter, Deserializable, DeserializationError, Felt, NonceBytes, NonceElements,
Polynomial, PublicKeyBytes, Rpo256, Serializable, SignatureBytes, Word, MODULUS, N,
SIG_L2_BOUND, ZERO,
};
use crate::utils::string::ToString;
@@ -182,7 +182,9 @@ fn decode_nonce(nonce: &NonceBytes) -> NonceElements {
let mut result = [ZERO; 8];
for (i, bytes) in nonce.chunks(5).enumerate() {
buffer[..5].copy_from_slice(bytes);
result[i] = u64::from_le_bytes(buffer).into();
// we can safely (without overflow) create a new Felt from u64 value here since this value
// contains at most 5 bytes
result[i] = Felt::new(u64::from_le_bytes(buffer));
}
result