Skip to content

Conversation

@GheisMohammadi
Copy link
Collaborator

@GheisMohammadi GheisMohammadi commented Dec 30, 2024

Issue

This PR refactors Staged Stream Sync Long Range stage. It adds BlockHashes stage to Staged Stream Sync. By calculating the correct hash first, this ensures data integrity and reliability in the block download process.

@GheisMohammadi GheisMohammadi self-assigned this Dec 30, 2024
@GheisMohammadi GheisMohammadi marked this pull request as draft December 30, 2024 11:55
@GheisMohammadi GheisMohammadi marked this pull request as ready for review January 6, 2025 11:44
@sophoah
Copy link
Contributor

sophoah commented Jan 9, 2025

is it possible to write test in this PR as well ?

@GheisMohammadi
Copy link
Collaborator Author

is it possible to write test in this PR as well ?

done

@sophoah
Copy link
Contributor

sophoah commented Jan 10, 2025

@GheisMohammadi for long range how many block behind are we talking about

@GheisMohammadi
Copy link
Collaborator Author

GheisMohammadi commented Jan 10, 2025

@GheisMohammadi for long range how many block behind are we talking about

The node starts in long-range sync mode by default. Once it catches up, it switches to short-range sync.

@GheisMohammadi
Copy link
Collaborator Author

@GheisMohammadi for long range how many block behind are we talking about

The node starts in long-range sync mode by default. Once it catches up, it switches to short-range sync.

Also, I am currently working on a PR that dynamically switches between short-range and long-range sync based on the block gap.

@sophoah
Copy link
Contributor

sophoah commented Jan 23, 2025

@GheisMohammadi did you test the issue #4826 (comment) ?

@GheisMohammadi
Copy link
Collaborator Author

@GheisMohammadi did you test the issue #4826 (comment) ?

in progress

@GheisMohammadi GheisMohammadi force-pushed the refactor/staged_stream_sync_long_range branch from 6c57170 to ce62cf5 Compare January 24, 2025 03:21
@sophoah
Copy link
Contributor

sophoah commented Jan 24, 2025

@GheisMohammadi i am still facing panic when i try to restart the harmony process that I killed just previously

My Genesis Account: one1pf75h0t4am90z8uv3y0dgunfqp4lj8wr3t5rsp/e751ec995defe4931273aaebcb2cd14bf37e629c554a57d3f334c37881a34a6188a93e76113c55ef3481da23b7d7ab09:0
Legacy mode; node key e751ec995defe4931273aaebcb2cd14bf37e629c554a57d3f334c37881a34a6188a93e76113c55ef3481da23b7d7ab09; -> shard 0
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x112887e]

goroutine 1 [running]:
github.com/harmony-one/harmony/core.(*StateProcessor).Process(_, _, _, {0x0, {0x0, 0x0}, 0x0, 0x0, {{0x0, 0x0, ...}, ...}, ...}, ...)
        /home/soph/harmony/harmony2/core/state_processor.go:110 +0x9e
github.com/harmony-one/harmony/core.(*BlockChainImpl).insertChain(0xc000f26008, {0xc00089af50, 0x1, 0x1}, 0x1)
        /home/soph/harmony/harmony2/core/blockchain_impl.go:1860 +0xc56
github.com/harmony-one/harmony/core.(*BlockChainImpl).repairRecreateStateTries(0xc000f26008, 0xc00089b2d8)
        /home/soph/harmony/harmony2/core/blockchain_impl.go:800 +0x72
github.com/harmony-one/harmony/core.(*BlockChainImpl).repair(0xc000f26008, 0xc00089b2d8)
        /home/soph/harmony/harmony2/core/blockchain_impl.go:820 +0xa5
github.com/harmony-one/harmony/core.(*BlockChainImpl).loadLastState(0xc000f26008)
        /home/soph/harmony/harmony2/core/blockchain_impl.go:609 +0x116b
github.com/harmony-one/harmony/core.newBlockChainWithOptions({_, _}, {_, _}, {_, _}, _, _, {0x2d26918, 0xc00064f920}, ...)
        /home/soph/harmony/harmony2/core/blockchain_impl.go:331 +0x9b3
github.com/harmony-one/harmony/core.NewBlockChainWithOptions(...)
        /home/soph/harmony/harmony2/core/blockchain_impl.go:237
github.com/harmony-one/harmony/internal/shardchain.(*CollectionImpl).ShardChain(0xc0007da240, 0x0, {0x0, 0x0, 0x2d1a2c8?})
        /home/soph/harmony/harmony2/internal/shardchain/shardchains.go:147 +0x765
main.setupChain({{0x25e780e, 0x5}, {{0x25efa8f, 0x9}, 0x1, 0xffffffffffffffff, 0x0, 0x0, 0x0, 0x0, ...}, ...}, ...)
        /home/soph/harmony/harmony2/cmd/harmony/main.go:695 +0x7c7
main.setupConsensusAndNode({{0x25e780e, 0x5}, {{0x25efa8f, 0x9}, 0x1, 0xffffffffffffffff, 0x0, 0x0, 0x0, 0x0, ...}, ...}, ...)
        /home/soph/harmony/harmony2/cmd/harmony/main.go:735 +0x347
main.setupNodeAndRun({{0x25e780e, 0x5}, {{0x25efa8f, 0x9}, 0x1, 0xffffffffffffffff, 0x0, 0x0, 0x0, 0x0, ...}, ...})
        /home/soph/harmony/harmony2/cmd/harmony/main.go:247 +0x389
main.runHarmonyNode(0x3fa57a0, {0x25e6aef?, 0x4?, 0x25e68d7?})
        /home/soph/harmony/harmony2/cmd/harmony/main.go:127 +0x205
github.com/spf13/cobra.(*Command).execute(0x3fa57a0, {0xc000052258, 0x22, 0x22})
        /home/soph/go/pkg/mod/github.com/spf13/cobra@v1.5.0/command.go:876 +0x69b
github.com/spf13/cobra.(*Command).ExecuteC(0x3fa57a0)
        /home/soph/go/pkg/mod/github.com/spf13/cobra@v1.5.0/command.go:990 +0x38d
github.com/spf13/cobra.(*Command).Execute(...)
        /home/soph/go/pkg/mod/github.com/spf13/cobra@v1.5.0/command.go:918
main.main()
        /home/soph/harmony/harmony2/cmd/harmony/main.go:107 +0x1a

[1]+  Exit 2

@GheisMohammadi
Copy link
Collaborator Author

@GheisMohammadi i am still facing panic when i try to restart the harmony process that I killed just previously


My Genesis Account: one1pf75h0t4am90z8uv3y0dgunfqp4lj8wr3t5rsp/e751ec995defe4931273aaebcb2cd14bf37e629c554a57d3f334c37881a34a6188a93e76113c55ef3481da23b7d7ab09:0

Legacy mode; node key e751ec995defe4931273aaebcb2cd14bf37e629c554a57d3f334c37881a34a6188a93e76113c55ef3481da23b7d7ab09; -> shard 0

panic: runtime error: invalid memory address or nil pointer dereference

[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x112887e]



goroutine 1 [running]:

github.com/harmony-one/harmony/core.(*StateProcessor).Process(_, _, _, {0x0, {0x0, 0x0}, 0x0, 0x0, {{0x0, 0x0, ...}, ...}, ...}, ...)

        /home/soph/harmony/harmony2/core/state_processor.go:110 +0x9e

github.com/harmony-one/harmony/core.(*BlockChainImpl).insertChain(0xc000f26008, {0xc00089af50, 0x1, 0x1}, 0x1)

        /home/soph/harmony/harmony2/core/blockchain_impl.go:1860 +0xc56

github.com/harmony-one/harmony/core.(*BlockChainImpl).repairRecreateStateTries(0xc000f26008, 0xc00089b2d8)

        /home/soph/harmony/harmony2/core/blockchain_impl.go:800 +0x72

github.com/harmony-one/harmony/core.(*BlockChainImpl).repair(0xc000f26008, 0xc00089b2d8)

        /home/soph/harmony/harmony2/core/blockchain_impl.go:820 +0xa5

github.com/harmony-one/harmony/core.(*BlockChainImpl).loadLastState(0xc000f26008)

        /home/soph/harmony/harmony2/core/blockchain_impl.go:609 +0x116b

github.com/harmony-one/harmony/core.newBlockChainWithOptions({_, _}, {_, _}, {_, _}, _, _, {0x2d26918, 0xc00064f920}, ...)

        /home/soph/harmony/harmony2/core/blockchain_impl.go:331 +0x9b3

github.com/harmony-one/harmony/core.NewBlockChainWithOptions(...)

        /home/soph/harmony/harmony2/core/blockchain_impl.go:237

github.com/harmony-one/harmony/internal/shardchain.(*CollectionImpl).ShardChain(0xc0007da240, 0x0, {0x0, 0x0, 0x2d1a2c8?})

        /home/soph/harmony/harmony2/internal/shardchain/shardchains.go:147 +0x765

main.setupChain({{0x25e780e, 0x5}, {{0x25efa8f, 0x9}, 0x1, 0xffffffffffffffff, 0x0, 0x0, 0x0, 0x0, ...}, ...}, ...)

        /home/soph/harmony/harmony2/cmd/harmony/main.go:695 +0x7c7

main.setupConsensusAndNode({{0x25e780e, 0x5}, {{0x25efa8f, 0x9}, 0x1, 0xffffffffffffffff, 0x0, 0x0, 0x0, 0x0, ...}, ...}, ...)

        /home/soph/harmony/harmony2/cmd/harmony/main.go:735 +0x347

main.setupNodeAndRun({{0x25e780e, 0x5}, {{0x25efa8f, 0x9}, 0x1, 0xffffffffffffffff, 0x0, 0x0, 0x0, 0x0, ...}, ...})

        /home/soph/harmony/harmony2/cmd/harmony/main.go:247 +0x389

main.runHarmonyNode(0x3fa57a0, {0x25e6aef?, 0x4?, 0x25e68d7?})

        /home/soph/harmony/harmony2/cmd/harmony/main.go:127 +0x205

github.com/spf13/cobra.(*Command).execute(0x3fa57a0, {0xc000052258, 0x22, 0x22})

        /home/soph/go/pkg/mod/github.com/spf13/cobra@v1.5.0/command.go:876 +0x69b

github.com/spf13/cobra.(*Command).ExecuteC(0x3fa57a0)

        /home/soph/go/pkg/mod/github.com/spf13/cobra@v1.5.0/command.go:990 +0x38d

github.com/spf13/cobra.(*Command).Execute(...)

        /home/soph/go/pkg/mod/github.com/spf13/cobra@v1.5.0/command.go:918

main.main()

        /home/soph/harmony/harmony2/cmd/harmony/main.go:107 +0x1a



[1]+  Exit 2

It seems it is not related to stream sync. Based on the logs, it happened even before sync module gets started on the setup chain.

@sophoah
Copy link
Contributor

sophoah commented Jan 24, 2025

ok i just tested the same from the dev branch and seems we are also facing the same issue

@sophoah sophoah merged commit 1b4d625 into dev Jan 24, 2025
4 checks passed
@sophoah sophoah deleted the refactor/staged_stream_sync_long_range branch January 24, 2025 08:31
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.

4 participants