Skip to content

Update May 15, 2018 fork activation time as per spec draft#987

Merged
gandrewstone merged 2 commits intoBitcoinUnlimited:devfrom
sickpig:fix-may2018-forktime
Mar 7, 2018
Merged

Update May 15, 2018 fork activation time as per spec draft#987
gandrewstone merged 2 commits intoBitcoinUnlimited:devfrom
sickpig:fix-may2018-forktime

Conversation

@sickpig
Copy link
Copy Markdown
Collaborator

@sickpig sickpig commented Mar 2, 2018

See bitcoincashorg/spec#53 for more details.

According to the draft specification for the upcoming May 15, 2018
Bitcoin Cash HF (bitcoincashorg/spec#53) the
activation time is 1526400000, i.e. Tue May 15 18:00:00 CEST 2018
@sickpig
Copy link
Copy Markdown
Collaborator Author

sickpig commented Mar 5, 2018

travis failure is due to the fact that Params struct is not initialized at the time of definition of miningForkTime CTweak. This is due globals ctor order.

Since Params struct is defined at the Consensus namespace level this is by definition not defined at the time globals are defined.

@sickpig sickpig force-pushed the fix-may2018-forktime branch 2 times, most recently from 6305659 to 4755db6 Compare March 6, 2018 13:43
@sickpig
Copy link
Copy Markdown
Collaborator Author

sickpig commented Mar 6, 2018

Using CChainParams &Params(const std::string &chain) in global.cpp rather than &Params() fixed the problem locally on an Ubuntu 16.04 machine.

I was able to reproduce the error (src/test/test_bitcoin segmentation fault) on an VM running ubuntu 14.04 (same as travis). This is the backtrace:

(gdb) bt
#0  0x00002b232b3256f3 in std::string::size() const () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#1  0x00002b2329663e39 in std::operator==<char> (__lhs=<error reading variable: Cannot access memory at address 0xffffffffffffffe8>, 
    __rhs=<error reading variable: Cannot access memory at address 0xffffffffffffffe8>) at /usr/include/c++/4.8/bits/basic_string.h:2495
#2  0x00002b2329cfd5f0 in Params (chain=<error reading variable: Cannot access memory at address 0xffffffffffffffe8>) at chainparams.cpp:463
#3  0x00002b23299e7fe3 in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at globals.cpp:183
#4  0x00002b23299e87db in _GLOBAL__sub_I_dd_mutex () at globals.cpp:282
#5  0x00002b232a151ecd in __libc_csu_init ()
#6  0x00002b232baaded5 in __libc_start_main (main=0x2b232963ba00 <main>, argc=1, argv=0x7ffe0b36c2c8, init=0x2b232a151e80 <__libc_csu_init>, fini=<optimized out>, rtld_fini=<optimized out>, 
    stack_end=0x7ffe0b36c2b8) at libc-start.c:246
#7  0x00002b232963e7ab in _start ()

so it seems that for some reason the ctor order is different when using gcc ver 4.8 (ubuntu 14.04) than when we use gcc 5.4.1 (ubuntu 16.04). In fact CBaseChainParams::MAIN is already initialize at the time we define miningForkTime tweak with 5.4.1 whereas it is not when we use gcc 4.8.

Before the default value for mining.forkMay2018Time tweak was
Tue 15 May 2018 12:00:00 UTC. As per spec the actual value to be used
is Tue 15 May 2018 18:00:00 UTC.

While at is use the consensus params interface rather than stating the
epoch directly in the file.

Unfortunately we could not use `CChainParams &Params(const std::string &chain)`
to access to the consensus params definition to define miningForkTime tweak
due to ctor global ordering.

In fact such order is influenced by compiler version, distro and probably linker
version; so for example:

    const CChainParams &chainparams = Params(CBaseChainParams::MAIN);

works w/o issue, i.e. test_bitcoin won't segfault during `make check`,
if the build process is carried over on an Ubuntu 16.04. Same code leads
to a segfault on Ubuntu 14.04 and this is why travis was failing (cause
travis use Ubuntu 14.04)
@sickpig sickpig force-pushed the fix-may2018-forktime branch from 4755db6 to 1a2b795 Compare March 7, 2018 15:26
@gandrewstone gandrewstone merged commit 924c27a into BitcoinUnlimited:dev Mar 7, 2018
CTweak<uint64_t> miningForkTime("mining.forkMay2018Time",
"Time in seconds since the epoch to initiate a hard fork scheduled on 15th May 2018.",
1526386800); // Tue 15 May 2018 12:20:00 UTC FIXME: use the correct timestamp once the spec will be ready
1526400000); // Tue 15 May 2018 18:00:00 UTC
Copy link
Copy Markdown
Collaborator

@dgenr8 dgenr8 Mar 7, 2018

Choose a reason for hiding this comment

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

The correct human-readable time is Tue 15 May 2018 16:00:00 UTC

marlengit pushed a commit to marlengit/BitcoinUnlimited that referenced this pull request Sep 25, 2018
…limited#987)

* Add May 15, 2018 HF activation time to consensus params

According to the draft specification for the upcoming May 15, 2018
Bitcoin Cash HF (bitcoincashorg/spec#53) the
activation time is 1526400000, i.e. Tue May 15 18:00:00 CEST 2018
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.

4 participants