Skip to content

Conversation

@freeman-jiang
Copy link
Contributor

When marshalling a legacy type transaction to JSON, the chain ID field is always omitted, despite the fact that it can be derived using the signature values after EIP-155.

This change adds the chain ID to a legacy transaction's JSON encoding when it can be derived.

If the transaction is not signed or is pre EIP-155, the chain ID will be omitted.

Copy link
Member

@lightclient lightclient left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple nits, but I think this change is okay. The api spec currently has chainid as an optional field for transaction objects. So this will still be within spec. Since it is only adding a field, it should be backward compatible.

@lightclient
Copy link
Member

Adding to triage. Main question I have is now legacy transactions don't check if the ChainID field matches the signature. I'm not sure if it is worth adding this check, but wanted to make a note of it.

@fjl fjl removed the status:triage label Jun 13, 2023
Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, if this feature is something we want

@fjl fjl merged commit 8bbaf88 into ethereum:master Jun 13, 2023
@fjl fjl added this to the 1.12.1 milestone Jun 13, 2023
yperbasis added a commit to erigontech/erigon that referenced this pull request Jun 14, 2023
For legacy transactions ChainID is optional (missing in
pre-[EIP155](https://eips.ethereum.org/EIPS/eip-155) transactions) and
is derived from `V` anyway.

Also, cherry pick ethereum/go-ethereum#27452.
devopsbo3 pushed a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
devopsbo3 added a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
devopsbo3 added a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Nov 19, 2025
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Nov 19, 2025
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Nov 26, 2025
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Nov 26, 2025
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Nov 26, 2025
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.

4 participants