* 1) Calculate pruning point incrementally
2) Add IsValidPruningPoint to pruning manager and consensus
3) Use reachability children for selected child iterator
* Add request IBD root hash flow
* Fix UpdatePruningPointByVirtual and IsValidPruningPoint
* Regenerate messages.pb.go
* Make the pruning point the earliest chain block with finality interval higher than the previous pruning point
* Fix merge errors
* [NOD-1575] Implement Clone and Equal for all model types
* [NOD-1575] Add assertion for transaction ID equality
* [NOD-1575] Use DomainTransaction.Equal to compare to expected coinbase transaction
* [NOD-1575] Add TestDomainBlockHeader_Clone
* [NOD-1575] Don't clone nil values
* [NOD-1575] Add type assertions
* [NOD-1575] Don't clone nil values
* [NOD-1575] Add missing Equals
* [NOD-1575] Add length checks
* [NOD-1575] Update comment
* [NOD-1575] Check length for TransactionAcceptanceData
* [NOD-1575] Explicitly clone nils where needed
* [NOD-1575] Clone tx id
* [NOD-1575] Flip condition
* Nod 1576 make coverage tests for equal clone inside model externalapi (#1177)
* [NOD-1576] Make coverage tests for equal and clone inside model and externalapi
* Some formatting and naming fixes
* Made transactionToCompare type exported
* Added some tests and made some changes to the tests code
* No changes made
* Some formatting and naming changes made
* Made better test coverage for externalapi clone and equal functions
* Changed expected result for two cases
* Added equal and clone functions tests for ghostdag and utxodiff
* Added tests
* [NOD-1576] Implement reachabilitydata equal/clone unit tests
* [NOD-1576] Full coverage of reachabilitydata equal/clone unit tests
* Made changes and handling panic to transaction_equal_clone_test.go and formating of utxodiff_equal_clone_test.go
* Added recoverForEqual2 for handling panic to transaction_equal_clone_test.go
* [NOD-1576] Full coverage of transaction equal unit test
* [NOD-1576] Add expects panic
* [NOD-1576] Allow composites in go vet
* [NOD-1576] Code review fixes (#1223)
* [NOD-1576] Code review fixes
* [NOD-1576] Code review fixes part 2
* [NOD-1576] Fix wrong name
Co-authored-by: karim1king <karimkaspersky@yahoo.com>
Co-authored-by: Ori Newman <orinewman1@gmail.com>
Co-authored-by: Karim <karim1king@users.noreply.github.com>
* Fix merge errors
* Use Equal where possible
* Use Equal where possible
* Use Equal where possible
Co-authored-by: andrey-hash <74914043+andrey-hash@users.noreply.github.com>
Co-authored-by: karim1king <karimkaspersky@yahoo.com>
Co-authored-by: Karim <karim1king@users.noreply.github.com>
* comments on default constants
* more comments on default constants
* more comments on default constants
* more comments on default constants
* gofmt
* small typos
* Replace default hasher (Double-SHA256) with domain seperated blake2b
* Replace all hashes with domain seperated blake2b
* Update the genesis blocks
* Replace OP_HASH256 with OP_BLAKE2B
* Fix the merkle tree by appending zeros instead of duplicating the hash when there is 1 branch left
* Update tests
* Add a payloadHash function
* Update gitignore to ignore binaries
* Fix a bug in the blake2b opcode
* Get rid of insertMode
* Rename AddBlockToVirtual->AddBlock
* When F is not in the future of P, enforce finality with P and not with F.
* Don't allow blocks with invalid parents or with missing block body
* Check finality violation before checking block status
* Implement CalculateIndependentPruningPoint
* Move checkBlockStatus to validateBlock
* Add ValidateBlock to block processor interface
* Adjust SetPruningPoint to the new IBD flow
* Add pruning store to CSM's constructor
* Flip wrong condition on AddHeaderTip
* Fix func (hts *headerSelectedTipStore) Has
* Fix block stage order
* Call to ValidateBodyInContext from validatePostProofOfWork
* Enable overrideDAGParams
* Update log
* Rename SetPruningPoint to ValidateAndInsertPruningPoint and move most of its logic inside block processor
* Rename hasValidatedHeader->hasValidatedOnlyHeader
* Fix typo
* Name return values for fetchMissingUTXOSet
* Add comment
* Return ErrMissingParents when block body is missing
* Add logs and comments
* Fix merge error
* Fix pruning point calculation to be by virtual selected parent
* Replace CalculateIndependentPruningPoint to CalculatePruningPointByHeaderSelectedTip
* Fix isAwaitingUTXOSet to check pruning point by headers
* Change isAwaitingUTXOSet indication
* Remove IsBlockInHeaderPruningPointFuture from BlockInfo
* Fix LowestChainBlockAboveOrEqualToBlueScore
* Add validateNewPruningPointTransactions
* Add validateNewPruningAgainstPastUTXO
* Rename set_pruning_utxo_set.go to update_pruning_utxo_set.go
* Check missing block body hashes by missing block instead of status
* Validate pruning point against past UTXO with the pruning point as block hash
* Remove virtualHeaderHash
* Fix comment
* Fix imports
* Expose CheckProofOfWork from model/pow
* Update blockvalidator to call the new CheckProofOfWork
* Update genesis blocks
* Update tools to use the new CheckProofOfWork
* Update tests with new PoW
* Change DifficultyAdjustmentWindowSize and TimestampDeviationTolerance from uint64 to int
* refactor block_heap for readability and usage
* Add a new SizedUpHeap
* Refactor BlueWindow with the new DAA
* Update TestBlueBlockWindow with the new DAA window
* Fix review requested changes
* [NOD-1579] Remove selected tip hash messages.
* [NOD-1579] Start moving IBD stuff into blockrelay.
* [NOD-1579] Rename relaytransactions to transactionrelay.
* [NOD-1579] Move IBD files into blockrelay.
* [NOD-1579] Remove flow stuff from ibd.go.
* [NOD-1579] Bring back IsInIBD().
* [NOD-1579] Simplify block relay flow.
* [NOD-1579] Check orphan pool for missing parents to avoid unnecessary processing.
* [NOD-1579] Implement processOrphan.
* [NOD-1579] Implement addToOrphanSetAndRequestMissingParents.
* [NOD-1579] Fix TestIBD.
* [NOD-1579] Implement isBlockInOrphanResolutionRange.
* [NOD-1579] Implement limited block locators.
* [NOD-1579] Add some comments.
* [NOD-1579] Specifically check for StatusHeaderOnly in blockrelay.
* [NOD-1579] Simplify runIBDIfNotRunning.
* [NOD-1579] Don't run IBD if it is already running.
* [NOD-1579] Fix a comment.
* [NOD-1579] Rename mode to syncInfo.
* [NOD-1579] Simplify validateAndInsertBlock.
* [NOD-1579] Fix bad SyncStateSynced condition.
* [NOD-1579] Implement validateAgainstSyncStateAndResolveInsertMode.
* [NOD-1579] Use insertModeHeader.
* [NOD-1579] Add logs to TrySetIBDRunning and UnsetIBDRunning.
* [NOD-1579] Implement and use dequeueIncomingMessageAndSkipInvs.
* [NOD-1579] Fix a log.
* [NOD-1579] Fix a bug in createBlockLocator.
* [NOD-1579] Rename a variable.
* [NOD-1579] Fix a slew of bugs in missingBlockBodyHashes and selectedChildIterator.
* [NOD-1579] Fix bad chunk size in syncMissingBlockBodies.
* [NOD-1579] Remove maxOrphanBlueScoreDiff.
* [NOD-1579] Fix merge errors.
* [NOD-1579] Remove a debug log.
* [NOD-1579] Add logs.
* [NOD-1579] Make various go quality tools happy.
* [NOD-1579] Fix a typo in a variable name.
* [NOD-1579] Fix full blocks over header-only blocks not failing the missing-parents validation.
* [NOD-1579] Add an error log about a condition that should never happen.
* [NOD-1579] Check all antiPast hashes instead of just the lowHash's anticone to filter for header-only blocks.
* [NOD-1579] Remove the nil stuff from GetBlockLocator.
* [NOD-1579] Remove superfluous condition in handleRelayInvsFlow.start().
* [NOD-1579] Return a boolean from requestBlock instead of comparing to nil.
* [NOD-1579] Fix a bad log.Debugf.
* [NOD-1579] Remove a redundant check.
* [NOD-1579] Change an info log to a warning log.
* [NOD-1579] Move OnNewBlock out of relayBlock.
* [NOD-1579] Remove redundant exists check from runIBDIfNotRunning.
* [NOD-1579] Fix bad call to OnNewBlock.
* [NOD-1579] Remove an impossible check.
* [NOD-1579] Added a log.
* [NOD-1579] Rename insertModeBlockWithoutUpdatingVirtual to insertModeBlockBody.
* [NOD-1579] Add a check for duplicate headers.
* [NOD-1579] Added a comment.
* [NOD-1579] Tighten a stop condition.
* [NOD-1579] Simplify a log.
* [NOD-1579] Clarify a log.
* [NOD-1579] Move a log.
* Replace blueScore with blueWork in ghostDAG SelectedParent selection
* Add blueWork to protopuf ghostdag data
* Auto generate protobuf go code
* Serialize/Deserialize blueWork when converting to protobuf
* pass block header store to ghostdagmanager
* Convert tal's ghostdag2 implementation to blueWork
* Change finality test to check the blueWork instead of blueScore
* Update ghostdag_test to pass blockHeaderStore to ghostdag, and test all networks genesis headers
* Add sanity blueWork check to ghostdag_test
commit 3830df34b2a53c361c8a6ca450f7f4a683fe1ae1
Merge: 46dc2e977 17e7819c2
Author: Elichai Turkel <elichai.turkel@gmail.com>
Date: Tue Dec 1 16:29:51 2020 +0200
Merge pull request #1170 from kaspanet/tal-ghost-fix
Fix GhostDAG tests and jsons
commit 17e7819c27153b8527f18d638a3173a6cc4975eb
Author: Elichai Turkel <elichai.turkel@gmail.com>
Date: Tue Dec 1 16:24:01 2020 +0200
Remove non-json ghostdag tests
commit 4bebb1d96a8740c5359351c0aea7aca20067d65b
Author: Elichai Turkel <elichai.turkel@gmail.com>
Date: Tue Dec 1 13:26:06 2020 +0200
Add a coment above tal's ghostdag2 impl
commit faf21a042e0f40f3842bbe2b4a6aeef48a9bf0fd
Author: Elichai Turkel <elichai.turkel@gmail.com>
Date: Tue Dec 1 13:20:08 2020 +0200
fix the interfaces after merge
commit a8b7a25b2e85a47ef2acffa426db25ce0d8c753c
Merge: af91b69b2 f1c6df48c
Author: Elichai Turkel <elichai.turkel@gmail.com>
Date: Tue Dec 1 13:19:08 2020 +0200
Merge branch 'v0.8.2-dev' into tal-ghost-fix
commit af91b69b207cf3c3e9eaedf031810153b8a576d3
Author: Elichai Turkel <elichai.turkel@gmail.com>
Date: Tue Dec 1 13:18:41 2020 +0200
Fix the non-json tests
commit c56f34b73b16f0b28f02f4dc5ae4607b420afb36
Author: Elichai Turkel <elichai.turkel@gmail.com>
Date: Tue Dec 1 13:18:17 2020 +0200
Fix the jsons
commit 46dc2e97736e304fa5398289566c0d281d02cf8e
Author: tal <tal@daglabs.com>
Date: Mon Nov 30 17:15:20 2020 +0200
[NOD - 1143] Cosmetics changes.
commit b28e5ce816c8f9ea69720b0c8d2e8fb63fc1d6c3
Author: tal <tal@daglabs.com>
Date: Mon Nov 30 15:48:08 2020 +0200
[#1126] Place selectedParent to be first on blueMergeSet.
commit 4b56ed2da94638736d02c038acaa4ab4d8b625ac
Author: tal <tal@daglabs.com>
Date: Mon Nov 30 14:51:50 2020 +0200
[#1126] Change pacement between blockRight and blockLeft .
commit b09f31be9301cf51a8f3866166cf38a174c368c9
Merge: e17a98b7b 0db39833f
Author: talelbaz <63008512+talelbaz@users.noreply.github.com>
Date: Mon Nov 30 14:30:22 2020 +0200
Merge pull request #1162 from kaspanet/new-jsons
Update the dag json tests
commit e17a98b7ba4beba77699fb68081a0d23f4feb714
Author: tal <tal@daglabs.com>
Date: Mon Nov 30 14:08:25 2020 +0200
[#1126] Use WALK function in tests & cosmetic changes.
commit 0db39833f3afeea8f79a67795d2e532c111b0eda
Author: Elichai Turkel <elichai.turkel@gmail.com>
Date: Mon Nov 30 12:20:13 2020 +0200
Update the dag json tests
commit 5a3da43dd4c492120debabca643293ed5269a842
Author: tal <tal@daglabs.com>
Date: Sun Nov 29 12:03:37 2020 +0200
[NOD-1433] Remove unneccessry code.
commit a6cde558ac8ff788b548da7ec695460cd680bb32
Author: tal <tal@daglabs.com>
Date: Mon Nov 23 17:05:56 2020 +0200
[NOD-1433] Change "Stage" sig function according to the new interface - added error as a return type.
commit 07859b6218f503f13079640d1ab9139f9b63a51b
Author: tal <tal@daglabs.com>
Date: Mon Nov 23 17:03:26 2020 +0200
[NOD-1433] Print formats changed & Cosmetics code changes.
commit e1a851664ea69185a93cd189bb328f4cded07a8e
Author: tal <tal@daglabs.com>
Date: Sun Nov 15 17:34:59 2020 +0200
[NOD-1433] Travers the tests dir and run each test.
commit 4c7474edc16ce4553532f893c81f0c795a649b1c
Author: tal <tal@daglabs.com>
Date: Mon Nov 9 12:44:53 2020 +0200
[NOD-1433] Travers the tests dir and run each test.
commit 89dd1e61d36af077493f38d90d925e3057eb962a
Author: tal <tal@daglabs.com>
Date: Mon Nov 9 11:48:36 2020 +0200
[NOD-1433] Change implementation to adjust genesis's score 0.
Also, keep changing the test file to fit the new implementation.
commit 6acdcd17def0bb29aca1f65c713d89d1e9960416
Author: tal <tal@daglabs.com>
Date: Sun Nov 8 17:07:22 2020 +0200
[NOD-1433] New test was added(Test 6).
commit bf238893170e5b5ebc509d40937b410b22d8a9ff
Author: tal <tal@daglabs.com>
Date: Sun Nov 8 14:59:36 2020 +0200
Fix golint errors
commit 79ff990b5f04a5a80ccccd95ec3c6fb745e2ca41
Author: tal <tal@daglabs.com>
Date: Sun Nov 8 14:47:12 2020 +0200
added "Optimize imports".
commit 73d0128f639517b27a01d016a14d67d7f1a42570
Author: tal <tal@daglabs.com>
Date: Sun Nov 8 13:03:22 2020 +0200
Added an implementation factory.
commit 61ca8b2e7e20f0dbced5424028e6b52ea511d25c
Author: tal <tal@daglabs.com>
Date: Thu Nov 5 16:03:18 2020 +0200
1. impl - choose the highest hash.
2. test - changed the test accordingly.
commit ef0943ca29ad8699b2c50978cf94d28561bb3e10
Author: tal <tal@daglabs.com>
Date: Thu Oct 29 18:00:45 2020 +0200
Update Tests
commit 6e5936abff9be604a0bd62329ec2d09be13c1d33
Author: tal <tal@daglabs.com>
Date: Tue Oct 27 10:22:45 2020 +0200
Change to the new API
commit 5a70dc48b376994634586e0053a56f775b93f6b9
Author: tal <tal@daglabs.com>
Date: Mon Oct 26 18:35:31 2020 +0200
1. Added tests for ori
commit 2b9f78353f671d2243fee36394618a59f3eb8d4c
Author: tal <tal@daglabs.com>
Date: Mon Oct 26 13:04:37 2020 +0200
1. Added structure "isolatedTest" {k, test}
2. Added for loop on the tests.
3. New test - Test 5.
commit c026d7b7a26348d0f2999a73cb9caefd3ada0ab1
Author: tal <tal@daglabs.com>
Date: Thu Oct 22 17:35:56 2020 +0300
Fix bugs in the GHOSTDAG : counters, conntains and isAncestorOf.
Added more tests.
commit 74493b27d21ed09195eaab164c0f3399312090b5
Author: tal <tal@daglabs.com>
Date: Thu Oct 22 16:49:27 2020 +0300
added compare between Hashes
commit f689253463cb46cb5787067aade9c7c6545878bc
Author: tal <tal@daglabs.com>
Date: Thu Oct 22 11:49:01 2020 +0300
added compare between Hashes
commit 66be07f6168c8cde92ac68ebbafa45c7ab3484d9
Author: tal <tal@daglabs.com>
Date: Mon Oct 19 18:42:40 2020 +0300
First test - pass.
commit 327f34f2dcb5567ef983a7d63e857688e5b8a395
Author: tal <tal@daglabs.com>
Date: Mon Oct 19 15:20:27 2020 +0300
Add alternative implementation for ghostdag.
change all function's signatures (add error type)
commit fd2ea3d84a4f21bed0f1e2a4c6eba549287bef46
Author: tal <tal@daglabs.com>
Date: Mon Oct 19 11:57:05 2020 +0300
add alternative implementation for ghostdag
* Update go-secp256k1 to v0.0.3
* Update the txscript engine to support only 32 bytes pubkeys
* Update the txscript engine tests
* Update txscript/sign.go to use the new Schnorr KeyPair API
* Update txscript sign_test to use the new schnorr
* Update sigcache tests to use new schnorr pubkey
* Update integration tests to use the new txscript and new schnorr pubkey
* [NOD-1126]
1. Change function name in BlockValidator interface from: "ValidateProofOfWorkAndDifficulty" to "ValidatePruningPointViolationAndProofOfWorkAndDifficulty".
2. Add to the blockValidator struct the pruningManager (also added to the function "New" Respectively).
3. Added new function "checkPruningPointViolation" of blockValidator type.
4. Add new internal check - "checkPruningPointViolation", on the function "ValidateProofOfWorkAndDifficulty".(The third check).
5. Add new error rule - "ErrPruningPointViolation".
* [Issue-1126]
1. Remove the function "PruningPoint" from PruningManager interface.
2. Changes in blockValidator struct - remove pruningManager, and adding pruningStore.
3. Reads for "pruningPoint" function from pruningStore instead of pruningManager (because of note 1 above) in the functions: * "checkPruningPointViolation" of type blockValidator.
* "FindNextPruningPoint" of type pruningManager.
* [Issue-1126]
1. Add missing error handling.
* [Issue-1126] Changes in function "checkPruningPointViolation": If header = genesis, stop checking and return nil.
* [Issue-1126] In function "checkPruningPointViolation" - change from a for loop to the "IsAncestorOfAny" function.
* [#1126] "FindNextPruningPoint" - save the pruning point in case the point is the genesis and change code internal order.
* [#1126] "FindNextPruningPoint" - cosmetics change.
* [#1126] "FindNextPruningPoint" - remove "return nil" when there is no pruning point on the if expression.
Co-authored-by: tal <tal@daglabs.com>
* [NOD-1551] Add NewTestConsensusWithDataDir to factory
* [NOD-1551] Cache transaction ID
* [NOD-1551] Should return err if err != nil
* [NOD-1551] BuildBlockWithParents returns the blocks pastUTXOData
* [NOD-1551] Set BlockCoinbaseMaturity to 0 in TestDoubleSpends
* [NOD-1551] Fix comments
* --amend
Co-authored-by: Ori Newman <orinewman1@gmail.com>