-
Notifications
You must be signed in to change notification settings - Fork 249
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
Tx pool tests #632
Conversation
@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) |
There was a problem hiding this comment.
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?
Line 238 in 352fbc6
if isChainSynced(uint64(time.Now().Unix()), headSummary.Header.Timestamp()) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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:
- Use the genesis builder to build a minimal genesis, like this
- 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.
There was a problem hiding this comment.
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.
Never mind it was a dangling test for a deleted file. |
Codecov ReportAttention:
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. |
"github.com/vechain/thor/v2/thor" | ||
) | ||
|
||
func SetupFile(t *testing.T, testFilePath string, dummyData string) { |
There was a problem hiding this comment.
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) { | ||
|
There was a problem hiding this comment.
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.
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.