Skip to content

Conversation

jsvisa
Copy link
Contributor

@jsvisa jsvisa commented Jul 31, 2023

No description provided.

@jsvisa jsvisa marked this pull request as draft July 31, 2023 07:59
@jsvisa jsvisa marked this pull request as ready for review August 1, 2023 06:33
@jsvisa jsvisa force-pushed the ethapi-receipt-blobgas branch from 2306fa4 to 174db68 Compare August 6, 2023 14:08
@jsvisa jsvisa changed the title internal/ethapi: getTransactionReceipt return blobGasUsed,blobGasPrice internal/ethapi: add testcases for blobTx Aug 19, 2023
@jsvisa jsvisa force-pushed the ethapi-receipt-blobgas branch from 174db68 to ad9d00d Compare August 19, 2023 03:11
@jsvisa
Copy link
Contributor Author

jsvisa commented Aug 19, 2023

@fjl ptal, thanks

@fjl
Copy link
Contributor

fjl commented Aug 19, 2023

It's good that you're adding tests, but I'm not so happy to have all of these test vectors inline as strings. If we ever change the API again, a lot of hand-editing will need to happen. So I would like to ask you, if you have time, to restructure these tests using testdata files. It can be done as follows:

  • In the test case struct, add a new string field with a name. This name can be used as the "test name", but also as the filename of a JSON file in testdata.
  • During test execution, if a special environment variable is set (e.g. GENERATE_TEST), the output that you are comparing against should be written to the testdata file. Use json.MarshalIndent to write a readable version.
  • If the environment variable is not set, the test should load the file and compare the text just like now.

@jsvisa
Copy link
Contributor Author

jsvisa commented Aug 19, 2023

It's good that you're adding tests, but I'm not so happy to have all of these test vectors inline as strings. If we ever change the API again, a lot of hand-editing will need to happen. So I would like to ask you, if you have time, to restructure these tests using testdata files. It can be done as follows:

  • In the test case struct, add a new string field with a name. This name can be used as the "test name", but also as the filename of a JSON file in testdata.

  • During test execution, if a special environment variable is set (e.g. GENERATE_TEST), the output that you are comparing against should be written to the testdata file. Use json.MarshalIndent to write a readable version.

  • If the environment variable is not set, the test should load the file and compare the text just like now.

Sounds good to me, I'll adjust them this weekend

@jsvisa
Copy link
Contributor Author

jsvisa commented Aug 20, 2023

@fjl, please take another look, thanks.

use the env variable WRITE_TEST_FILES from

if os.Getenv("WRITE_TEST_FILES") != "" {

jsvisa and others added 2 commits August 21, 2023 21:24
Co-authored-by: Martin Holst Swende <[email protected]>
Signed-off-by: jsvisa <[email protected]>
@fjl fjl merged commit 9f4a528 into ethereum:master Aug 22, 2023
@fjl fjl added this to the 1.13.0 milestone Aug 22, 2023
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
@jsvisa jsvisa deleted the ethapi-receipt-blobgas branch May 9, 2025 14:08
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