Skip to content

fix(lido): fix panic in eth_call — reqwest::blocking inside async runtime (v0.2.1)#92

Closed
GeoGu360 wants to merge 1 commit intookx:mainfrom
GeoGu360:fix/lido-async-eth-call-clean
Closed

fix(lido): fix panic in eth_call — reqwest::blocking inside async runtime (v0.2.1)#92
GeoGu360 wants to merge 1 commit intookx:mainfrom
GeoGu360:fix/lido-async-eth-call-clean

Conversation

@GeoGu360
Copy link
Copy Markdown

Problem

eth_call used reqwest::blocking::Client, which internally creates its own tokio runtime. Calling it from within a #[tokio::main] async context causes an immediate panic:

thread 'main' panicked: Cannot drop a runtime in a context where blocking is not allowed.
This happens when a runtime is dropped from within an asynchronous context.

Affected commands (all call eth_call from async context):

Command Call sites
balance 2 (balanceOf, sharesOf)
stake 1 (isStakingPaused pre-flight check)
get-withdrawals 2 (getWithdrawalRequests, getWithdrawalStatus)
claim-withdrawal 2 (getLastCheckpointIndex, findCheckpointHints)

Fix

  • Convert eth_call to async fn in onchainos.rs
  • Replace reqwest::blocking::Client with async reqwest::Client
  • Add .await to all 7 call sites across balance.rs, stake.rs, get_withdrawals.rs, claim_withdrawal.rs
  • Bump version to 0.2.1 in Cargo.toml, SKILL.md, plugin.yaml, .claude-plugin/plugin.json

Test plan

  • lido get-apy — APR query (unaffected, returns 2.39%)
  • lido balance — on-chain stETH balance query, no panic
  • lido get-withdrawals — lists withdrawal requests from chain, no panic
  • lido request-withdrawal --amount-eth 0.00001 --confirm — 2-step tx (approve + requestWithdrawals), both confirmed on-chain
  • lido claim-withdrawal --ids <ID> — reaches chain correctly (returns expected RequestNotFoundOrNotFinalized for PENDING requests, confirming RPC call succeeds)

🤖 Generated with Claude Code

…time (v0.2.1)

`eth_call` used `reqwest::blocking::Client` which internally creates its own
tokio runtime. Calling it inside a `#[tokio::main]` async context causes a
panic: "Cannot drop a runtime in a context where blocking is not allowed."

This crashed the following commands at startup:
  - balance (2 eth_call sites)
  - stake (1 eth_call site — isStakingPaused check)
  - get-withdrawals (2 eth_call sites)
  - claim-withdrawal (2 eth_call sites)

Fix: convert eth_call to async fn, replace reqwest::blocking::Client with
async reqwest::Client, and add .await to all 7 call sites.

Bump version to 0.2.1 in Cargo.toml, SKILL.md, plugin.yaml, and
.claude-plugin/plugin.json.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@GeoGu360
Copy link
Copy Markdown
Author

Superseded by #93 — rebased on fork main to avoid .github/ diff false positive.

@GeoGu360 GeoGu360 closed this Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant