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

Fix invalid account signature #132

Merged
merged 4 commits into from
Jan 24, 2025
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
36 changes: 18 additions & 18 deletions Cargo.lock

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

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fs2 = "0.4.3"
cairo-native = { git = "https://github.com/lambdaclass/cairo_native.git", rev = "e9151aa8420a138f70febb721f8979d3dd2f7223" }
anyhow = "1.0"
# Sequencer Dependencies
starknet_api = { git = "https://github.com/lambdaclass/sequencer.git", rev = "bc355ff595095268a698f8075848ec89948791e1" } # replay
blockifier = { git = "https://github.com/lambdaclass/sequencer.git", rev = "bc355ff595095268a698f8075848ec89948791e1", features = ["cairo_native"] } # replay
starknet_gateway = { git = "https://github.com/lambdaclass/sequencer.git", rev = "bc355ff595095268a698f8075848ec89948791e1" } # replay
blockifier_reexecution = { git = "https://github.com/lambdaclass/sequencer.git", rev = "bc355ff595095268a698f8075848ec89948791e1" } # replay
starknet_api = { git = "https://github.com/lambdaclass/sequencer.git", rev = "e60ec7d88b59e9fbfec7bdc7094062fb45d17554" } # replay
blockifier = { git = "https://github.com/lambdaclass/sequencer.git", rev = "e60ec7d88b59e9fbfec7bdc7094062fb45d17554", features = ["cairo_native"] } # replay
starknet_gateway = { git = "https://github.com/lambdaclass/sequencer.git", rev = "e60ec7d88b59e9fbfec7bdc7094062fb45d17554" } # replay
blockifier_reexecution = { git = "https://github.com/lambdaclass/sequencer.git", rev = "e60ec7d88b59e9fbfec7bdc7094062fb45d17554" } # replay
14 changes: 7 additions & 7 deletions replay/src/benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ use blockifier::{
use rpc_state_reader::{
cache::RpcCachedStateReader,
execution::{fetch_block_context, fetch_blockifier_transaction},
reader::{RpcChain, RpcStateReader, StateReader},
reader::{RpcStateReader, StateReader},
};
use serde::Serialize;
use starknet_api::{
block::BlockNumber,
core::{ClassHash, EntryPointSelector},
core::{ChainId, ClassHash, EntryPointSelector},
felt,
hash::StarkHash,
transaction::TransactionHash,
Expand All @@ -40,14 +40,14 @@ pub type BlockCachedData = (
pub fn fetch_block_range_data(
block_start: BlockNumber,
block_end: BlockNumber,
chain: RpcChain,
chain: ChainId,
) -> Vec<BlockCachedData> {
let mut block_caches = Vec::new();

for block_number in block_start.0..=block_end.0 {
// For each block
let block_number = BlockNumber(block_number);
let reader = RpcCachedStateReader::new(RpcStateReader::new(chain, block_number));
let reader = RpcCachedStateReader::new(RpcStateReader::new(chain.clone(), block_number));

// Fetch block context
let block_context = fetch_block_context(&reader).unwrap();
Expand All @@ -70,7 +70,7 @@ pub fn fetch_block_range_data(
// Create cached state
let previous_block_number = block_number.prev().unwrap();
let previous_reader =
RpcCachedStateReader::new(RpcStateReader::new(chain, previous_block_number));
RpcCachedStateReader::new(RpcStateReader::new(chain.clone(), previous_block_number));
let cached_state = CachedState::new(OptionalStateReader::new(previous_reader));

block_caches.push((cached_state, block_context, transactions));
Expand Down Expand Up @@ -171,8 +171,8 @@ fn get_class_executions(call: CallInfo) -> Vec<ClassExecutionInfo> {
classes
}

pub fn fetch_transaction_data(tx: &str, block: BlockNumber, chain: RpcChain) -> BlockCachedData {
let reader = RpcCachedStateReader::new(RpcStateReader::new(chain, block));
pub fn fetch_transaction_data(tx: &str, block: BlockNumber, chain: ChainId) -> BlockCachedData {
let reader = RpcCachedStateReader::new(RpcStateReader::new(chain.clone(), block));

// Fetch block context
let block_context = fetch_block_context(&reader).unwrap();
Expand Down
12 changes: 6 additions & 6 deletions replay/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ use clap::{Parser, Subcommand};
use rpc_state_reader::cache::RpcCachedStateReader;
use rpc_state_reader::execution::fetch_transaction_with_state;
use rpc_state_reader::objects::RpcTransactionReceipt;
use rpc_state_reader::reader::{RpcChain, RpcStateReader, StateReader};
use rpc_state_reader::reader::{RpcStateReader, StateReader};
use starknet_api::block::BlockNumber;
use starknet_api::core::ChainId;
use starknet_api::felt;
use starknet_api::transaction::{TransactionExecutionStatus, TransactionHash};
use tracing::{debug, error, info, info_span};
Expand Down Expand Up @@ -302,12 +303,11 @@ fn main() {
}
}

fn parse_network(network: &str) -> RpcChain {
fn parse_network(network: &str) -> ChainId {
match network.to_lowercase().as_str() {
"mainnet" => RpcChain::MainNet,
"testnet" => RpcChain::TestNet,
"testnet2" => RpcChain::TestNet2,
_ => panic!("Invalid network name, it should be one of: mainnet, testnet, testnet2"),
"mainnet" => ChainId::Mainnet,
"testnet" => ChainId::Sepolia,
_ => panic!("Invalid network name, it should be one of: mainnet, testnet"),
}
}

Expand Down
Loading
Loading