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(starknet_integration_tests): delete deprecated fns #3307

Closed
wants to merge 1 commit into from
Closed
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
3 changes: 0 additions & 3 deletions Cargo.lock

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

3 changes: 0 additions & 3 deletions crates/starknet_integration_tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,17 @@ futures.workspace = true
indexmap.workspace = true
itertools.workspace = true
mempool_test_utils.workspace = true
papyrus_common.workspace = true
papyrus_config.workspace = true
papyrus_consensus.workspace = true
papyrus_consensus_orchestrator.workspace = true
papyrus_execution.workspace = true
papyrus_network = { workspace = true, features = ["testing"] }
papyrus_protobuf.workspace = true
papyrus_rpc.workspace = true
papyrus_storage = { workspace = true, features = ["testing"] }
serde_json.workspace = true
starknet-types-core.workspace = true
starknet_api.workspace = true
starknet_batcher.workspace = true
starknet_client.workspace = true
starknet_consensus_manager.workspace = true
starknet_gateway = { workspace = true, features = ["testing"] }
starknet_gateway_types.workspace = true
Expand Down
46 changes: 2 additions & 44 deletions crates/starknet_integration_tests/src/state_reader.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use std::collections::HashMap;
use std::net::SocketAddr;
use std::sync::Arc;

use assert_matches::assert_matches;
use blockifier::context::ChainInfo;
Expand All @@ -11,15 +9,13 @@ use cairo_lang_starknet_classes::casm_contract_class::CasmContractClass;
use indexmap::IndexMap;
use itertools::Itertools;
use mempool_test_utils::starknet_api_test_utils::{AccountTransactionGenerator, Contract};
use papyrus_common::pending_classes::PendingClasses;
use papyrus_rpc::{run_server, RpcConfig};
use papyrus_storage::body::BodyStorageWriter;
use papyrus_storage::class::ClassStorageWriter;
use papyrus_storage::compiled_class::CasmStorageWriter;
use papyrus_storage::header::HeaderStorageWriter;
use papyrus_storage::state::StateStorageWriter;
use papyrus_storage::test_utils::TestStorageBuilder;
use papyrus_storage::{StorageConfig, StorageReader, StorageScope, StorageWriter};
use papyrus_storage::{StorageConfig, StorageScope, StorageWriter};
use starknet_api::abi::abi_utils::get_fee_token_var_address;
use starknet_api::block::{
BlockBody,
Expand All @@ -30,7 +26,7 @@ use starknet_api::block::{
FeeType,
GasPricePerToken,
};
use starknet_api::core::{ChainId, ClassHash, ContractAddress, Nonce, SequencerContractAddress};
use starknet_api::core::{ClassHash, ContractAddress, Nonce, SequencerContractAddress};
use starknet_api::deprecated_contract_class::ContractClass as DeprecatedContractClass;
use starknet_api::state::{SierraContractClass, StorageKey, ThinStateDiff};
use starknet_api::test_utils::{
Expand All @@ -41,12 +37,9 @@ use starknet_api::test_utils::{
};
use starknet_api::transaction::fields::Fee;
use starknet_api::{contract_address, felt};
use starknet_client::reader::PendingData;
use starknet_sequencer_infra::test_utils::get_available_socket;
use starknet_types_core::felt::Felt;
use strum::IntoEnumIterator;
use tempfile::TempDir;
use tokio::sync::RwLock;

type ContractClassesMap =
(Vec<(ClassHash, DeprecatedContractClass)>, Vec<(ClassHash, CasmContractClass)>);
Expand Down Expand Up @@ -287,41 +280,6 @@ fn test_block_header(block_number: BlockNumber) -> BlockHeader {
}
}

/// Spawns a papyrus rpc server for given state reader and chain id.
/// Returns the address of the rpc server.
pub async fn spawn_test_rpc_state_reader(
storage_reader: StorageReader,
chain_id: ChainId,
) -> SocketAddr {
let socket = get_available_socket().await;
spawn_test_rpc_state_reader_with_socket(storage_reader, chain_id, socket).await;
socket
}

/// Spawns a papyrus rpc server for given state reader, chain id, and socket address.
pub async fn spawn_test_rpc_state_reader_with_socket(
storage_reader: StorageReader,
chain_id: ChainId,
socket: SocketAddr,
) -> SocketAddr {
let rpc_config =
RpcConfig { chain_id, server_address: socket.to_string(), ..Default::default() };
let (addr, handle) = run_server(
&rpc_config,
Arc::new(RwLock::new(None)),
Arc::new(RwLock::new(PendingData::default())),
Arc::new(RwLock::new(PendingClasses::default())),
storage_reader,
"NODE VERSION",
)
.await
.unwrap();
// Spawn the server handle to keep the server running, otherwise the server will stop once the
// handler is out of scope.
tokio::spawn(handle.stopped());
addr
}

/// Constructs a thin state diff from lists of contracts, where each contract can be declared,
/// deployed, and in case it is an account, funded.
#[derive(Default)]
Expand Down
Loading