From 32ca0008a56de4cb5749dd966407588b773c49b1 Mon Sep 17 00:00:00 2001 From: AlexG Date: Sat, 18 Nov 2023 11:40:47 +0900 Subject: [PATCH] split-merge_page_added --- .../develop/blockchain/sharding-lifecycle.mdx | 74 +++ sidebars.js | 8 + .../blockchain-fundamentals/split-merge.svg | 441 ++++++++++++++++++ 3 files changed, 523 insertions(+) create mode 100644 docs/develop/blockchain/sharding-lifecycle.mdx create mode 100644 static/img/docs/blockchain-fundamentals/split-merge.svg diff --git a/docs/develop/blockchain/sharding-lifecycle.mdx b/docs/develop/blockchain/sharding-lifecycle.mdx new file mode 100644 index 0000000000..f1b98bb179 --- /dev/null +++ b/docs/develop/blockchain/sharding-lifecycle.mdx @@ -0,0 +1,74 @@ +# Infinity Sharding Paradigm + +:::danger +Page is under development. +::: + +## Understanding Split Merge in TON Blockchain + +The TON (Telegram Open Network) Blockchain introduces innovative concepts for blockchain scalability and efficiency. One such concept is the Split Merge functionality, integral to its blockchain architecture. This short article explores the key aspects of Split Merge in the TON Blockchain, focusing on its role within the Infinite Sharding Paradigm (ISP). + +#### Infinite Sharding Paradigm (ISP) and its Application + +ISP underpins the TON Blockchain's design, treating each account as part of its separate "accountchain." These accountchains are then aggregated into shardchain blocks for efficiency. The state of a shardchain comprises the states of all its accountchains. Thus, a shardchain block essentially is a collection of virtual blocks of accounts assigned to it. + +- **ShardState**: Approximated as Hashmap(n, AccountState), where n is the bit length of the account_id. +- **ShardBlock**: Approximated as Hashmap(n, AccountBlock). + +Each shardchain, or more precisely, each shardchain block, is identified by a combination of `workchain_id` and a binary prefix `s` of the account_id. + +## Sharding Example + +![](/img/docs/blockchain-fundamentals/split-merge.svg) + +In the provided graphic scheme: + +- The black line represents the masterchain. +- Shards of a workchain are divided by time and denoted in black dashed line. +- Blocks 101, 102, 103, and 80 relate to the masterchain block with seqno=29. Here, 101, 102, and 103 are in one shard, while 80 is in another. +- If a split or merge event happens, the affected shards pause until the next masterchain block. + +In summary, Split Merge in TON Blockchain is a complex yet efficient mechanism that enhances scalability and interaction within the blockchain network. It exemplifies TON's approach to resolving common blockchain challenges, emphasizing efficiency and global consistency. + + +## Sharding Details + +#### Split and Non-Split Parts of Shardchain + +A shardchain block and state are divided into two parts: + +1. **Split Part**: Complies with the ISP form, containing account-specific data. +2. **Non-Split Part**: Involves data pertaining to the block's interaction with other blocks and the outside world. + +#### Interaction with Other Blocks + +The non-split parts are crucial for ensuring global consistency, reduced to internal and external local consistency conditions. They are significant for: + +- Message forwarding between shardchains. +- Transactions involving multiple shardchains. +- Delivery guarantees and validation of a block's initial state against its predecessor. + +#### Inbound and Outbound Messages + +Key components of the non-split part of a shardchain block include: + +- **InMsgDescr**: Descriptions of all messages imported into the block. +- **OutMsgDescr**: Descriptions of all messages exported or generated by the block. + +#### Block Header and Validator Signatures + +The block header, another non-split component, contains essential information like workchain_id, binary prefix of account_ids, and various hashes (e.g., of the immediate predecessor). Validator signatures are appended to the unsigned block, forming the signed block. + +#### Outbound Message Queue + +OutMsgQueue in the shardchain state is a critical non-split part. It holds undelivered messages from OutMsgDescr until they are processed or delivered to their destination. + +#### Shard Split and Merge Mechanics + +In the context of dynamic sharding, shard configurations may change due to split and merge events. These events are synchronized with the masterchain block. For instance, if a split or merge occurs, the affected shards wait for the next masterchain block before proceeding. + + +## See Also + +* [Block Layout](/develop/data-formats/block-layout) +* [Whitepapers](/learn/docs) \ No newline at end of file diff --git a/sidebars.js b/sidebars.js index 9baf21bbe4..b47360a996 100644 --- a/sidebars.js +++ b/sidebars.js @@ -549,6 +549,14 @@ const sidebars = { } ], }, + { + type: 'category', + label: 'Blockchain Fundamentals', + items: [ + + 'develop/blockchain/sharding-lifecycle', + ], + }, { type: 'category', label: 'Data Formats', diff --git a/static/img/docs/blockchain-fundamentals/split-merge.svg b/static/img/docs/blockchain-fundamentals/split-merge.svg new file mode 100644 index 0000000000..a664bf9f55 --- /dev/null +++ b/static/img/docs/blockchain-fundamentals/split-merge.svg @@ -0,0 +1,441 @@ + + + + + + + + + + + + + + + + + + + + + + split-merge-scheme + + + + Circle.37 + + + + + + + Sheet.2 + seqno = 28 + + + + seqno = 28 + + Dynamic connector.44 + + + + Dynamic connector.4 + + + + Sheet.5 + Masterchain (workchain = -1) + + + + Masterchain (workchain = -1) + + Circle.7 + + + + + + + Dynamic connector.8 + + + + Circle.9 + + + + + + + Sheet.12 + seqno = 29 + + + + seqno = 29 + + Sheet.13 + seqno = 30 + + + + seqno = 30 + + Circle.14 + + + + + + + Dynamic connector.15 + + + + Sheet.16 + Basechain (workchain = 0) + + + + Basechain (workchain = 0) + + Sheet.17 + 100 + + + + 100 + + Circle.18 + + + + + + + Dynamic connector.19 + + + + Sheet.20 + 101 + + + + 101 + + Circle.22 + + + + + + + Dynamic connector.23 + + + + Sheet.24 + 102 + + + + 102 + + Circle.25 + + + + + + + Dynamic connector.26 + + + + Sheet.27 + 103 + + + + 103 + + Dynamic connector.28 + + + + Circle.29 + + + + + + + Dynamic connector.30 + + + + Sheet.31 + 104 + + + + 104 + + Dynamic connector.32 + + + + Circle.33 + + + + + + + Dynamic connector.34 + + + + Sheet.35 + 105 + + + + 105 + + Circle.36 + + + + + + + Dynamic connector.37 + + + + Sheet.38 + 106 + + + + 106 + + Dynamic connector.39 + + + + Dynamic connector.40 + + + + Circle.41 + + + + + + + Sheet.42 + 60 + + + + 60 + + Circle.43 + + + + + + + Dynamic connector.44 + + + + Sheet.45 + 61 + + + + 61 + + Circle.46 + + + + + + + Dynamic connector.47 + + + + Sheet.48 + 62 + + + + 62 + + Circle.50 + + + + + + + Dynamic connector.51 + + + + Sheet.52 + 63 + + + + 63 + + Dynamic connector.53 + + + + Dynamic connector + + + + Dynamic connector.55 + + + + Dynamic connector.59 + + + + Dynamic connector.60 + + + + Circle.67 + + + + + + + Sheet.68 + 80 + + + + 80 + + Circle.69 + + + + + + + Dynamic connector.70 + + + + Sheet.71 + 81 + + + + 81 + + Circle.72 + + + + + + + Dynamic connector.73 + + + + Sheet.74 + 82 + + + + 82 + + Dynamic connector.76 + + + + Dynamic connector.77 + + + + Dynamic connector.79 + + + + Dynamic connector.80 + t + + + + + t + + Circle.81 + + + + + + + Dynamic connector.82 + + + + Sheet.83 + seqno = 31 + + + + seqno = 31 + + Dynamic connector.84 + + + +