Skip to content
This repository has been archived by the owner on Jun 17, 2022. It is now read-only.

RPC instead of client / server design #29

Closed
andrecronje opened this issue Oct 10, 2018 · 4 comments
Closed

RPC instead of client / server design #29

andrecronje opened this issue Oct 10, 2018 · 4 comments
Assignees
Labels
enhancement New feature or request
Projects

Comments

@andrecronje
Copy link
Member

Is your feature request related to a problem? Please describe.
Current architecture for Lachesis to EVM interaction is client server design.

A Lachesis nodes specifies a downstream client. An EVM node exposes a proxy server to receive responses.

This design tightly couples a Lachesis node with an EVM node. The design is supposed to allow for join/drop participation. So a Lachesis node can not have awareness of an EVM node. Although EVM nodes should have awareness of Lachesis nodes.

Describe the solution you'd like
New EVM joins

The EVM genesis file creates a stateHash. This hash must be sent to the Lachesis node. This stateHash is used to see which blockstream is appropriate. The node needs to go into FastSync mode and synchronize missing blocks until the state matches.

From here nodes can either subscribe to WS for blocks, or simply use incremental catchup calls with their attached node. Alternatively block propagation could occur via standard gossip based communication protocols and the lachesis network needs to keep track of the evm network.

@andrecronje andrecronje added this to To do in Lachesis via automation Oct 12, 2018
@andrecronje andrecronje added the enhancement New feature or request label Oct 12, 2018
@RoanBrand
Copy link
Contributor

Just to be clear:

  • Many EVMs will be able to join a single node.
  • When do you want the evm to send the stateHash to the node as you mention: Is this the same stateHash the node currently receives from rpc calls to the EVM State.CommitBlock ? If so, doesn't that only happen when the node syncs with the EVM?

@RoanBrand
Copy link
Contributor

RoanBrand commented Oct 18, 2018

@andrecronje

I see the current stateHash isn't being used by the node: 06bbb03#diff-fe72219e854ef7d912a53b4f7dea56afL604

Will the stateHash only be sent from an EVM once at first connect? Or each time the node sends a block (commit block)?

If the statehash is not needed when sending blocks it would be quite trivial to finish the websocket subscribe model where the node would just send out blocks to each currently connected EVM.

The problem comes in where the EVM needs to send back an associated stateHash with a received block. This is a request-response model that is more suited for rpc. (the node would need extra layer of logic to distinguish between incoming tx's and statehashes, etc. And it would need to keep track of which hash for which block previously sent)

If you want to use 1 connection between a node and evm and want to use websockets we could try something like:
https://gist.github.com/mowings/dad4917b6fc21e6e5ffe2da3b16e7ef9

@RoanBrand RoanBrand moved this from To do to In progress in Lachesis Oct 24, 2018
@RoanBrand
Copy link
Contributor

RoanBrand commented Oct 24, 2018

@andrecronje
Minor stuff left:

  • Test when client disconnects gracefully from node that node deletes connection
  • After WS ping-pong timeout also disconnect and delete.
  • VM must retry connecting to node indefinitely if not currently connected
  • Remove lachesis node -c flag and the evm -lachesis.client_addr flags

Do you agree with all that?
One thing still unclear: When blocks are sent to VMs, each block send request returns a statehash. Now we receive multiple statehashes from each connected vm. What will the consequences/policy be around that?
Currently I return the last client's one.

@andrecronje
Copy link
Member Author

We can remove the stateHash logic.
Agreed on all items.
Are you working on the EVM implementation as well?

Lachesis automation moved this from In progress to Done Dec 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
Lachesis
  
Done
Development

No branches or pull requests

2 participants