Skip to content
Permalink
Browse files

Merge pull request #22 from PascalCoinDev/master

Set to 5.2
  • Loading branch information
PascalCoinDev committed Feb 11, 2020
2 parents a7049b4 + c0a5e81 commit 377380d8168d995135a758c5ffeb5bf7f5b3c658
@@ -1,13 +1,16 @@
# Changelog

## Build 5.2.0 (PENDING)
## Build 5.2.0 - 2020-02-11
- Mandatory upgrade due fixes some important security bugs
- Fixed CryptoLib4Pascal multithreading bug
- Fixed important bug caused by bad calculated "more work" blockchain
- Previous "more work" (introduced on build 1.5.0.0 2017-02-15) was calculated by SUM(compact_target), but compact_target is a linear value (not exponential)
- Current "more work" will be equals to "aggregated hashrate" that is SUM(CompactTargetToHashRate(compact_target)) where "hashrate" is exponential
- This important bug was found by Herman Schoenfeld (herman@sphere10.com)
- NAT limited to 7 seconds by default as proposed by Herman Schoenfeld (herman@sphere10.com) in order to minimize a warp timestamp attack. This value can be configured.
- Fix invalid "balance" rounded decimals value caused by FPC (daemon or Linux versions)
- Improvements on hashlib4pascal library by Ugochukwu Mmaduekwe <https://github.com/Xor-el>
- Introducing CryptoLib4Pascal usage
- Minor improvements and fixed bugs

## Build 5.1.0 - 2019-11-25
@@ -24,29 +24,18 @@

- Use_CryptoLib4Pascal : Will not use OpenSSL library, will use pascal native CryptoLib4Pascal
- Use_OpenSSL : Will use OpenSSL library (Need version 1.1)
- OpenSSL10 : When "Use_OpenSSL" enabled, will use version 1.0 instead of 1.1 -> DO NOT USE!

- Synapse : Will use Synapse sockets (Preferred)
- DelphiSockets : Will use Delphi Indy sockets (Use only for special purposes... for example for mobile apps)

- OPTIONS_BY_DEFAULT : (Preferred)
Will define "Synapse" and will undefine "OpenSSL10"
- DelphiSockets_OpenSSLv10 :
Will define "DelphiSockets" and will define "OpenSSL10"
- Synapse_OpenSSLv10 :
Will define "Synapse" and will define "OpenSSL10"
- Synapse_OpenSSLv11 :
Will define "Synapse" and will undefine "OpenSSL10"

}

{.$DEFINE PRODUCTION}
{$DEFINE TESTNET}
{$DEFINE PRODUCTION}
{.$DEFINE TESTNET}

// Activate to define CryptoLib4Pascal by default on all compilations
{.$DEFINE Use_CryptoLib4Pascal}

{$DEFINE OPTIONS_BY_DEFAULT}
{.$DEFINE DelphiSockets_OpenSSLv10}
{.$DEFINE Synapse_OpenSSLv10}
{.$DEFINE Synapse_OpenSSLv11}

// Used to activate RandomHash in V4 hard-fork
{$DEFINE ACTIVATE_RANDOMHASH_V4}
@@ -77,60 +66,36 @@
ERROR: You must select ONLY ONE option: PRODUCTION or TESTNET
{$ENDIF}{$ELSE}{$DEFINE PRODUCTION}{$ENDIF}

{$IFNDEF OPTIONS_BY_DEFAULT}{$IFNDEF DelphiSockets_OpenSSLv10}{$IFNDEF Synapse_OpenSSLv10}{$IFNDEF Synapse_OpenSSLv11}
ERROR: You must select ONE option!
{$ENDIF}{$ENDIF}{$ENDIF}{$ENDIF}
{$IFDEF OPTIONS_BY_DEFAULT}
{$IFDEF DARWIN}
{$DEFINE Use_CryptoLib4Pascal}
{$ELSE}
{$IF (not Defined(Use_OpenSSL)) or (not Defined(Use_CryptoLib4Pascal))}
{$DEFINE Use_OpenSSL}
{$ENDIF}
{$UNDEF Use_CryptoLib4Pascal}
{$ENDIF}

{$IF (Defined(Use_OpenSSL)) and (Defined(Use_CryptoLib4Pascal))}
ERROR: You must select ONLY ONE option: Use_OpenSSL or Use_CryptoLib4Pascal
{$ENDIF}

{$IFDEF DARWIN}
{$UNDEF Use_OpenSSL}
{$DEFINE Use_CryptoLib4Pascal}
{$ENDIF}


// By default are: Synapse + OpenSSLv11
{$IFDEF ANDROID}
// Android usage (on Delphi) does not use Synapse
{$UNDEF Synapse}
{$DEFINE DelphiSockets}
{$ELSE}
{$DEFINE Synapse}
{$UNDEF DelphiSockets}
{$ENDIF}
{$UNDEF OpenSSL10}
{$IFDEF DelphiSockets_OpenSSLv10}ERROR: You selected more than 1 option{$ENDIF}
{$IFDEF Synapse_OpenSSLv10}ERROR: You selected more than 1 option{$ENDIF}
{$IFDEF Synapse_OpenSSLv11}ERROR: You selected more than 1 option{$ENDIF}
{$ELSE}
{$IFDEF DelphiSockets_OpenSSLv10}
{$IFDEF FPC}
ERROR: With Free Pascal you cannot choose compiler directive DelphiSockets_OpenSSLv10
{$ELSE}
{$UNDEF Synapse}
{$DEFINE OpenSSL10}
{$ENDIF}
{$IFDEF Synapse_OpenSSLv10}ERROR: You selected more than 1 option{$ENDIF}
{$IFDEF Synapse_OpenSSLv11}ERROR: You selected more than 1 option{$ENDIF}
{$ELSE}
{$IFDEF Synapse_OpenSSLv10}
{$DEFINE Synapse}
{$DEFINE OpenSSL10}
{$IFDEF Synapse_OpenSSLv11}ERROR: You selected more than 1 option{$ENDIF}
{$ELSE}
{$IFDEF FPC}
{$DEFINE Synapse}
{$UNDEF OpenSSL10}
{$ELSE}
ERROR: With Delphi you cannot choose compiler directive Synapse_OpenSSLv11
{$ENDIF}
{$ENDIF}
{$ENDIF}
{$ENDIF}

{$IFNDEF FPC}
// We are on Delphi compiler
{$IF Defined(ANDROID) or Defined(MACOS) or Defined(IOS) }
// On Delphi and Android/IOS/MAC environment, AnsiString is not available and use DelphiSockets instead of Synapse
{$DEFINE NO_ANSISTRING}
{$UNDEF OpenSSL10}
{$UNDEF Use_OpenSSL}
{$DEFINE Use_CryptoLib4Pascal}
{$UNDEF Synapse}
@@ -28,7 +28,7 @@
{$MODE Delphi}
{$ENDIF}

{$I config.inc}
{$I ./../config.inc}

{$IF not Defined(Use_OpenSSL)}
{$Message Warn 'ERROR: Use_OpenSSL is not defined, you should not use this UNIT!'}
@@ -28,7 +28,7 @@ interface
UPCHardcodedRandomHashTable, UJSONFunctions,
{$IFNDEF FPC}System.Generics.Collections{$ELSE}Generics.Collections{$ENDIF};

{$I config.inc}
{$I ./../config.inc}

Type
TAccountKey = TECDSA_Public;
@@ -30,7 +30,7 @@ interface
uses
Classes, SysUtils;

{$I config.inc}
{$I ./../config.inc}

Type
{$IFDEF NO_ANSISTRING}
@@ -26,7 +26,7 @@ interface
Classes, UCrypto, UAccounts, ULog, UThread, SyncObjs, UBaseTypes, SysUtils,
{$IFNDEF FPC}System.Generics.Collections{$ELSE}Generics.Collections{$ENDIF},
UPCDataTypes;
{$I config.inc}
{$I ./../config.inc}

{
@@ -1132,7 +1132,7 @@ function TPCBank.GetTargetSecondsMedian(AFromBlock: Cardinal; ABackBlocks : Inte
end;
LOrd := TOrderedCardinalList.Create;
try
LStart := Integer(AFromBlock) - Integer(ABackBlocks);
LStart := Integer(AFromBlock) - Integer(ABackBlocks) + 1;
LEnd := Integer(AFromBlock);
if LStart<1 then LStart := 1; // Ensure we will get access to 0 as a previous Timestamp
LPreviousTimestamp := SafeBox.GetBlockInfo(LStart - 1).timestamp; // Get first previous timestamp
@@ -22,7 +22,7 @@

interface

{$I config.inc}
{$I ./../config.inc}

{$IFNDEF FPC}
// See http://wiki.freepascal.org/Code_Conversion_Guide
@@ -20,7 +20,7 @@
{$MODE Delphi}
{$ENDIF}

{$I config.inc}
{$I ./../config.inc}

{$IF (not Defined(Use_CryptoLib4Pascal)) and (not Defined(Use_OpenSSL))}
ERROR: At least Use_CryptoLib4Pascal or Use_OpenSSL must be defined!
@@ -39,7 +39,7 @@
{$MODE Delphi}
{$ENDIF}

{$I config.inc}
{$I ./../config.inc}

{$IF not Defined(Use_OpenSSL)}
{$Message Warn 'ERROR: Use_OpenSSL is not defined, you should not use this UNIT!'}
@@ -24,7 +24,7 @@ interface

uses
Classes, {$IFnDEF FPC}Windows,{$ENDIF} UBlockChain, SyncObjs, UThread, UAccounts, UCrypto;
{$I config.inc}
{$I ./../config.inc}

Type
TBlockHeader = Record
@@ -38,7 +38,7 @@ interface
{$IFNDEF FPC}System.Generics.Collections{$ELSE}Generics.Collections{$ENDIF},
UBlockChain, UNetProtocol, UAccounts, UCrypto, UThread, SyncObjs, ULog, UBaseTypes, UPCOrderedLists;

{$I config.inc}
{$I ./../config.inc}

Type

@@ -873,7 +873,11 @@ class function TNode.NodeExists: Boolean;

class function TNode.NodeVersion: String;
begin
Result := CT_ClientAppVersion{$IFDEF LINUX}+'L'{$ELSE}+'W'{$ENDIF}{$IFDEF FPC}{$IFDEF LCL}+'l'{$ELSE}+'f'{$ENDIF}{$ENDIF}{$IFDEF FPC}{$IFDEF CPU32}+'32b'{$ELSE}+'64b'{$ENDIF}{$ELSE}{$IFDEF CPU32BITS}+'32b'{$ELSE}+'64b'{$ENDIF}{$ENDIF};
Result := CT_ClientAppVersion
{$IFDEF LINUX}+'L'{$ELSE}+'W'{$ENDIF}
{$IFDEF FPC}{$IFDEF LCL}+'l'{$ELSE}+'f'{$ENDIF}{$ENDIF}
{$IFDEF FPC}{$IFDEF CPU32}+'32b'{$ELSE}+'64b'{$ENDIF}{$ELSE}{$IFDEF CPU32BITS}+'32b'{$ELSE}+'64b'{$ENDIF}{$ENDIF}
{$IFDEF Use_CryptoLib4Pascal}+'CL4P'{$ENDIF};
end;

procedure TNode.Notification(AComponent: TComponent; Operation: TOperation);
@@ -26,7 +26,7 @@ interface
{$MODE Delphi}
{$ENDIF}

{$I config.inc}
{$I ./../config.inc}

{$IFDEF ANDROID}
Uses UBaseTypes;
@@ -34,7 +34,7 @@ interface
{$MODE Delphi}
{$ENDIF}

{$I config.inc}
{$I ./../config.inc}

{$IF (not Defined(Use_OpenSSL)) and (not Defined(Use_CryptoLib4Pascal))}
{$Message Fatal 'ERROR: Use_OpenSSL or Use_CryptoLib4Pascal are not defined, you need to at least define one!'}
@@ -20,7 +20,7 @@
{$MODE Delphi}
{$ENDIF}

{$I config.inc}
{$I ./../config.inc}

interface

@@ -31,7 +31,7 @@ interface
{$ENDIF}


{$I config.inc}
{$I ./../config.inc}

{$IF (not Defined(Use_OpenSSL))}
{$Message Fatal 'ERROR: Use_OpenSSL is not defined!'}
@@ -28,7 +28,7 @@

interface

{$I config.inc}
{$I ./../config.inc}

{$IFDEF FPC}
{$MODE Delphi}
@@ -28,7 +28,7 @@

interface

{$I config.inc}
{$I ./../config.inc}

{$IFDEF FPC}
{$MODE Delphi}
@@ -329,7 +329,10 @@ procedure TPCOperationsSignatureValidatorThread.BCExecute;
try
LIsValid := LOperation.IsValidSignatureBasedOnCurrentSafeboxState(FValidator.FSafeBoxTransaction);
except
LIsValid := False;
On E:Exception do begin
LIsValid := False;
TLog.NewLog(lterror,ClassName,LOperation.ToString+' ERROR: ('+E.ClassName+') '+E.Message);
end;
end;
FValidator.SetOperationCheckResult(Self,LOperation, LIsValid);
end;
@@ -22,7 +22,7 @@

interface

{$I config.inc}
{$I ./../config.inc}

Uses classes, SysUtils,
UJSONFunctions, UAccounts, UBaseTypes, UOpTransaction, UConst,
@@ -86,7 +86,7 @@

interface

{$I config.inc}
{$I ./../config.inc}
uses
Classes, SysUtils, UConst, UCrypto, SyncObjs, UThread, UBaseTypes,
UPCOrderedLists, UPCDataTypes,
@@ -26,7 +26,7 @@

interface

{$I config.inc}
{$I ./../config.inc}

{$IFDEF FPC}
{$MODE Delphi}
@@ -22,7 +22,7 @@

interface

{$I config.inc}
{$I ./../config.inc}

uses
Classes, SysUtils, syncobjs, UThread, UPoolMining, UAccounts, UCrypto, ULog, UBlockChain, USha256, URandomHash, URandomHash2, UBaseTypes, UCommon,
@@ -22,7 +22,7 @@

interface

{$I config.inc}
{$I ./../config.inc}

Uses
{$IFnDEF FPC}
@@ -22,7 +22,7 @@

interface

{$I config.inc}
{$I ./../config.inc}

Uses UThread, ULog, UConst, UNode, UAccounts, UCrypto, UBlockChain,
UNetProtocol, UOpTransaction, UWallet, UTime, UPCEncryption, UTxMultiOperation,
@@ -20,7 +20,7 @@
{$mode delphi}
{$ENDIF}

{$I config.inc}
{$I ./../config.inc}

interface

@@ -22,7 +22,7 @@ interface
{$mode delphi}
{$ENDIF}

{$I config.inc}
{$I ./../config.inc}

{
Change log: 2019-01-31
@@ -36,7 +36,7 @@ interface
{$IFNDEF FPC}System.Generics.Collections{$ELSE}Generics.Collections{$ENDIF},
Classes, SyncObjs, SysUtils, UBaseTypes;

{$I config.inc}
{$I ./../config.inc}

Type
TPCCriticalSection = Class(TCriticalSection)
@@ -22,7 +22,7 @@

interface

{$I config.inc}
{$I ./../config.inc}

{$IFDEF ANDROID}
{$UNDEF INTERNAL_USE_SETTINGS_UNIT}

0 comments on commit 377380d

Please sign in to comment.
You can’t perform that action at this time.