Skip to content

Commit

Permalink
fix: softfork json style
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangsoledad committed Apr 7, 2023
1 parent 464dad2 commit 287bc09
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 19 deletions.
6 changes: 1 addition & 5 deletions devtools/doc/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,11 +524,7 @@ def handle_starttag(self, tag, attrs):
if tag == 'section':
attrs_dict = dict(attrs)
if 'id' in attrs_dict and attrs_dict['id'].startswith('variant.') and ('class', 'variant') in attrs:
if self.name in ["DeploymentPos", "DeploymentState"]:
self.next_variant = attrs_dict['id'].split('.')[1]
else:
self.next_variant = camel_to_snake(
attrs_dict['id'].split('.')[1])
self.next_variant = camel_to_snake(attrs_dict['id'].split('.')[1])
elif self.variant_parser is None:
if tag == 'div' and attrs == [("class", "docblock")]:
self.variant_parser = MarkdownParser(title_level=3)
Expand Down
16 changes: 8 additions & 8 deletions rpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1678,8 +1678,8 @@ Response
"secp256k1_blake160_multisig_all_type_hash": null,
"secp256k1_blake160_sighash_all_type_hash": null,
"softforks": {
"Testdummy": {
"status": "Rfc0043",
"testdummy": {
"status": "rfc0043",
"rfc0043": {
"bit": 1,
"min_activation_epoch": "0x0",
Expand Down Expand Up @@ -4668,13 +4668,13 @@ Response
"epoch": "0x1",
"hash": "0xa5f5c85987a15de25661e5a214f2c1449cd803f071acc7999820f25246471f40",
"deployments": {
"Testdummy": {
"testdummy": {
"bit": 1,
"min_activation_epoch": "0x0",
"period": "0xa",
"since": "0x0",
"start": "0x0",
"state": "Failed",
"state": "failed",
"timeout": "0x0",
"threshold": {
"numer": 3,
Expand Down Expand Up @@ -5706,7 +5706,7 @@ An object containing various state info regarding deployments of consensus chang

Deployment name

`DeploymentPos` is equivalent to `"Testdummy" | "LightClient"`.
`DeploymentPos` is equivalent to `"testdummy" | "light_client"`.

* Dummy
* light client protocol
Expand All @@ -5716,7 +5716,7 @@ Deployment name

The possible softfork deployment state

`DeploymentState` is equivalent to `"Defined" | "Started" | "LockedIn" | "Active" | "Failed"`.
`DeploymentState` is equivalent to `"defined" | "started" | "locked_in" | "active" | "failed"`.

* First state that each softfork starts. The 0 epoch is by definition in this state for each deployment.
* For epochs past the `start` epoch.
Expand Down Expand Up @@ -6641,8 +6641,8 @@ SoftFork information

`SoftFork` is equivalent to `"buried" | "rfc0043"`.

* the activation epoch is hard-coded into the client implementation
* the activation is controlled by rfc0043 signaling
* buried - the activation epoch is hard-coded into the client implementation
* rfc0043 - the activation is controlled by rfc0043 signaling


### Type `Status`
Expand Down
4 changes: 2 additions & 2 deletions rpc/src/module/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1363,8 +1363,8 @@ pub trait ChainRpc {
/// "secp256k1_blake160_multisig_all_type_hash": null,
/// "secp256k1_blake160_sighash_all_type_hash": null,
/// "softforks": {
/// "Testdummy": {
/// "status": "Rfc0043",
/// "testdummy": {
/// "status": "rfc0043",
/// "rfc0043": {
/// "bit": 1,
/// "min_activation_epoch": "0x0",
Expand Down
4 changes: 2 additions & 2 deletions rpc/src/module/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ pub trait StatsRpc {
/// "epoch": "0x1",
/// "hash": "0xa5f5c85987a15de25661e5a214f2c1449cd803f071acc7999820f25246471f40",
/// "deployments": {
/// "Testdummy": {
/// "testdummy": {
/// "bit": 1,
/// "min_activation_epoch": "0x0",
/// "period": "0xa",
/// "since": "0x0",
/// "start": "0x0",
/// "state": "Failed",
/// "state": "failed",
/// "timeout": "0x0",
/// "threshold": {
/// "numer": 3,
Expand Down
5 changes: 3 additions & 2 deletions util/jsonrpc-types/src/blockchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1384,6 +1384,7 @@ pub struct HardForkFeature {
/// hard-coded into the client implementation), or `rfc0043` (for soft fork deployments
/// where activation is controlled by rfc0043 signaling).
#[derive(Clone, Copy, Serialize, Deserialize, Debug)]
#[serde(rename_all = "snake_case")]
pub enum SoftForkStatus {
/// the activation epoch is hard-coded into the client implementation
Buried,
Expand All @@ -1395,9 +1396,9 @@ pub enum SoftForkStatus {
#[derive(Clone, Serialize, Deserialize, Debug)]
#[serde(untagged)]
pub enum SoftFork {
/// the activation epoch is hard-coded into the client implementation
/// buried - the activation epoch is hard-coded into the client implementation
Buried(Buried),
/// the activation is controlled by rfc0043 signaling
/// rfc0043 - the activation is controlled by rfc0043 signaling
Rfc0043(Rfc0043),
}

Expand Down
2 changes: 2 additions & 0 deletions util/jsonrpc-types/src/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::collections::BTreeMap;

/// Deployment name
#[derive(Clone, Hash, Deserialize, Serialize, Debug, Ord, PartialOrd, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum DeploymentPos {
/// Dummy
Testdummy,
Expand All @@ -14,6 +15,7 @@ pub enum DeploymentPos {

/// The possible softfork deployment state
#[derive(Deserialize, Serialize, Debug)]
#[serde(rename_all = "snake_case")]
pub enum DeploymentState {
/// First state that each softfork starts.
/// The 0 epoch is by definition in this state for each deployment.
Expand Down

0 comments on commit 287bc09

Please sign in to comment.