Skip to content

Commit

Permalink
Ignore transaction deserialization error (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmikolajczyk41 authored Jan 3, 2025
1 parent bbb4187 commit 56627ce
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 65 deletions.
98 changes: 55 additions & 43 deletions Cargo.lock

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

22 changes: 11 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ categories = ["cryptography"]
repository = "https://github.com/Cardinal-Cryptography/zkOS-monorepo"

[workspace.dependencies]
alloy-contract = { version = "0.8.1" }
alloy-eips = { version = "0.8.1" }
alloy-network = { version = "0.8.1" }
alloy-primitives = { version = "0.8.5" }
alloy-provider = { version = "0.8.1" }
alloy-rpc-types = { version = "0.8.1" }
alloy-rpc-types-eth = { version = "0.8.1" }
alloy-signer = { version = "0.8.1" }
alloy-signer-local = { version = "0.8.1" }
alloy-sol-types = { version = "0.8.5" }
alloy-transport = { version = "0.8.1" }
alloy-contract = { version = "0.9.1" }
alloy-eips = { version = "0.9.1" }
alloy-network = { version = "0.9.1" }
alloy-primitives = { version = "0.8.15" }
alloy-provider = { version = "0.9.1" }
alloy-rpc-types = { version = "0.9.1" }
alloy-rpc-types-eth = { version = "0.9.1" }
alloy-signer = { version = "0.9.1" }
alloy-signer-local = { version = "0.9.1" }
alloy-sol-types = { version = "0.8.15" }
alloy-transport = { version = "0.9.1" }
anyhow = { version = "1.0.86", default-features = false }
askama = { version = "0.12.0", default-features = false }
async-channel = { version = "2.3.1" }
Expand Down
21 changes: 10 additions & 11 deletions crates/shielder-cli/src/recovery.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use alloy_eips::BlockNumberOrTag;
use alloy_primitives::{BlockHash, BlockNumber, U256};
use alloy_provider::{
network::{primitives::BlockTransactionsKind, TransactionResponse},
Expand Down Expand Up @@ -80,23 +79,23 @@ async fn find_shielder_transaction(
block_number: BlockNumber,
account: &ShielderAccount,
) -> Result<ShielderAction> {
let block_number = block_number.into();
let block = provider
.get_block_by_number(
BlockNumberOrTag::Number(block_number),
BlockTransactionsKind::Full,
)
.get_block_by_number(block_number, BlockTransactionsKind::Hashes)
.await?
.ok_or(anyhow!("Block not found"))?;
let txs = block
.transactions
.as_transactions()
.expect("We should get full transactions");

for tx in txs {
let event = match try_get_shielder_event_for_tx(provider, tx, block.header.hash).await? {
for tx_hash in block.transactions.as_hashes().expect("We have hashes") {
let tx = match provider.get_transaction_by_hash(*tx_hash).await {
Ok(Some(tx)) => tx,
_ => continue,
};

let event = match try_get_shielder_event_for_tx(provider, &tx, block.header.hash).await? {
Some(event) => event,
_ => continue,
};

event.check_version().map_err(|_| anyhow!("Bad version"))?;
let event_note = event.note();
let action = ShielderAction::from((tx.tx_hash(), event));
Expand Down

0 comments on commit 56627ce

Please sign in to comment.