Skip to content

Commit

Permalink
Merge pull request nervosnetwork#4225 from doitian/doc-extension
Browse files Browse the repository at this point in the history
doc: update RPC doc related to block extension
  • Loading branch information
zhangsoledad authored Nov 9, 2023
2 parents 413f2af + 675ef3a commit ab760fd
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
10 changes: 9 additions & 1 deletion rpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5248,6 +5248,10 @@ The JSON view of a Block used as a parameter in the RPC.

* `proposals`: `Array<` [`ProposalShortId`](#type-proposalshortid) `>` - The proposal IDs in the block body.

* `extension`: [`JsonBytes`](#type-jsonbytes) `|` `null` - The extension in the block body.

This is a field introduced in [CKB RFC 0031](https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0031-variable-length-header-field/0031-variable-length-header-field.md). Since the activation of [CKB RFC 0044](https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0044-ckb-light-client/0044-ckb-light-client.md), this field is at least 32 bytes, and at most 96 bytes. The consensus rule of first 32 bytes is defined in the RFC 0044.


### Type `BlockEconomicState`

Expand Down Expand Up @@ -5400,7 +5404,7 @@ Miners optional pick transactions and then assemble the final block.

* `extension`: [`JsonBytes`](#type-jsonbytes) `|` `null` - The extension for the new block.

This field is optional. It’s a reserved field, please leave it blank. More details can be found in [CKB RFC 0031](https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0031-variable-length-header-field/0031-variable-length-header-field.md).
This is a field introduced in [CKB RFC 0031](https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0031-variable-length-header-field/0031-variable-length-header-field.md). Since the activation of [CKB RFC 0044](https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0044-ckb-light-client/0044-ckb-light-client.md), this field is at least 32 bytes, and at most 96 bytes. The consensus rule of first 32 bytes is defined in the RFC 0044.


### Type `BlockView`
Expand All @@ -5419,6 +5423,10 @@ The JSON view of a Block including header and body.

* `proposals`: `Array<` [`ProposalShortId`](#type-proposalshortid) `>` - The proposal IDs in the block body.

* `extension`: [`JsonBytes`](#type-jsonbytes) `|` `null` - The extension in the block body.

This is a field introduced in [CKB RFC 0031](https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0031-variable-length-header-field/0031-variable-length-header-field.md). Since the activation of [CKB RFC 0044](https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0044-ckb-light-client/0044-ckb-light-client.md), this field is at least 32 bytes, and at most 96 bytes. The consensus rule of first 32 bytes is defined in the RFC 0044.


### Type `Byte32`

Expand Down
6 changes: 4 additions & 2 deletions util/jsonrpc-types/src/block_template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,12 @@ pub struct BlockTemplate {
pub dao: Byte32,
/// The extension for the new block.
///
/// This field is optional. It's a reserved field, please leave it blank.
/// More details can be found in [CKB RFC 0031].
/// This is a field introduced in [CKB RFC 0031]. Since the activation of [CKB RFC 0044], this
/// field is at least 32 bytes, and at most 96 bytes. The consensus rule of first 32 bytes is
/// defined in the RFC 0044.
///
/// [CKB RFC 0031]: https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0031-variable-length-header-field/0031-variable-length-header-field.md
/// [CKB RFC 0044]: https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0044-ckb-light-client/0044-ckb-light-client.md
#[serde(default)]
pub extension: Option<JsonBytes>,
}
Expand Down
16 changes: 12 additions & 4 deletions util/jsonrpc-types/src/blockchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -924,8 +924,12 @@ pub struct Block {
pub proposals: Vec<ProposalShortId>,
/// The extension in the block body.
///
/// This field is optional. It's a reserved field, please leave it blank.
#[doc(hidden)]
/// This is a field introduced in [CKB RFC 0031]. Since the activation of [CKB RFC 0044], this
/// field is at least 32 bytes, and at most 96 bytes. The consensus rule of first 32 bytes is
/// defined in the RFC 0044.
///
/// [CKB RFC 0031]: https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0031-variable-length-header-field/0031-variable-length-header-field.md
/// [CKB RFC 0044]: https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0044-ckb-light-client/0044-ckb-light-client.md
#[serde(default, skip_serializing_if = "Option::is_none")]
pub extension: Option<JsonBytes>,
}
Expand Down Expand Up @@ -981,8 +985,12 @@ pub struct BlockView {
pub proposals: Vec<ProposalShortId>,
/// The extension in the block body.
///
/// This field is optional. It's a reserved field, please leave it blank.
#[doc(hidden)]
/// This is a field introduced in [CKB RFC 0031]. Since the activation of [CKB RFC 0044], this
/// field is at least 32 bytes, and at most 96 bytes. The consensus rule of first 32 bytes is
/// defined in the RFC 0044.
///
/// [CKB RFC 0031]: https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0031-variable-length-header-field/0031-variable-length-header-field.md
/// [CKB RFC 0044]: https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0044-ckb-light-client/0044-ckb-light-client.md
#[serde(default, skip_serializing_if = "Option::is_none")]
pub extension: Option<JsonBytes>,
}
Expand Down

0 comments on commit ab760fd

Please sign in to comment.