Skip to content
Open
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
382 changes: 218 additions & 164 deletions Cargo.lock

Large diffs are not rendered by default.

47 changes: 20 additions & 27 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ katana-trie = { path = "crates/trie" }
katana-utils = { path = "crates/utils" }

# cairo-lang
cairo-lang-casm = "=2.12.0-dev.1"
cairo-lang-runner = "=2.12.0-dev.1"
cairo-lang-sierra = "=2.12.0-dev.1"
cairo-lang-sierra-to-casm = "=2.12.0-dev.1"
cairo-lang-starknet = "=2.12.0-dev.1"
cairo-lang-starknet-classes = "=2.12.0-dev.1"
cairo-lang-utils = "=2.12.0-dev.1"
cairo-lang-casm = "2.12.3"
cairo-lang-runner = "2.12.3"
cairo-lang-sierra = "2.12.3"
cairo-lang-sierra-to-casm = "2.12.3"
cairo-lang-starknet = "2.12.3"
cairo-lang-starknet-classes = "2.12.3"
cairo-lang-utils = "2.12.3"

anyhow = "1.0.89"
arbitrary = { version = "1.3.2", features = [ "derive" ] }
Expand Down Expand Up @@ -154,7 +154,7 @@ slot = { git = "https://github.com/cartridge-gg/slot", rev = "1298a30" }
spinoff = "0.8.0"
strum = "0.25"
strum_macros = "0.25"
tempfile = "3.9.0"
tempfile = "3.20.0"
thiserror = "1.0.32"
tokio = { version = "1.39.2", features = [ "full" ] }
tokio-util = "0.7.12"
Expand Down Expand Up @@ -215,25 +215,18 @@ opentelemetry-http = "0.30.0"
opentelemetry-stackdriver = { version = "0.27.0", features = [ "propagator" ] }

# starknet
starknet = "0.17.0-rc.2"
starknet-crypto = "0.7.4"
starknet-types-core = { version = "0.1.8", features = [ "arbitrary", "hash" ] }
starknet = "0.17.0"
starknet-crypto = "0.8.1"
starknet-types-core = { version = "=0.2.0", features = [ "arbitrary", "hash" ] }

blockifier = { git = "https://github.com/dojoengine/sequencer", branch = "blockifier/v0.15.0-rc.2", default-features = false }
cairo-native = "0.5.0-rc.6"
starknet_api = { git = "https://github.com/dojoengine/sequencer", branch = "blockifier/v0.15.0-rc.2" }
blockifier = { git = "https://github.com/dojoengine/sequencer", branch = "blockifier/v0.16.0-rc.0", default-features = false }
cairo-native = "0.6.2"
starknet_api = { git = "https://github.com/dojoengine/sequencer", branch = "blockifier/v0.16.0-rc.0" }
# Some types that we used from cairo-vm implements the `Arbitrary` trait,
# only under the `test_utils` feature.
cairo-vm = { version = "=2.3.1", features = [ "test_utils" ] }

cainome = { git = "https://github.com/cartridge-gg/cainome", rev = "7d60de1", features = [ "abigen-rs" ] }
cainome-cairo-serde = { git = "https://github.com/cartridge-gg/cainome", rev = "7d60de1" }
piltover = { git = "https://github.com/kariy/piltover.git", rev = "a908ce2" }

[patch.crates-io]
starknet = { git = "https://github.com/kariy/starknet-rs", rev = "2ef3088" }
# NOTE: remove this patch once this PR is merged <https://github.com/starknet-io/types-rs/pull/132>
#
# This patch fixes an issue where we're unable to correctly evaluate the accurate size
# for constructing `Felt` from unstructured data (Arbitrary).
starknet-types-core = { git = "https://github.com/kariy/types-rs", rev = "0f6ae31" }
cairo-vm = { version = "2.5.0", features = [ "test_utils" ] }

cainome = { version = "0.10.0", features = [ "abigen-rs" ] }
cainome-cairo-serde = { version = "0.4.0" }
# <https://github.com/cartridge-gg/piltover/tree/starknet-types-0.2.0>
piltover = { git = "https://github.com/cartridge-gg/piltover.git", rev = "1dcb9fa4aaf22a23353c9233341ef373d7664929" }
8 changes: 4 additions & 4 deletions bin/katana/src/cli/db/prune.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ fn prune_database(db_path: &str, mode: PruneMode) -> Result<()> {

if blocks > latest_block {
eprintln!(
"Warning: Requested to keep {} blocks, but only {} blocks exist",
blocks, latest_block
"Warning: Requested to keep {blocks} blocks, but only {latest_block} blocks \
exist"
);
return Ok(());
}
Expand All @@ -122,7 +122,7 @@ fn prune_database(db_path: &str, mode: PruneMode) -> Result<()> {
}

prune_keep_last_n(&tx, cutoff_block)?;
println!("Pruned historical data for blocks 0 to {}", cutoff_block);
println!("Pruned historical data for blocks 0 to {cutoff_block}");
}
}

Expand Down Expand Up @@ -455,7 +455,7 @@ fn show_confirmation_prompt(stats: &PruningStats, mode: &PruneMode) -> Result<bo
println!("- Action: Remove ALL historical data, keeping only the latest state");
}
PruneMode::KeepLastN { blocks } => {
println!("- Action: Keep only the last {} blocks of historical data", blocks);
println!("- Action: Keep only the last {blocks} blocks of historical data");
}
}

Expand Down
1 change: 1 addition & 0 deletions bin/katana/src/cli/init/deployment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ pub async fn deploy_settlement_contract(
sp.update_text("Deploying contract...");

let salt = Felt::from(rand::random::<u64>());
#[allow(deprecated)]
let factory = ContractFactory::new(class_hash, &account);

const INITIAL_STATE_ROOT: Felt = Felt::ZERO;
Expand Down
4 changes: 2 additions & 2 deletions bin/katana/src/cli/init/prompt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ fn prompt_slot_paymasters() -> Result<Option<Vec<slot::PaymasterAccountArgs>>> {

// Prompt for slot paymaster accounts
while Confirm::new("Add Slot paymaster account?").with_default(true).prompt()? {
let pubkey_prompt_text = format!("Paymaster #{} public key", paymaster_count);
let pubkey_prompt_text = format!("Paymaster #{paymaster_count} public key");
let public_key = CustomType::<Felt>::new(&pubkey_prompt_text)
.with_formatter(&|input: Felt| format!("{input:#x}"))
.prompt()?;
Expand All @@ -222,7 +222,7 @@ fn prompt_slot_paymasters() -> Result<Option<Vec<slot::PaymasterAccountArgs>>> {
}
};

let salt_prompt_text = format!("Paymaster #{} salt", paymaster_count);
let salt_prompt_text = format!("Paymaster #{paymaster_count} salt");
let salt = CustomType::<Felt>::new(&salt_prompt_text)
.with_formatter(&|input: Felt| format!("{input:#x}"))
.with_validator(unique_salt_validator)
Expand Down
2 changes: 1 addition & 1 deletion bin/katana/src/cli/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub fn generate_long() -> String {
writeln!(out, "{}", generate_short()).unwrap();
writeln!(out).unwrap();
writeln!(out, "features: {}", features().join(",")).unwrap();
write!(out, "built on: {}", VERGEN_BUILD_TIMESTAMP).unwrap();
write!(out, "built on: {VERGEN_BUILD_TIMESTAMP}").unwrap();
out
}

Expand Down
6 changes: 3 additions & 3 deletions crates/cartridge/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ fn main() {
let struct_name = filename_to_struct_name(&file_name);

generated_code.push_str(&format!(
"::katana_contracts::contract!(\n {},\n \
\"{{CARGO_MANIFEST_DIR}}/controller/account_sdk/artifacts/classes/{}.json\"\n);\n",
struct_name, file_name
"::katana_contracts::contract!(\n {struct_name},\n \
\"{{CARGO_MANIFEST_DIR}}/controller/account_sdk/artifacts/classes/{file_name}.\
json\"\n);\n"
));
}
}
Expand Down
5 changes: 2 additions & 3 deletions crates/cli/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,8 @@ PREDEPLOYED CONTRACTS
println!(
r"
| Contract | Universal Deployer
| Address | {}
| Class Hash | {:#064x}",
DEFAULT_UDC_ADDRESS, DEFAULT_LEGACY_UDC_CLASS_HASH
| Address | {DEFAULT_UDC_ADDRESS}
| Class Hash | {DEFAULT_LEGACY_UDC_CLASS_HASH:#064x}"
);

if let Some(hash) = account_class_hash {
Expand Down
7 changes: 3 additions & 4 deletions crates/contracts/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,19 @@ fn main() {

panic!(
"Contract compilation build script failed. Below are the last 50 lines of `scarb \
build` output:\n\n{}",
last_n_lines
build` output:\n\n{last_n_lines}"
);
}

// Create build directory if it doesn't exist
if let Err(e) = fs::create_dir_all(build_dir) {
panic!("Failed to create build directory: {}", e);
panic!("Failed to create build directory: {e}");
}

// Copy artifacts from target/dev to build directory
if target_dir.exists() {
if let Err(e) = copy_dir_contents(&target_dir, build_dir) {
panic!("Failed to copy contract artifacts: {}", e);
panic!("Failed to copy contract artifacts: {e}");
}
println!("cargo:warning=Contract artifacts copied to build directory");
} else {
Expand Down
6 changes: 3 additions & 3 deletions crates/contracts/macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,14 @@ fn generate_contract_impl(input: &ContractInput) -> Result<proc_macro2::TokenStr

// Compute class hash
let class_hash =
contract_class.class_hash().map_err(|e| format!("failed to compute class hash: {}", e))?;
contract_class.class_hash().map_err(|e| format!("failed to compute class hash: {e}"))?;

// Compile and compute compiled class hash
let compiled_class =
contract_class.compile().map_err(|e| format!("failed to compile contract class: {}", e))?;
contract_class.compile().map_err(|e| format!("failed to compile contract class: {e}"))?;

let compiled_class_hash =
compiled_class.class_hash().map_err(|e| format!("failed to compute casm hash: {}", e))?;
compiled_class.class_hash().map_err(|e| format!("failed to compute casm hash: {e}"))?;

// Convert Felt values to string representation for const generation
let class_hash_str = format!("{class_hash:#x}",);
Expand Down
18 changes: 18 additions & 0 deletions crates/executor/src/implementation/blockifier/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ impl From<EntryPointExecutionError> for ExecutionError {
}
}

impl From<Box<EntryPointExecutionError>> for ExecutionError {
fn from(error: Box<EntryPointExecutionError>) -> Self {
Self::from(*error)
}
}

impl From<PreExecutionError> for ExecutionError {
fn from(error: PreExecutionError) -> Self {
match error {
Expand Down Expand Up @@ -77,6 +83,12 @@ impl From<TransactionPreValidationError> for ExecutionError {
}
}

impl From<Box<TransactionPreValidationError>> for ExecutionError {
fn from(error: Box<TransactionPreValidationError>) -> Self {
Self::from(*error)
}
}

impl From<TransactionFeeError> for ExecutionError {
fn from(error: TransactionFeeError) -> Self {
match error {
Expand All @@ -92,6 +104,12 @@ impl From<TransactionFeeError> for ExecutionError {
}
}

impl From<Box<TransactionFeeError>> for ExecutionError {
fn from(error: Box<TransactionFeeError>) -> Self {
Self::from(*error)
}
}

impl From<StateError> for ExecutionError {
fn from(error: StateError) -> Self {
match error {
Expand Down
1 change: 1 addition & 0 deletions crates/executor/src/implementation/blockifier/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ impl<'a> StarknetVMProcessor<'a> {
let bouncer = Bouncer::new(BouncerConfig {
block_max_capacity,
builtin_weights: BuiltinWeights::default(),
..Default::default()
});

Self {
Expand Down
7 changes: 6 additions & 1 deletion crates/executor/src/implementation/blockifier/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ pub fn transact<S: StateReader>(
&tx_state,
&tx_state_changes_keys,
&info.summarize(versioned_constants),
&info.summarize_builtins(),
&info.receipt.resources,
versioned_constants,
)?;
Expand Down Expand Up @@ -472,7 +473,11 @@ pub fn block_context_from_envs(block_env: &BlockEnv, cfg_env: &CfgEnv) -> BlockC
use_kzg_da: false,
};

let chain_info = ChainInfo { fee_token_addresses, chain_id: to_blk_chain_id(cfg_env.chain_id) };
let chain_info = ChainInfo {
fee_token_addresses,
chain_id: to_blk_chain_id(cfg_env.chain_id),
is_l3: false,
};

// IMPORTANT:
//
Expand Down
4 changes: 2 additions & 2 deletions crates/explorer/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ fn build_ui_assets(ui_dir: &Path) {
return;
}
Err(e) => {
eprintln!("Warning: Failed to run bun install: {}", e);
eprintln!("Warning: Failed to run bun install: {e}");
return;
}
}
Expand All @@ -105,7 +105,7 @@ fn build_ui_assets(ui_dir: &Path) {
eprintln!("Warning: Failed to build UI in {}", ui_dir.display());
}
Err(e) => {
eprintln!("Warning: Failed to run bun build: {}", e);
eprintln!("Warning: Failed to run bun build: {e}");
}
}
}
6 changes: 3 additions & 3 deletions crates/explorer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ impl<S> ExplorerService<S> {
};

if let Some(asset) = EmbeddedAssets::get(asset_path) {
let content_type = Self::get_content_type(&format!("/{}", asset_path));
let content_type = Self::get_content_type(&format!("/{asset_path}"));
let content = if content_type == "text/html" {
let html = String::from_utf8_lossy(&asset.data);
let injected = Self::inject_environment(config, &html);
Expand Down Expand Up @@ -640,9 +640,9 @@ impl<S> ExplorerService<S> {

if let Some(head_pos) = html.find("<head>") {
let (start, end) = html.split_at(head_pos + 6);
format!("{}{}{}", start, script, end)
format!("{start}{script}{end}")
} else {
format!("{}\n{}", script, html)
format!("{script}\n{html}")
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/messaging/src/ethereum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ fn parse_messages(messages: &[MessageToL1]) -> Vec<U256> {
}

fn felt_from_u256(v: U256) -> Felt {
Felt::from_str(format!("{:#064x}", v).as_str()).unwrap()
Felt::from_str(format!("{v:#064x}").as_str()).unwrap()
}

#[cfg(test)]
Expand Down
4 changes: 2 additions & 2 deletions crates/messaging/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ pub trait Messenger {
#[derive(Debug)]
pub enum MessengerMode {
Ethereum(EthereumMessaging),
Starknet(StarknetMessaging),
Starknet(Box<StarknetMessaging>),
}

impl MessengerMode {
Expand All @@ -193,7 +193,7 @@ impl MessengerMode {
CONFIG_CHAIN_STARKNET => match StarknetMessaging::new(config).await {
Ok(m_sn) => {
info!(target: LOG_TARGET, "Messaging enabled [Starknet].");
Ok(MessengerMode::Starknet(m_sn))
Ok(MessengerMode::Starknet(Box::new(m_sn)))
}
Err(e) => {
error!(target: LOG_TARGET, error = %e, "Starknet messenger init.");
Expand Down
8 changes: 4 additions & 4 deletions crates/pool/pool/src/validation/stateful.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ fn map_fee_err(
}

TransactionFeeError::InsufficientResourceBounds { errors } => {
let error = errors.iter().map(|e| format!("{}", e)).collect::<Vec<_>>().join("\n");
let error = errors.iter().map(|e| format!("{e}")).collect::<Vec<_>>().join("\n");
Ok(InvalidTransactionError::InsufficientIntrinsicFee(
InsufficientIntrinsicFeeError::InsufficientResourceBounds { error },
))
Expand All @@ -281,9 +281,9 @@ fn map_executor_err(
) -> Result<InvalidTransactionError, Box<dyn std::error::Error>> {
match err {
TransactionExecutorError::TransactionExecutionError(e) => match e {
TransactionExecutionError::TransactionFeeError(e) => map_fee_err(e),
TransactionExecutionError::TransactionFeeError(e) => map_fee_err(*e),
TransactionExecutionError::TransactionPreValidationError(e) => {
map_pre_validation_err(e)
map_pre_validation_err(*e)
}

_ => Err(Box::new(e)),
Expand Down Expand Up @@ -325,7 +325,7 @@ fn map_pre_validation_err(
err: TransactionPreValidationError,
) -> Result<InvalidTransactionError, Box<dyn std::error::Error>> {
match err {
TransactionPreValidationError::TransactionFeeError(err) => map_fee_err(err),
TransactionPreValidationError::TransactionFeeError(err) => map_fee_err(*err),
TransactionPreValidationError::StateError(err) => Err(Box::new(err)),
TransactionPreValidationError::InvalidNonce {
address,
Expand Down
4 changes: 2 additions & 2 deletions crates/primitives/src/da/blob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use super::math::{fft, ifft};
pub fn recover(data: Vec<BigUint>) -> Vec<BigUint> {
let xs: Vec<BigUint> = (0..BLOB_LEN)
.map(|i| {
let bin = format!("{:012b}", i);
let bin = format!("{i:012b}");
let bin_rev = bin.chars().rev().collect::<String>();
GENERATOR.modpow(&BigUint::from_str_radix(&bin_rev, 2).unwrap(), &BLS_MODULUS)
})
Expand All @@ -31,7 +31,7 @@ pub fn recover(data: Vec<BigUint>) -> Vec<BigUint> {
pub fn transform(data: Vec<BigUint>) -> Vec<BigUint> {
let xs: Vec<BigUint> = (0..BLOB_LEN)
.map(|i| {
let bin = format!("{:012b}", i);
let bin = format!("{i:012b}");
let bin_rev = bin.chars().rev().collect::<String>();
GENERATOR.modpow(&BigUint::from_str_radix(&bin_rev, 2).unwrap(), &BLS_MODULUS)
})
Expand Down
Loading
Loading