Skip to content

Commit 168df2c

Browse files
joe-alewinedenyeart
authored andcommitted
[FAB-15979] Improve capabilities documentation
Created new "key concept" capabilities doc. Moved existing capabilities doc to Ops Guide (where it probably always belonged) Change-Id: Ic16baf0e30066121f0b4f2d0e8c5b047680fff1c Signed-off-by: joe-alewine <Joe.Alewine@ibm.com>
1 parent 4e34ccd commit 168df2c

File tree

5 files changed

+165
-66
lines changed

5 files changed

+165
-66
lines changed

docs/source/architecture.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ Architecture Reference
1010
fabric-sdks
1111
discovery-overview
1212
channels
13-
capability_requirements
1413
couchdb_as_state_database
1514
peer_event_services
1615
private-data-arch

docs/source/capabilities_concept.md

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
# Channel capabilities
2+
3+
**Audience**: Channel administrators, node administrators
4+
5+
*Note: this is an advanced Fabric concept that is not necessary for new
6+
users or application developers to understand. However, as channels and
7+
networks mature, understanding and managing capabilities becomes vital.
8+
Furthermore, it is important to recognize that updating capabilties is a
9+
different, though often related, process to upgrading nodes. We'll describe
10+
this in detail in this topic.*
11+
12+
Because Fabric is a distributed system that will usually involve multiple
13+
organizations, it is
14+
possible (and typical) that different versions of Fabric code will exist on
15+
different nodes within the network as well as on the channels in that network.
16+
Fabric allows this --- it is not necessary for every peer and ordering node to
17+
be at the same version level. In fact, supporting different version levels
18+
is what enables rolling upgrades of Fabric nodes.
19+
What **is** important is that networks and channels
20+
process things in the same way, creating deterministic results for things like
21+
channel configuration updates and chaincode invocations. Without deterministic
22+
results, one peer on a channel might invalidate a transaction while another peer
23+
may validate it.
24+
25+
To that end, Fabric defines levels of what are called "capabilities". These
26+
capabilities, which are defined in the configuration of each channel, ensure
27+
determinism by defining a level at which behaviors produce consistent results.
28+
As you'll see, these capabilities have versions which are closely related to
29+
node binary versions. Capabilities enable nodes running at different version
30+
levels to behave in a compatible and consistent way given the channel
31+
configuration at a specific block height. You will also see that capabilities
32+
exist in many parts of the configuration tree, defined along the lines of
33+
administration for particular tasks.
34+
35+
As you'll see, sometimes it is necessary to update your channel to a new
36+
capability level to enable a new feature.
37+
38+
## Node versions and capability versions
39+
40+
If you're familiar with Hyperledger Fabric, you're aware that it follows the
41+
typical semantic versioning pattern: v1.1, v1.2.1, etc. These versions refer to
42+
releases and their related binary versions.
43+
44+
Capabilities follow the same semantic versioning convention. There are v1.1
45+
capabilities and v1.2 capabilities and so on. But it's important to note a few
46+
distinctions.
47+
48+
* **There is not necessarily a new capability level with each release**.
49+
The need to establish a new capability is determined on a case by case basis
50+
and relies chiefly on the backwards compatibility of new features and older
51+
binary versions. Adding Raft ordering services in v1.4.1, for example, did not
52+
change the way either transactions or ordering service functions were handled
53+
and thus did not require the establishment of any new capabilities.
54+
[Private Data](./private-data/private-data.html), on the other hand, could not
55+
be handled by peers before v1.2, requiring the establishment of a v1.2
56+
capability level. Because not every release contains a new feature (or a bug
57+
fix) that changes the way transactions are processed, certain releases will not
58+
require any new capabilities (for example, v1.4) while others will only have new
59+
capabilities at particular levels (such as v1.2 and v1.3). We'll discuss the
60+
"levels" of capabilities and where they reside in the configuration tree later.
61+
62+
63+
* **Nodes must be at least at the level of certain capabilities in a channel**.
64+
When a peer joins a channel, it reads all of the blocks in the ledger sequentially,
65+
starting with the genesis block of the channel and continuing through the
66+
transaction blocks and any subsequent configuration blocks. If a node,
67+
for example a peer, attempts to read a block containing an update to a
68+
capability it doesn't understand (for example, a v1.2 peer trying to read
69+
a block with a v1.4.2 application capability), **the peer will crash**. This
70+
crashing behavior is intentional, as a v1.2 peer cannot validate or commit any
71+
transactions past this point. Before joining a channel, **make sure the node is
72+
at the Fabric version (binary) level of the capabilities specified in the
73+
channel config relevant to the node or higher**. We'll discuss which
74+
capabilities are relevant to which nodes later. However, because no user wants
75+
their nodes to crash, it is strongly recommended to update all nodes to the
76+
required level (preferably, to the latest release) before attempting to update
77+
capabilities. This is in line with the default Fabric recommendation to
78+
**always** be at the latest binary and capability levels.
79+
80+
If users are unable to upgrade their binaries, then capabilities must be left at
81+
their lower levels. Lower level binaries and capabilities will still work
82+
together as they're meant to. However, keep in mind that it is a best practice
83+
to always update to new binaries even if a user chooses not to update their
84+
capabilities. Because capabilities themselves also include bug-fixes, it is
85+
always recommended to update capabilities once the network binaries support them.
86+
87+
## Capability configuration groupings
88+
89+
As we discussed earlier, there is not a single capability level encompassing an
90+
entire channel. Rather, there are three capabilities, each representing an area of
91+
administration.
92+
93+
* **Orderer**: These capabilities govern tasks and processing exclusive to the
94+
ordering service. Because these capabilities do not involve processes that
95+
affect transactions or the peers, updating them falls solely to the ordering
96+
service admins (peers do not need to understand orderer capabilities and will
97+
therefore not crash no matter what the orderer capability is updated to). Note
98+
that these capabilities did not change between v1.1 and v1.4.2. However, as
99+
we'll see in the **channel** section, this does not mean that v1.1 ordering
100+
nodes will work on all channels with capability levels below v1.4.2.
101+
102+
* **Application**: These capabilities govern tasks and processing exclusive to
103+
the peers. Because ordering service admins have no role in deciding the nature
104+
of transactions between peer organizations, changing this capability level
105+
falls exclusively to peer organizations. For example, Private Data can only be
106+
enabled on a channel with the v1.2 application group capability (or higher)
107+
enabled. In the case of Private Data, this is the only capability that must be
108+
enabled, as nothing about the way Private Data works requires a change to
109+
channel administration or the way the ordering service processes transactions.
110+
111+
* **Channel**: This grouping encompasses tasks that are **jointly administered**
112+
by the peer organizations and the ordering service. For example, this is the
113+
capability that defines the level at which channel configuration updates, which
114+
are initiated by peer organizations and orchestrated by the ordering service, are
115+
processed. On a practical level, **this grouping defines the minimum level for
116+
all of the binaries in a channel, as both ordering nodes and peers must be at
117+
least at the binary level corresponding to this capability in order to process
118+
the capability**.
119+
120+
The **orderer** and **channel** capabilities of a channel are inherited by
121+
default from the ordering system channel, where modifying them are the exclusive
122+
purview of ordering service admins. As a result, peer organizations should
123+
inspect the genesis block of a channel prior to joining their peers to that
124+
channel. Although the channel capability is administered by the orderers in the
125+
orderer system channel (just as the consortium membership is), it is typical and
126+
expected that the ordering admins will coordinate with the consortium admins to
127+
ensure that the channel capability is only upgraded when the consortium is ready
128+
for it.
129+
130+
Because the ordering system channel does not define an **application**
131+
capability, this capability must be specified in the channel profile when
132+
creating the genesis block for the channel. For more information about creating
133+
the genesis block of a channel, check out [configtx](configtx.html).
134+
135+
**Take caution** when specifying or modifying an application capability. Because
136+
the ordering service does not validate that the capability level is valid, it will
137+
allow a channel to be created (or modified) to contain, for example, a v1.8
138+
application capability even if no such capability exists. Any peer attempting to
139+
read a configuration block with this capability would, as we have shown, crash,
140+
and even if it was possible to modify the channel once again to a valid capability,
141+
it would not matter, as no peer would be able to get past the block with the
142+
invalid v1.8 capability.
143+
144+
For a full look at the current valid orderer, application, and channel capabilities
145+
check out a [sample `configtx.yaml` file](http://github.com/hyperledger/fabric/blob/master/sampleconfig/configtx.yaml),
146+
which lists them in the "Capabilities" section.
147+
148+
For more specific information about capabilities and where they reside in the channel
149+
configuration, check out [defining capability requirements](capability_requirements.html).
150+
151+
<!--- Licensed under Creative Commons Attribution 4.0 International License
152+
https://creativecommons.org/licenses/by/4.0/ -->

docs/source/capability_requirements.rst

Lines changed: 11 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,10 @@
1-
Capability Requirements
2-
-----------------------
3-
4-
Because Fabric is a distributed system that will usually involve multiple
5-
organizations (sometimes in different countries or even continents), it is
6-
possible (and typical) that many different versions of Fabric code will exist in
7-
the network. Nevertheless, it’s vital that networks process transactions in the
8-
same way so that everyone has the same view of the current network state.
9-
10-
This means that every network -- and every channel within that network – must
11-
define a set of what we call “capabilities” to be able to participate in
12-
processing transactions. For example, Fabric v1.1 introduces new MSP role types
13-
of “Peer” and “Client”. However, if a v1.0 peer does not understand these new
14-
role types, it will not be able to appropriately evaluate an endorsement policy
15-
that references them. This means that before the new role types may be used, the
16-
network must agree to enable the v1.1 ``channel`` capability requirement,
17-
ensuring that all peers come to the same decision.
18-
19-
Only binaries which support the required capabilities will be able to participate in the
20-
channel, and newer binary versions will not enable new validation logic until the
21-
corresponding capability is enabled. In this way, capability requirements ensure that
22-
even with disparate builds and versions, it is not possible for the network to suffer a
23-
state fork.
24-
25-
Defining Capability Requirements
1+
Defining capability requirements
262
================================
273

28-
Capability requirements are defined per channel in the channel configuration (found
29-
in the channel’s most recent configuration block). The channel configuration contains
30-
three locations, each of which defines a capability of a different type.
4+
As discussed in :doc:`capabilities_concept`, capability requirements are defined
5+
per channel in the channel configuration (found in the channel’s most recent
6+
configuration block). The channel configuration contains three locations, each
7+
of which defines a capability of a different type.
318

329
+------------------+-----------------------------------+----------------------------------------------------+
3310
| Capability Type | Canonical Path | JSON Path |
@@ -40,51 +17,20 @@ three locations, each of which defines a capability of a different type.
4017
| | | Capabilities |
4118
+------------------+-----------------------------------+----------------------------------------------------+
4219

43-
* **Channel:** these capabilities apply to both peer and orderers and are located in
44-
the root ``Channel`` group.
45-
46-
* **Orderer:** apply to orderers only and are located in the ``Orderer`` group.
47-
48-
* **Application:** apply to peers only and are located in the ``Application`` group.
49-
50-
The capabilities are broken into these groups in order to align with the existing
51-
administrative structure. Updating orderer capabilities is something the ordering orgs
52-
would manage independent of the application orgs. Similarly, updating application
53-
capabilities is something only the application admins would manage. By splitting the
54-
capabilities between "Orderer" and "Application", a hypothetical network could run a
55-
v1.6 ordering service while supporting a v1.3 peer application network.
56-
57-
However, some capabilities cross both the ‘Application’ and ‘Orderer’ groups. As we
58-
saw earlier, adding a new MSP role type is something both the orderer and application
59-
admins agree to and need to recognize. The orderer must understand the meaning
60-
of MSP roles in order to allow the transactions to pass through ordering, while
61-
the peers must understand the roles in order to validate the transaction. These
62-
kinds of capabilities -- which span both the application and orderer components
63-
-- are defined in the top level "Channel" group.
64-
65-
.. note:: It is possible that the channel capabilities are defined to be at version
66-
v1.3 while the orderer and application capabilities are defined to be at
67-
version 1.1 and v1.4, respectively. Enabling a capability at the "Channel"
68-
group level does not imply that this same capability is available at the
69-
more specific "Orderer" and "Application" group levels.
70-
7120
Setting Capabilities
72-
====================
21+
--------------------
7322

7423
Capabilities are set as part of the channel configuration (either as part of the
7524
initial configuration -- which we'll talk about in a moment -- or as part of a
7625
reconfiguration).
7726

78-
.. note:: We have a two documents that talk through different aspects of channel
79-
reconfigurations. First, we have a tutorial that will take you through
80-
the process of :doc:`channel_update_tutorial`. And we also have a document that
81-
talks through :doc:`config_update` which gives an overview of the
82-
different kinds of updates that are possible as well as a fuller look
83-
at the signature process.
27+
.. note:: For a tutorial that shows how to update a channel configuration, check
28+
out :doc:`channel_update_tutorial`. For an overview of the different
29+
kinds of channel updates that are possible, check out :doc:`config_update`.
8430

85-
Because new channels copy the configuration of the Orderer System Channel by
31+
Because new channels copy the configuration of the ordering system channel by
8632
default, new channels will automatically be configured to work with the orderer
87-
and channel capabilities of the Orderer System Channel and the application
33+
and channel capabilities of the ordering system channel and the application
8834
capabilities specified by the channel creation transaction. Channels that already
8935
exist, however, must be reconfigured.
9036

docs/source/key_concepts.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ Key Concepts
1515
ledger/ledger.md
1616
orderer/ordering_service.md
1717
private-data/private-data.md
18+
capabilities_concept.md
1819
usecases

docs/source/ops_guide.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Operations Guides
99
config_update
1010
msp
1111
configtx
12+
capability_requirements
1213
endorsement-policies
1314
token/FabToken
1415
pluggable_endorsement_and_validation

0 commit comments

Comments
 (0)