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: do not insert inserted blocks #612

Conversation

Francesco4203
Copy link
Contributor

@Francesco4203 Francesco4203 commented Oct 23, 2024

Before this PR, in TestIsPeriodBlock and TestIsTrippEffective, the chain of blocks is inserted while it still includes some previously inserted blocks, potentially cause the following error when running on path scheme:

--- FAIL: TestIsTrippEffective (0.19s)
panic: triedb parent [0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421] layer missing [recovered]
        panic: triedb parent [0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421] layer missing

goroutine 4016 [running]:
testing.tRunner.func1.2({0x105c97d20, 0x140002d1770})
        /opt/homebrew/Cellar/go/1.22.3/libexec/src/testing/testing.go:1631 +0x1c4
testing.tRunner.func1()
        /opt/homebrew/Cellar/go/1.22.3/libexec/src/testing/testing.go:1634 +0x33c
panic({0x105c97d20?, 0x140002d1770?})
        /opt/homebrew/Cellar/go/1.22.3/libexec/src/runtime/panic.go:770 +0x124
github.com/ethereum/go-ethereum/consensus/consortium/v2.testIsTrippEffective(0x140000c3a00, {0x10592235d, 0x4})
        /Users/long.nguyen/Documents/GitHub/ronin/consensus/consortium/v2/consortium_test.go:2437 +0xe5c
github.com/ethereum/go-ethereum/consensus/consortium/v2.TestIsTrippEffective(0x140000c3a00)
        /Users/long.nguyen/Documents/GitHub/ronin/consensus/consortium/v2/consortium_test.go:2341 +0x40
testing.tRunner(0x140000c3a00, 0x105df9818)
        /opt/homebrew/Cellar/go/1.22.3/libexec/src/testing/testing.go:1689 +0xec
created by testing.(*T).Run in goroutine 1
        /opt/homebrew/Cellar/go/1.22.3/libexec/src/testing/testing.go:1742 +0x318
exit status 2
FAIL    github.com/ethereum/go-ethereum/consensus/consortium/v2 1.631s

This PR is to fix it by creating a new list of blocks that only contains newly created blocks.
Run test after fixing:

PASS
ok      github.com/ethereum/go-ethereum/consensus/consortium/v2 1.530s

}
if _, err := chain.InsertChain(bs[:], nil); err != nil {
// only insert newly generated blocks
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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(bs[:], nil); err != nil {
// only insert newly generated blocks
if _, err := chain.InsertChain(newBs[:], nil); err != nil {
Copy link
Contributor

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 newBs by only using bs[399:] here

}
if _, err := chain.InsertChain(bs[:], nil); err != nil {
// only insert newly generated blocks
if _, err := chain.InsertChain(newBs[:], nil); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

similarly

@huyngopt1994
Copy link
Collaborator

huyngopt1994 commented Oct 24, 2024

@Francesco4203 so for clear, that the test is failed related to limit of maxdifflayer logic Pathbase, for Hashbase they still look into the keyvalue for checking rootState by Hash?, so could u verify this limit again? after that add comment in the test for clearing why do we choose this number.

@huyngopt1994 huyngopt1994 deleted the branch axieinfinity:all-fix-some-bugs-during-testing October 25, 2024 07:15
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