Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump cairo-vm #386

Merged
merged 4 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"] }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you bump this branch to cairo-vm latest?
@notlesh

Copy link
Collaborator Author

@notlesh notlesh Sep 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the change here basically does:

  1. undo the previous hack mentioned in the PR description (by not including the commit 56b68b5)
  2. include merge main which pulls in the upstream fix (also mentioned in the PR desc)

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
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 @@ -105,7 +106,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}")))?;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are these changes? @notlesh

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"
Loading