New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement "post ICO" fork #69

Merged
merged 4 commits into from Nov 6, 2018

Conversation

Projects
None yet
1 participant
@domob1812
Collaborator

domob1812 commented Nov 6, 2018

This implements the planned "post ICO" hard fork. For now, it is scheduled at height 500 on regtest, 11k on testnet and 1M on mainnet. The mainnet height will be defined later after a (hopefully) successful activation on testnet.

This changes three things:

  1. The nonce values of main block headers no longer need to be zero (#50).
  2. The block intervals are changed and made algorithm-dependent: Neoscrypt targets 40s and SHA-256d two minutes after the fork (for an average that is still 30s per block). See #67 for the discussion.
  3. The block rewards are increased to 10 CHI on testnet and mainnet after the fork. For testnet, that is the (arbitrary) value we will use. For mainnet, the value will be changed when the actual fork height becomes known, so that we can calculate the correct value. This implements #40.

domob1812 added some commits Oct 17, 2018

Allow non-zero nonce with POST_ICO fork.
This implements a hard fork scheduled at certain heights (500 on regtest,
1M on testnet and mainnet for now, will be changed) that allows non-zero
nonce values in the main block header (not the fake header).  This solves
#50.

Forks are added to Consensus::Params similar to how they are handled in
Huntercoin.  For now, there's only this one, but there will likely be
more in the future; for instance, to change the standalone mining
algorithm or when we implement ephemeral timestamps.

The created POST_ICO fork will contain more things in the future, namely
a change to the block reward and block interval as described in
#40.
Make block target spacing fork-able.
Instead of having the nPowTargetSpacing a simple chain param, turn it
into a method on the chain rules so that it can depend both on the
algorithm and on the block height (so that it can be changed in forks).

The code using the value is separated into parts that use the real
target spacing per algo (mainly for difficulty retargeting) and code
that actually needs the *average* spacing among all algorithms for
estimates of tip staleness and related stuff.  The latter is now
achieved using a new AvgTargetSpacing method, that computes the value
for all algorithms from the pure algo-dependent values (but still
depends on the height in case the value changes through forks in the
future).

The new flexibility is used to set the target spacing to 40 seconds
with Neoscrypt and 120 seconds with SHA-256d merged mining.  This will
allow us to get the desired 25%/75% split of block rewards between the
algorithms, while keeping the average at two blocks per minute for now.

Note that the average target spacing is not changed (even though the
code is made to support changes with it), so that the block heights
passed to AvgTargetSpacing do not matter for now.  The only changes
are due to some places where the nPowTargetSpacing was used while
it should have been nPowTargetSpacing/2 instead.  (For instance,
the -assumevalid time window had to be decreased again for this
to make the test with 2,100 blocks as window pass.)

This implements #67.
Increase block reward with POST_ICO fork.
Increase the block reward on testnet and mainnet together with the other
changes in the POST_ICO fork.  That means that the reward will be 1 CHI
before the fork, and then increase to a currently-set value of 10 CHI
afterwards.  It will halve as usual from there on.

On regtest, this rule is disabled, so that the reward stays 50 CHI with
normal halving.  This ensures that no magic numbers in tests have to be
tweaked unnecessarily.

The value of 10 CHI for the block reward is arbitrary.  It will be used
on testnet for verifying the fork.  On mainnet, the number will be changed
once the final fork height and thus the correct block reward (to achieve
the targeted total supply) have been fixed.
Set POST_ICO fork for testnet.
This schedules the POST_ICO fork on testnet for block height 11k
(currently testnet is at 10824 and has been for a long time).

On mainnet, the fork remains at height 1M, to be scheduled later after
a (hopefully) successful testnet activation.

@domob1812 domob1812 added this to the 1.1 milestone Nov 6, 2018

@domob1812 domob1812 merged commit 356be12 into master Nov 6, 2018

domob1812 added a commit that referenced this pull request Nov 6, 2018

Merge #69: Implement "post ICO" fork
356be12 Set POST_ICO fork for testnet. (Daniel Kraft)
5752067 Increase block reward with POST_ICO fork. (Daniel Kraft)
dd40da9 Make block target spacing fork-able. (Daniel Kraft)
d7f7e84 Allow non-zero nonce with POST_ICO fork. (Daniel Kraft)

Pull request description:

  This implements the planned "post ICO" hard fork.  For now, it is scheduled at height 500 on regtest, 11k on testnet and 1M on mainnet.  The mainnet height will be defined later after a (hopefully) successful activation on testnet.

  This changes three things:

  1. The nonce values of main block headers no longer need to be zero (#50).
  2. The block intervals are changed and made algorithm-dependent:  Neoscrypt targets 40s and SHA-256d two minutes after the fork (for an average that is still 30s per block).  See #67 for the discussion.
  3. The block rewards are increased to 10 CHI on testnet and mainnet after the fork.  For testnet, that is the (arbitrary) value we will use.  For mainnet, the value will be changed when the actual fork height becomes known, so that we can calculate the correct value.  This implements #40.

Tree-SHA512: 20b0cc0ea020cdcf46bbb2476bdfe0799b02faffcaf23f0b312d76d351e735ff17ac294a6ad1b6dd865e5134ff15fa5a53a1b2869990efdbb51caa847ba827fd

@domob1812 domob1812 deleted the fork branch Nov 6, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment