-
Notifications
You must be signed in to change notification settings - Fork 370
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
Documentation #503
Documentation #503
Conversation
Signed-off-by: Lovesh <[email protected]>
Signed-off-by: Lovesh <[email protected]>
Signed-off-by: Lovesh <[email protected]>
Signed-off-by: Lovesh <[email protected]>
Signed-off-by: Lovesh <[email protected]>
Signed-off-by: Lovesh <[email protected]>
Signed-off-by: Lovesh <[email protected]>
Signed-off-by: Lovesh <[email protected]>
docs/catchup.md
Outdated
@@ -0,0 +1,33 @@ | |||
# Ledger catchup | |||
|
|||
A node uses a process called `catchup` to sync its ledgers with other nodes. It does this process after starting up |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use bullet points to mention all cases where we can start catch-up more explicitly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
The `LedgerManager` performs catchup of each ledger sequentially, which means unless catchup for one ledger is complete, catchup for other will not start. | ||
This is mostly done for simplicity and can be optimised but the pool ledger needs to be caught up first as the pool ledger knows how many nodes are there | ||
in the network. Catchup for any ledger involves these steps: | ||
- Learn the correct state (how many txns, merkle roots) of the ledger by using `LedgerStatus` messages from other nodes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please mention how and when LedgerStatus is sent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is mentioned below.
docs/catchup.md
Outdated
This is mostly done for simplicity and can be optimised but the pool ledger needs to be caught up first as the pool ledger knows how many nodes are there | ||
in the network. Catchup for any ledger involves these steps: | ||
- Learn the correct state (how many txns, merkle roots) of the ledger by using `LedgerStatus` messages from other nodes. | ||
- Once sufficient consistent `LedgerStatus` messages are received so that the node knows the latest state of the ledger, if it finds it ledger to be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please mention the exact number of LedgerStatus messages to be sufficient (see quorums.py)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Relevant code: | ||
- LedgerManager: `plenum/common/ledger_manager.py` | ||
- LedgerInfo: `plenum/common/ledger_info.py` | ||
- Catchup message types: `plenum/common/messages/node_messages.py` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also mention Quorums (quorums.py) containing all quorum values including catch-up quorums.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
docs/catchup.md
Outdated
the receiving node B's size is 30 with merkle root `y`, B sends a proof to A that A's ledger with size 20 and root `x` is a subset of B's ledger with size | ||
30 and root `y`. | ||
- After receiving a `ConsistencyProof`, the node verifies it. | ||
- Once the node that is catching up has sufficient consistent `ConsistencyProof` messages, it knows how many transactions it needs to catchup and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please mention the exact number of ConsistencyProof messages to be sufficient (see quorums.py)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Signed-off-by: Lovesh <[email protected]>
Signed-off-by: Lovesh <[email protected]>
docs/request_handling.md
Outdated
@@ -0,0 +1,54 @@ | |||
# Request handling. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the dot at the end
docs/request_handling.md
Outdated
#### Request handling | ||
Below is a description of how a request is processed. | ||
A node on receiving a client request in `validateClientMsg`: | ||
- The node performs static validation checks (validation that does not require any state, like mandatory fields are present, etc), it calls `RequestHandler`'s `doStaticValidation` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also have a schema-based validation before static validation in req handlers. This schema-based validation checks that the request is a valid request semantically with expected types and limitations. Probably we should mention it here as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
docs/request_handling.md
Outdated
- The node performs static validation checks (validation that does not require any state, like mandatory fields are present, etc), it calls `RequestHandler`'s `doStaticValidation` | ||
- If the static validation passes, it checks if the signature check is required and does that if needed in `verifySignature`. More on this later. | ||
- Checks if it a generic transaction query (`GET_TXN`). If it is then query the ledger for that particular sequence number and return the result. A `REQNACK` might be sent if the query is not correctly constructed. | ||
- Checks if it a specific query (needs a specific `RequestHandler`), if it is then it uses `process_query` that uses the specific `RequestHandler` to respond to the query. A `REQNACK` might be sent if the query is not correctly constructed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be Checks if it is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
docs/request_handling.md
Outdated
A node on receiving a client request in `validateClientMsg`: | ||
- The node performs static validation checks (validation that does not require any state, like mandatory fields are present, etc), it calls `RequestHandler`'s `doStaticValidation` | ||
- If the static validation passes, it checks if the signature check is required and does that if needed in `verifySignature`. More on this later. | ||
- Checks if it a generic transaction query (`GET_TXN`). If it is then query the ledger for that particular sequence number and return the result. A `REQNACK` might be sent if the query is not correctly constructed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be Checks if it is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
docs/request_handling.md
Outdated
A node has atleast 1 authenticator called `CoreAuthNr` whose `authenticate` method is called over the serialised request data to verify signature. | ||
|
||
|
||
Relevant code: `` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use bullet points here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
docs/request_handling.md
Outdated
Below is a description of how a request is processed. | ||
A node on receiving a client request in `validateClientMsg`: | ||
- The node performs static validation checks (validation that does not require any state, like mandatory fields are present, etc), it calls `RequestHandler`'s `doStaticValidation` | ||
- If the static validation passes, it checks if the signature check is required and does that if needed in `verifySignature`. More on this later. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please mention that signature is not required for queries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
- If the `Request` is already in process, then it sends an acknowledgement to the client as a `REQACK` | ||
- If the node has not seen the `Request` before it broadcasts the `Request` to all nodes in a `PROPAGATE`. | ||
- Once a node receives sufficient (`Quorums.propagate`) `PROPAGATE`s for a request, it forwards the request to its replicas. | ||
- A primary replica on receiving a forwarded request does dynamic validation (requiring state, like if violating some unique constraint or doing an unauthorised action) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we mention batching here? That Primary applies dynamic validation for each request in the batch, and that the batch can still be processed if there are invalid requests there. Reject is sent just for invalid requests from the batch,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Batch is an optimisation for consensus, i didn't want to digress, i think a detailed doc explaining our differences in 3PC with RBFT should list batching, merkle roots and checks in 3PC messages, etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, that's fine. Probably it's sufficient here to just mention this doc so that one can have a look how this all works with batches.
|
||
|
||
#### Signature verification | ||
Each node has a `ReqAuthenticator` object which allows to register `ClientAuthNr` objects using `register_authenticator` method. During signature verification, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we mention that we support both single signature and multi-signatures now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe? Do you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to mention this if we have such a section as signature verification.
Signed-off-by: Lovesh <[email protected]>
docs/request_handling.md
Outdated
A node has atleast 1 authenticator called `CoreAuthNr` whose `authenticate` method is called over the serialised request data to verify signature. | ||
|
||
|
||
Relevant code: `` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove `` at the end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
docs/request_handling.md
Outdated
Below is a description of how a request is processed. | ||
A node on receiving a client request in `validateClientMsg`: | ||
- The node performs static validation checks (validation that does not require any state, like mandatory fields are present, etc), it uses `ClientMessageValidator` and | ||
`RequestHandler`'s `doStaticValidation` for this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please put a dot at the end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Signed-off-by: Lovesh <[email protected]>
Signed-off-by: Lovesh <[email protected]>
No description provided.