Skip to content

Conversation

@hrobeers
Copy link

@hrobeers hrobeers commented Mar 6, 2017

On testnet, the BIP34 softfork get's accidently activated prematurely. Probably due to experimentation with the version number on testnet.

A protocol v0.6 switchtime should still be decided on.
Note that BIP34 is just a soft fork, legacy clients will still accept blocks created after activation.

@hrobeers hrobeers changed the title Prevent premature activation of BIP34 softfork [ppcoin v0.6] Prevent premature activation of BIP34 softfork Mar 10, 2017
@hrobeers hrobeers requested a review from sunnyking March 10, 2017 09:11
@hrobeers hrobeers added the v0.6 label Mar 10, 2017
src/kernel.h Outdated
// Whether a given transaction is subject to new v0.5 protocol
bool IsProtocolV05(unsigned int nTimeTx);
// Whether a given block or transaction is subject to new v0.6 protocol
bool IsProtocolV06(unsigned int nTimeTx);
Copy link
Member

Choose a reason for hiding this comment

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

This appears to refer to block timestamp only for the version requirements of blocks (iirc version 2 adds block height info to coinbase)

Copy link
Member

Choose a reason for hiding this comment

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

So better use nTimeBlock instead?

Copy link
Author

Choose a reason for hiding this comment

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

I didn't notice the difference between nTimeBlock and nTimeTx.

Why would you ever use nTimeTx?
It is not reliable as the sender can pick any time he likes.

Copy link
Member

Choose a reason for hiding this comment

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

For v0.5 it's only supposed to be used for coinstake transactions I think, whose nTime cannot be picked arbitrarily

@hrobeers
Copy link
Author

Changed to nTimeBlock

@sunnyking
Copy link
Member

On second thought, why do we need to make a hard fork upgrade for this feature, as the purpose of IsSuperMajority() is to allow miners/pools to migrate at their own schedule?

@sunnyking
Copy link
Member

I can understand it's a problem on testnet, our testnet has no mining majority as likely no one is mining on testnet most of times, so if your new node mines 100 blocks your node would falsely think 'the majority' has upgraded so it starts rejecting other miners' blocks

@hrobeers
Copy link
Author

hrobeers commented Mar 23, 2017

It is not hard fork, it is a soft fork.

The v06 activation time prevents the softfork from being activated prematurely, which happens on testnet and therefore testnet fails to sync.
It happens on testnet because there are a lot of v2 blocks already in the chain.

Just try to sync the testnet with the client without this fix, you'll see.

IsSuperMajority() check both PoW and PoS blocks, it's not about miners only on peercoin.

@sunnyking
Copy link
Member

Yes, I meant both miners and minters. If I understand correctly, is it not only limited to testnet? On the testnet, isn't it only a problem as there is no consistent minting/mining body? Or else how did you reach 75 blocks of 100 to trigger the enforcement of version 2 blocks? What was the concern such that mainnet must use a delayed turn-on of this feature?

@hrobeers
Copy link
Author

The soft fork get's activated on testnet because someone experimented with version 2 blocks on it.
Indeed the switchtime is not needed on mainnet, but it is much cleaner and more readable to introduce a V06 switchtime compared to adding if(testnet && islaterthan())

What alternative do you suggest?

@sunnyking
Copy link
Member

I am thinking maybe we should choose only one of the two:
a) bitcoin's IsSuperMajority()
pros: no mandatory upgrade deadline
cons: users not sure when the upgrade deadline is, especially not nice for miners
b) pre announce mandatory upgrade deadline like peercoin's v0.5, v0.4
pros: clear expectation for users, easier to understand behavior for debugging
cons: requires every node to upgrade before deadline
I think maybe b) should be our preferred approach, of help with our testing on testnet and also easier to diagnose if something happens. bitcoin later versions have quite a few of these 'soft' upgrades, so it's also a consideration down the road. this means disabling the calls to IsSuperMajority(), treating the bitcoin soft upgrades as mandatory protocol upgrades.
For this particular upgrade, all the nodes that mint blocks (pos and pow) are required to upgrade, unlike in bitcoin's case it's only the mining nodes.
What do you think?

@hrobeers
Copy link
Author

I don't know if you see that this pull request currently implements a) using bitcoin's IsSuperMajority()
It just makes sure that it can't happen before V06 switchtime which is currently even disabled.

I believe we should go for a) if we won't make any protocol changes anymore, as it would allow old clients to still validate the chain, they will just fail to mint.

I agree that if we are going to hard fork for other reasons, we should hard fork this change too.

Because all of this is not yet clear, I suggest to just merge this pull request. Currently the soft fork is disabled anyway (see code snippet below). At least we'll have a working client on testnet, I've been running and minting with this code on testnet for a few weeks now.

bool IsProtocolV06(unsigned int nTimeBlock)
 {
     // TODO decide on upgrade timing
     return false;
 }

@sunnyking sunnyking merged commit 15ea8df into peercoin:develop Mar 25, 2017
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.

2 participants