This repository was archived by the owner on Jun 6, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 34
v2/consortium_test: fix: do not insert inserted blocks #612
Closed
Francesco4203
wants to merge
1
commit into
axieinfinity:all-fix-some-bugs-during-testing
from
Francesco4203:pbss-fix-tests
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2219,7 +2219,7 @@ func testSystemTransactionOrder(t *testing.T, scheme string) { | |
| } | ||
|
|
||
| func TestIsPeriodBlock(t *testing.T) { | ||
| //testIsPeriodBlock(t, rawdb.PathScheme) | ||
| testIsPeriodBlock(t, rawdb.PathScheme) | ||
| testIsPeriodBlock(t, rawdb.HashScheme) | ||
| } | ||
|
|
||
|
|
@@ -2292,17 +2292,25 @@ func testIsPeriodBlock(t *testing.T, scheme string) { | |
| if c.IsPeriodBlock(chain, header, nil) { | ||
| t.Error("wrong period block") | ||
| } | ||
|
|
||
| newBs := make(types.Blocks, 0) | ||
| for i := 0; i < 210; i++ { | ||
| callback := func(i int, bg *core.BlockGen) { | ||
| if i == 0 { | ||
| bg.OffsetTime(int64(dayInSeconds)) | ||
| } | ||
| } | ||
| block, _ := core.GenerateChain(&chainConfig, bs[len(bs)-1], ethash.NewFaker(), db, 1, callback, true) | ||
| bs = append(bs, block...) | ||
| if i == 0 { | ||
| block, _ := core.GenerateChain(&chainConfig, bs[len(bs)-1], ethash.NewFaker(), db, 1, callback, true) | ||
| newBs = append(newBs, block...) | ||
| bs = append(bs, block...) | ||
| } else { | ||
| block, _ := core.GenerateChain(&chainConfig, newBs[len(newBs)-1], ethash.NewFaker(), db, 1, callback, true) | ||
| newBs = append(newBs, block...) | ||
| bs = append(bs, block...) | ||
| } | ||
| } | ||
| if _, err := chain.InsertChain(bs[:], nil); err != nil { | ||
| // only insert newly generated blocks | ||
| if _, err := chain.InsertChain(newBs[:], nil); err != nil { | ||
| panic(err) | ||
| } | ||
|
|
||
|
|
@@ -2330,8 +2338,7 @@ Will disable this test firstly for further investigation. | |
| */ | ||
| func TestIsTrippEffective(t *testing.T) { | ||
| testIsTrippEffective(t, rawdb.HashScheme) | ||
| // testIsTrippEffective(t, rawdb.PathScheme) | ||
|
|
||
| testIsTrippEffective(t, rawdb.PathScheme) | ||
| } | ||
|
|
||
| func testIsTrippEffective(t *testing.T, scheme string) { | ||
|
|
@@ -2408,16 +2415,25 @@ func testIsTrippEffective(t *testing.T, scheme string) { | |
| t.Error("fail test Tripp effective") | ||
| } | ||
|
|
||
| newBs := make(types.Blocks, 0) | ||
| for i := 0; i < 210; i++ { | ||
| callback := func(i int, bg *core.BlockGen) { | ||
| if i == 0 { | ||
| bg.OffsetTime(int64(dayInSeconds)) | ||
| } | ||
| } | ||
| block, _ := core.GenerateChain(&chainConfig, bs[len(bs)-1], ethash.NewFaker(), db, 1, callback, true) | ||
| bs = append(bs, block...) | ||
| if i == 0 { | ||
| block, _ := core.GenerateChain(&chainConfig, bs[len(bs)-1], ethash.NewFaker(), db, 1, callback, true) | ||
| newBs = append(newBs, block...) | ||
| bs = append(bs, block...) | ||
| } else { | ||
| block, _ := core.GenerateChain(&chainConfig, newBs[len(newBs)-1], ethash.NewFaker(), db, 1, callback, true) | ||
| newBs = append(newBs, block...) | ||
| bs = append(bs, block...) | ||
| } | ||
| } | ||
| if _, err := chain.InsertChain(bs[:], nil); err != nil { | ||
| // only insert newly generated blocks | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For some reason this still previously passed for Hash Scheme 🤔 |
||
| if _, err := chain.InsertChain(newBs[:], nil); err != nil { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. similarly |
||
| panic(err) | ||
| } | ||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 think we can remove
newBsby only using bs[399:] here