feat(consensus): auto checkpointing mechanism with a master node#670
feat(consensus): auto checkpointing mechanism with a master node#670ca333 merged 17 commits intoGLEECBTC:devfrom
Conversation
…ster key in wallet, dpow deactivation, checkpoint rpc
|
Here https://github.com/dimxy/komodo/wiki/Auto-Checkpoints-description you mentioned that the auto-checkpointing system was derived from the Gulden (Munt) codebase, but Munt itself seems to have never had auto-checkpoints. Gulden’s auto-checkpointing is actually based on the checkpoint system originally developed by Peercoin (PPCoin). So I think it would be better to also mention the original implementation source. p.s. Checkpoints were removed from the Peercoin codebase in this PR: peercoin/peercoin#588. Commit: peercoin/peercoin@6b43fbd. |
As I understood Gulden was renamed to Munt for some time. And their repo had auto checkpoints as an interim feature (where I took it from: https://github.com/muntorg/munt-official/commits/e6b6223c10d4123c170eb2e14897430cef24349e) |
My mistake, you are right. The Munt repository does include checkpoints. However, they are still derived from Peercoin, as indicated here: p.s. I just wanted to find the origin to trace the full history of this feature. Maybe another branch or repository contains updates that Gulden (Munt) does not have, etc. That’s why I tried to draw attention to this. |
|
@dimxy It looks like I’ve found at least one logic error. Please take a look: bool IsSunsettingActive(int nHeight, int64_t timestamp) {
AssertLockHeld(cs_main);
if (chainName.isKMD()) {
return nHeight > nSunsettingHeight;
} else {
return timestamp > nSunsettingTimestamp;
}
}
For example: { "MARTY", { nSyncChkPointTimestamp, "03fdc6ca526c0cfaed2211d03dc2ea9c083aea127c7769d97dc92fed2085803ce3" }},
{ "GULDEN", { 1764606619, "02f9dc5271cc789aab77fb27e8007e681f93135cfcf92d4a514a4649c0e36f14ad" }},In this case, the planned activation time for GULDEN is As a result, dPoW remains active independently of the chain’s checkpoint activation time. In other words, dPoW ends at |
1e511bc to
cebde33
Compare
|
the current implementation increases the |
Oh I should fix this, tyvm. |
fixed c45d817 |
New Auto Checkpoints feature
This PR adds Auto Checkpoints feature (timestamp or height activated)
Auto Checkpoints is a lightweight finality mechanism in Komodo-based blockchains based on dynamically created checkpoints as the chain progresses.
A single designated master node for each block issues a synchronization checkpoint, ensuring that no chain reorganisation is permitted below the most recent checkpoint. This effectively guarantees transaction finality up to a checkpoint depth of 4 blocks behind the chain tip.
Komodo’s implementation is derived from the Gulden (Munt) codebase and is used for both KMD mainnet and asset chains.
Updated and new RPCs:
getblockchaininfo: addedsyncCheckpointandsyncCheckpointUpgradefields,getcheckpoint: returns the latest checkpoint.More info: https://github.com/dimxy/komodo/wiki/Auto-Checkpoints-description
DPoW sunsetting
This PR also adds sunsetting for the Komodo DPoW consensus code (timestamp or height deactivated):
TODO: