Skip to content

Commit

Permalink
Merge branch 'gm/no-possible-convertion' into gm/internal-error-tree-…
Browse files Browse the repository at this point in the history
…height
  • Loading branch information
whichqua authored Oct 1, 2024
2 parents 048752e + 9a5ff62 commit b5d131d
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 12 deletions.
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ base64 = "0.21.3"
bitvec = { version = "1.0.1", features = ["serde"] }
# Point to the latest commit of branch msl/backport-secp-patches-0.8.0-rc.3
blockifier = { git = "https://github.com/Moonsong-Labs/sequencer", rev = "6624e910c57db9a16f1607c1ed26f7d8f1114e73", features = ["testing"] }
cairo-lang-starknet = { version = "=2.7.1" }
cairo-lang-starknet-classes = { version = "=2.7.1" }
cairo-lang-utils = { version = "=2.7.1" }
cairo-lang-casm = { version = "=2.7.1" }
cairo-lang-starknet = { version = "=2.8.2" }
cairo-lang-starknet-classes = { version = "=2.8.2" }
cairo-lang-utils = { version = "=2.8.2" }
cairo-lang-casm = { version = "=2.8.2" }
cairo-type-derive = { version = "0.1.0", path = "crates/cairo-type-derive" }
cairo-vm = { git = "https://github.com/Moonsong-Labs/cairo-vm", rev = "56b68b50944ecb3123a168218ea7b8b8e23f9be8", features = ["cairo-1-hints", "extensive_hints", "mod_builtin"] }
cairo-vm = { git = "https://github.com/Moonsong-Labs/cairo-vm", branch = "notlesh/segment-arena-relocation-fix", features = ["cairo-1-hints", "extensive_hints", "mod_builtin"] }
clap = { version = "4.5.4", features = ["derive"] }
c-kzg = { version = "1.0.3" }
env_logger = "0.11.3"
Expand Down
1 change: 1 addition & 0 deletions crates/starknet-os-types/src/casm_contract_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub type BlockifierCasmClass = blockifier::execution::contract_class::ContractCl

/// A generic contract class that supports conversion to/from the most commonly used
/// contract class types in Starknet and provides utility methods.
///
/// Operations are implemented as lazily as possible, i.e. we only convert
/// between different types if strictly necessary.
/// Fields are boxed in an RC for cheap cloning.
Expand Down
1 change: 1 addition & 0 deletions crates/starknet-os-types/src/deprecated_compiled_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub type BlockifierDeprecatedClass = blockifier::execution::contract_class::Cont

/// A generic contract class that supports conversion to/from the most commonly used
/// contract class types in Starknet and provides utility methods.
///
/// Operations are implemented as lazily as possible, i.e. we only convert
/// between different types if strictly necessary.
/// Fields are boxed in an RC for cheap cloning.
Expand Down
2 changes: 1 addition & 1 deletion crates/starknet-os-types/src/sierra_contract_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pub type StarknetCoreSierraContractClass = starknet_core::types::FlattenedSierra

/// A generic Sierra contract class that supports conversion to/from the most commonly used
/// contract class types in Starknet and provides utility methods.
///
/// Operations are implemented as lazily as possible, i.e. we only convert
/// between different types if strictly necessary.
/// Fields are boxed in an Arc for cheap cloning.
Expand Down Expand Up @@ -106,7 +107,6 @@ impl GenericSierraContractClass {

#[serde_as]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "no_unknown_fields", serde(deny_unknown_fields))]
pub struct FlattenedSierraClassWithAbi {
/// The list of sierra instructions of which the program consists
pub sierra_program: Vec<Felt>,
Expand Down
6 changes: 3 additions & 3 deletions crates/starknet-os/src/sharp/pie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ fn write_to_zip<W: Write + Seek>(pie: CairoPie, mut zip: ZipWriter<W>) -> Result
let pie_mem_bytes = hex::decode(pie_s[file].to_string().trim_matches('"'))
.map_err(|e| SnOsError::PieZipping(format!("{e}")))?;

zip.start_file(&format!("{file}.bin"), options).map_err(|e| SnOsError::PieZipping(format!("{e}")))?;
zip.start_file(format!("{file}.bin"), options).map_err(|e| SnOsError::PieZipping(format!("{e}")))?;
zip.write_all(&pie_mem_bytes).map_err(|e| SnOsError::PieZipping(format!("{e}")))?;
} else {
zip.start_file(&format!("{file}.json"), options).map_err(|e| SnOsError::PieZipping(format!("{e}")))?;
zip.start_file(format!("{file}.json"), options).map_err(|e| SnOsError::PieZipping(format!("{e}")))?;
zip.write_all(pie_s[file].to_string().as_bytes()).map_err(|e| SnOsError::PieZipping(format!("{e}")))?;
};
}
Expand All @@ -71,7 +71,7 @@ pub fn decode_base64_to_unzipped(pie_str: &str, dst: &str) -> Result<(), SnOsErr
general_purpose::STANDARD.decode(pie_str.as_bytes()).map_err(|e| SnOsError::PieZipping(format!("{e}")))?;
ZipArchive::new(Cursor::new(&buffer))
.unwrap()
.extract(&PathBuf::from(dst))
.extract(PathBuf::from(dst))
.map_err(|e| SnOsError::PieZipping(format!("{e}")))?;
Ok(())
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ where

/// Traverses a tree as follows:
/// 1. Starts by calling get_children_callback(root). This function should return the children of
/// root in the tree that you want to visit.
/// root in the tree that you want to visit.
/// 2. Call get_children_callback() on each of the children to get more nodes, and repeat.
///
/// The order of execution is not guaranteed, except that it is more similar to DFS than BFS in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,10 @@ impl Serializable for BinaryNodeFact {
}
}

#[allow(clippy::too_long_first_doc_paragraph)]
/// A node in a Patricia-Merkle tree that represents the edge to a subtree that contains data
/// with value != 0.
///
/// Represented by three values embedding this information (elaborated below).
/// Note that the bottom_node cannot be an edge node itself (otherwise, they would have both been
/// fused to a bigger edge node).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ impl<'preimage> Iterator for PreimageNodeIterator<'preimage> {
/// The Python implementation returns a generator as follows:
/// * if node is a leaf: [0]
/// * Otherwise: [left, right] where each child is either None if empty or a generator defined
/// recursively.
/// recursively.
///
/// Note that this does not necessarily traverse the entire tree. The caller may open the branches
/// as they wish.
fn preimage_tree(height: Height, preimage: &Preimage, node: Triplet) -> PreimageNodeIterator {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ where

/// Given a node generated by build_update_tree(), returns which update case it belongs to,
/// and both children. This is a utility to make cairo hints shorter.
///
/// Cases: both, if both children are to be updated, and left or right, if only one child is to be
/// updated.
pub fn decode_node<LF>(node: &TreeUpdate<LF>) -> Result<DecodedNode<LF>, TreeError>
Expand Down
1 change: 1 addition & 0 deletions crates/starknet-os/src/storage/composite_storage.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::storage::storage::{Storage, StorageError};

/// A composite storage is a storage object made of one main and one fallback storages.
///
/// It will first attempt to look up the main storage then try the fallback one if it could
/// not find any value in the main storage.
pub struct CompositeStorage<M, F>
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[toolchain]
channel = "nightly-2024-05-02"
channel = "nightly-2024-09-05"
components = ["rustfmt", "clippy"]
profile = "minimal"

0 comments on commit b5d131d

Please sign in to comment.