Skip to content
This repository was archived by the owner on Aug 18, 2020. It is now read-only.

[CDEC-610] Hard Fork mechanism #3822

Merged
merged 7 commits into from
Nov 6, 2018
Merged

[CDEC-610] Hard Fork mechanism #3822

merged 7 commits into from
Nov 6, 2018

Conversation

mhuesch
Copy link
Contributor

@mhuesch mhuesch commented Nov 4, 2018

Description

Implement a hard fork mechanism to transition from the legacy codebase to the new codebase.

I'm labeling with DO NOT MERGE because the debug commits must be dropped before this is merged.

Linked issue

https://iohk.myjetbrains.com/youtrack/issue/CDEC-610

Type of change

  • [~] 🐞 Bug fix (non-breaking change which fixes an issue)
  • [~] 🛠 New feature (non-breaking change which adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)
  • [~] 🏭 Refactoring that does not change existing functionality but does improve things like code readability, structure etc
  • 🔨 New or improved tests for existing code
  • [~] ⛑ git-flow chore (backport, hotfix, etc)

Developer checklist

  • I have read the style guide document, and my code follows the code style of this project.
  • If my code deals with exceptions, it follows the guidelines.
  • I have updated any documentation accordingly, if needed. Documentation changes can be reflected in opening a PR on cardanodocs.com, amending the inline Haddock comments, any relevant README file or one of the document listed in the docs directory.
  • CHANGELOG entry has been added and is linked to the correct PR on GitHub.

Testing checklist

  • I have added tests to cover my changes.
  • All new and existing tests passed.

@mhuesch mhuesch self-assigned this Nov 4, 2018
@mhuesch mhuesch requested a review from erikd November 4, 2018 20:07
erikd
erikd previously approved these changes Nov 5, 2018
Copy link
Member

@erikd erikd left a comment

Choose a reason for hiding this comment

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

Looks great!

@erikd erikd dismissed their stale review November 5, 2018 07:18

Don't want to merge this by accident.

@mhuesch
Copy link
Contributor Author

mhuesch commented Nov 5, 2018

I've just reproduced a successful "hard fork" on my devnet cluster by following these steps again, using the CDEC-610 branch.

This gives me fairly high confidence that this solution works, but I would be more confident if we had a secondary reproduction from a different team member. Since setting up a devnet cluster is a pain, it would be ideal if we had a method to perform the necessary rolling restart on a local cluster.

rvl and others added 7 commits November 5, 2018 23:14
The `verifyBlockAndSoftwareVersions` function combines the
`verifySoftwareVersion` and `verifyBlockVersion` functions, and we
add tests for the various allowed & disallowed state transitions
between software + block versions.
Since protocol-only updates are now allowed, these tests should
return `Right ()`.
Here we use the `bvdUnlockStakeEpoch` field and compare it to a
magic constant, which turns the field into essentially a Bool. Our
predicate tells us if we're in the OBFT era, and if we should enable
OBFT code.
These are the places where it's necessary to know the @ConsensusEra@ and
act according to that value.
@mhuesch
Copy link
Contributor Author

mhuesch commented Nov 6, 2018

I've just dropped the extraneous DEBUG commits, and force-pushed the branch. I'm removing the DO NOT MERGE tag because this should be mergeable once CI passes (/cc @erikd).

For future reference, these are the modifications to the devnet configuration section which enable the OBFT logic. For mainnet/staging/testnets, we should alter the corresponding sections - this is just an example, not to be applied literally:

commit f90a211aba1cf2fb44215a4236104cbf317d4734
Author: Michael Hueschen <[email protected]>
Date:   Mon Oct 29 20:47:20 2018 -0400

    DEBUG [CO-610] Update config for 1.0.0, with magic Obft value

diff --git a/lib/configuration.yaml b/lib/configuration.yaml
index 3a3053f5da..8ce2be6d51 100644
--- a/lib/configuration.yaml
+++ b/lib/configuration.yaml
@@ -15073,6 +15073,7 @@ devnet: &devnet
           maxHeaderSize:      2000
           maxProposalSize:   70000 # 70KB
           maxTxSize:         65536 # 64KiB
+          unlockStakeEpoch: 9999999999999999999 # magic OBFT flag value
         protocolConstants:
           <<: *mainnet_base_protocolConstants
           protocolMagic: 170987650
@@ -15100,7 +15101,7 @@ devnet: &devnet
     applicationName: cardano-sl
     applicationVersion: 0
     lastKnownBlockVersion:
-      bvMajor: 0
+      bvMajor: 1
       bvMinor: 0
       bvAlt: 0
     systemTag: none

@erikd erikd merged commit 1826fad into develop Nov 6, 2018
@mhuesch mhuesch deleted the mhuesch/CDEC-610 branch November 6, 2018 19:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants