Skip to content

Conversation

@codablock
Copy link

@codablock codablock commented May 28, 2019

Instead use a class (CSporkDef) to define individual sporks and use maps to get from name->id and vice versa.

This PR currently shares a commit with #2945, which adds support for enum serialization. I'll later rebase one of both PRs, depending on which one gets merged first.

@codablock codablock added this to the 14.1 milestone May 28, 2019
@codablock codablock force-pushed the pr_refactor_sporks branch from 1875598 to ad48a16 Compare May 29, 2019 06:07
@codablock codablock force-pushed the pr_refactor_sporks branch from ad48a16 to 9756cb6 Compare May 29, 2019 08:55
@codablock
Copy link
Author

Rebased on develop to pull in the mentioned commit from #2945

This ensures correct order of initialization.
Copy link

@nmarley nmarley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! Much cleaner!

utACK

Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

@UdjinM6 UdjinM6 merged commit fc73b4d into dashpay:develop May 29, 2019
Copy link
Member

@PastaPastaPasta PastaPastaPasta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

post-ACK, sporks match on testnet as develop

random-zebra added a commit to PIVX-Project/PIVX that referenced this pull request Sep 26, 2019
84930b9 [Trivial] Align the format of the log messages in kernel.cpp (random-zebra)
faa9090 [Trivial] rename DisconnectBlocks argument for consistency (random-zebra)
3df34c6 [Spork] fix CSporkManager maps (random-zebra)
3ec2f61 [Tests] spork functional test: check spork value after node restart (random-zebra)
8f6d6e1 [Core] ReprocessBlocks: adjust to PIVX blocktime (random-zebra)
50bfe70 Fix spork RPC to use new spork defs (random-zebra)
fd05256 [Spork] Make CSporkMessage::vchSig private (random-zebra)
3709ba8 [Spork] Introduce CSporkDef and remove if/else blocks (random-zebra)
4df1046 [Spork] Define SporkId enum (with its serialization) (random-zebra)
41effbf [Spork] Remove unused SPORK_11 and SPORK_12 (random-zebra)
459e41a [Spork] Remove unused SPORK_7_MASTERNODE_SCANNING (random-zebra)
5124b89 [Spork] Do not accept sporks signed too far into the future (random-zebra)
806f607 [Spork] CSporkManager class serialization (random-zebra)
cd33d3c [Spork] Protect CSporkManager with critical section (random-zebra)
c41dd7c [Refactor] refactor/fix CSporkManager and CSporkMessage classes (random-zebra)
ab603a1 [Refactor] rename SporkKey to SporkPubKey (random-zebra)

Pull request description:

  Chengeset:

  - move ProcessSpork, GetSporkValue, IsSporkActive, ExecuteSpork and mapSporksActive to CSporkManager
  - move Sign, CheckSignature, Relay to CSporkMessage
  - move ReprocessBlocks out of sporks to main.cpp / rename DisconnectBlocksAndReprocess to DisconnectBlocks
  - rename SporkKey to SporkPubKey
  - bugfix: only set strMasterPrivKey if spork signature produced by that key was verified successfully
  - few log format changes, cleaned up includes
  - Protect CSporkManager with critical section
  - bugfix:  do not accept sporks with nTimeSigned way too far into the future
  - remove unused sporks: 7, 11, 12
  - Refactor code to get rid of repeated if/else blocks (introduce CSporkDef)

  Mostly based off of:
  - dashpay#922
  - dashpay#2213
  - dashpay#2578
  - dashpay#2607
  - dashpay#2946

ACKs for top commit:
  Warrows:
    ACK 84930b9
  furszy:
    ACK [`84930b9`](84930b9)

Tree-SHA512: 17f923e85371c444aa2092b12b025db1894c55679549d1a6a3d9f4525f8d78e9225d3f05e296643e7c79d02414bef1613f14d441901dc5f52531c3f30dce357c
akshaynexus added a commit to dogecash/dogecash-old that referenced this pull request Oct 27, 2019
84930b9 [Trivial] Align the format of the log messages in kernel.cpp (random-zebra)
faa9090 [Trivial] rename DisconnectBlocks argument for consistency (random-zebra)
3df34c6 [Spork] fix CSporkManager maps (random-zebra)
3ec2f61 [Tests] spork functional test: check spork value after node restart (random-zebra)
8f6d6e1 [Core] ReprocessBlocks: adjust to PIVX blocktime (random-zebra)
50bfe70 Fix spork RPC to use new spork defs (random-zebra)
fd05256 [Spork] Make CSporkMessage::vchSig private (random-zebra)
3709ba8 [Spork] Introduce CSporkDef and remove if/else blocks (random-zebra)
4df1046 [Spork] Define SporkId enum (with its serialization) (random-zebra)
41effbf [Spork] Remove unused SPORK_11 and SPORK_12 (random-zebra)
459e41a [Spork] Remove unused SPORK_7_MASTERNODE_SCANNING (random-zebra)
5124b89 [Spork] Do not accept sporks signed too far into the future (random-zebra)
806f607 [Spork] CSporkManager class serialization (random-zebra)
cd33d3c [Spork] Protect CSporkManager with critical section (random-zebra)
c41dd7c [Refactor] refactor/fix CSporkManager and CSporkMessage classes (random-zebra)
ab603a1 [Refactor] rename SporkKey to SporkPubKey (random-zebra)

Pull request description:

  Chengeset:

  - move ProcessSpork, GetSporkValue, IsSporkActive, ExecuteSpork and mapSporksActive to CSporkManager
  - move Sign, CheckSignature, Relay to CSporkMessage
  - move ReprocessBlocks out of sporks to main.cpp / rename DisconnectBlocksAndReprocess to DisconnectBlocks
  - rename SporkKey to SporkPubKey
  - bugfix: only set strMasterPrivKey if spork signature produced by that key was verified successfully
  - few log format changes, cleaned up includes
  - Protect CSporkManager with critical section
  - bugfix:  do not accept sporks with nTimeSigned way too far into the future
  - remove unused sporks: 7, 11, 12
  - Refactor code to get rid of repeated if/else blocks (introduce CSporkDef)

  Mostly based off of:
  - dashpay/dash#922
  - dashpay/dash#2213
  - dashpay/dash#2578
  - dashpay/dash#2607
  - dashpay/dash#2946

ACKs for top commit:
  Warrows:
    ACK 84930b9
  furszy:
    ACK [`84930b9`](PIVX-Project/PIVX@84930b9)

Tree-SHA512: 17f923e85371c444aa2092b12b025db1894c55679549d1a6a3d9f4525f8d78e9225d3f05e296643e7c79d02414bef1613f14d441901dc5f52531c3f30dce357c
akshaynexus added a commit to dogecash/dogecash-old that referenced this pull request Oct 27, 2019
84930b9 [Trivial] Align the format of the log messages in kernel.cpp (random-zebra)
faa9090 [Trivial] rename DisconnectBlocks argument for consistency (random-zebra)
3df34c6 [Spork] fix CSporkManager maps (random-zebra)
3ec2f61 [Tests] spork functional test: check spork value after node restart (random-zebra)
8f6d6e1 [Core] ReprocessBlocks: adjust to PIVX blocktime (random-zebra)
50bfe70 Fix spork RPC to use new spork defs (random-zebra)
fd05256 [Spork] Make CSporkMessage::vchSig private (random-zebra)
3709ba8 [Spork] Introduce CSporkDef and remove if/else blocks (random-zebra)
4df1046 [Spork] Define SporkId enum (with its serialization) (random-zebra)
41effbf [Spork] Remove unused SPORK_11 and SPORK_12 (random-zebra)
459e41a [Spork] Remove unused SPORK_7_MASTERNODE_SCANNING (random-zebra)
5124b89 [Spork] Do not accept sporks signed too far into the future (random-zebra)
806f607 [Spork] CSporkManager class serialization (random-zebra)
cd33d3c [Spork] Protect CSporkManager with critical section (random-zebra)
c41dd7c [Refactor] refactor/fix CSporkManager and CSporkMessage classes (random-zebra)
ab603a1 [Refactor] rename SporkKey to SporkPubKey (random-zebra)

Pull request description:

  Chengeset:

  - move ProcessSpork, GetSporkValue, IsSporkActive, ExecuteSpork and mapSporksActive to CSporkManager
  - move Sign, CheckSignature, Relay to CSporkMessage
  - move ReprocessBlocks out of sporks to main.cpp / rename DisconnectBlocksAndReprocess to DisconnectBlocks
  - rename SporkKey to SporkPubKey
  - bugfix: only set strMasterPrivKey if spork signature produced by that key was verified successfully
  - few log format changes, cleaned up includes
  - Protect CSporkManager with critical section
  - bugfix:  do not accept sporks with nTimeSigned way too far into the future
  - remove unused sporks: 7, 11, 12
  - Refactor code to get rid of repeated if/else blocks (introduce CSporkDef)

  Mostly based off of:
  - dashpay/dash#922
  - dashpay/dash#2213
  - dashpay/dash#2578
  - dashpay/dash#2607
  - dashpay/dash#2946

ACKs for top commit:
  Warrows:
    ACK 84930b9
  furszy:
    ACK [`84930b9`](PIVX-Project/PIVX@84930b9)

Tree-SHA512: 17f923e85371c444aa2092b12b025db1894c55679549d1a6a3d9f4525f8d78e9225d3f05e296643e7c79d02414bef1613f14d441901dc5f52531c3f30dce357c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants