-
Notifications
You must be signed in to change notification settings - Fork 51
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
feat: added special address with block number and block hash #347
Changes from 2 commits
e2e2ea1
91e0837
a067c6a
d583d76
f3ef556
0370eab
7381840
f08dc89
27ed156
38e7c75
04353f2
e546705
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -405,9 +405,32 @@ impl<Mempool: MempoolProvider> BlockProductionTask<Mempool> { | |
|
||
// Complete the block with full bouncer capacity. | ||
let start_time = Instant::now(); | ||
let (new_state_diff, _n_executed) = | ||
let (mut new_state_diff, _n_executed) = | ||
self.continue_block(self.backend.chain_config().bouncer_config.block_max_capacity)?; | ||
|
||
if block_n >= 10 { | ||
let prev_block_number = block_n - 10; | ||
match self.backend.get_block_hash(&BlockId::Number(prev_block_number)) { | ||
Ok(Some(prev_block_hash)) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's add a comment There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added |
||
let address = Felt::ONE; | ||
new_state_diff.storage_diffs.push(ContractStorageDiffItem { | ||
address, | ||
storage_entries: vec![StorageEntry { | ||
key: Felt::from(prev_block_number), | ||
value: prev_block_hash, | ||
}], | ||
}); | ||
} | ||
Ok(None) => { | ||
// this shouldn't happen, ideally should panic | ||
log::error!("No block hash found for block number {}", prev_block_number); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's panic ig? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. resolved |
||
} | ||
Err(e) => { | ||
log::error!("Error fetching block hash for block {}: {:?}", prev_block_number, e); | ||
} | ||
} | ||
} | ||
|
||
// Convert the pending block to a closed block and save to db. | ||
|
||
let parent_block_hash = Felt::ZERO; // temp parent block hash | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -263,6 +263,8 @@ impl ChainConfig { | |||||
chain_name: "Madara".into(), | ||||||
chain_id: ChainId::Other("MADARA_DEVNET".into()), | ||||||
sequencer_address: Felt::from_hex_unchecked("0x123").try_into().unwrap(), | ||||||
block_time: Duration::from_secs(4), | ||||||
pending_block_update_time: Duration::from_secs(1), | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. resolved |
||||||
..ChainConfig::starknet_sepolia() | ||||||
} | ||||||
} | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this match can be simplified to
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved