From 43ef56ba8daeb4dd4071e8e145fa425d5d3c2d6e Mon Sep 17 00:00:00 2001 From: librelois <elois@ifee.fr> Date: Sat, 15 Sep 2018 19:47:14 +0200 Subject: [PATCH] [ref] rework all binary formats to use the bincode standard --- rfc/0006_ws2p_v2.md | 450 +++++++++++++++++++++----------------------- 1 file changed, 212 insertions(+), 238 deletions(-) diff --git a/rfc/0006_ws2p_v2.md b/rfc/0006_ws2p_v2.md index 210ca5c..1805d15 100644 --- a/rfc/0006_ws2p_v2.md +++ b/rfc/0006_ws2p_v2.md @@ -27,8 +27,11 @@ We are also taking advantage of these changes to address minor issues : * [Conventions](#conventions) * [JSON format](#json-format) * [Binary format](#binary-format) + * [Primitive types](#primitive-types) + * [Useful non-primitive types](#useful-non-primitive-types) + * [Binary messages format](#binary-messages-format) -* [Endpoints](#endpoints) +* [Endpoints v1](#endpoints-1) * [Endpoint binary format](#endpoint-binary-format) * [Endpoint utf8 format](#endpoint-utf8-format) * [Peer card](#peer-card) @@ -125,9 +128,8 @@ Example : ### Binary format -#### Types notation +#### Primitive types -utf8 : String formatted in utf8 and [NFKC normalized](https://fr.wikipedia.org/wiki/Normalisation_Unicode#NFKC). u8 : Unsigned 8-bit integer. u16 : Unsigned 16-bit integer. u32 : Unsigned 32-bit integer. @@ -136,30 +138,83 @@ i8 : Signed 8-bit integer. i16 : Signed 16-bit integer. i32 : Signed 32-bit integer. i64 : Signed 64-bit integer. -[T; n] : Array of n elements of type T. -bool : boolean stored on 8 bits (0x00 = false, 0x01 = true, any other value must generate an error). -0 : Corresponds to data that must be filled with bits to zero (for example padding). -specific : Corresponds to a non-primitive type, which must be detailed in the RFC. -Blockstamp : BlockNumber(u32) + BlockHash([u8; 32]). +bool : boolean stored on 8 bits (0x00 = false, 0x01 = true, any other value must generate an error). +0 : Corresponds to data that must be filled with bits to zero (for example padding). + +#### Useful non-primitive types + +##### (T, U) + +(T, U) = Tuples of 2 elements. the 1st type T and the second type U. +A tuple is simply a concatenation of types written one after the other. +A tuple can be of any size (no maximum limit), but its size is necessarily fixed. +The different elements may be of different types, but the order cannot change. + +##### [T; n] + +Array of n elements of type T. +If the size of the array is variable, its size (in number of cells) is stored on 8 bytes. + +| data | size in bytes | data type | +|:-----------:|--------------:|----------------:| +| cells_count | 8 | u64 | +| content* | ?*cells_count | (T1, T2, ...) | + +All cells in the table are written one after the other without a separator, _like_ a tuple of `cells_count` elements of the same type. + +**/*\ CAUTION: If the size of the array is static (=a literal constant) then the array is serialized without a size field. ** +For example, the content of a public key ed25519 is a 32-byte array, (a [u8; 32] therefore), it is serialized directly without a size field. + +##### Opt(T) + +Indicates that a field is optional. The optional fields are preceded by a 1-byte boolean that indicates whether or not the field is present. + +| data | size in bytes | data type | +|:---------:|--------------:|----------------:| +| is_some | 1 | u8 | +| content | ? | T | + +If `is_some` is equal to `1`, field `content` is present. +If `is_some` is equal to `0`, field `content` is missing. +Any other value of `is_some` is prohibited and will invalidate the entire message. -##### algorithm +##### String -| algorithm | code | -|:----------------------:|-------:| -| Ed25519 | 0x00 | -| Schnorr | 0x01 | +String formatted in utf8 and [NFKC normalized](https://fr.wikipedia.org/wiki/Normalisation_Unicode#NFKC). + +**/!\ CAUTION: All strings are systematically prefixed with their size, including for an empty string. The size is stored on 8 bytes as shown in the table below :** + +| data | size in bytes | data type | +|:---------:|--------------:|----------------:| +| str_size | 8 | u64 | +| content | str_size | [u8; str_size] | + +content := String in binary utf8 with [NFKC normalization](https://fr.wikipedia.org/wiki/Normalisation_Unicode#NFKC). + +If the string is empty, field `content` is missing and `str_size` is equal to zero. + +##### Blockstamp + +| data | size in bytes | data type | +|:----------:|--------------:|----------:| +| block_id | 4 | u32 | +| block_hash | 32 | [u8; 32] | + +##### KeysAlgorithm + +| algorithm | u32 | +|:----------:|----:| +| Ed25519 | 0 | +| Schnorr | 1 | ##### PubkeyBox Contains the signatory's public key. -| data | size in bytes | data type | -|:-------:|--------------:|-------------------:| -| size | 2 | u16 | -| algo | 1 | algorithm | -| content | size - 1 | ?* | - -size := Size of the whole PubkeyBox (size field excluded). +| data | size in bytes | data type | +|:---------:|--------------:|-------------------:| +| algorithm | 4 | KeysAlgorithm | +| content | ? | ?* | _*The type of field `content` depends on the algorithm. In the case of Ed25519, `content` is a 32-byte array containing the public key._ @@ -169,121 +224,96 @@ Contains the cryptographic signature of a document. | data name | size in bytes | data type | |:---------:|--------------:|----------------:| -| size | 2 | u16 | -| content | sig_size | ?* | - -size := Size of the whole SigBox (size field excluded). +| algorithm | 4 | KeysAlgorithm | +| content | ? | ?* | _*The type of field `content` depends on the algorithm. In the case of Ed25519, `content` is a 64-byte array containing the signature._ #### Endianness -All numbers (integers and floats) are encoded in big endian. +All numbers (integers and floats) are encoded in little endian. ## Binary messages format All binary WS2P v2 messages are encapsulated in the following format : -| data name | size in bytes | data type | -|:----------------:|--------------:|----------:| -| currency_code | 2 | u16 | -| ws2p_version | 2 | u16 | -| issuer_node_id | 4 | u32 | -| issuer_pubkey | ? | PubkeyBox | -| message_type | 2 | specific | -| elements_count | 2 | u16 | -| payload_size | 4 | u32 | -| payload | payload_size | ?* | -| message_hash | 32 | [u8; 32] | -| signature | ? | SigBox | +| data name | size in bytes | data type | +|:----------------:|--------------:|-----------------:| +| ws2p_version | 4 | u32 | +| currency_name | ? | String | +| issuer_node_id | 4 | u32 | +| issuer_pubkey | ? | PubkeyBox | +| message_type | 4 | u32 | +| payload | ? | ?* | +| message_hash | 32 | Opt([u8; 32]) | +| signature | ? | Opt(SigBox) | -_* The type of `payload` is determined by the content of `message_type`._ - -The signature is not always present, it's only present for messages_type values `0x00??`. -The signature is generated from the hash sha 256 of the message. This hash is always given to allow the receiving node to verify that it has not received corrupted datas. +ws2p_version := This field is placed first so that future versions of WS2P are not constrained on the other fields, +the only constraint will be to start the message with the version number stored in u32. -### currency_code +currency_name := Empty string is allowed, it allow the user to synchronize his node without having to manually enter the currency on which he synchronizes. The node will then adopt the currency that is specified in the CONNECT message it will receive from the selected reference node. -| currency | code | -|:----------------------:|-------:| -| null* | 0x0000 | -| g1 | 0x0001 | -| Others prod currencies | 0x0??? | -| g1-test | 0x1000 | -| Others test currencies | 0x???? | +_* The type of `payload` is determined by the content of `message_type`._ -_*the `null` value is essential, it allows the user to synchronize his node without having to manually enter the currency on which he synchronizes. The node will then adopt the currency that is specified in the CONNECT message it will receive from the selected reference node._ +The signature is not always present, it's only present for connection negotiation messages. +The signature is generated from the hash sha 256 of the message. +This hash is always given to allow the receiving node to verify that it has not received corrupted datas. ### message_type interpretation -| message type | code | Signed | elements_count interval | -|:--------------------:|--------|--------|-------------------------| -| CONNECT | 0x0000 | yes | [1] | -| ACK | 0x0001 | yes | [1] | -| FLAGS | 0x0002 | yes | [1] | -| OK | 0x0003 | yes | [1] | -| KO | 0x0004 | yes | [1] | -| REQUEST | 0x0010 | no | [1] | -| REQUEST_RESPONSE | 0x0011 | no | [1] | -| PEERS | 0x0100 | no | [1, u16::MAX] | -| HEADS v2 | 0x0102 | no | [1, u16::MAX] | -| HEADS v3 | 0x0103 | no | [1, u16::MAX] | -| BLOCKS | 0x1000 | no | [1, u16::MAX] | -| PENDING_IDENTITIES | 0x2001 | no | [1, u16::MAX] | -| PENDING_MEMBERSHIPS | 0x2002 | no | [1, u16::MAX] | -| PENDING_CERTS | 0x2003 | no | [1, u16::MAX] | -| PENDING_REVOCATIONS | 0x2004 | no | [1, u16::MAX] | -| PENDING_TXS | 0x2005 | no | [1, u16::MAX] | - -## Endpoints +| message type | code | Signed | +|:--------------------:|--------|--------| +| CONNECT | 0 | yes | +| ACK | 1 | yes | +| SECRET_FLAGS | 2 | yes | +| OK | 3 | yes | +| KO | 4 | yes | +| REQUEST | 5 | no | +| REQUEST_RESPONSE | 6 | no | +| PEERS | 7 | no | +| HEADS_V2 | 8 | no | +| HEADS_V3 | 9 | no | +| BLOCKS | 10 | no | +| PENDING_IDENTITIES | 11 | no | +| PENDING_MEMBERSHIPS | 12 | no | +| PENDING_CERTS | 13 | no | +| PENDING_REVOCATIONS | 14 | no | +| PENDING_TXS | 15 | no | + +## Endpoints v1 + +WS2pv1 used endpoints version v0. So, in WS2Pv2 we improve to endpoints version v1. ### Endpoint binary format -| data name | size in bytes | data type | -|:----------------:|--------------:|----------:| -| api_size | 1 | u8 | -| host_size | 1 | u8 | -| path_size | 1 | u8 | -| api_name | 1/api_size | specific | -| api_version | 2 | u16 | -| nf_size | 1 | u8 | -| network_features | nf_size | specific | -| af_size | 1 | u8 | -| api_features | af_size | specific | -| ip_v4 | 4 | [u8; 4] | -| ip_v6 | 16 | [u16; 8] | -| host | host_size | utf8 | -| port | 2 | u16 | -| path | path_size | utf8 | - -#### api_code interpretation - -If api_size > 0 then `api_name` is a string utf8. - -If api_size == 0 then `api_name` is an 8-bit binary value : - -| API | code | -|:--------------------:|----------| -| BASIC_MERKLED_API | 0x00 | -| WS2P | 0x01 | -| GVA | 0x02 | -| DASA | 0x03 | +| data name | size in bytes | data type | +|:----------------:|--------------:|--------------:| +| endpoint_version | 4 | u32 | +| api_name | ? | String | +| api_version | 2 | u16 | +| nf_size | 8 | u64 | +| network_features | nf_size | specific | +| af_size | 8 | u64 | +| api_features | af_size | specific | +| ip_v4 | 4 | Opt([u8; 4]) | +| ip_v6 | 16 | Opt([u16; 8]) | +| host | ? | Opt(String) | +| port | 2 | u16 | +| path | ? | Opt(String) | + +endpoint_version := value is `1`. #### network_features -The 16 bits represent booleans to define the presence or absence of 16 network features. WS2Pv2 defines only 4 features, the remaining 12 are undefined and are in anticipation of future Ğfeatures. +The 16 bits represent booleans to define the presence or absence of 16 network features. WS2Pv2 defines only 2 features, the remaining 14 are undefined and are in anticipation of future Ğfeatures. Network features : | bit | feature | |:---------:|----------| -| 0000_0001 | IP4 | -| 0000_0010 | IP6 | | 0000_0100 | TLS | | 0000_1000 | TOR | -The first two features are a bit special because they must be read to parse the endpoint, indicating if the ipv4 and ipv6 fields are present or not. - TLS := This feature indicates that the endpoint should be contacted with an SSL/TLS overlay (HTTPS or WSS). TOR := This feature indicates that the endpoint must be contacted via the tor network (hidden service). @@ -314,32 +344,30 @@ The utf8 format is used to display the endpoint in a human-readable format. It i General utf8 endpoint format : - API_NAME VERSION n NF1 .. NFn n2 AF1 .. AFn2 IP4 IP6 HOST PORT PATH + API_NAME VERSION n NF1 .. NFn n2 AF1 .. AFn2 PORT HOST IP4 [IP6] PATH NF := NETWORK_FEATURE AF := API_FEATURE Example: - WS2P 2 1 TLS 3 DEF LOW ABF g1.durs.ifee.fr 443 ws2p + WS2P 2 1 TLS 3 DEF LOW ABF 443 g1.durs.info ws2p Same endpoint in binary format : -| data name | size in bytes | data type | value | -|:----------------:|--------------:|----------:|--------| -| api_size | 1 | u8 | 0x00 | -| host_size | 1 | u8 | 0x0F | -| path_size | 1 | u8 | 0x04 | -| api_name | 1/api_size | specific | 0x01 | -| api_version | 2 | u16 | 0x0002 | -| network_features | 2 | specific | 0x0004 | -| af_size | 1 | u8 | 0x01 | -| api_features | 1 | specific | 0x07 | -| ip_v4 | 4 | [u8; 4] | None | -| ip_v6 | 16 | [u16; 8] | None | -| host | host_size | utf8 | "g1.durs.ifee.fr" encoded in utf8 | -| port | 2 | u16 | 0x01BB | -| path | path_size | utf8 | "ws2p" encoded in utf8 | +| data name | size in bytes | data type | value | +|:----------------:|--------------:|--------------:|---------------------| +| api_name | ? | String | 0x0000_0004 ++ "ws2p" encoded in utf8 | +| api_version | 2 | u16 | 0x0002 | +| nf_size | 8 | u64 | 0x0000_0001 | +| network_features | nf_size | specific | 0x04 | +| af_size | 8 | u64 | 0x0000_0001 | +| api_features | af_size | specific | 0x07 | +| ip_v4 | 4 | Opt([u8; 4]) | 0x00 | +| ip_v6 | 16 | Opt([u16; 8]) | 0x00 | +| host | ? | Opt(String) | 0x0000_0004 ++ "g1.durs.info" encoded in utf8 | +| port | 2 | u16 | 0x01BB | +| path | ? | Opt(String) | 0x01 ++ 0x0000_0004 ++ "ws2p" encoded in utf8 | ## Peer card @@ -349,18 +377,15 @@ Signed document declaring all the endpoints of a peer. | data name | size in bytes | data type | |:-----------------:|---------------|------------------------------------| -| peer_card_size | 2 | u16 | -| version | 1 | u8 | -| endpoints_count | 1 | u8 | +| version | 4 | u32 | | currency_code | 2 | u16 | -| node_id | 4 | u32 | | issuer_public_key | ? | PubkeyBox | +| node_id | 4 | u32 | | blockstamp | 36 | Blockstamp | -| endpoints_datas | calculate* | [(u16, endpoint); endpoints_count] | +| endpoints_count | 8 | u64 | +| endpoints_datas | ? | [Endpoint; endpoints_count] | | signature | ? | SigBox | -endpoints_datas := table of tuples (endpoint_size, endpoint). - `endpoint_size` type : u16. `endpoint` type is defined above (See "Endpoint format"). @@ -395,7 +420,7 @@ Example : "pubkey": "D9D2zaJoWYWveii1JRYLVK3J4Z7ZH3QczoKrnQeiM6mx" "block": "128310-000002A569DCEED62227CAC0ABDFE6B2647B21B3193A40398CD12BC2A95C24D9", "endpoinds": [ - "WS2P 2 4 7 g1.durs.ifee.fr 443 ws2p" + "WS2P 2 1 TLS 3 DEF LOW ABF 443 g1.durs.info ws2p" ], "signature": "e2BtWtLs3Uqw80bvOx8YGfmDLfA44/apzpZA8YfH+WtnmPY5r4XUlgvctPsq2bHVw3iPWxuxx5oJh0JHITrECw==", } @@ -465,8 +490,7 @@ WARNING: independently of all these rules, each implementation must integrate it | flags_size | 1 | u8 | | flags_queries | flags_size | WS2PFlags | | peer_card | ? | Peer card | -| chunk_id* | 4 | u32 | -| chunk_hash* | 32 | [u8; 32] | +| chunkstamp | 4 | Opt(Blockstamp) | challenge := random hash generated by the sending node of the CONNECT message, the receiving node will then have to sign this challenge and then send this signature in its ACK message to prove that it has the corresponding private key to the public key it indicates. @@ -476,10 +500,7 @@ flags_queries := See "WS2PFlags type definition" below. peer_card := This field is optional, if it's not present it must be replaced by 2 bytes filled with zeros. Why two bytes ? Because the first field of any peer card, `peer_card_size`, is 2 bytes long. -_*Fields `chunk_id` and `chunk_hash` are present only if flag `ASK_SYNC_CHUNK` is present in `flags_queries`._ - -chunk_id := Last block number of the chunk. -chunk_hash := Last block hash of the chunk. +chunkstamp := Blockstamp of the last block of the chunk. This field is present only if flag `ASK_SYNC_CHUNK` is present in `flags_queries`. #### WS2PFlags type definition @@ -513,8 +534,8 @@ The message is already signed at the container level, so there is no need to rep |:-------------:|---------------|-----------------| | flags_size | 1 | u8 | | flags | flags_size | WS2PSecretFlags | -| member_pubkey | ? | PubkeyBox | -| member_proof | ? | SigBox | +| member_pubkey | ? | Opt(PubkeyBox) | +| member_proof | ? | Opt(SigBox) | #### WS2PSecretFlags type definition @@ -529,50 +550,32 @@ LOW_FLOW_DEMAND := The sender node of this message indicates that it's behind a MEMBER_PUBKEY: Indicates whether or not the member_pubkey field is present in the message. MEMBER_PROOF := Indicates that the message contains proof that the sender node is a member. If this boolean is false, then the member_proof field must not be present. -If this boolean is true, the "member_proof" must contain a signature must sign the following datas : - -| data name | size in bytes | data type | -|:--------------:|---------------|-----------| -| flags | 2 | b16 | -| prefix | 2 | u16 | -| issuer_node_id | 4 | u32 | -| m_pubkey | 32 | PubkeyBox | -| challenge* | 32 | [u8; 32] | +If this boolean is true, the "member_proof" must contain a signature of the challenge* send by other node in their CONNECT message. -_*This is the remote challenge for the signatory, and the local challenge for the verifier._ +_*It's the remote challenge for the signatory, and the local challenge for the verifier._ ### OK message -If payload_size == 0 : - -In most cases, the OK message is empty, it simply indicates that the remote node accepts the connection establishment. If the local node has also sent an OK message, then it considers the connection as fully established. -But sometimes the OK message can also transmit additional informations, the `payload_size` value can handle these cases. - -Else if payload_size == 2 : +In most cases, the OK message is empty (=3 zero-bytes), it simply indicates that the remote node accepts the connection establishment. If the local node has also sent an OK message, then it considers the connection as fully established. +But sometimes the OK message can also transmit additional informations : | data name | size in bytes | data type | |:--------------------:|---------------|--------------------------------| | prefix/- | 2 | u16/0 | +| sync_target | ? | Opt(WS2Pv2SyncTarget) | -prefix := In ws2p v2, member nodes have the option of not publicly communicating their prefix. It will only reveal their prefix to the node of their choice among those with which they establish a connection. For example, a member node may decide to share its prefix only with other member nodes of the same key. +prefix := In ws2p v2, member nodes have the option of not publicly communicating their prefix. It will only reveal their prefix to the node of their choice among those with which they establish a connection. For example, a member node may decide to share its prefix only with other member nodes of the same key. +If this field is zero, it means that the remote node does not want to reveal its prefix (the prefix being necessarily greater than or equal to 1). -Else if payload_size > 2 : +#### WS2Pv2SyncTarget | data name | size in bytes | data type | |:--------------------:|------------------------|--------------------------------| -| prefix/- | 2 | u16/0 | -| target_b_number | 4 | u32 | -| target_b_hash | 32 | [u8; 32] | -| chunks_hashs_count | 4 | u32 | +| target_blockstamp | 36 | Blockstamp | +| chunks_hashs_count | 8 | u64 | | chunks_hashs | 32* chunks_hashs_count | [[u8; 32]; chunks_hashs_count] | -prefix := If this field is zero, it means that the remote node does not want to reveal its prefix (the prefix being necessarily greater than or equal to 1). - -target_b_number := Indicates the current block number of the message sender node. This number will be the target to reach for the node being synchronized. - -target_b_hash := Indicates the current block hash of the message sender node. This hash will be the target to reach for the node being synchronized. - -chunks_hashs_count := `chunks_hashs` array size +target_blockstamp := Indicates the current blockstamp of the message sender node. This blockstamp will be the target to reach for the node being synchronized. chunks_hashs := Hash table of the last block of each chunk. We do not need the block numbers, we know them. Here the remote node sends the hashs of all these chunk, which correspond to the current hashs of all the blocks having a number in 250 module 249, in ascending order. @@ -580,7 +583,7 @@ chunks_hashs := Hash table of the last block of each chunk. We do not need the b | data name | size in bytes | data type | |:---------:|---------------|-----------| -| reason | 1 | u8 | +| reason | 2 | u16 | #### reason interpretation @@ -601,14 +604,14 @@ Some WS2Pv1 messages are accepted within WS2Pv2 connections, here is the exhaust * v1 requests * responses to v1 requests -WARNING : Exception with the ABF api feature : In a WS2P connection between two nodes that both support ABF api feature, any WS2Pv1 message is rejected ! +WARNING : Exception with the ABF api feature : In a WS2P connection between two nodes that both support ABF api feature, any WS2Pv1 message are rejected ! ### REQUESTS | data name | size in bytes | data type | |:------------:|---------------|-------------| | request_id | 4 | u32 | -| request_type | 1 | u8 | +| request_type | 4 | u32 | | param_1 | ? | ? | | param_2 | ? | ? | @@ -637,19 +640,19 @@ _*This is part of the specificities of WS2P requests in binary format, which wil | data name | size in bytes | data type | |:----------------:|---------------|------------| | request_id | 4 | u32 | -| response_type | 1 | u8 | +| response_type | 4 | u32 | | response_content | ? | ? | #### response_type interpretation | value | significance | |:-----:|--------------------| -| 0x00 | EMPTY_RESPONSE | -| 0xff | BAD_REQUEST | -| 0x01 | CURRENT_BLOCKSTAMP | -| 0x02 | BLOCKS_HASHS | -| 0x03 | CHUNK | -| 0x05 | WOT_POOL | +| 0 | EMPTY_RESPONSE | +| 1 | BAD_REQUEST | +| 2 | CURRENT_BLOCKSTAMP | +| 3 | BLOCKS_HASHS | +| 4 | CHUNK | +| 5 | WOT_POOL | EMPTY_RESPONSE := `response_content` field is absent. @@ -659,7 +662,7 @@ BAD_REQUEST := Used only in debug mode. In production, bad requests are simply i | data name | size in bytes | data type | |:------------:|---------------|------------| -| reason | ? | utf8 | +| reason | ? | String | _*The total payload size of any WS2P message is indicated in the metadata, field `reason` being the only one of unknown size, its size is deduced by calculation._ @@ -673,94 +676,69 @@ _*The total payload size of any WS2P message is indicated in the metadata, field | data name | size in bytes | data type | |:------------:|----------------|---------------| +| hashs_count | 8 | u64 | | hashs | 32*hashs_count | [[u8; 32]; ?] | -_*The total payload size of any WS2P message is indicated in the metadata, field `hashs` being the only one of unknown size, its size is deduced by calculation._ - #### CHUNK response -| data name | size in bytes | data type | -|:------------:|---------------|----------------------| -| blocks | ? | (u16, BlockDocument) | - -_*The total payload size of any WS2P message is indicated in the metadata, field `blocks` being the only one of unknown size, its size is deduced by calculation._ -blocks := table of tuples (block_size, block_content) +| data name | size in bytes | data type | +|:------------:|---------------|---------------| +| blocks_count | 8 | u64 | +| blocks | ? | [BlockDocument; blocks_count] | #### WOT_POOL response -| data name | size in bytes | data type | -|:-------------:|---------------|---------------------| -| certs_size | 4 | u32 | -| certs | certs_size | CompactPoolIntCert | -| folders | ?* | PendingIdtyFolder | - -_*The total payload size of any WS2P message is indicated in the metadata, field `folders` being the only one of unknown size, its size is deduced by calculation._ +| data name | size in bytes | data type | +|:-------------:|---------------|------------------------------| +| certs_count | 8 | u64 | +| certs | ? | CompactCertificationDocument | +| folders_count | 8 | u64 | +| folders | ? | WotPoolFolder | -CompactPoolIntCert type description : +CompactCertificationDocument type description : | data name | size in bytes | data type | |:-------------:|---------------|---------------------| -| issuer* | 4 | u32 | -| target* | 4 | u32 | -| blockstamp | 36 | Blockstamp | +| issuer* | ? | PubKeyBox | +| target* | ? | PubKeyBox | +| block_id | 4 | u32 | | signature | ? | SigBox | -_*Durs assigns a unique integer to each member according to the order in which the identities are declared in the blocks, so it's guaranteed that all Durs nodes will always assign the same integer to any given member._ - -PendingIdtyFolder type description : +WotPoolFolder type description : -| data name | size in bytes | data type | -|:---------------:|-----------------|-----------------------| -| folder_size | 4 | u32 | -| certs_count | 1 | u8 | -| identity | ? | IdentityDocument | -| membership | ? | CompactPoolMembership | -| certs | ? | CompactPoolExtCert | +| data name | size in bytes | data type | +|:---------------:|-----------------|------------------------------| +| identity | ? | CompactIdentityDocument | +| membership | ? | CompactPoolMembershipDoc | +| certs_count | 8 | u64 | +| certs | ? | CompactCertificationDocument | -folder_size := Total size of object `PendingIdtyFolder` in bytes (field `folder_size` excluded). - -IdentityDocument type description : +CompactIdentityDocument type description : | data name | size in bytes | data type | |:-------------:|---------------|---------------------| -| uid_size | 1 | u8 | -| uid | uid_size | utf8 | +| uid | ? | String | | blockstamp | 36 | Blockstamp | -| pubkey | 32 | [u8;32] | +| pubkey | ? | PubkeyBox | | signature | ? | SigBox | -uid_size := `uid` field size in bytes. - -CompactPoolMembership type description : +CompactPoolMembershipDoc type description : | data name | size in bytes | data type | |:-------------:|---------------|---------------------| | blockstamp | 36 | Blockstamp | | signature | ? | SigBox | -CompactPoolExtCert type description : - -| data name | size in bytes | data type | -|:-----------------:|---------------|---------------------| -| issuer | 4 | u32 | -| blockstamp | 36 | Blockstamp | -| signature | ? | SigBox | - ### HEADS v2 | data name | size in bytes | data type | |:------------:|---------------|-----------| -| head_size | 2 | u32 | -| head_content | head_size | utf8 | +| head_content | ? | String | ### HEADs v3 | data name | size in bytes | data type | |:------------------:|-------------------|------------| -| head_size | 2 | u16 | -| software_size | 1 | u8 | -| soft_version_size | 1 | u8 | -| step | 1 | u8 | | api_outgoing_conf | 1 | u8 | | api_incoming_conf | 1 | u8 | | free_mirror_rooms | 1 | u8 | @@ -768,15 +746,10 @@ CompactPoolExtCert type description : | node_id | 4 | u32 | | pubkey | ? | PubkeyBox | | blockstamp | 36 | Blockstamp | -| software_name | software_size | utf8 | -| soft_version | soft_version_size | utf8 | +| software_name | ? | String | +| soft_version | ? | String | | signature | ? | SigBox | - -head_size := Total size of object `HEADv3` in bytes. - -software_size := Field size `software_name` in number of bytes. - -soft_version_size := Field size `soft_version` in number of bytes. +| step | 1 | u8 | api_outgoing_conf := See "api_outgoing_conf interpretation". @@ -810,6 +783,7 @@ step := Number of head rebounds (unsigned field). "software_name": String, "software_version": String, "signature": String(signature.sig_content in base64), + "step", Number, } #### api_outgoing_conf interpretation @@ -839,4 +813,4 @@ All WS2Pv2 documents are necessarily in Binary Format. When document binarizatio We must therefore wait for the binarization of the blockchain protocol. -In the meantime, Duniter-Rust nodes exchange documents directly as portable binary objects (this is a Rust feature). +In the meantime, Durs nodes exchange documents directly as portable binary objects (this is a Rust feature). -- GitLab