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

continuously send new activations and malfeasance proofs to peers #5306

Closed
dshulyak opened this issue Nov 26, 2023 · 5 comments
Closed

continuously send new activations and malfeasance proofs to peers #5306

dshulyak opened this issue Nov 26, 2023 · 5 comments

Comments

@dshulyak
Copy link
Contributor

dshulyak commented Nov 26, 2023

we are not syncing activations and malfeasence proofs reliably (#4831)

  • activations and proofs should be indexed in memory by timestamp when they are received. we should limit index to one full epoch
  • peers can ask for a set of objects that were received after certain timestamp
  • it will do so continuously every 5-30 minutes. there should be some randomization, for example round is 5 minutes, but we request only from a subset of peers on every round
  • it will store timestamps for each individual peer for last X known peers. can use local db for that
  • for unknown peers we ask for all malfeasence proofs (timestamp = 0) and activations that could be created in this epoch (timestamp=epoch_start.timestamp())
  • we should be using native libp2p streams instead of custom fetcher code, as the latter is not very good and needs to be replaced

this code should start working after we executed initial sync that tries to download data from the very beggining without additional logic.

@ivan4th
Copy link
Contributor

ivan4th commented Dec 22, 2023

Related: #3987 (comment)
Using technique from Range-Based Set Reconciliation by Aljoscha Meyer, which is used for things like iroh-sync, it should be possible to sync activations and malfeasance proofs across peers cheaply and often without the peers keeping track of each other.

@lrettig lrettig changed the title continuously send new activations and malfeasence proofs to peers continuously send new activations and malfeasance proofs to peers Dec 26, 2023
@dshulyak
Copy link
Contributor Author

dshulyak commented Mar 1, 2024

i think we can do something simpler for malfeasance proofs, following the pattern in #5599.

we can ask 5-10 peers for all equivocating identities every 10-30 minutes. and then download full missing proofs. we don't expect this number to be significant, as it effectively cancels all rewards. the ultimate attack here is that if all identities will equivocate, and this is bounded by the number of atxs.

this will enable distributed verification significantly faster.

@dshulyak
Copy link
Contributor Author

dshulyak commented Mar 8, 2024

proposed protocol:

  • on node startup check how long ago proofs were synced, if it was in a previous epoch or a quarter of epoch ago download all malfeasance identities and download missing proofs synchronously from N peers. N can be 2-3, just to avoid downloading data from not very well synced node
  • otherwise spin up a background loop to download malfeasance identities every M minutes from N peers. and then sync missing malfeasance proofs for those identities. the interval and number of peers can be parametrized, but should be chosen such that overhead is negligible.

for example, we have ~600 malfeasance/canceled identities, if this number grows to 3000 then every query will have to download 10KB of data. if we ask 10 peers every 30 minutes (not concurrently), thats 55 bytes per second.

@ivan4th
Copy link
Contributor

ivan4th commented Mar 8, 2024

I think this approach should work quite well at least for a few years (unless the number of malfeasant identities grows for some unanticipated reason, which is unlikely)

@pigmej
Copy link
Member

pigmej commented Mar 8, 2024

Can we then try to expedite that to the mainnet? It will make us able to use distributed verification.

spacemesh-bors bot pushed a commit that referenced this issue Mar 22, 2024
## Motivation

Need to sync malfeasance proofs continuously to facilitate distributed verification. See #5306
@ivan4th ivan4th closed this as completed Apr 18, 2024
@github-project-automation github-project-automation bot moved this from 🔖 Next to ✅ Done in Dev team kanban Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

3 participants