Skip to content

Commit e7b02e6

Browse files
authored
fix: restart madara 0x2 and bouncer weight issue (#849)
1 parent 8cc56bb commit e7b02e6

File tree

13 files changed

+681
-206
lines changed

13 files changed

+681
-206
lines changed

Makefile

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -253,14 +253,17 @@ check: setup-cairo
253253
@cargo fmt -- --check
254254
@echo -e "$(INFO)Running taplo fmt check...$(RESET)"
255255
@taplo fmt --config=./taplo/taplo.toml --check
256-
@echo -e "$(INFO)Running cargo clippy workspace checks...$(RESET)"
256+
@echo "Running cargo clippy..."
257257
@cargo clippy --workspace --no-deps -- -D warnings
258-
@echo -e "$(INFO)Running cargo clippy workspace tests...$(RESET)"
259258
@cargo clippy --workspace --tests --no-deps -- -D warnings
260-
@echo -e "$(INFO)Running cargo clippy with testing features...$(RESET)"
261-
@cargo clippy --workspace --exclude madara --features testing --no-deps -- -D warnings
262-
@echo -e "$(INFO)Running cargo clippy with testing features and tests...$(RESET)"
263-
@cargo clippy --workspace --exclude madara --features testing --tests --no-deps -- -D warnings
259+
@# TODO(mehul 14/11/2025, hotfix): This is a temporary fix to ensure that the madara is linted.
260+
@# Madara does not belong to the toplevel workspace, so we need to lint it separately.
261+
@# Remove this once we add madara back to toplevel workspace.
262+
@echo "Running cargo clippy for madara..."
263+
@cd madara && \
264+
cargo clippy --workspace --no-deps -- -D warnings && \
265+
cargo clippy --workspace --tests --no-deps -- -D warnings && \
266+
cd ..
264267
@echo -e "$(INFO)Running markdownlint check...$(RESET)"
265268
@npx markdownlint -c .markdownlint.json -q -p .markdownlintignore .
266269
@echo -e "$(PASS)All code quality checks passed!$(RESET)"

configs/args/config.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@
107107
},
108108
"block_production_params": {
109109
"block_production_disabled": false,
110-
"close_preconfirmed_block_upon_restart": false,
111110
"devnet_contracts": 10
112111
},
113112
"chain_config_override": {

madara/crates/client/block_production/src/executor/thread.rs

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
33
use crate::util::{create_execution_context, BatchToExecute, BlockExecutionContext, ExecutionStats};
44
use anyhow::Context;
5-
use blockifier::{blockifier::transaction_executor::TransactionExecutor, state::state_api::State};
5+
use blockifier::blockifier::transaction_executor::TransactionExecutor;
66
use futures::future::OptionFuture;
77
use mc_db::MadaraBackend;
8-
use mc_exec::{execution::TxInfo, LayeredStateAdapter, MadaraBackendExecutionExt};
8+
use mc_exec::{execution::TxInfo, LayeredStateAdapter};
99
use mp_convert::{Felt, ToFelt};
1010
use starknet_api::contract_class::ContractClass;
1111
use starknet_api::core::ClassHash;
@@ -220,29 +220,14 @@ impl ExecutorThread {
220220
previous_l2_gas_used,
221221
)?;
222222

223-
// Create the TransactionExecution, but reuse the layered_state_adapter.
224-
let mut executor =
225-
self.backend.new_executor_for_block_production(state.state_adaptor, exec_ctx.to_blockifier()?)?;
226-
227-
// Prepare the block_n-10 state diff entry on the 0x1 contract.
228-
if let Some((block_n_min_10, block_hash_n_min_10)) =
229-
self.wait_for_hash_of_block_min_10(exec_ctx.block_number)?
230-
{
231-
let contract_address = 1u64.into();
232-
let key = block_n_min_10.into();
233-
executor
234-
.block_state
235-
.as_mut()
236-
.expect("Blockifier block context has been taken")
237-
.set_storage_at(contract_address, key, block_hash_n_min_10)
238-
.context("Cannot set storage value in cache")?;
223+
// Create the TransactionExecutor with block_n-10 handling, reusing the layered_state_adapter.
224+
let executor = crate::util::create_executor_with_block_n_min_10(
225+
&self.backend,
226+
&exec_ctx,
227+
state.state_adaptor,
228+
|block_n| self.wait_for_hash_of_block_min_10(block_n),
229+
)?;
239230

240-
tracing::debug!(
241-
"State diff inserted {:#x} {:#x} => {block_hash_n_min_10:#x}",
242-
contract_address.to_felt(),
243-
key.to_felt()
244-
);
245-
}
246231
Ok(ExecutorStateExecuting {
247232
exec_ctx,
248233
executor,
@@ -433,7 +418,11 @@ impl ExecutorThread {
433418
);
434419
let block_exec_summary = execution_state.executor.finalize()?;
435420

436-
if self.replies_sender.blocking_send(super::ExecutorMessage::EndBlock(Box::new(block_exec_summary))).is_err() {
421+
if self
422+
.replies_sender
423+
.blocking_send(super::ExecutorMessage::EndBlock(Box::new(block_exec_summary)))
424+
.is_err()
425+
{
437426
// Receiver closed
438427
break Ok(());
439428
}

0 commit comments

Comments
 (0)