Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tx pool tests #632

Closed
wants to merge 2 commits into from
Closed

Tx pool tests #632

wants to merge 2 commits into from

Conversation

MakisChristou
Copy link
Contributor

This PR fixes the following issue by increasing the coverage of all files to 80%. @libotony let me know if I should make any adjustments. Maybe you can recommend a better way to create a DevNet with a custom timestamp.

@libotony
Copy link
Member

@MakisChristou Could you do a rebase against the master branch? There is a major change recently of the import path.

@@ -29,6 +29,13 @@ func newChainRepo(db *muxdb.MuxDB) *chain.Repository {
return repo
}

func newChainRepoCustomTimestamp(db *muxdb.MuxDB, timestamp uint64) *chain.Repository {
gene := genesis.NewDevnetCustomTimestamp(timestamp)
Copy link
Member

Choose a reason for hiding this comment

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

What's the purpose of new genesis with timestamp? Is it for the following code?

if isChainSynced(uint64(time.Now().Unix()), headSummary.Header.Timestamp()) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't remember the exact path of the code but its probably that one. The purpose was to get more coverage in areas that I could not cover otherwise with the default timestamp.

Copy link
Member

Choose a reason for hiding this comment

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

I would suggest two approaches:

  1. Use the genesis builder to build a minimal genesis, like this
  2. Add a new block with the current time, add it to the repository, and set it with best would make loops inside txpool start working.

Copy link
Member

Choose a reason for hiding this comment

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

@MakisChristou Another approach https://github.com/vechain/thor/blob/master/genesis/customnet.go#L35, but I like to use the genesis builder for testing purposes.

@MakisChristou
Copy link
Contributor Author

MakisChristou commented Jan 2, 2024

@MakisChristou Could you do a rebase against the master branch? There is a major change recently of the import path.

Hello @libotony . Regarding this, I am having issues with the latest commit on master in the test coverage. I think is has to do with the block module. Specifically the raw_test.go file. You can run make test-coverage to see these errors.

Never mind it was a dangling test for a deleted file.

@codecov-commenter
Copy link

Codecov Report

Attention: 44 lines in your changes are missing coverage. Please review.

Comparison is base (869e9c5) 53.89% compared to head (034c85d) 54.60%.

Files Patch % Lines
genesis/genesis.go 0.00% 44 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #632      +/-   ##
==========================================
+ Coverage   53.89%   54.60%   +0.70%     
==========================================
  Files         179      179              
  Lines       20665    20709      +44     
==========================================
+ Hits        11138    11308     +170     
+ Misses       8703     8568     -135     
- Partials      824      833       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

"github.com/vechain/thor/v2/thor"
)

func SetupFile(t *testing.T, testFilePath string, dummyData string) {
Copy link
Member

Choose a reason for hiding this comment

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

How about storing the test file in the OS's temporary dir?

}

func TestLoad(t *testing.T) {

Copy link
Member

Choose a reason for hiding this comment

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

Is this new empty line on purpose? I saw serval functions has a new empty line.

@libotony libotony closed this Jan 4, 2024
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