namecoin / namecoin-core

Namecoin full node + wallet based on the current Bitcoin Core codebase.
https://www.namecoin.org/
MIT License
461 stars 147 forks source link

Soft fork for BIP16, segwit and others #239

Open domob1812 opened 6 years ago

domob1812 commented 6 years ago

There are a couple of soft forks that have gone through long ago in upstream Bitcoin but not yet in Namecoin. The most important ones are BIP16 and Segwit. BIP16 has not been activated yet as it was activated in Bitcoin through a scheduled time instead of through BIP34, and we never explicitly scheduled it in Namecoin after upgrading to Namecoin Core (while the BIP34 forks went through automatically). Segwit has not been activated because versionbits/BIP9 conflicts with merge mining.

Not having those forks is both a loss in functionality (mainly for BIP16) and a burden/risk when merging upstream changes, as Bitcoin might change things with the assumption that those forks are already done. Thus I think we should finally get them activated.

I already added a parameter for setting an activation height including for segwit (to get around the BIP9 issue) in 4cf6ddbfd80921e1e82f001cdc9c2dc44ce0ac2c. So all that remains is coordinating mainly with the biggest miners on an actual height and finalising it. I want to use this issue for tracking the effort.

domob1812 commented 6 years ago

Top mining pools and contact information for them: https://forum.namecoin.org/viewtopic.php?f=6&p=17489

I'll try to get in touch with everyone and inquire if they are willing to support such a fork (I don't see a reason why not) and how much time they would need in advance.

domob1812 commented 6 years ago

@wangchun: Would you support such a fork and if so, how much advance notice do you need? I'm currently thinking of something like three months. Would that be sufficient? (We can also wait longer - we've now been talking about forks for years already without doing any....)

domob1812 commented 6 years ago

Contacted Slush through their contact form, BTC.com and ViaBTC through their support email addresses. @JeremyRand - I'm not on Twitter, could you perhaps take care of pointing the BTC.top CEO to this issue?

If we get support from F2Pool, Slush, BTC.com, BTC.top and ViaBTC, then we have around 88% of the hash rate covered. Then I think it would be fine to just announce the planned fork on various threads publicly and schedule it three months in advance or something.

YihaoPeng commented 6 years ago

Hi I'm the BTC.com's maintainer and I have read your email. We support and welcome this soft fork.

In addition, because this soft fork doesn‘t seem to have any effect on the merge mining, we should be able to complete the upgrade very quickly. It will take about 1 to 2 days to upgrade all the nodes. We can start the upgrade at any date.

So what is your plan? When should I upgrade these nodes and how do I configure it (about the parameter for setting the activation height including for segwit)?

domob1812 commented 6 years ago

Thanks @YihaoPeng for the quick reply - that sounds great! I've not yet set a fork height in the code, so for now, there's no need to update. I'll coordinate with other big pools as well and then fix the height. Once that is done and an upgrade is required from your side, I'll ping this thread and mention you.

wangchun commented 6 years ago

@domob1812 Three months good to me.

JeremyRand commented 6 years ago

@domob1812 As I alluded to on the forum, there are some edge cases introduced by P2SH and SegWit (mostly SegWit) that I'd like to make sure we have test cases for. I've been busy for the last few weeks due to other areas of dev and some deadlines for DWS submissions, but both of those have quieted down as of today, so I'll inspect the existing test cases in the next day or two and file issues for anything I think we need to test for.

EDIT: To be clear, I don't have any specific reason to believe we have any bugs in the P2SH or SegWit integration -- I just want to make sure that things are tested for, since having something unexpectedly go wrong would be highly bad.

domob1812 commented 6 years ago

@JeremyRand - sounds good. There is plenty of time before this would actually go live (three months at least), so there is also no particular hurry. We've had some P2SH testing for a long time, both in unit and regression tests - but it is always good for a second check, so please take a look and let me know (issues are perfect) about anything you feel like it needs more tests.

In addition, the activation of the soft forks should not by itself cause any issues even if there were bugs. We only need to make sure that all interactions between P2SH / Segwit and Namecoin are good before we tell people that multisig is now safe with Namecoin and/or change the default address type to Segwit.

JeremyRand commented 6 years ago

In addition, the activation of the soft forks should not by itself cause any issues even if there were bugs. We only need to make sure that all interactions between P2SH / Segwit and Namecoin are good before we tell people that multisig is now safe with Namecoin and/or change the default address type to Segwit.

@domob1812 The things I want to add tests for actually would cause problems in such a case, because incorrect behavior could conceivably cause the softfork to become a hardfork, and/or require a hardfork to fix if P2SH and SegWit are already activated.

domob1812 commented 6 years ago

Slush gave their support by email. I've not yet heard from ViaBTC. @JeremyRand, did you try to contact BTC.top via Twitter yet?

domob1812 commented 5 years ago

In https://github.com/namecoin/meta/issues/51, we decided that we should go for Segwit with Bitcoin's block weight at least initially (and then see how the situation evolves and consider lowering the weight limit as needed later on). This means that all that remains to do is schedule the softfork. @JeremyRand, can you confirm that I did not miss any other blockers from your point of view?

We should set the fork heights to blocks maybe in a month for testnet and six months for mainnet, and include that as well in the upcoming 0.18 release.

JeremyRand commented 5 years ago

@domob1812 AFAIK the softforks activated here are P2SH, CSV, and SegWit, correct? Are there any others? P2SH and SegWit now have unit tests to verify that they don't misbehave with name scripts, so I think those are good to go. I can't think of any reason why CSV could possibly interact badly with Namecoin's changes compared to Bitcoin, so I think that's okay as well. If those are the only 3 softforks activated, then I don't think there are any blockers from my end.

domob1812 commented 5 years ago

Yes, it is only those. Ok cool! Then I suggest this as the next steps: As soon as Bitcoin releases the final 0.18.0, I will set the soft fork for six months ahead on mainnet and one month on testnet, and release Namecoin 0.18.0 based on Bitcoin 0.18.0 including the softfork trigger.

domob1812 commented 5 years ago

Proposed activation is in #302. Please take a look and give feedback there (especially if you do not agree with the proposed activation heights).

domob1812 commented 5 years ago

Version 0.18.0 has just been released with a scheduled segwit activation. @YihaoPeng, @wangchun and everyone else, please make sure to update timely.

JeremyRand commented 5 years ago

@YihaoPeng @wangchun Just checking, have BTC.COM and F2Pool upgraded to Namecoin Core 0.18.0 yet? (I'm reaching out to mining pools to gauge how much hashrate has already upgraded.)

JeremyRand commented 5 years ago

@YihaoPeng All of BTC.com's Namecoin blocks today have been valid (followed the softfork correctly) except for the most recent two, block hashes aa90328f456dc560da1291f78c32e48b20009808d5e2bb482914818e7af8c9c8 and 4d6b4840cc84e7e4a83eebf0a34754e6439a52b5dc008000a4c6b911d00a87c6. Can you please check your systems and see if maybe one of your Namecoin Core nodes wasn't upgraded properly for the softfork?

(There are a couple of other mining pools who somehow botched the upgrade, specifically Poolin and Slush, we're working to get their systems fixed. Until we get their systems fixed, there will be some invalid blocks being mined from those pools. Your Namecoin Core 0.18.0 nodes should be ignoring those blocks.)

jrkenn commented 5 years ago

I am currently using the Windows version 13.99 with the QT GUI. Will this be affected? I use it mainly for domains.

JeremyRand commented 5 years ago

I am currently using the Windows version 13.99 with the QT GUI. Will this be affected? I use it mainly for domains.

@jrkenn 0.13.99 will not enforce the softfork, but it should be fine as long as the miners are enforcing the softfork. As stated on the Namecoin Twitter account, there's a bit of network disruption in the wake of the softfork, so you may want to avoid registering new names or accepting incoming payments until we give the all clear. Updating or renewing existing names should be completely safe AFAIK.