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

bug(forge script): Failure on receiving a receipt, server returned a null response when a non-null response was expected #9636

Closed
1 of 2 tasks
Aliceonly opened this issue Jan 7, 2025 · 6 comments · Fixed by #9650
Assignees
Labels
Cmd-forge-script Command: forge script T-bug Type: bug

Comments

@Aliceonly
Copy link

Aliceonly commented Jan 7, 2025

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

uses: foundry-rs/foundry-toolchain@v1

What command(s) is the bug in?

forge script

Operating System

Linux

Describe the bug

I run workflow on ubuntu-22.04
there're like 100+ txs in script

      - name: Install Foundry
        uses: foundry-rs/foundry-toolchain@v1

          forge script script/deploy.s.sol:DeployScript \
            --slow \
            --rpc-url ${{ env.RPC }} \
            --private-key ${{ secrets.PRIVATE_KEY }} \
            --broadcast \

always got error:

Error: Failure on receiving a receipt for 0x37949a9954e1....d679f0a8601879c5bc314bceee8:
server returned a null response when a non-null response was expected

 Add `--resume` to your command to try and continue broadcasting
        the transactions.

but tx has been comfirmed onchain, also I tried serval rpcs and failed

@Aliceonly Aliceonly added T-bug Type: bug T-needs-triage Type: this issue needs to be labelled labels Jan 7, 2025
@github-project-automation github-project-automation bot moved this to Todo in Foundry Jan 7, 2025
@Aliceonly
Copy link
Author

tryna add --timeout 900, but script run failed in 45s

@zerosnacks
Copy link
Member

zerosnacks commented Jan 7, 2025

Hi @Aliceonly

What blockchain are you targeting? Are the RPCs you are using protected by an API key or are they public? Does it consistently fail on that specific transaction, around the same time or at around a specific transaction count?

@zerosnacks zerosnacks changed the title forge script Failure on receiving a receipt, server returned a null response when a non-null response was expected bug(forge script): Failure on receiving a receipt, server returned a null response when a non-null response was expected Jan 7, 2025
@zerosnacks zerosnacks added Cmd-forge-script Command: forge script T-to-investigate Type: to investigate and removed T-needs-triage Type: this issue needs to be labelled labels Jan 7, 2025
@Aliceonly
Copy link
Author

Hi @Aliceonly

What blockchain are you targeting? Are the RPCs you are using protected by an API key or are they public? Does it consistently fail on that specific transaction, around the same time or at around a specific transaction count?

Thx for reply, I target Berachain bArtio, it mostly fail on broadcasting batch txs in one script. Also, I tried diff rpcs in private(like quicknode) and public, same situation. It may be that the state of this blockchain is not synchronised in a timely manner or rpc not stable causing the rpc return null of tx receipt tentatively, but it will fails all the script, esp in github action it's fatal

@grandizzy
Copy link
Collaborator

grandizzy commented Jan 8, 2025

I see a similar failure in https://github.com/foundry-rs/foundry/actions/runs/12664378135/job/35292428706#step:12:283 but it's passing on next attempt, cannot reproduce locally either...

Maybe we should not exit on first failure here but retry couple of times as the receipt could not be available right away?

Err(err) => {
errors.push(format!("Failure on receiving a receipt for {tx_hash:?}:\n{err}"));
seq_progress.inner.write().finish_tx_spinner(tx_hash);
}

Le: probably this started to manifest more from when introducing better error handling (previously script was just hanging waiting for receipt if error) d402afd#diff-40b142bf1cc0e034c56533fad30c71161b2cc0b4dd4d6a72468e0649e3c7002dR52

@Aliceonly
Copy link
Author

I see a similar failure in https://github.com/foundry-rs/foundry/actions/runs/12664378135/job/35292428706#step:12:283 but it's passing on next attempt, cannot reproduce locally either...

Maybe we should not exit on first failure here but retry couple of times as the receipt could not be available right away?

foundry/crates/script/src/progress.rs

Lines 213 to 217 in ad09bbe

Err(err) => {
errors.push(format!("Failure on receiving a receipt for {tx_hash:?}:\n{err}"));

 seq_progress.inner.write().finish_tx_spinner(tx_hash); 

}

Agree, it will happen more frequently on online chain cuz many rpc and testnet are not stable. It fails whole broadcast prograss, esp in workflow that's annoying

@klkvr
Copy link
Member

klkvr commented Jan 9, 2025

for context: this error is most likely coming from here https://github.com/alloy-rs/alloy/blob/b9b2da02bfac649bd06b30bd970ea63470a23d70/crates/provider/src/heart.rs#L238

which means that transaction was included into latest block but receipt for it is still not available

@grandizzy grandizzy self-assigned this Jan 13, 2025
@grandizzy grandizzy removed the T-to-investigate Type: to investigate label Jan 13, 2025
@grandizzy grandizzy moved this from Todo to Ready For Review in Foundry Jan 13, 2025
@github-project-automation github-project-automation bot moved this from Ready For Review to Done in Foundry Jan 13, 2025
@grandizzy grandizzy moved this from Done to Completed in Foundry Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cmd-forge-script Command: forge script T-bug Type: bug
Projects
Status: Completed
Development

Successfully merging a pull request may close this issue.

4 participants