Ori Newman
4ab2e0d498
[NOD-1507] Implement model.DBTransaction ( #997 )
2020-11-03 18:08:02 +02:00
Svarog
8dc246a2a7
[NOD-1498] Consensus State Store ( #992 )
...
* [NOD-1420] Start working on ConsensusStateManager. Might be redundant due to recent changes
* [NOD-1420] Convert model to externalapi in utxo_algerbra helpers
* [NOD-1420] Add UTXO-diff algebra
* [NOD-1420] Prepare skeleton of calculateAcceptanceDataAndMultiset
* [NOD-1420] Added skeleton for AddBlockToVirtual
* [NOD-1420] Implement PopulateTransactionWithUTXOEntries
* [NOD-1420] Implement restorePastUTXO
* [NOD-1420] Implement finality check
* [NOD-1420] Move handling of tips to consensusStateManager
* [NOD-1420] Implement calculateAcceptanceDataAndMultiset
* [NOD-1420] Start implementing resolveBlockStatus
* [NOD-1420] Implement resolveBlockStatus
* [NOD-1420] Update related fields in end of resolveSingleBlockStatus
* [NOD-1420] Start working on selectVirtualParents
* [NOD-1420] Implemented BlockHeap
* [NOD-1420] Implement selectVirtualParents
* [NOD-1420] Implement updateVirtual
* [NOD-1420] Added comments where they were missing
* [NOD-1420] Place all consensusStateManager functions in correct files
* [NOD-1420] Return the missing outpoints from populateTransactionWithUTXOEntriesFromVirtualOrDiff
* [NOD-1420] Outpoint.ID -> TransactionID
* [NOD-1420] Fix Stringer tests
* [NOD-1420] Copy hash.FromString into utils
* [NOD-1420] SetParents should return an error
* [NOD-1420] Remove all reachabilityManager references from consensusStateManager
* [NOD-1420] Remove VirtualData. Get the info from the stores where needed
* [NOD-1420] Invert parameters to IsAncestorOf
* [NOD-1420] Use model.AcceptanceData
* [NOD-1420] Don't return accumulatedMassBefore in error cases
* [NOD-1420] Don't expect store functions to return nil when the requested data was found - instead add HasXXX functions
* [NOD-1420] addTransactionToMultiset sets isCoinbase properly
* [NOD-1420] expected hash string length is externalapi.DomainHashSize * 2
* [NOD-1420] Rename reachabilityTree -> reachabilityManager + updateReindexRoot if isNextVirtualSelectedParent
* [NOD-1420] ValidateCoinbaseTransaction in csm.verifyAndBuildUTXO
* [NOD-1420] Re-write HAsUTXODiffChild
* [NOD-1420] delete past_utxo.go.bak
* [NOD-1420] Implement validateCoinbaseTransaction in CSM
* [NOD-1420] Imlemented missing functionality in ValidateTransactionAndPopulateWithConsensusData
* [NOD-1420] Moved merge depth logic to MergeDepthManager
* [NOD-1420] Add logs
* [NOD-1498] Implement tips-related methods of consensusStateStore
* [NOD-1498] Implement consensusStateStore virtualDiffParents functionality
* [NOD-1498] Implement ConsensusStateStore UTXO-Set part
* [NOD-1498] Implement rest of consensusStateStore methods
* [NOD-1498] Use io.ReadFull instead of r.Read
* [NOD-1498] Added comments
* [NOD-1498] Move utxo serialization to protobufs
* [NOD-1498] Add comments
* [NOD-1498] Minor fixes in ConsensusStateStore
* [NOD-1498] Use empty bucket key + simplify serializeUTXOEntry
2020-11-03 14:42:26 +02:00
Ori Newman
2abd4a274b
[NOD-1496] Implement headers only verification ( #987 )
...
* [NOD-1496] Implement headers only verification
* [NOD-1496] Add checkParentsExist
* [NOD-1496] Stage block statuses in block processor
* [NOD-1496] Rename AddBlock->AddHeaderTip
* [NOD-1496] Return early from validateAndInsertBlock on header only and put ValidateProofOfWorkAndDifficulty inside validateBlock
2020-11-02 16:30:59 +02:00
stasatdaglabs
23cccb6396
[NOD-1497] Add additional methods to consensus external API ( #989 )
...
* [NOD-1497] Add missing APIs.
* [NOD-1497] Rename some new APIs.
* [NOD-1497] Add fields to BlockInfo.
* [NOD-1497] Add comments over BlockInfo and BlockLocator.
* [NOD-1497] Rename GetSelectedParent to GetVirtualSelectedParent.
* [NOD-1497] Add SetPruningPointUTXOSet.
* [NOD-1497] Rename GetHashesAbovePruningPoint to GetMissingBlockBodyHashes.
* [NOD-1497] Fix rename error.
2020-11-02 12:05:33 +02:00
Ori Newman
14fbe50636
[NOD-1493] Implement serialization in data stores ( #983 )
...
* [NOD-1493] Implement serialization in data stores
* [NOD-1493] Remove redundant functions
* [NOD-1493] Use bluesAnticoneSizesToDBBluesAnticoneSizes inside BlockGHOSTDAGDataToDBBlockGHOSTDAGData
2020-10-29 17:39:35 +02:00
stasatdaglabs
01c7c67aed
[NOD-1493] Implement serialization in AcceptanceDataStore, BlockRelationStore, BlockStatusStore, and BlockStore ( #982 )
...
* [NOD-1493] Add DbHashToDomainHash and DomainHashToDbHash.
* [NOD-1493] Use DbHashToDomainHash and DomainHashToDbHash.
* [NOD-1493] Begin implementing serializeAcceptanceData.
* [NOD-1493] Extract serialization blockHeader logic to serialization.
* [NOD-1493] Extract serialization acceptance data logic to serialization.
* [NOD-1493] Implement acceptance data serialization/deserialization.
* [NOD-1493] Implement transaction serialization/deserialization.
* [NOD-1493] Implement outpoint serialization/deserialization.
* [NOD-1493] Implement transaction ID serialization/deserialization.
* [NOD-1493] Implement subnetwork ID serialization/deserialization.
* [NOD-1493] Implement block relation serialization/deserialization.
* [NOD-1493] Implement block status serialization/deserialization.
* [NOD-1493] Implement block serialization/deserialization.
* [NOD-1493] Implement serialization/deserialization in BlockRelationStore.
* [NOD-1493] Implement serialization/deserialization in BlockStatusStore.
* [NOD-1493] Implement serialization/deserialization in BlockStore.
* [NOD-1493] Make go vet happy.
* [NOD-1493] Use DomainHashesToDbHashes.
2020-10-29 16:49:05 +02:00
stasatdaglabs
9cf1557c37
[NOD-1493] Implement types for serialization ( #980 )
...
* [NOD-1493] Add DbAcceptanceData.
* [NOD-1493] Add DbBlockRelations.
* [NOD-1493] Add DbBlockStatus.
* [NOD-1493] Add DbBlockGhostdagData.
* [NOD-1493] Add DbMultiset.
* [NOD-1493] Add DbPruningPoint.
* [NOD-1493] Add DbUtxoSet.
* [NOD-1493] Add DbReachabilityData.
* [NOD-1493] Add DbReachabilityReindexRoot.
* [NOD-1493] Add DbUtxoDiff.
* [NOD-1493] Add DbUtxoDiffChild.
* [NOD-1493] Make sure everything is lowercase.
* [NOD-1493] Add DbHash.
* [NOD-1493] Fix BlockHeaderStore.
2020-10-29 12:18:18 +02:00
stasatdaglabs
126e2e49bb
[NOD-1493] Implement serialization/deserialization inside BlockHeaderStore ( #979 )
...
* [NOD-1492] Rename dbmanager to database.
* [NOD-1492] Write messages.proto for DbBlock and DbTransaction.
* [NOD-1492] Implement serializeHeader.
* [NOD-1492] Implement deserializeHeader.
2020-10-29 11:15:14 +02:00
Ori Newman
be56fb7e8b
[NOD-1488] Get rid of dbaccess ( #973 )
...
* [NOD-1488] Get rid of dbaccess
* [NOD-1488] Rename dbwrapper to dbmanager
* [NOD-1488] Create DBWriter interface
* [NOD-1488] Fix block header store
* [NOD-1488] Rename dbwrapper.go to dbmanager.go
2020-10-28 11:34:06 +02:00
stasatdaglabs
97b5b0b875
[NOD-1416] Implement BlockProcessor. ( #969 )
...
* [NOD-1416] Add entry/exit logs to all the functions.
* [NOD-1416] Build some scaffolding inside BlockProcessor.
* [NOD-1416] Implement selectParentsForNewBlock.
* [NOD-1416] Implement validateBlock.
* [NOD-1476] Fix merge errors.
* [NOD-1416] Move buildBlock and validateAndInsertBlock to separate files.
* [NOD-1416] Begin implementing buildBlock.
* [NOD-1416] Implement newBlockDifficulty.
* [NOD-1416] Add skeletons for the rest of the buildBlock functions.
* [NOD-1416] Implement newBlockUTXOCommitment.
* [NOD-1416] Implement newBlockAcceptedIDMerkleRoot.
* [NOD-1416] Implement newBlockHashMerkleRoot.
* [NOD-1416] Fix bad function call.
* [NOD-1416] Implement validateHeaderAndProofOfWork and validateBody.
* [NOD-1416] Use ValidateProofOfWorkAndDifficulty.
* [NOD-1416] Finish validateAndInsertBlock.
* [NOD-1416] Implement newBlockHashMerkleRoot.
* [NOD-1416] Implement newBlockAcceptedIDMerkleRoot.
* [NOD-1416] Fix a comment.
* [NOD-1416] Implement newBlockCoinbaseTransaction.
* [NOD-1416] Add VirtualBlockHash.
* [NOD-1416] Add ParentHashes and SelectedParent to VirtualData().
* [NOD-1416] Make go vet happy.
* [NOD-1416] Implement discardAllChanges.
* [NOD-1416] Implement commitAllChanges.
* [NOD-1416] Fix factory.
* [NOD-1416] Make go vet happy.
* [NOD-1416] Format factory.
* [NOD-1416] Pass transactionsWithCoinbase to buildHeader.
* [NOD-1416] Call VirtualData() from buildHeader.
* [NOD-1416] Fix a typo.
* [NOD-1416] Fix in-out-of-context/header-body confusion.
* [NOD-1416] Extract LogAndMeasureExecutionTime.
* [NOD-1416] Add a comment about LogAndMeasureExecutionTime.
* [NOD-1416] Simplify discardAllChanges and commitAllChanges.
* [NOD-1416] If in-context validations fail, discard all changes and store the block with StatusInvalid.
* [NOD-1416] Add a comment above Store.
* [NOD-1416] Use errors.As instead of errors.Is.
2020-10-27 17:24:15 +02:00
stasatdaglabs
a96a5fd2ef
[NOD-1462] Simplify consensus external API ( #958 )
...
* [NOD-1461] Change the external api interface to not having anything besides DomainTransactions and DomainBlocks.
* [NOD-1462] Move external api types to a separate package.
* [NOD-1462] Clarify which model we're using in miningmanager.
* [NOD-1462] Extract coinbase data to its own struct.
* [NOD-1462] Add a comment above CoinbaseData.
* [NOD-1462] Fix the comment above CoinbaseData.
2020-10-19 17:59:04 +03:00
Svarog
790dc74581
[NOD-1457] Pass DomainDBContext to all constructors, instead of passing a general dbContext ( #955 )
...
* [NOD-1457] Pass DomainDBContext to all constructors, instead of passing a general dbContext
* [NOD-1457] Add NewTx to DomainDBContext
* [NOD-1457] Added comment
2020-10-14 09:59:27 +03:00
stasatdaglabs
e9951bc34a
[NOD-1413] Decouple the model package from everything ( #949 )
...
* [NOD-1416] Move processes/datastructures interfaces into the model package.
* [NOD-1416] Decouple the model from dbaccess.
* [NOD-1413] Implement DomainBlock and DomainTransaction.
* [NOD-1413] Decouple model from appmessage.
* [NOD-1413] Decouple model from util.
* [NOD-1413] Decouple model from subnetworkid.
* [NOD-1413] Remove an unused const.
* [NOD-1413] Add DomainHash and DomainTransactionID.
* [NOD-1413] Decouple model from daghash.
* [NOD-1413] Decouple model from mstime.
* [NOD-1413] Decouple model from go-secp256k1.
* [NOD-1413] Add a proxy over dbaccess.
* [NOD-1413] Add comments over all added types.
* [NOD-1413] Fix a comment.
* [NOD-1413] Get rid of DomainTime.
* [NOD-1413] Simplify BlockGHOSTDAGData.
2020-10-11 14:32:41 +03:00