Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
17 changes: 15 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
[package]
name = "starknet-rs"
name = "starknet_in_rust"
version = "0.1.0"
edition = "2021"
description = "A Rust implementation of Starknet execution logic"
license = "Apache-2.0"

[features]
default = ["with_mimalloc"]
Expand All @@ -12,6 +14,8 @@ members = ["crates/starknet-contract-class"]

[workspace.dependencies]
cairo-vm = { version = "0.8.0", features = ["cairo-1-hints"]}


lambda_starknet_api = "0.1.0"

[dependencies]
Expand All @@ -34,7 +38,7 @@ mimalloc = { version = "0.1.29", default-features = false, optional = true }
hex = "0.4.3"
cargo-llvm-cov = "0.5.14"
anyhow = "1.0.66"
starknet-contract-class = { path = "crates/starknet-contract-class" }
starknet-contract-class = "0.1.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't it better to keep a relative path, as it is a crate within the same workspace?. This would make sure all crates are up to date and no breaking changes pop up later

Copy link
Contributor

Choose a reason for hiding this comment

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

This can prevent issues such as this one: #590 (comment). Where code used by another crate was removed without any warning

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I tried to publish it with a relative path and it asked me to change it to a pinned version

Copy link
Contributor

@MegaRedHand MegaRedHand Jun 27, 2023

Choose a reason for hiding this comment

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

In cairo-rs we have both a path and a version specified for the felt package. Maybe that way it works?

once_cell = "1.17.1"

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion bench/internals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use cairo_vm::felt;
use felt::{felt_str, Felt252};
use lazy_static::lazy_static;
use num_traits::Zero;
use starknet_rs::{
use starknet_in_rust::{
core::contract_address::compute_deprecated_class_hash,
definitions::{
block_context::StarknetChainId,
Expand Down
2 changes: 1 addition & 1 deletion cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use cairo_vm::felt::Felt252;
use clap::{Args, Parser, Subcommand};
use num_traits::{Num, Zero};
use serde::{Deserialize, Serialize};
use starknet_rs::{
use starknet_in_rust::{
core::{
contract_address::compute_deprecated_class_hash,
errors::{contract_address_errors::ContractAddressError, state_errors::StateError},
Expand Down
2 changes: 2 additions & 0 deletions crates/starknet-contract-class/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
name = "starknet-contract-class"
version = "0.1.0"
edition = "2021"
description = "Crate that parses a Starknet contract class from API"
license = "Apache-2.0"

[dependencies]
serde = "1.0.156"
Expand Down
2 changes: 1 addition & 1 deletion examples/contract_execution/execute_contract.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![deny(warnings)]

use cairo_vm::felt::Felt252;
use starknet_rs::{
use starknet_in_rust::{
execution::{
execution_entry_point::ExecutionEntryPoint,
objects::{CallInfo, CallType, TransactionExecutionContext},
Expand Down
2 changes: 1 addition & 1 deletion examples/contract_execution/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//! running some pre-compiled contracts is as expected.

use cairo_vm::felt::Felt252;
use starknet_rs::{
use starknet_in_rust::{
services::api::contract_classes::deprecated_contract_class::ContractClass,
testing::state::StarknetState,
utils::{calculate_sn_keccak, Address},
Expand Down
2 changes: 1 addition & 1 deletion fuzzer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use cairo_vm::felt::Felt252;
use cairo_vm::vm::runners::cairo_runner::ExecutionResources;
use num_traits::Zero;
use starknet_contract_class::EntryPointType;
use starknet_rs::{
use starknet_in_rust::{
definitions::{block_context::BlockContext, constants::TRANSACTION_VERSION},
execution::{
execution_entry_point::ExecutionEntryPoint, CallInfo, CallType, TransactionExecutionContext,
Expand Down
2 changes: 1 addition & 1 deletion src/bin/deploy.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::path::PathBuf;

use lazy_static::lazy_static;
use starknet_rs::{
use starknet_in_rust::{
services::api::contract_classes::deprecated_contract_class::ContractClass,
testing::state::StarknetState,
};
Expand Down
2 changes: 1 addition & 1 deletion src/bin/deploy_invoke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::path::PathBuf;
use cairo_vm::felt::{felt_str, Felt252};
use num_traits::Zero;

use starknet_rs::{
use starknet_in_rust::{
services::api::contract_classes::deprecated_contract_class::ContractClass,
testing::state::StarknetState, utils::Address,
};
Expand Down
2 changes: 1 addition & 1 deletion src/bin/fibonacci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use cairo_vm::felt::{felt_str, Felt252};
use num_traits::Zero;

use lazy_static::lazy_static;
use starknet_rs::{
use starknet_in_rust::{
services::api::contract_classes::deprecated_contract_class::ContractClass,
state::cached_state::CachedState, state::in_memory_state_reader::InMemoryStateReader,
testing::state::StarknetState, utils::Address,
Expand Down
2 changes: 1 addition & 1 deletion src/bin/invoke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{collections::HashMap, path::PathBuf};
use cairo_vm::felt::{felt_str, Felt252};
use num_traits::Zero;

use starknet_rs::{
use starknet_in_rust::{
services::api::contract_classes::deprecated_contract_class::ContractClass,
state::cached_state::CachedState, state::in_memory_state_reader::InMemoryStateReader,
testing::state::StarknetState, utils::Address,
Expand Down
2 changes: 1 addition & 1 deletion src/bin/invoke_with_cachedstate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{collections::HashMap, path::PathBuf};
use cairo_vm::felt::{felt_str, Felt252};
use num_traits::Zero;

use starknet_rs::{
use starknet_in_rust::{
definitions::{
block_context::{BlockContext, StarknetChainId, StarknetOsConfig},
constants::TRANSACTION_VERSION,
Expand Down
2 changes: 1 addition & 1 deletion tests/cairo_1_syscalls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use cairo_vm::{
use num_bigint::BigUint;
use num_traits::{Num, One, Zero};
use starknet_contract_class::EntryPointType;
use starknet_rs::{
use starknet_in_rust::{
definitions::{block_context::BlockContext, constants::TRANSACTION_VERSION},
execution::{
execution_entry_point::ExecutionEntryPoint, CallInfo, CallType, L2toL1MessageInfo,
Expand Down
4 changes: 2 additions & 2 deletions tests/complex_contracts/amm_contracts/amm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use cairo_vm::vm::runners::cairo_runner::ExecutionResources;
use cairo_vm::{felt::Felt252, vm::runners::builtin_runner::RANGE_CHECK_BUILTIN_NAME};
use num_traits::Zero;
use starknet_contract_class::EntryPointType;
use starknet_rs::definitions::block_context::BlockContext;
use starknet_rs::{
use starknet_in_rust::definitions::block_context::BlockContext;
use starknet_in_rust::{
execution::{CallInfo, CallType},
services::api::contract_classes::deprecated_contract_class::ContractClass,
state::{cached_state::CachedState, state_api::StateReader},
Expand Down
6 changes: 3 additions & 3 deletions tests/complex_contracts/amm_contracts/amm_proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use cairo_vm::felt::Felt252;
use cairo_vm::vm::runners::cairo_runner::ExecutionResources;
use starknet_contract_class::EntryPointType;
use starknet_crypto::FieldElement;
use starknet_rs::definitions::block_context::BlockContext;
use starknet_rs::services::api::contract_classes::deprecated_contract_class::ContractClass;
use starknet_rs::{
use starknet_in_rust::definitions::block_context::BlockContext;
use starknet_in_rust::services::api::contract_classes::deprecated_contract_class::ContractClass;
use starknet_in_rust::{
execution::{CallInfo, CallType},
state::{cached_state::CachedState, state_api::StateReader},
state::{in_memory_state_reader::InMemoryStateReader, ExecutionResourcesManager},
Expand Down
10 changes: 5 additions & 5 deletions tests/complex_contracts/nft/erc721.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ use cairo_vm::vm::runners::cairo_runner::ExecutionResources;
use num_traits::Zero;
use starknet_contract_class::EntryPointType;
use starknet_crypto::FieldElement;
use starknet_rs::definitions::block_context::BlockContext;
use starknet_rs::services::api::contract_classes::deprecated_contract_class::ContractClass;
use starknet_rs::state::cached_state::CachedState;
use starknet_rs::transaction::error::TransactionError;
use starknet_rs::{
use starknet_in_rust::definitions::block_context::BlockContext;
use starknet_in_rust::services::api::contract_classes::deprecated_contract_class::ContractClass;
use starknet_in_rust::state::cached_state::CachedState;
use starknet_in_rust::transaction::error::TransactionError;
use starknet_in_rust::{
execution::{CallInfo, CallType, OrderedEvent},
state::state_api::StateReader,
state::{in_memory_state_reader::InMemoryStateReader, ExecutionResourcesManager},
Expand Down
2 changes: 1 addition & 1 deletion tests/complex_contracts/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use cairo_vm::felt::Felt252;
use num_traits::Zero;
use starknet_contract_class::{ContractEntryPoint, EntryPointType};
use starknet_crypto::{pedersen_hash, FieldElement};
use starknet_rs::{
use starknet_in_rust::{
definitions::{
block_context::{BlockContext, StarknetChainId},
constants::TRANSACTION_VERSION,
Expand Down
2 changes: 1 addition & 1 deletion tests/delegate_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mod cairo_1_syscalls;
use cairo_vm::felt::Felt252;
use num_traits::{One, Zero};
use starknet_contract_class::EntryPointType;
use starknet_rs::{
use starknet_in_rust::{
definitions::{block_context::BlockContext, constants::TRANSACTION_VERSION},
execution::{
execution_entry_point::ExecutionEntryPoint, CallType, TransactionExecutionContext,
Expand Down
2 changes: 1 addition & 1 deletion tests/delegate_l1_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mod cairo_1_syscalls;
use cairo_vm::felt::{felt_str, Felt252};
use num_traits::{One, Zero};
use starknet_contract_class::EntryPointType;
use starknet_rs::{
use starknet_in_rust::{
definitions::{block_context::BlockContext, constants::TRANSACTION_VERSION},
execution::{
execution_entry_point::ExecutionEntryPoint, CallType, TransactionExecutionContext,
Expand Down
2 changes: 1 addition & 1 deletion tests/deploy_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use cairo_vm::{
use lazy_static::lazy_static;
use num_traits::Zero;
use starknet_contract_class::EntryPointType;
use starknet_rs::{
use starknet_in_rust::{
core::contract_address::compute_deprecated_class_hash,
definitions::{
block_context::StarknetChainId, constants::CONSTRUCTOR_ENTRY_POINT_SELECTOR,
Expand Down
4 changes: 2 additions & 2 deletions tests/fibonacci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use cairo_vm::vm::runners::cairo_runner::ExecutionResources;
use cairo_vm::{felt::Felt252, vm::runners::builtin_runner::RANGE_CHECK_BUILTIN_NAME};
use num_traits::Zero;
use starknet_contract_class::EntryPointType;
use starknet_rs::definitions::block_context::BlockContext;
use starknet_rs::{
use starknet_in_rust::definitions::block_context::BlockContext;
use starknet_in_rust::{
definitions::constants::TRANSACTION_VERSION,
execution::{
execution_entry_point::ExecutionEntryPoint, CallInfo, CallType, TransactionExecutionContext,
Expand Down
2 changes: 1 addition & 1 deletion tests/increase_balance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use cairo_vm::felt::Felt252;
use cairo_vm::vm::runners::cairo_runner::ExecutionResources;
use num_traits::Zero;
use starknet_contract_class::EntryPointType;
use starknet_rs::{
use starknet_in_rust::{
definitions::{block_context::BlockContext, constants::TRANSACTION_VERSION},
execution::{
execution_entry_point::ExecutionEntryPoint, CallInfo, CallType, TransactionExecutionContext,
Expand Down
2 changes: 1 addition & 1 deletion tests/internal_calls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use cairo_vm::felt::Felt252;
use num_traits::Zero;
use starknet_contract_class::EntryPointType;
use starknet_rs::{
use starknet_in_rust::{
definitions::{block_context::BlockContext, constants::TRANSACTION_VERSION},
execution::{
execution_entry_point::ExecutionEntryPoint, CallType, TransactionExecutionContext,
Expand Down
18 changes: 9 additions & 9 deletions tests/internals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ use lazy_static::lazy_static;
use num_bigint::BigUint;
use num_traits::{Num, One, ToPrimitive, Zero};
use starknet_contract_class::EntryPointType;
use starknet_rs::core::errors::state_errors::StateError;
use starknet_rs::definitions::constants::{
use starknet_in_rust::core::errors::state_errors::StateError;
use starknet_in_rust::definitions::constants::{
DEFAULT_CAIRO_RESOURCE_FEE_WEIGHTS, VALIDATE_ENTRY_POINT_SELECTOR,
};
use starknet_rs::execution::execution_entry_point::ExecutionEntryPoint;
use starknet_rs::execution::TransactionExecutionContext;
use starknet_rs::services::api::contract_classes::deprecated_contract_class::ContractClass;
use starknet_rs::state::ExecutionResourcesManager;
use starknet_rs::transaction::{DeclareV2, Deploy};
use starknet_rs::CasmContractClass;
use starknet_rs::{
use starknet_in_rust::execution::execution_entry_point::ExecutionEntryPoint;
use starknet_in_rust::execution::TransactionExecutionContext;
use starknet_in_rust::services::api::contract_classes::deprecated_contract_class::ContractClass;
use starknet_in_rust::state::ExecutionResourcesManager;
use starknet_in_rust::transaction::{DeclareV2, Deploy};
use starknet_in_rust::CasmContractClass;
use starknet_in_rust::{
definitions::{
block_context::{BlockContext, StarknetChainId, StarknetOsConfig},
constants::{
Expand Down
2 changes: 1 addition & 1 deletion tests/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use cairo_vm::felt::Felt252;
use cairo_vm::vm::runners::cairo_runner::ExecutionResources;
use num_traits::Zero;
use starknet_contract_class::EntryPointType;
use starknet_rs::{
use starknet_in_rust::{
definitions::{block_context::BlockContext, constants::TRANSACTION_VERSION},
execution::{
execution_entry_point::ExecutionEntryPoint, CallInfo, CallType, TransactionExecutionContext,
Expand Down
2 changes: 1 addition & 1 deletion tests/syscalls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use cairo_vm::{
};
use num_traits::{Num, One, Zero};
use starknet_contract_class::EntryPointType;
use starknet_rs::{
use starknet_in_rust::{
definitions::{
block_context::{BlockContext, StarknetChainId},
constants::{CONSTRUCTOR_ENTRY_POINT_SELECTOR, TRANSACTION_VERSION},
Expand Down
2 changes: 1 addition & 1 deletion tests/syscalls_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use cairo_vm::felt::Felt252;
use starknet_contract_class::EntryPointType;
use starknet_rs::{
use starknet_in_rust::{
core::errors::state_errors::StateError,
definitions::{block_context::BlockContext, constants::TRANSACTION_VERSION},
execution::{
Expand Down