Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions foundations/consensus/catchain-overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
## Problem

No network can guarantee that

- messages will be delivered,
- messages will arrive in the order they were sent,
- even if it's 2 messages between 2 nodes.
Expand All @@ -28,7 +29,7 @@

### Formal capabilities

The protocol implements a [CRDT](https://en.wikipedia.org/wiki/Conflict-free_replicated_data_type) over the set of messages known to each node and achieves [eventual consistency](https://en.wikipedia.org/wiki/Eventual_consistency). As a synchronization mechanism, it uses the idea similar to [vector clock](https://en.wikipedia.org/wiki/Vector_clock) with modifications that preserve eventual consistency even when some nodes are Byzantine.

Check warning on line 32 in foundations/consensus/catchain-overview.mdx

View workflow job for this annotation

GitHub Actions / Spelling

Unknown word (CRDT) Suggestions: (crit, CDT, CRD, CRT, rcpt)

<Aside type="note">
The [ADNL](/foundations/network/adnl) protocol is responsible for message integrity, at-least-once delivery guarantees, and message authenticity.
Expand All @@ -39,7 +40,7 @@
Catchain selects [five](https://github.com/ton-blockchain/ton/blob/34823b1ea378edbe3bc59f3bcc48126480a0b768/catchain/catchain-receiver.cpp#L36) neighbors at random and periodically refreshes the list each random interval between [60 and 120 seconds](https://github.com/ton-blockchain/ton/blob/34823b1ea378edbe3bc59f3bcc48126480a0b768/catchain/catchain-receiver.cpp#L988) in the current configuration. Note, that the neighbor relation is not symmetric: if B is a neighbor of A, it does not imply that A is also a neighbor of B.

<Aside type="tip">
In the current implementation, [Mersenne Twister](https://en.wikipedia.org/wiki/Mersenne_Twister) is used to pick the random interval for refreshing the neighbor list. It is seeded with values from [std::random_device](https://en.cppreference.com/w/cpp/numeric/random/random_device.html), whose behavior is platform-dependent.
In the current implementation, [Mersenne Twister](https://en.wikipedia.org/wiki/Mersenne_Twister) is used to pick the random interval for refreshing the neighbor list. It is seeded with values from [std::random\_device](https://en.cppreference.com/w/cpp/numeric/random/random_device.html), whose behavior is platform-dependent.

Check warning on line 43 in foundations/consensus/catchain-overview.mdx

View workflow job for this annotation

GitHub Actions / Spelling

Unknown word (Mersenne) Suggestions: (Messene, mergence, mesne, mermen, Mersin)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In the current implementation, [Mersenne Twister](https://en.wikipedia.org/wiki/Mersenne_Twister) is used to pick the random interval for refreshing the neighbor list. It is seeded with values from [std::random\_device](https://en.cppreference.com/w/cpp/numeric/random/random_device.html), whose behavior is platform-dependent.
In the current implementation, [Mersenne Twister](https://en.wikipedia.org/wiki/Mersenne_Twister) is used to pick the random interval for refreshing the neighbor list. It is seeded with values from [`std::random_device`](https://en.cppreference.com/w/cpp/numeric/random/random_device.html), whose behavior is platform-dependent.

Since its a code ref, let's use backticks

</Aside>

## Message identification
Expand Down Expand Up @@ -72,21 +73,20 @@
C -- "(C; 2)<br/>prev: (C; 1)<br/>deps: (A; 1), (B; 1)" --> B
```

These messages do not have an order by default. In asynchronous system they can be received in any order. Declaring message dependencies helps to establish a particial ordering on all messages in general and on each of node in particular. This is possible because in catchain "dependency" relation is antisymmetric, transitive and reflexive.

Check warning on line 76 in foundations/consensus/catchain-overview.mdx

View workflow job for this annotation

GitHub Actions / Spelling

Unknown word (particial) Suggestions: (patrician, patricidal, Patricia, partial, parricidal)

## Handling Byzantine nodes

The key goal is not to allow Byzantine nodes break the particial order of the messages in the Cathcain. It theoretically can be broken by violating one of three key properties.

Check warning on line 80 in foundations/consensus/catchain-overview.mdx

View workflow job for this annotation

GitHub Actions / Spelling

Unknown word (Cathcain) Suggestions: (catchain, Catchain, catchains, Catchains, catechin)

Check warning on line 80 in foundations/consensus/catchain-overview.mdx

View workflow job for this annotation

GitHub Actions / Spelling

Unknown word (particial) Suggestions: (patrician, patricidal, Patricia, partial, parricidal)

### Antisymmetry

Check warning on line 82 in foundations/consensus/catchain-overview.mdx

View workflow job for this annotation

GitHub Actions / Spelling

Unknown word (Antisymmetry) Suggestions: (antisymmetric)

This property means, that $\forall A, B depends(A, B) -> !depends(B, A)$. Catchain preserves this property, as when `A` depends on `B`, `B` is included in the `body hash` field of `A`. Therefore `B` can't depend on `A` as it's `body hash` mush include `A`.

### Transitivity

CHECK
This property means, that $\forall A B C depends(A, B) && depends(B, C) -> depends(A, C)$. This property is preserved implicitly by honest nodes because if `A` depends on `B`, `A` will wait in queue for processing of `B`. Imagine a situation, when `

This property means, that $\forall A B C depends(A, B) && depends(B, C) -> depends(A, C)$. This property is preserved implicitly by honest nodes because if `A` depends on `B`, `A` will wait in queue for processing of `B`. Imagine a situation, when \`

### Detecting forks (duplicate message IDs)

Expand All @@ -106,7 +106,7 @@
<code>(A<sub>i</sub>, B<sub>j</sub>, C<sub>k</sub>, D<sub>m</sub> ...)</code>
This vector tracks the last processed message for each validator. So, if A<sub>i</sub> is stored and A<sub>i+2</sub> arrives, the node must download A<sub>i+1</sub>.

(Link to https://en.wikipedia.org/wiki/Vector_clock)
(Link to [https://en.wikipedia.org/wiki/Vector\_clock](https://en.wikipedia.org/wiki/Vector_clock))

## Dependency retrieval process

Expand Down
Loading