-
Notifications
You must be signed in to change notification settings - Fork 215
mesh hash resolution with peers #2507
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
Comments
this issue is broken down to the following smaller issues: |
## Motivation <!-- Please mention the issue fixed by this PR or detailed motivation --> Closes #3259 preparing for #2507 <!-- `Closes #XXXX, closes #XXXX, ...` links mentioned issues to this PR and automatically closes them when this it's merged --> ## Changes <!-- Please describe in detail the changes made --> ran ``` go get github.com/libp2p/go-libp2p@latest go mod tidy go get github.com/libp2p/go-libp2p-pubsub@latest go mod tidy ``` ## Test Plan <!-- Please specify how these changes were tested (e.g. unit tests, manual testing, etc.) --> ## DevOps Notes <!-- Please uncheck these items as applicable to make DevOps aware of changes that may affect releases --> - [x] This PR does not require configuration changes (e.g., environment variables, GitHub secrets, VM resources) - [x] This PR does not affect public APIs - [x] This PR does not rely on a new version of external services (PoET, elasticsearch, etc.) - [x] This PR does not make changes to log messages (which monitoring infrastructure may rely on)
## Motivation <!-- Please mention the issue fixed by this PR or detailed motivation --> Closes #3259 preparing for #2507 <!-- `Closes #XXXX, closes #XXXX, ...` links mentioned issues to this PR and automatically closes them when this it's merged --> ## Changes <!-- Please describe in detail the changes made --> ran ``` go get github.com/libp2p/go-libp2p@latest go mod tidy go get github.com/libp2p/go-libp2p-pubsub@latest go mod tidy ``` ## Test Plan <!-- Please specify how these changes were tested (e.g. unit tests, manual testing, etc.) --> ## DevOps Notes <!-- Please uncheck these items as applicable to make DevOps aware of changes that may affect releases --> - [x] This PR does not require configuration changes (e.g., environment variables, GitHub secrets, VM resources) - [x] This PR does not affect public APIs - [x] This PR does not rely on a new version of external services (PoET, elasticsearch, etc.) - [x] This PR does not make changes to log messages (which monitoring infrastructure may rely on)
## Motivation <!-- Please mention the issue fixed by this PR or detailed motivation --> Closes #3259 preparing for #2507 <!-- `Closes #XXXX, closes #XXXX, ...` links mentioned issues to this PR and automatically closes them when this it's merged --> ## Changes <!-- Please describe in detail the changes made --> ran ``` go get github.com/libp2p/go-libp2p@latest go mod tidy go get github.com/libp2p/go-libp2p-pubsub@latest go mod tidy ``` ## Test Plan <!-- Please specify how these changes were tested (e.g. unit tests, manual testing, etc.) --> ## DevOps Notes <!-- Please uncheck these items as applicable to make DevOps aware of changes that may affect releases --> - [x] This PR does not require configuration changes (e.g., environment variables, GitHub secrets, VM resources) - [x] This PR does not affect public APIs - [x] This PR does not rely on a new version of external services (PoET, elasticsearch, etc.) - [x] This PR does not make changes to log messages (which monitoring infrastructure may rely on)
## Motivation <!-- Please mention the issue fixed by this PR or detailed motivation --> Closes #3259 preparing for #2507 <!-- `Closes #XXXX, closes #XXXX, ...` links mentioned issues to this PR and automatically closes them when this it's merged --> ## Changes <!-- Please describe in detail the changes made --> ran ``` go get github.com/libp2p/go-libp2p@latest go mod tidy go get github.com/libp2p/go-libp2p-pubsub@latest go mod tidy ``` ## Test Plan <!-- Please specify how these changes were tested (e.g. unit tests, manual testing, etc.) --> ## DevOps Notes <!-- Please uncheck these items as applicable to make DevOps aware of changes that may affect releases --> - [x] This PR does not require configuration changes (e.g., environment variables, GitHub secrets, VM resources) - [x] This PR does not affect public APIs - [x] This PR does not rely on a new version of external services (PoET, elasticsearch, etc.) - [x] This PR does not make changes to log messages (which monitoring infrastructure may rely on)
## Motivation <!-- Please mention the issue fixed by this PR or detailed motivation --> Closes #3259 preparing for #2507 <!-- `Closes #XXXX, closes #XXXX, ...` links mentioned issues to this PR and automatically closes them when this it's merged --> ## Changes <!-- Please describe in detail the changes made --> ran ``` go get github.com/libp2p/go-libp2p@latest go mod tidy go get github.com/libp2p/go-libp2p-pubsub@latest go mod tidy ``` ## Test Plan <!-- Please specify how these changes were tested (e.g. unit tests, manual testing, etc.) --> ## DevOps Notes <!-- Please uncheck these items as applicable to make DevOps aware of changes that may affect releases --> - [x] This PR does not require configuration changes (e.g., environment variables, GitHub secrets, VM resources) - [x] This PR does not affect public APIs - [x] This PR does not rely on a new version of external services (PoET, elasticsearch, etc.) - [x] This PR does not make changes to log messages (which monitoring infrastructure may rely on)
## Motivation <!-- Please mention the issue fixed by this PR or detailed motivation --> Closes #3259 preparing for #2507 <!-- `Closes #XXXX, closes #XXXX, ...` links mentioned issues to this PR and automatically closes them when this it's merged --> ## Changes <!-- Please describe in detail the changes made --> ran ``` go get github.com/libp2p/go-libp2p@latest go mod tidy go get github.com/libp2p/go-libp2p-pubsub@latest go mod tidy ``` ## Test Plan <!-- Please specify how these changes were tested (e.g. unit tests, manual testing, etc.) --> ## DevOps Notes <!-- Please uncheck these items as applicable to make DevOps aware of changes that may affect releases --> - [x] This PR does not require configuration changes (e.g., environment variables, GitHub secrets, VM resources) - [x] This PR does not affect public APIs - [x] This PR does not rely on a new version of external services (PoET, elasticsearch, etc.) - [x] This PR does not make changes to log messages (which monitoring infrastructure may rely on)
## Motivation <!-- Please mention the issue fixed by this PR or detailed motivation --> Closes #3259 preparing for #2507 <!-- `Closes #XXXX, closes #XXXX, ...` links mentioned issues to this PR and automatically closes them when this it's merged --> ## Changes <!-- Please describe in detail the changes made --> ran ``` go get github.com/libp2p/go-libp2p@latest go mod tidy go get github.com/libp2p/go-libp2p-pubsub@latest go mod tidy ``` ## Test Plan <!-- Please specify how these changes were tested (e.g. unit tests, manual testing, etc.) --> ## DevOps Notes <!-- Please uncheck these items as applicable to make DevOps aware of changes that may affect releases --> - [x] This PR does not require configuration changes (e.g., environment variables, GitHub secrets, VM resources) - [x] This PR does not affect public APIs - [x] This PR does not rely on a new version of external services (PoET, elasticsearch, etc.) - [x] This PR does not make changes to log messages (which monitoring infrastructure may rely on)
## Motivation <!-- Please mention the issue fixed by this PR or detailed motivation --> Closes #3259 preparing for #2507 <!-- `Closes #XXXX, closes #XXXX, ...` links mentioned issues to this PR and automatically closes them when this it's merged --> ## Changes <!-- Please describe in detail the changes made --> ran ``` go get github.com/libp2p/go-libp2p@latest go mod tidy go get github.com/libp2p/go-libp2p-pubsub@latest go mod tidy ``` ## Test Plan <!-- Please specify how these changes were tested (e.g. unit tests, manual testing, etc.) --> ## DevOps Notes <!-- Please uncheck these items as applicable to make DevOps aware of changes that may affect releases --> - [x] This PR does not require configuration changes (e.g., environment variables, GitHub secrets, VM resources) - [x] This PR does not affect public APIs - [x] This PR does not rely on a new version of external services (PoET, elasticsearch, etc.) - [x] This PR does not make changes to log messages (which monitoring infrastructure may rely on)
## Motivation <!-- Please mention the issue fixed by this PR or detailed motivation --> Closes #3259 preparing for #2507 <!-- `Closes #XXXX, closes #XXXX, ...` links mentioned issues to this PR and automatically closes them when this it's merged --> ## Changes <!-- Please describe in detail the changes made --> ran ``` go get github.com/libp2p/go-libp2p@latest go mod tidy go get github.com/libp2p/go-libp2p-pubsub@latest go mod tidy ``` ## Test Plan <!-- Please specify how these changes were tested (e.g. unit tests, manual testing, etc.) --> ## DevOps Notes <!-- Please uncheck these items as applicable to make DevOps aware of changes that may affect releases --> - [x] This PR does not require configuration changes (e.g., environment variables, GitHub secrets, VM resources) - [x] This PR does not affect public APIs - [x] This PR does not rely on a new version of external services (PoET, elasticsearch, etc.) - [x] This PR does not make changes to log messages (which monitoring infrastructure may rely on)
## Motivation <!-- Please mention the issue fixed by this PR or detailed motivation --> part of #2507 Closes #3247 ## Changes <!-- Please describe in detail the changes made --> - turn on gossipsub peer scoring. params are copied from FIL (https://github.com/filecoin-project/lotus) - shorten protocol names and moved them to p2p/pubsub pkg - gossip validation return `ValidationReject` on malformed msgs for atx/poetproof/block proposals ## Test Plan <!-- Please specify how these changes were tested (e.g. unit tests, manual testing, etc.) --> unit test, systests
## Motivation <!-- Please mention the issue fixed by this PR or detailed motivation --> part of #2507 Closes #3247 ## Changes <!-- Please describe in detail the changes made --> - turn on gossipsub peer scoring. params are copied from FIL (https://github.com/filecoin-project/lotus) - shorten protocol names and moved them to p2p/pubsub pkg - gossip validation return `ValidationReject` on malformed msgs for atx/poetproof/block proposals ## Test Plan <!-- Please specify how these changes were tested (e.g. unit tests, manual testing, etc.) --> unit test, systests
i will take a look, but just a note that tortoise.Rerun is completely removed in the upcoming changes. |
couple of other more general notes:
so basically there is no need for a distinct thing as tortoise rerun, rerun will be a part of the regular tortoise flow. this is how recovery from 50/50 partition looks like https://github.com/dshulyak/go-spacemesh/blob/rerun-within-window/tortoise/tortoise_test.go#L1563-L1582 . i will be opening prs at the start of the week. adopting opinion is also not very relevant, i suggest we don't do it for genesis. full tortoise using 10 000 layers as a sliding window is completely viable to run. |
yay.
ok.
so essentially, in a 30/70 split, all nodes in 30-split will enter self-healing. correct? |
30-split will count votes in full mode (e.g from both sides) at some point and after that vote consistently with 70-split. but there should be no voting using coin |
## Motivation <!-- Please mention the issue fixed by this PR or detailed motivation --> part of #2507 <!-- `Closes #XXXX, closes #XXXX, ...` links mentioned issues to this PR and automatically closes them when this it's merged --> ## Changes <!-- Please describe in detail the changes made --> - move the layer data/opinion fetching logic from fetch pkg to syncer pkg. as such, fetch is made simpler by fetching data as directed - add `GetPeers()` interface to fetch so that syncer can choose which peer to sync data from. this also simplifies the callbacks to fetch package as the callers know a priori how many peers are requested. - add functional options to syncer/fetcher constructor to better facilitate testing code structure now ``` - fetch - fetch.go -> serve hash data in batches - mesh_data.go -> serve mesh data in batches - syncer - data_fetcher.go -> manages epoch/layer logic - syncer.go -> manages data sync - state_syncer.go -> manages state sync ```
## Motivation <!-- Please mention the issue fixed by this PR or detailed motivation --> part of #2507 <!-- `Closes #XXXX, closes #XXXX, ...` links mentioned issues to this PR and automatically closes them when this it's merged --> ## Changes <!-- Please describe in detail the changes made --> - add fork finder to find the layer at which the node's mesh hash diverge with the peer's. for each fork-finding session: - number of hashes requested is capped at N - uses a modified binary search algorithm that request N hashes at a time, with the boundaries hashes (from and to) re-queried each time to make sure the peer has not changed during the session - fetch: request mesh hashes in batch from a specified peer
## Motivation <!-- Please mention the issue fixed by this PR or detailed motivation --> Closes #2507 Closes #2527 <!-- `Closes #XXXX, closes #XXXX, ...` links mentioned issues to this PR and automatically closes them when this it's merged --> ## Changes <!-- Please describe in detail the changes made --> - syncer: remove code syncing block validity. this is done to simplified genesis logic, as full tortoise is feasible. - syncer: when detecting peers has a different mesh hash, taking the following measure - for each peer, find fork layer with that peer and resync from that peer [fork+1, latest] - avoid resync from the same peer within the same run - avoid resync based on the same layer hash divergence - after all data is collected, trigger ProcessLayer to allow tortoise to tally votes - fetch: use EpochInfo to capture weight/beacon/active set when peers exchange epoch data. this is used - to sync epoch ATXs - to avoid malicious peer forcing the node to do endless fork-finding session, make sure the peer's active set is valid prior to entering a session - add systests for 30/70 and 50/50 splits. the success condition is that all nodes agreed on the state hash for every layer
design discussion
spacemeshos/SMIPS#51
spacemeshos/SMIPS#60
implementation plan
fetch
add the following to fetch interface
syncer
syncer periodically check peers’ agreement on the mesh hash (aka aggregated hash) along with its layer opinions.
given a list of opinions for layer
N
from peers, syncer first finds those that differ from the node’s mesh hash at layerN-1
. for those peers. pseudo code below:fork finder
add the following to facilitate finding divergent layer with peers.
basic algorithm
maxHashesInReq
. based on that, calculate the delta layers in each step, and the number of steps between LA and OD to getmaxHashesInReq
of hashes in requests.example
assuming
maxHashesInReq
is 5the resulting requests with peer X are
adopting a peer's mesh
as per #3573, tortoise will be changed to such that as long as tortoise is fed with new data it will change opinion on the previous layers
assuming syncer decides to adopt the mesh from a confident peer from layer
F+1
toN-1
, it will first fetch the missing ATXs, and ballots/blocks layer by layer fromF+1
.data
OnAtx(atx)
handlerOnBallot(ballot)
handlerOnBlock(block)
)opinions
as per #3573, for genesis, full tortoise using 10 000 layers as a sliding window is completely viable to run. therefore importing opinions from confident peers are not relevant (importing opinions is only relevant for verifying tortoise).
as a result, in the event of network rejoin from a 30/70 split, nodes on the 70-split will remain confident. nodes on the 30-split will do full vote counting on ballots in both sides (self-healing without voting by coin flip) and reach the same mesh hash as the 70-split nodes.
The text was updated successfully, but these errors were encountered: