go-ethereum icon indicating copy to clipboard operation
go-ethereum copied to clipboard

core/types,internal/ethapi: Add tests for round tripping transaction JSON

Open ajsutton opened this issue 2 years ago • 3 comments

Checks that Transaction.MarshalJSON and newRPCTransaction JSON output can be parsed by Transaction.UnmarshalJSON

ajsutton avatar Feb 13 '23 00:02 ajsutton

The duplication of the allTransactionTypes helper function is rather unfortunate. If there's a good place to put a shared version of that I'm happy to move it - just point me at the right place. :)

ajsutton avatar Feb 13 '23 00:02 ajsutton

I refactored it a bit -- now it's only in internal/ethapi, where it can perform both tests. Semantically, that's a bit odd, since arguably the 'types' test should be done in 'types' and not a satellite package. I'd argue that we get the same coverage doing it like this, but less clutter and copied code.

holiman avatar Feb 23 '23 07:02 holiman

Yeah that makes sense. Avoiding the duplication is a good tradeoff for the tests being in the "wrong" package. Looks like the windows build failed TestSkeletonSyncRetrievals which I'm guessing in flaky.

ajsutton avatar Feb 23 '23 23:02 ajsutton