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

Check commit_with_diff() inside generate_new_block_and_state() #501

Closed
mikiw opened this issue Jun 18, 2024 · 1 comment · Fixed by #503
Closed

Check commit_with_diff() inside generate_new_block_and_state() #501

mikiw opened this issue Jun 18, 2024 · 1 comment · Fixed by #503
Assignees

Comments

@mikiw
Copy link
Contributor

mikiw commented Jun 18, 2024

No description provided.

@mikiw mikiw self-assigned this Jun 18, 2024
@FabijanC
Copy link
Contributor

Transferring from #484:

Refactoring will probably have to deal with this problem of redundant state committing:

In handle_accepted_transaction, we call commit_with_diff and optionally generate_new_block_and_state:

pub(crate) fn handle_accepted_transaction(
&mut self,
transaction_hash: &TransactionHash,
transaction: &TransactionWithHash,
tx_info: TransactionExecutionInfo,
) -> DevnetResult<()> {
let state_diff = self.commit_with_diff()?;
let trace = create_trace(
&mut self.pending_state.state,
transaction.get_type(),
&tx_info,
state_diff.clone().into(),
)?;
let transaction_to_add = StarknetTransaction::create_accepted(transaction, tx_info, trace);
// add accepted transaction to pending block
self.blocks.pending_block.add_transaction(*transaction_hash);
self.transactions.insert(transaction_hash, transaction_to_add);
// create new block from pending one, only if block on-demand mode is disabled
if !self.config.blocks_on_demand {
self.generate_new_block_and_state(state_diff)?;

In generate_new_block_and_state we call commit_with_diff again:

@mikiw mikiw linked a pull request Jun 19, 2024 that will close this issue
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants