Skip to content

Commit

Permalink
conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Noa Moulin committed Apr 5, 2024
1 parent 6aa4a44 commit fdab421
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions crates/client/rpc/src/events/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use deoxys_runtime::opaque::DBlockT;
use jsonrpsee::core::RpcResult;
use mc_sync::l2::get_pending_block;
use mp_block::DeoxysBlock;
use jsonrpsee::core::RpcResult;
use mp_felt::Felt252Wrapper;
use mp_hashers::HasherT;
use pallet_starknet_runtime_api::{ConvertTransactionRuntimeApi, StarknetRuntimeApi};
Expand Down Expand Up @@ -89,7 +89,7 @@ where
Felt252Wrapper::try_from(h)
.map(|f| f.0)
.map_err(|e| {
error!("'{e}'");
log::error!("'{e}'");
StarknetRpcApiError::InternalServerError
})
.unwrap()
Expand All @@ -116,12 +116,12 @@ where
fn get_block_by_number(&self, block_number: u64) -> Result<DeoxysBlock, StarknetRpcApiError> {
let substrate_block_hash =
self.substrate_block_hash_from_starknet_block(BlockId::Number(block_number)).map_err(|e| {
error!("'{e}'");
log::error!("'{e}'");
StarknetRpcApiError::BlockNotFound
})?;

let starknet_block = get_block_by_block_hash(self.client.as_ref(), substrate_block_hash).map_err(|e| {
error!("'{e}'");
log::error!("'{e}'");
StarknetRpcApiError::BlockNotFound
})?;
Ok(starknet_block)
Expand All @@ -130,12 +130,12 @@ where
fn get_block_by_hash(&self, block_hash: FieldElement) -> Result<DeoxysBlock, StarknetRpcApiError> {
let substrate_block_hash =
self.substrate_block_hash_from_starknet_block(BlockId::Hash(block_hash)).map_err(|e| {
error!("'{e}'");
log::error!("'{e}'");
StarknetRpcApiError::BlockNotFound
})?;

let starknet_block = get_block_by_block_hash(self.client.as_ref(), substrate_block_hash).map_err(|e| {
error!("'{e}'");
log::error!("'{e}'");
StarknetRpcApiError::BlockNotFound
})?;
Ok(starknet_block)
Expand All @@ -145,7 +145,7 @@ where
if block_tag == BlockTag::Latest {
self.get_block_by_number(
self.substrate_block_number_from_starknet_block(BlockId::Tag(BlockTag::Latest)).map_err(|e| {
error!("'{e}'");
log::error!("'{e}'");
StarknetRpcApiError::BlockNotFound
})?,
)
Expand Down
6 changes: 3 additions & 3 deletions crates/client/rpc/src/methods/read/get_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,22 +176,22 @@ where
H: HasherT + Send + Sync + 'static,
{
let latest = starknet.substrate_block_number_from_starknet_block(BlockId::Tag(BlockTag::Latest)).map_err(|e| {
error!("'{e}'");
log::error!("'{e}'");
StarknetRpcApiError::BlockNotFound
})?;
let from = if from_block == Some(BlockId::Tag(BlockTag::Pending)) {
latest + 1
} else {
starknet.substrate_block_number_from_starknet_block(from_block.unwrap_or(BlockId::Number(0))).map_err(|e| {
error!("'{e}'");
log::error!("'{e}'");
StarknetRpcApiError::BlockNotFound
})?
};
let to = if to_block == Some(BlockId::Tag(BlockTag::Pending)) {
latest + 1
} else {
starknet.substrate_block_number_from_starknet_block(from_block.unwrap_or(BlockId::Number(0))).map_err(|e| {
error!("'{e}'");
log::error!("'{e}'");
StarknetRpcApiError::BlockNotFound
})?
};
Expand Down

0 comments on commit fdab421

Please sign in to comment.