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

data did not match any variant of untagged enum SerializableTransactionType #9324

Open
2 tasks done
PatrickAlphaC opened this issue Nov 14, 2024 · 5 comments · May be fixed by #9280
Open
2 tasks done

data did not match any variant of untagged enum SerializableTransactionType #9324

PatrickAlphaC opened this issue Nov 14, 2024 · 5 comments · May be fixed by #9280
Labels
T-bug Type: bug T-needs-triage Type: this issue needs to be labelled

Comments

@PatrickAlphaC
Copy link

PatrickAlphaC commented Nov 14, 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 (31c24b0 2024-11-14T00:20:56.222819000Z)

What command(s) is the bug in?

anvil --load-state

Operating System

macOS (Apple Silicon)

Describe the bug

Running:

anvil --load-state /path/anvil_data/state.json

Gives me:

error: invalid value '/path/anvil_data/state.json' for '--load-state <PATH>': failed to parse json file: "/path/anvil_data/state.json": data did not match any variant of untagged enum SerializableTransactionType at line 1 column 11125

However, this command worked on a previously working edition of foundry & anvil.

I was able to revert to an older version where I did not get such an error with the following command:

foundryup -C 1d2379a22a78d48a6f1a159868ca5978f31c5462

Here is the block that was erroring:

{
            "header": {
                "parentHash": "0x4974542d1b2db2ffc73b16aa6394fe5a90b338cc0586ebbecc47c146430d526b",
                "ommersHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
                "beneficiary": "0x0000000000000000000000000000000000000000",
                "stateRoot": "0x230b4caf2bd80724bf342cdf4829b1940934848e6aad0f2783436ee72492f3ae",
                "transactionsRoot": "0xab916ba5327c96fc466ed5b8c97511a68fdee5969ed2664d355ebdb6ec79d47e",
                "receiptsRoot": "0xdcb8d1138a074583db4436c14009728a21adce5a5f31ff989a62bd20a239819f",
                "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
                "difficulty": "0x0",
                "number": "0x6",
                "gasLimit": "0x1c9c380",
                "gasUsed": "0x13c56",
                "timestamp": "0x66ff46ba",
                "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
                "nonce": "0x0000000000000000",
                "baseFeePerGas": "0x1eaa23e3",
                "blobGasUsed": "0x0",
                "excessBlobGas": "0x0",
                "extraData": "0x"
            },
            "transactions": [
                {
                    "transaction": {
                        "EIP1559": {
                            "chainId": "0x7a69",
                            "nonce": "0x1",
                            "gasLimit": "0x13c56",
                            "maxFeePerGas": "0x7a90ed8f",
                            "maxPriorityFeePerGas": "0x3b9aca00",
                            "value": "0x0",
                            "accessList": [],
                            "input": "0x61008061000f6000396100806000f35f3560e01c60026003820660011b61007a01601e395f51565b63d6d1ee14811861007257602436103417610076576004355f55005b63d09de08a81186100575734610076575f54600181018181106100765790505f55005b638381f58a81186100725734610076575f5460405260206040f35b5f5ffd5b5f80fd001800340072841880810600a1657679706572830004000013",
                            "r": "0x77e68ead43366987d79a008b4b2d170dde77cf8696b0621871de78e7882a7f3b",
                            "s": "0xa3ebb096729873e4e09287734cdd8bc043b31eb1a40bbeeb77f391ebc15a2d0",
                            "yParity": "0x1",
                            "hash": "0x5ef0b097eac1311b110fdb3b76e8d6029199c9f9bc3197f9ed51548834617c79"
                        }
                    },
                    "impersonated_sender": null
                }
            ], # Error here
            "ommers": []
        },

Where line 1 column 11125 was pointing to the spot I have marked Error here.

This state.json was created on an older version of anvil using --dump-state originally.

@PatrickAlphaC PatrickAlphaC added T-bug Type: bug T-needs-triage Type: this issue needs to be labelled labels Nov 14, 2024
@github-project-automation github-project-automation bot moved this to Todo in Foundry Nov 14, 2024
@klkvr
Copy link
Member

klkvr commented Nov 14, 2024

This transaction has gasLimit field name, however, it was changed to gas recently in alloy (as this is correct per JSON-RPC spec). Changing the field name in the JSON file should fix this

@grandizzy @mattsse unsure if we need to take any action here? eg we could add gasLimit back as an alias to alloy

@PatrickAlphaC
Copy link
Author

That did the job! Thank you.

Maybe flag a warning that this was deprecated? Although, IMO it's unlikely a lot of people use this feature... Maybe its OK just as a breaking change.

@grandizzy
Copy link
Collaborator

I'm OK with taking no action here, since the breaking change is already introduced and an workaround exists.
Also, in scope of v1.0 we're looking into removing all deprecation (as in #8931, deprecated cheatcodes, etc.) so not sure we should introduce the warning now to just remove it in couple of weeks. @zerosnacks wdyt?

@zerosnacks
Copy link
Member

I tend to agree, this ticket can serve as a reference for anyone that does happen to run into the issue. The new gas field is JSON-RPC spec compliant whereas the previous gasLimit is not. For now marking as won't fix

@zerosnacks zerosnacks closed this as not planned Won't fix, can't repro, duplicate, stale Nov 15, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in Foundry Nov 15, 2024
@zerosnacks zerosnacks linked a pull request Nov 15, 2024 that will close this issue
@zerosnacks
Copy link
Member

zerosnacks commented Nov 15, 2024

Re-opening, this will be resolved as part of #9280 (comment)

It looks like there have been other breaking changes in Alloy that should be handled gracefully, including this one.

@zerosnacks zerosnacks reopened this Nov 15, 2024
@zerosnacks zerosnacks linked a pull request Nov 15, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-bug Type: bug T-needs-triage Type: this issue needs to be labelled
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants