Skip to content

Commit

Permalink
guard zk provider
Browse files Browse the repository at this point in the history
  • Loading branch information
nbaztec committed Dec 16, 2024
1 parent f0d0f9d commit d80312f
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions crates/script/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -639,17 +639,20 @@ impl ScriptConfig {
.expect("failed acquiring strategy")
.zksync_set_dual_compiled_contracts(dual_compiled_contracts);

if let Some(fork_url) = &self.evm_opts.fork_url {
let provider =
zksync_provider().with_recommended_fillers().on_http(fork_url.parse()?);
// TODO(zk): switch to getFeeParams call when it is implemented for anvil-zksync
let maybe_details =
provider.get_block_details(env.block.number.try_into()?).await?;
if let Some(block_details) = maybe_details {
strategy
.lock()
.expect("failed acquiring strategy")
.zksync_set_env(block_details);
// TODO(zk): Move this to strategy instead
if strategy.lock().expect("failed acquiring strategy").name() == "zk" {
if let Some(fork_url) = &self.evm_opts.fork_url {
let provider =
zksync_provider().with_recommended_fillers().on_http(fork_url.parse()?);
// TODO(zk): switch to getFeeParams call when it is implemented for anvil-zksync
let maybe_details =
provider.get_block_details(env.block.number.try_into()?).await?;
if let Some(block_details) = maybe_details {
strategy
.lock()
.expect("failed acquiring strategy")
.zksync_set_env(block_details);
}
}
}

Expand Down

0 comments on commit d80312f

Please sign in to comment.