Skip to content

Commit

Permalink
3.5.8.7-Mandatory Upgrade
Browse files Browse the repository at this point in the history
Gridcoin Research 3.5.8.7/MSI=42.1
Mandatory Upgrade

- Added checkpoint at 850000
- Enforce beacon age; beacons over 6 months are discarded network wide.
Beacons may be re-sent without restarting if they are expired.
- To sync: From the command line on windows: grcrestarter
downloadblocks.  NOTE ** We still need 51% to upgrade to stay in sync.
After block 855000, clients enforce the mandatory upgrade.
  • Loading branch information
gridcoin committed Mar 26, 2017
1 parent e58719f commit f955fd4
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 42 deletions.
1 change: 1 addition & 0 deletions Makefile.Debug
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#############################################################################
# Makefile for building: gridcoinresearch
# Generated by qmake (2.01a) (Qt 4.8.4) on: Sun Mar 26 17:49:04 2017
# Project: gridcoinresearch.pro
# Template: app
#############################################################################
Expand Down
1 change: 1 addition & 0 deletions Makefile.Release
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#############################################################################
# Makefile for building: gridcoinresearch
# Generated by qmake (2.01a) (Qt 4.8.4) on: Sun Mar 26 17:49:05 2017
# Project: gridcoinresearch.pro
# Template: app
#############################################################################
Expand Down
45 changes: 10 additions & 35 deletions contrib/Installer/GridcoinInstaller/GridcoinResearch.vdproj
Original file line number Diff line number Diff line change
Expand Up @@ -232,37 +232,37 @@
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
"OwnerKey" = "8:_7A0EA93E644A4D9E8037FBB3C062DD65"
"OwnerKey" = "8:_6408A3D03D15E306A4C3FC5FD95ADA69"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
"OwnerKey" = "8:_6AEABB5004EC4B57225B51B085DB5625"
"OwnerKey" = "8:_32F2DC723F30362B0B78F9A291EC0098"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
"OwnerKey" = "8:_5644D8F767F33372E534FBD5A2384D12"
"OwnerKey" = "8:_DEB886DE05C496A5AD26B43C4B1B90B9"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
"OwnerKey" = "8:_DEB886DE05C496A5AD26B43C4B1B90B9"
"OwnerKey" = "8:_5644D8F767F33372E534FBD5A2384D12"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
"OwnerKey" = "8:_32F2DC723F30362B0B78F9A291EC0098"
"OwnerKey" = "8:_6AEABB5004EC4B57225B51B085DB5625"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
"OwnerKey" = "8:_6408A3D03D15E306A4C3FC5FD95ADA69"
"OwnerKey" = "8:_7A0EA93E644A4D9E8037FBB3C062DD65"
"MsmSig" = "8:_UNDEFINED"
}
}
Expand Down Expand Up @@ -437,11 +437,6 @@
"AssemblyAsmDisplayName" = "8:GRCSec, Version=1.0.0.3, Culture=neutral, processorArchitecture=MSIL"
"ScatterAssemblies"
{
"_32F2DC723F30362B0B78F9A291EC0098"
{
"Name" = "8:GRCSec.dll"
"Attributes" = "3:512"
}
}
"SourcePath" = "8:GRCSec.dll"
"TargetName" = "8:"
Expand Down Expand Up @@ -559,11 +554,6 @@
"AssemblyAsmDisplayName" = "8:OpenPop, Version=2.0.5.0, Culture=neutral, processorArchitecture=MSIL"
"ScatterAssemblies"
{
"_5644D8F767F33372E534FBD5A2384D12"
{
"Name" = "8:openpopstake.dll"
"Attributes" = "3:512"
}
}
"SourcePath" = "8:openpopstake.dll"
"TargetName" = "8:"
Expand All @@ -590,11 +580,6 @@
"AssemblyAsmDisplayName" = "8:MySql.Data, Version=6.6.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL"
"ScatterAssemblies"
{
"_6408A3D03D15E306A4C3FC5FD95ADA69"
{
"Name" = "8:MySql.Data.dll"
"Attributes" = "3:512"
}
}
"SourcePath" = "8:MySql.Data.dll"
"TargetName" = "8:"
Expand All @@ -621,11 +606,6 @@
"AssemblyAsmDisplayName" = "8:SQLite.NET, Version=0.21.1869.3794, Culture=neutral, PublicKeyToken=c273bd375e695f9c"
"ScatterAssemblies"
{
"_6AEABB5004EC4B57225B51B085DB5625"
{
"Name" = "8:sqlitestake.net.dll"
"Attributes" = "3:512"
}
}
"SourcePath" = "8:sqlitestake.net.dll"
"TargetName" = "8:"
Expand Down Expand Up @@ -898,11 +878,6 @@
"AssemblyAsmDisplayName" = "8:ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73"
"ScatterAssemblies"
{
"_DEB886DE05C496A5AD26B43C4B1B90B9"
{
"Name" = "8:icsharpcode.sharpziplib.dll"
"Attributes" = "3:512"
}
}
"SourcePath" = "8:icsharpcode.sharpziplib.dll"
"TargetName" = "8:"
Expand Down Expand Up @@ -1109,19 +1084,19 @@
{
"Name" = "8:Microsoft Visual Studio"
"ProductName" = "8:Gridcoin Research"
"ProductCode" = "8:{99640ABC-1BE5-4E04-B0D9-47AAD10FB404}"
"PackageCode" = "8:{BFB1DB38-B968-4E50-9221-9918143CECEA}"
"ProductCode" = "8:{841D7D7B-708C-4FB6-952D-FE393085E82D}"
"PackageCode" = "8:{B62D5B84-E542-4BA2-9024-E4D93CD8DBA7}"
"UpgradeCode" = "8:{9617E9EA-252F-43CE-B53E-B48C85F71192}"
"AspNetVersion" = "8:4.0.30319.0"
"RestartWWWService" = "11:FALSE"
"RemovePreviousVersions" = "11:TRUE"
"DetectNewerInstalledVersion" = "11:FALSE"
"InstallAllUsers" = "11:TRUE"
"ProductVersion" = "8:42.0"
"ProductVersion" = "8:42.1"
"Manufacturer" = "8:GridcoinResearch"
"ARPHELPTELEPHONE" = "8:"
"ARPHELPLINK" = "8:"
"Title" = "8:Gridcoin Research 42.0"
"Title" = "8:Gridcoin Research 42.1"
"Subject" = "8:"
"ARPCONTACT" = "8:The Gridcoin Developers"
"Keywords" = "8:Gridcoin Research"
Expand Down
1 change: 1 addition & 0 deletions src/checkpoints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ namespace Checkpoints
(500000, uint256("0x3916b53eaa0eb392ce5d7e4eaf7db4f745187743f167539ffa4dc1a30c06acbd") )
(700000, uint256("0x2e45c8a834675b505b96792d198c2dc970f560429c635479c347204044acc59b") )
(770000, uint256("0xfc13a63162bc0a5a09acc3f284cf959d6812a027bb54b342a0e1ccaaca8627ce") )
(850000, uint256("0xc78b15f25ad990d02256907fab92ab37301d129eaea177fd04acacd56c0cbd22") )
;

// TestNet has no checkpoints
Expand Down
2 changes: 1 addition & 1 deletion src/clientversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#define CLIENT_VERSION_MAJOR 3
#define CLIENT_VERSION_MINOR 5
#define CLIENT_VERSION_REVISION 8
#define CLIENT_VERSION_BUILD 6
#define CLIENT_VERSION_BUILD 7

// Converts the parameter X to a string after macro replacement on X has been performed.
// Don't merge these into one macro!
Expand Down
18 changes: 14 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ extern void FlushGridcoinBlockFile(bool fFinalize);
std::string msHDDSerial = "";
//When syncing, we grandfather block rejection rules up to this block, as rules became stricter over time and fields changed

int nGrandfather = 726000;
int nGrandfather = 854400;
int nNewIndex = 271625;
int nNewIndex2 = 364500;

Expand Down Expand Up @@ -4368,8 +4368,9 @@ bool CBlock::CheckBlock(std::string sCaller, int height1, int64_t Mint, bool fCh
double bv = BlockVersion(bb.clientversion);
double cvn = ClientVersionNew();
if (fDebug10) printf("BV %f, CV %f ",bv,cvn);
//if (bv+10 < cvn) return error("ConnectBlock[]: Old client version after mandatory upgrade - block rejected\r\n");
if (bv < 3517 && IsResearchAgeEnabled(height1) && !fTestNet) return error("CheckBlock[]: Old client spamming new blocks after mandatory upgrade \r\n");
// if (bv+10 < cvn) return error("ConnectBlock[]: Old client version after mandatory upgrade - block rejected\r\n");
// Enforce Beacon Age
if (bv < 3587 && height1 > 855000 && !fTestNet) return error("CheckBlock[]: Old client spamming new blocks after mandatory upgrade \r\n");
if (bv < 3580 && fTestNet) return DoS(25, error("CheckBlock[]: Old testnet client spamming new blocks after mandatory upgrade \r\n"));

This comment has been minimized.

Copy link
@tomasbrod

tomasbrod Mar 27, 2017

Member

Why on testnet error is reported with DoS() and on prod with error()?

}

Expand Down Expand Up @@ -7169,6 +7170,14 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
return false;
}

if (pfrom->nVersion < 180322 & !fTestNet && pindexBest->nHeight > 855000)

This comment has been minimized.

Copy link
@denravonska

denravonska Mar 29, 2017

Member

This is supposed to be < 180322 &&, right?

{
// disconnect from peers older than this proto version - Enforce Beacon Age - 3-26-2017
if (fDebug10) printf("partner %s using obsolete version %i (before enforcing beacon age); disconnecting\n", pfrom->addr.ToString().c_str(), pfrom->nVersion);
pfrom->fDisconnect = true;
return false;
}

if (!fTestNet && pfrom->nVersion < 180314 && IsResearchAgeEnabled(pindexBest->nHeight))
{
// disconnect from peers older than this proto version
Expand Down Expand Up @@ -7196,7 +7205,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
if (GetArgument("autoban","true") == "true")
{

// Note: Hacking attempts start in this area 3-26-2016
// Note: Hacking attempts start in this area
if (false && pfrom->nStartingHeight < (nBestHeight/2) && LessVerbose(1) && !fTestNet)
{
if (fDebug3) printf("Node with low height");
Expand Down Expand Up @@ -9860,6 +9869,7 @@ bool MemorizeMessage(std::string msg, int64_t nTime, double dAmount, std::string
{
// If the Beacon Public Key is Not Empty - do not overwrite with a new beacon value
std::string sBPK = GetBeaconPublicKey(sMessageKey);
// Note that if the beacon is > 6 months old, this function now returns an empty string (allowing the beacon to be overwritten) : OK
if (!sBPK.empty())
{
// Do not overwrite this beacon
Expand Down
12 changes: 11 additions & 1 deletion src/rpcblockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1359,6 +1359,7 @@ bool AdvertiseBeacon(bool bFromService, std::string &sOutPrivKey, std::string &s
std::string sBeaconPublicKey = GetBeaconPublicKey(GlobalCPUMiningCPID.cpid);
if (!sBeaconPublicKey.empty())
{
// Ensure they can re-send the beacon if > 6 months old : GetBeaconPublicKey returns an empty string when > 6 months: OK.
sError = "ALREADY_IN_CHAIN";
return bFromService ? true : false;
}
Expand Down Expand Up @@ -3817,10 +3818,19 @@ std::string GetLocalBeaconPublicKey(std::string cpid)
return sBeaconPubKey;
}

std::string RetrieveCachedValueWithMaxAge(std::string sKey, int64_t iMaxSeconds)
{
int64_t iAge = GetAdjustedTime() - mvApplicationCacheTimestamp[sKey];
std::string sValue = mvApplicationCache[sKey];

This comment has been minimized.

Copy link
@tomasbrod

tomasbrod Mar 27, 2017

Member

mvApplicationCache contents should be changed from string to pointer to object.

// if (fDebug3) printf("\r\n BeaconAge %f, MaxAge %f, CPID %s\r\n",(double)iAge,(double)iMaxSeconds,sValue.c_str());
return (iAge > iMaxSeconds) ? "" : sValue;
}

std::string GetBeaconPublicKey(std::string cpid)
{
std::string sBeacon = mvApplicationCache["beacon;" + cpid];
//3-26-2017 - Ensure beacon public key is within 6 months of network age
int64_t iMaxSeconds = 60 * 24 * 30 * 6 * 60;

This comment has been minimized.

Copy link
@denravonska

denravonska Mar 31, 2017

Member

I think this either needs to check the height and not the time, or the verification in the init stage should be changed to match this. Right now they could desync, leaving you without the beacon.

std::string sBeacon = RetrieveCachedValueWithMaxAge("beacon;" + cpid, iMaxSeconds);
if (sBeacon.empty()) return "";
// Beacon data structure: CPID,hashRand,Address,beacon public key: base64 encoded
std::string sContract = DecodeBase64(sBeacon);
Expand Down
2 changes: 1 addition & 1 deletion src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ extern int MINOR_VERSION;
///////////////////////////////////////////////////////////
// network protocol versioning //
// //
static const int PROTOCOL_VERSION = 180321; //
static const int PROTOCOL_VERSION = 180322; //
// disconnect from peers older than this proto version //
static const int MIN_PEER_PROTO_VERSION = 180284; //
///////////////////////////////////////////////////////////
Expand Down

0 comments on commit f955fd4

Please sign in to comment.