Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

Ideas about abci architecture #133

Open
yihuang opened this issue Jun 30, 2020 · 0 comments
Open

Ideas about abci architecture #133

yihuang opened this issue Jun 30, 2020 · 0 comments

Comments

@yihuang
Copy link
Contributor

yihuang commented Jun 30, 2020

sorry to open a new issue for this, this is based on my current understanding of the abci semantics and rust ecosystem, I see there was already lots of discussions on this topic, I confess I didn't finish reading them all, there are probably some overlapping ideas here.

abci design

server thread

Run a single thread async executor (I think single thread should be good enough here).

Only handle networking and protobuf messages encoding/decoding.

Send the parsed request to different SPSC channels for different connections:

  • consensus channel
  • info channel
  • mempool channel

get result

Send a oneshot channel together with the request to get the result, like this:

let (sender, receiver) = channel::oneshot();
req_chan.send((request, send));
let result = receiver.recv().await;

inspect current connection role

Connection handler should peak the first message to decide the role of current connection, then it can choose which channel to send the message.

We can also enforce other restrictions based on this connection role information, like:

  • at most one connection at a time with each role
  • Some roles support re-connect, some don't (consensus connection?)

logic threads

app logic subscribe to the channels to process the requests, app logic is free to decide it's own internal threading policy(async vs sync, single thread vs multiple threads).

app states

abci library may or may not provide some abstraction to help app logic handle the state machine semantic or states separation.

Example

let (consensus_sender, consensus_receiver) = channel:spsc();
let (info_sender, info_receiver) = channel:spsc();
let (mempool_sender, mempool_receiver) = channel:spsc();
thread::spawn(|| {
  ...
})
abci::run(addr, consensus_sender, info_sender, mempool_sender);
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant