ethereum / cbc-casper

GNU Affero General Public License v3.0
229 stars 44 forks source link

Feat/async network #151

Closed djrtwo closed 6 years ago

djrtwo commented 6 years ago

Re-implement network is a collection of PriorityQueues one related to each validator.

QUESTION realizing send and send_all should probably include who is the sender. Right now, assumes message.sender is the sender for the delay function, but this is limiting if we want to model a more complex network and propagation (like gossiping). Thoughts?

(obviously validators could trick the network with this function exposed, but that access control maybe should exist in the simulation layer)

djrtwo commented 6 years ago

@naterush I wrote a bunch of in-line notes that might have been marked as "out dated" be sure to check those out.

djrtwo commented 6 years ago

@naterush realizing send and send_all should include who is the sender. Right now, assumes message.sender is the sender for the delay function, but this is limiting if we want to model a more complex network and propagation (like gossiping)

obviously validators could trick the network, but that access control maybe should exist in the simulation layer

naterush commented 6 years ago

@djrtwo had this realization as well w/ the last network PR. For now, I think there are two options that make sense:

  1. Leave as is. There probably will not be a huge need for changing the sender for a while (we are going to have to add signatures, message validity checking, and the network will be hyper-realistic). So it seems not super high priority to me.
  2. Add it in for now, but ignore access control (and say this comes later with signatures, or something). Just make it so validators don't lie.

I think 1 is fine for now - but let me know what you think.

djrtwo commented 6 years ago

@naterush @SeanAvery I suppose a threaded simulator that is controlling the network might override time with a clock... eh?

djrtwo commented 6 years ago

Generally ready to go. Still have StepNetwork...

Making a few issues around things to do related to this PR

naterush commented 6 years ago

@djrtwo last change, let's add back in either generated a gif or displaying by default. I'm fine with whatever for now, but something should happen by default (or we should change the make commands) to display or save.

naterush commented 6 years ago

Then LGTM!