Skip to content

Conversation

hero5512
Copy link
Contributor

LatestSignerForChainID was panicking when called with chainID 0 because it tried to create a modern signer which requires chainID > 0. Legacy transactions with chainID 0 should use HomesteadSigner instead.

Fixes panic when trying to get the signer of legacy transactions #32582

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.

Will let others chime in, but I think this is expected. We want to avoid users signing unprotected transactions. If you really need to do so, you can use the Homestead signer directly. I'm not sure we want to change the behavior.

@kevink1103
Copy link

kevink1103 commented Sep 12, 2025

@lightclient

// ChainId returns the EIP155 chain ID of the transaction. The return value will always be
// non-nil. For legacy transactions which are not replay-protected, the return value is
// zero.
func (tx *Transaction) ChainId() *big.Int {
return tx.inner.chainID()
}

according to the comment, a legacy tx's chainID can technically be considered as zero and this fix is in line with the comment. what do you think?

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.

3 participants