refactor: break up transformer and rpc package logic into smaller func and add unit tests#1313
Conversation
Tangui-Bitfly
left a comment
There was a problem hiding this comment.
There is a lot of good things in that pr but I'm wondering if some changes go maybe too far (too many little functions, too many tests that test not exported func without direct link to usage, ...) and will be a burden in the long run.
|
|
||
| // TestGetMaxFeePerBlobGas tests the getMaxFeePerBlobGas function | ||
| // which extracts the max fee per blob gas from a transaction | ||
| func TestGetMaxFeePerBlobGas(t *testing.T) { |
There was a problem hiding this comment.
Do we really want to test each individual function like that ? Too much tests is like too much codes, harder to maintain, more complex and prone to brake.
I mean what this test is really testing ? Following this logic we could do a test for each field of a block. IMO it's better to create one test where we test each field all together.
d0a42a1 to
0113175
Compare
Deploying beaconchain with
|
| Latest commit: |
0113175
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://466875fb.beaconchain.pages.dev |
| Branch Preview URL: | https://m-refactor-indexing-v2.beaconchain.pages.dev |
mccreedy-bitfly
left a comment
There was a problem hiding this comment.
lgtm, definitely a measurable improvement in readability of the code and testing.
…c and add unit tests
e2ff8ad to
3941876
Compare
Changes:
transformer.gofunctions in the/executionlayerpackage by breaking them into smaller, more readable functionserigon.goandgeth.gofunctions in the/rpcpackage by splitting them into smaller functions and introducedutils.goto share common functionality between themutils_test.goanderigon_test.goin the/rpcpackagetransformer_test.goin the/executionlayerpackage