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

v2/consortium_test: fix for pbss: do not insert inserted blocks #613

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions consensus/consortium/v2/consortium_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -2302,7 +2302,11 @@ func testIsPeriodBlock(t *testing.T, scheme string) {
block, _ := core.GenerateChain(&chainConfig, bs[len(bs)-1], ethash.NewFaker(), db, 1, callback, true)
bs = append(bs, block...)
}
if _, err := chain.InsertChain(bs[:], nil); err != nil {
// Only the new blocks are inserted here
// For path scheme, the number of db diff layers corresponding to blocks are limited to 128
// So just the newest 128 blocks can be retrieved from the db
// Therefore, the handling of the inserted blocks can result in error since the older blocks can not be retrieved for checking
if _, err := chain.InsertChain(bs[399:], nil); err != nil {
panic(err)
}

Expand All @@ -2322,15 +2326,9 @@ func testIsPeriodBlock(t *testing.T, scheme string) {
}
}

/*
Got issues related to parent layer missing in the test
panic: triedb parent [0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421] layer missing [recovered]
panic: triedb parent [0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421] layer missing
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)

}

Expand Down Expand Up @@ -2417,7 +2415,11 @@ func testIsTrippEffective(t *testing.T, scheme string) {
block, _ := core.GenerateChain(&chainConfig, bs[len(bs)-1], ethash.NewFaker(), db, 1, callback, true)
bs = append(bs, block...)
}
Copy link
Collaborator

@huyngopt1994 huyngopt1994 Nov 14, 2024

Choose a reason for hiding this comment

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

Could u added some comment explain related to max layers of Path base then we need to insert bs[:]?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added

if _, err := chain.InsertChain(bs[:], nil); err != nil {
// Only the new blocks are inserted here
// For path scheme, the number of db diff layers corresponding to blocks are limited to 128
// So just the newest 128 blocks can be retrieved from the db
// Therefore, the handling of the inserted blocks can result in error since the older blocks can not be retrieved for checking
if _, err := chain.InsertChain(bs[399:], nil); err != nil {
panic(err)
}

Expand Down
Loading