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

chore(blockifier): remove unnecessary func #2039

Merged
merged 1 commit into from
Nov 14, 2024
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.

15 changes: 0 additions & 15 deletions crates/blockifier/src/test_utils/contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,21 +181,6 @@ impl FeatureContract {
self.get_class().try_into().unwrap()
}

// TODO(Arni, 1/1/2025): Remove this function, and use the get_class function instead.
pub fn get_deprecated_contract_class(&self) -> DeprecatedContractClass {
let mut raw_contract_class: serde_json::Value =
serde_json::from_str(&self.get_raw_class()).unwrap();

// ABI is not required for execution.
raw_contract_class
.as_object_mut()
.expect("A compiled contract must be a JSON object.")
.remove("abi");

serde_json::from_value(raw_contract_class)
.expect("DeprecatedContractClass is not supported for this contract.")
}

pub fn get_raw_class(&self) -> String {
get_raw_contract_class(&self.get_compiled_path())
}
Expand Down
1 change: 1 addition & 0 deletions crates/papyrus_state_reader/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ starknet-types-core.workspace = true
starknet_api.workspace = true

[dev-dependencies]
assert_matches.workspace = true
blockifier = { workspace = true, features = ["testing"] }
indexmap.workspace = true
papyrus_storage = { workspace = true, features = ["testing"] }
7 changes: 6 additions & 1 deletion crates/papyrus_state_reader/src/papyrus_state_test.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use assert_matches::assert_matches;
use blockifier::abi::abi_utils::selector_from_name;
use blockifier::execution::call_info::CallExecution;
use blockifier::execution::entry_point::CallEntryPoint;
Expand All @@ -11,6 +12,7 @@ use indexmap::IndexMap;
use papyrus_storage::class::ClassStorageWriter;
use papyrus_storage::state::StateStorageWriter;
use starknet_api::block::BlockNumber;
use starknet_api::contract_class::ContractClass;
use starknet_api::state::{StateDiff, StorageKey};
use starknet_api::{calldata, felt};

Expand All @@ -22,7 +24,10 @@ fn test_entry_point_with_papyrus_state() -> papyrus_storage::StorageResult<()> {

let test_contract = FeatureContract::TestContract(CairoVersion::Cairo0);
let test_class_hash = test_contract.get_class_hash();
let test_class = test_contract.get_deprecated_contract_class();
let test_class = assert_matches!(
test_contract.get_class(), ContractClass::V0(contract_class) => contract_class
);

// Initialize Storage: add test contract and class.
let deployed_contracts =
IndexMap::from([(test_contract.get_instance_address(0), test_class_hash)]);
Expand Down
Loading