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(anvil): unable to submit blob transaction #8447

Closed
2 tasks done
Tracked by #8269
iAmMichaelConnor opened this issue Jul 15, 2024 · 3 comments
Closed
2 tasks done
Tracked by #8269

bug(anvil): unable to submit blob transaction #8447

iAmMichaelConnor opened this issue Jul 15, 2024 · 3 comments
Labels
C-anvil Command: anvil T-bug Type: bug T-to-investigate Type: to investigate
Milestone

Comments

@iAmMichaelConnor
Copy link

iAmMichaelConnor commented Jul 15, 2024

Component

Anvil

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

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (de33b6a 2024-07-03T14:00:39.781698671Z)

What command(s) is the bug in?

No response

Operating System

Linux

Describe the bug

Anvil throws an error, when it's sent valid blob transactions.

I've written a repo and test to highlight the bug here: https://github.com/iAmMichaelConnor/demo-anvil-blob-issue
Details of how to build the repo and run the failing test are in the README.

The test successfully runs when using a "Hardhat Network Node", but not when using an Anvil node. The fact that viem, cKzg, a hardhat node, and a Solidity contract compiled via forge, all work together to result in a passing test, suggests to me that it's Anvil that's likely got a bug interpreting blob txs.

When submitting a blob tx, Anvil says:

InvalidParamsRpcError: Invalid parameters were provided to the RPC method.
[1]     Double check you have provided the correct parameters.

Details of the test:

The test seeks to submit a blob transaction. Using viem and cKzg, I construct a valid blob transaction and send it via viem's sendRawTransaction() method. Using sendRawTransaction ensures a Hardhat node can understand the blobby tx format. I've not been able to get Anvil to correctly interpret the data, regardless of how I send the tx. A Solidity contract - compiled via forge -- then accepts the blob and stores its versionedHash. A second tx then verifies thte kzg proof.
This test fails when using Anvil.

The failing test is triggered via:

yarn test:anvil

whereas the passing test is triggered via:

yarn test:hardhat

Thanks for reading! :)

@iAmMichaelConnor iAmMichaelConnor added the T-bug Type: bug label Jul 15, 2024
@zerosnacks zerosnacks added the C-anvil Command: anvil label Jul 15, 2024
@zerosnacks zerosnacks changed the title Unable to submit blob transaction to Anvil node bug(anvil): unable to submit blob transaction Jul 15, 2024
@zerosnacks zerosnacks added the T-to-investigate Type: to investigate label Jul 15, 2024
@zerosnacks
Copy link
Member

Hi Michael, thanks for the report and the detailed repro!

@zerosnacks zerosnacks added this to the v1.0.0 milestone Jul 26, 2024
@mattsse
Copy link
Member

mattsse commented Aug 20, 2024

this has since been fixed

❯ yarn test
yarn run v1.22.21
$ export PRIV_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 && node --experimental-vm-modules node_modules/jest/bin/jest.js
(node:94207) ExperimentalWarning: VM Modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
(node:94206) ExperimentalWarning: VM Modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
 PASS  src/blob-submission.test.ts

Test Suites: 1 skipped, 1 passed, 1 of 2 total
Tests:       2 skipped, 2 passed, 4 total
Snapshots:   0 total
Time:        4.995 s, estimated 5 s
Ran all test suites.
✨  Done in 5.49s.

but I had to add timeouts to bypass receipt error

diff --git a/src/blob-submission.test.ts b/src/blob-submission.test.ts
index 2ff2cc5..1c24a0e 100644
--- a/src/blob-submission.test.ts
+++ b/src/blob-submission.test.ts
@@ -220,6 +220,8 @@ test("Test blob submission", async () => {
     serializedTransaction,
   });
 
+  await new Promise(f => setTimeout(f, 1000));
+
   const submitBlobsReceipt = await client.getTransactionReceipt({
     hash: submitBlobsHash,
   });
@@ -258,6 +260,9 @@ test("Test blob submission", async () => {
     serializedTransaction: verifyKzgProofSerializedTransaction,
   });
 
+
+  await new Promise(f => setTimeout(f, 1000));
+
   const verifyKzgProofReceipt = await client.getTransactionReceipt({
     hash: verifyKzgProofHash,
   });

@mattsse mattsse closed this as completed Aug 20, 2024
@iAmMichaelConnor
Copy link
Author

Amazing thanks! I've just validated that updating anvil and running the test successfully accepts a blob tx.
And then your suggestion to add a timeout fixed a new error of not waiting long enough before querying for a receipt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-anvil Command: anvil T-bug Type: bug T-to-investigate Type: to investigate
Projects
None yet
Development

No branches or pull requests

3 participants