Skip to content

Conversation

@fjl
Copy link
Contributor

@fjl fjl commented Mar 19, 2025

This removes the signer type-train in favor of defining a single object that can handle all tx types. Supported types are enabled via a map. Notably, the new signer also supports disabling legacy transactions.

fjl added 2 commits March 19, 2025 09:59
This removes the signer type train in favor of defining a single object that
can handle all tx types. Supported types are enabled via a map. Notably, the
Pnew signer also supports disabling legacy transactions.
@fjl fjl changed the title Core types cleanup signing core/types: cleanup tx signing logic Mar 19, 2025
Copy link
Member

@MariusVanDerWijden MariusVanDerWijden left a comment

Choose a reason for hiding this comment

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

LGTM, nice!

@fjl fjl requested a review from lightclient as a code owner March 19, 2025 10:25
@fjl fjl changed the title core/types: cleanup tx signing logic core/types: cleanup tx signer logic Mar 19, 2025
@fjl
Copy link
Contributor Author

fjl commented Mar 19, 2025

PTAL

Copy link
Contributor

@jwasinger jwasinger left a comment

Choose a reason for hiding this comment

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

This is nice as it removes a bunch of duplicated code for all post eip-155 signers. It also makes sense for signature recovery legacy type transactions to fall through directly to the legacy signer instead of being evaluated by each previous signer in reverse fork order. And ofc, now that computing the hash is coupled with the transaction and not the signer, that prevents the need to do similar chained evaluation to find matching hashing logic for a tx from a previous fork.

Hard for me to give a firm thumbs-up on anything in this area as this is very sensitive core stuff, but from what I've seen lgtm.

@fjl
Copy link
Contributor Author

fjl commented Mar 19, 2025

So one note here, this could probably be even faster by using a bitmap but I decided not to go there. We can do it if it's wanted, but I have a hunch it will be easier for downstream projects/forks to work with this type and add their own entries when it's a map.

if tt == LegacyTxType {
return s.legacy.SignatureValues(tx, sig)
}
// Check that chain ID of tx matches the signer. We also accept ID zero here,
Copy link
Member

Choose a reason for hiding this comment

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

This is kinda outdated now, right? We are not accepting 0 anymore

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are!

Copy link
Member

Choose a reason for hiding this comment

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

Ah now I get the logic

@fjl fjl added this to the 1.15.6 milestone Mar 19, 2025
@fjl fjl merged commit 80b8d7a into ethereum:master Mar 19, 2025
4 checks passed
sivaratrisrinivas pushed a commit to sivaratrisrinivas/go-ethereum that referenced this pull request Apr 21, 2025
This removes the signer type-train in favor of defining a single object
that can handle all tx types. Supported types are enabled via a map.
Notably, the new signer also supports disabling legacy transactions.
Rampex1 pushed a commit to streamingfast/go-ethereum that referenced this pull request Jun 6, 2025
jakub-freebit pushed a commit to fblch/go-ethereum that referenced this pull request Jul 3, 2025
This removes the signer type-train in favor of defining a single object
that can handle all tx types. Supported types are enabled via a map.
Notably, the new signer also supports disabling legacy transactions.
howjmay pushed a commit to iotaledger/go-ethereum that referenced this pull request Aug 27, 2025
This removes the signer type-train in favor of defining a single object
that can handle all tx types. Supported types are enabled via a map.
Notably, the new signer also supports disabling legacy transactions.
gballet pushed a commit to gballet/go-ethereum that referenced this pull request Sep 11, 2025
This removes the signer type-train in favor of defining a single object
that can handle all tx types. Supported types are enabled via a map.
Notably, the new signer also supports disabling legacy transactions.
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