Skip to content

Commit

Permalink
fix(blockifier, starknet_api): update of rust stable version
Browse files Browse the repository at this point in the history
  • Loading branch information
nimrod-starkware committed Nov 28, 2024
1 parent d437b34 commit 4f5271e
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 20 deletions.
2 changes: 1 addition & 1 deletion crates/blockifier/src/concurrency/worker_logic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ impl<'a, S: StateReader> WorkerExecutor<'a, S> {
}
}

impl<'a, U: UpdatableState> WorkerExecutor<'a, U> {
impl<U: UpdatableState> WorkerExecutor<'_, U> {
pub fn commit_chunk_and_recover_block_state(
self,
n_committed_txs: usize,
Expand Down
6 changes: 1 addition & 5 deletions crates/blockifier/src/execution/entry_point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,11 +343,7 @@ impl EntryPointExecutionContext {
// would cause underflow error.
// Logically, we update remaining steps to `max(0, remaining_steps - steps_to_subtract)`.
let remaining_steps = self.n_remaining_steps();
let new_remaining_steps = if remaining_steps < steps_to_subtract {
0
} else {
remaining_steps - steps_to_subtract
};
let new_remaining_steps = remaining_steps.saturating_sub(steps_to_subtract);
self.vm_run_resources = RunResources::new(new_remaining_steps);
self.n_remaining_steps()
}
Expand Down
1 change: 0 additions & 1 deletion crates/blockifier/src/execution/syscalls/hint_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ impl SyscallExecutionError {
}

/// Error codes returned by Cairo 1.0 code.
// "Out of gas";
pub const OUT_OF_GAS_ERROR: &str =
"0x000000000000000000000000000000000000000000004f7574206f6620676173";
Expand Down
1 change: 0 additions & 1 deletion crates/blockifier/src/execution/syscalls/syscall_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ pub type SyscallResult<T> = Result<T, SyscallExecutionError>;
pub const KECCAK_FULL_RATE_IN_WORDS: usize = 17;

/// This file is for sharing common logic between Native and VM syscall implementations.
pub struct SyscallHandlerBase<'state> {
// Input for execution.
pub state: &'state mut dyn State,
Expand Down
8 changes: 2 additions & 6 deletions crates/blockifier/src/fee/gas_usage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,8 @@ pub fn get_da_gas_cost(state_changes_count: &StateChangesCount, use_kzg_da: bool
let fee_balance_value_cost = eth_gas_constants::get_calldata_word_cost(12);
discount += eth_gas_constants::GAS_PER_MEMORY_WORD - fee_balance_value_cost;

let gas = if naive_cost < discount {
// Cost must be non-negative after discount.
0
} else {
naive_cost - discount
};
// Cost must be non-negative after discount.
let gas = naive_cost.saturating_sub(discount);

(u64_from_usize(gas).into(), 0_u8.into())
};
Expand Down
6 changes: 3 additions & 3 deletions crates/blockifier/src/state/cached_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ impl<'a, S: StateReader + ?Sized> MutRefState<'a, S> {
}

/// Proxies inner object to expose `State` functionality.
impl<'a, S: StateReader + ?Sized> StateReader for MutRefState<'a, S> {
impl<S: StateReader + ?Sized> StateReader for MutRefState<'_, S> {
fn get_storage_at(
&self,
contract_address: ContractAddress,
Expand Down Expand Up @@ -535,7 +535,7 @@ impl<'a, S: StateReader + ?Sized> StateReader for MutRefState<'a, S> {

pub type TransactionalState<'a, U> = CachedState<MutRefState<'a, U>>;

impl<'a, S: StateReader> TransactionalState<'a, S> {
impl<S: StateReader> TransactionalState<'_, S> {
/// Creates a transactional instance from the given updatable state.
/// It allows performing buffered modifying actions on the given state, which
/// will either all happen (will be updated in the state and committed)
Expand All @@ -549,7 +549,7 @@ impl<'a, S: StateReader> TransactionalState<'a, S> {
}

/// Adds the ability to perform a transactional execution.
impl<'a, U: UpdatableState> TransactionalState<'a, U> {
impl<U: UpdatableState> TransactionalState<'_, U> {
/// Commits changes in the child (wrapping) state to its parent.
pub fn commit(self) {
let state = self.state.0;
Expand Down
2 changes: 1 addition & 1 deletion crates/committer_cli/src/tests/python_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ impl TryFrom<String> for PythonTest {
impl PythonTest {
/// Returns the input string if it's `Some`, or an error if it's `None`.
pub fn non_optional_input(input: Option<&str>) -> Result<&str, PythonTestError> {
input.ok_or_else(|| PythonTestError::NoneInputError)
input.ok_or(PythonTestError::NoneInputError)
}

/// Runs the test with the given arguments.
Expand Down
1 change: 1 addition & 0 deletions crates/native_blockifier/src/py_block_executor.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(non_local_definitions)]
use std::collections::HashMap;

use blockifier::abi::constants as abi_constants;
Expand Down
1 change: 1 addition & 0 deletions crates/native_blockifier/src/py_objects.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(non_local_definitions)]
use std::collections::HashMap;

use blockifier::abi::constants;
Expand Down
1 change: 1 addition & 0 deletions crates/native_blockifier/src/py_validator.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(non_local_definitions)]
use blockifier::blockifier::stateful_validator::{StatefulValidator, StatefulValidatorResult};
use blockifier::bouncer::BouncerConfig;
use blockifier::context::BlockContext;
Expand Down
1 change: 1 addition & 0 deletions crates/native_blockifier/src/storage.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(non_local_definitions)]
use std::collections::HashMap;
use std::convert::TryFrom;
use std::path::PathBuf;
Expand Down
1 change: 0 additions & 1 deletion crates/starknet_api/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ impl ChainId {
/// The address of a contract, used for example in [StateDiff](`crate::state::StateDiff`),
/// [DeclareTransaction](`crate::transaction::DeclareTransaction`), and
/// [BlockHeader](`crate::block::BlockHeader`).
// The block hash table is stored in address 0x1,
// this is a special address that is not used for contracts.
pub const BLOCK_HASH_TABLE_ADDRESS: ContractAddress = ContractAddress(PatriciaKey(StarkHash::ONE));
Expand Down
2 changes: 1 addition & 1 deletion crates/starknet_task_executor/src/tokio_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl TaskExecutor for TokioExecutor {

/// Spawns a task that may block, on a dedicated thread, preventing disruption of the async
/// runtime.
///
/// # Example
///
/// ```
Expand Down

0 comments on commit 4f5271e

Please sign in to comment.