Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/rpc-replay/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ license-file.workspace = true
[dependencies]
blockifier = { workspace = true }
cairo-lang-starknet-classes = { workspace = true }
log = { workspace = true }
rpc-client = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
Expand Down
21 changes: 19 additions & 2 deletions crates/rpc-replay/src/block_context.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use std::env;
use std::num::NonZeroU128;
use std::path::Path;

use blockifier::blockifier::block::{BlockInfo, GasPrices};
use blockifier::bouncer::BouncerConfig;
Expand Down Expand Up @@ -62,10 +64,25 @@ pub fn build_block_context(
},
};

let versioned_constants = VersionedConstants::get(starknet_version);
// let versioned_constants = VersionedConstants::get(starknet_version);

// Check for custom versioned constants path
let versioned_constants = if let Ok(path) = env::var("SNOS_BLOCKIFIER_VERSIONED_CONSTANTS_PATH") {
log::info!("Loading versioned constants from path: {}", path);
// Try to load versioned constants from the specified JSON file
VersionedConstants::try_from(Path::new(&path)).map_err(|e| {
log::error!("Failed to load versioned constants from file {}, {}", path, e);
FeltConversionError::CustomError(format!("Failed to load versioned constants from file: {}", e))
})?
} else {
log::info!("Env for versioned constants not set. Using default values");
// Use the default versioned constants from the library
VersionedConstants::get(starknet_version).clone()
};

let bouncer_config = BouncerConfig::max();

Ok(BlockContext::new(block_info, chain_info, versioned_constants.clone(), bouncer_config))
Ok(BlockContext::new(block_info, chain_info, versioned_constants, bouncer_config))
}

#[cfg(test)]
Expand Down
Loading