Skip to content
This repository has been archived by the owner on Aug 18, 2020. It is now read-only.

Commit

Permalink
[CDEC-505] Move txp types from core to chain
Browse files Browse the repository at this point in the history
  • Loading branch information
ruhatch committed Aug 16, 2018
1 parent 057abe9 commit 088a005
Show file tree
Hide file tree
Showing 174 changed files with 1,122 additions and 810 deletions.
3 changes: 1 addition & 2 deletions auxx/src/Command/Proc.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import System.Wlog (CanLog, HasLoggerName, logError, logInfo,
logWarning)
import qualified Text.JSON.Canonical as CanonicalJSON

import Pos.Chain.Txp (TxpConfiguration)
import Pos.Chain.Txp (TxOut (..), TxpConfiguration)
import Pos.Chain.Update (BlockVersionModifier (..))
import Pos.Client.KeyStorage (addSecretKey, getSecretKeysPlain)
import Pos.Client.Txp.Balances (getBalance)
Expand All @@ -26,7 +26,6 @@ import Pos.Core.Common (AddrAttributes (..), AddrSpendingData (..),
makeAddress)
import Pos.Core.Configuration (genesisSecretKeys)
import Pos.Core.Delegation (HeavyDlgIndex (..))
import Pos.Core.Txp (TxOut (..))
import Pos.Core.Update (SoftwareVersion (..))
import Pos.Crypto (ProtocolMagic, PublicKey, emptyPassphrase,
encToPublic, fullPublicKeyF, hashHexF, noPassEncrypt,
Expand Down
3 changes: 1 addition & 2 deletions auxx/src/Command/Rollback.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ import Formatting (build, int, sformat, string, (%))
import System.Wlog (logInfo)

import Pos.Chain.Block (Blund, mainBlockTxPayload)
import Pos.Chain.Txp (flattenTxPayload)
import Pos.Chain.Txp (TxAux, flattenTxPayload)
import Pos.Core (difficultyL, epochIndexL)
import Pos.Core.Chrono (NewestFirst, _NewestFirst)
import Pos.Core.Txp (TxAux)
import Pos.Crypto (ProtocolMagic)
import Pos.DB.Block (BypassSecurityCheck (..),
ShouldCallBListener (..), rollbackBlocksUnsafe)
Expand Down
5 changes: 2 additions & 3 deletions auxx/src/Command/Tx.hs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ import System.IO (BufferMode (LineBuffering), hClose, hSetBuffering)
import System.Wlog (logError, logInfo)
import UnliftIO (MonadUnliftIO)

import Pos.Chain.Txp (topsortTxAuxes)
import Pos.Chain.Txp (TxAux (..), TxIn (TxInUtxo), TxOut (..),
TxOutAux (..), topsortTxAuxes, txaF)
import Pos.Client.KeyStorage (getSecretKeysPlain)
import Pos.Client.Txp.Balances (getOwnUtxoForPk)
import Pos.Client.Txp.Network (prepareMTx, submitTxRaw)
Expand All @@ -45,8 +46,6 @@ import Pos.Core.Conc (concurrently, currentTime, delay,
forConcurrently, modifySharedAtomic, newSharedAtomic)
import Pos.Core.Configuration (genesisBlockVersionData,
genesisSecretKeys)
import Pos.Core.Txp (TxAux (..), TxIn (TxInUtxo), TxOut (..),
TxOutAux (..), txaF)
import Pos.Core.Update (BlockVersionData (..))
import Pos.Crypto (EncryptedSecretKey, ProtocolMagic, emptyPassphrase,
encToPublic, fakeSigner, hash, safeToPublic, toPublic,
Expand Down
2 changes: 1 addition & 1 deletion auxx/src/Command/TyProjection.hs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ import Data.Time.Units (Microsecond, TimeUnit, convertUnit,
fromMicroseconds)
import Serokell.Data.Memory.Units (Byte, fromBytes)

import Pos.Chain.Txp (TxOut (..))
import Pos.Chain.Update (ApplicationName (..),
BlockVersionModifier (..), SystemTag (..))
import Pos.Core (AddrStakeDistribution (..), Address, Coin,
CoinPortion, EpochIndex, ScriptVersion, StakeholderId,
mkCoin, unsafeCoinPortionFromDouble, unsafeGetCoin)
import Pos.Core.Txp (TxOut (..))
import Pos.Core.Update (BlockVersion, SoftwareVersion)
import Pos.Crypto (AHash (..), Hash, PublicKey)

Expand Down
2 changes: 1 addition & 1 deletion auxx/src/Lang/Value.hs
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ import Universum
import Control.Lens (makePrisms)
import Data.Scientific (Scientific)

import Pos.Chain.Txp (TxOut)
import Pos.Chain.Update (BlockVersionData, BlockVersionModifier,
SystemTag)
import Pos.Core (AddrStakeDistribution, Address, CoinPortion,
StakeholderId)
import Pos.Core.Txp (TxOut)
import Pos.Core.Update (BlockVersion, SoftwareVersion)
import Pos.Crypto (AHash, PublicKey)

Expand Down
2 changes: 1 addition & 1 deletion chain/bench/block-bench.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import Pos.Chain.Block (Body, BodyProof, ConsensusData, ExtraBodyData,
MainBlockchain, _gbBody, _gbExtra, _gbHeader,
_gbhBodyProof, _gbhConsensus, _gbhExtra, _mbDlgPayload,
_mbSscPayload, _mbTxPayload, _mbUpdatePayload)
import Pos.Chain.Txp (TxPayload (..))
import Pos.Core.Delegation (DlgPayload)
import Pos.Core.ProtocolConstants (ProtocolConstants (..))
import Pos.Core.Ssc (SscPayload)
import Pos.Core.Txp (TxPayload (..))
import Pos.Core.Update (UpdatePayload)
import Pos.Crypto (ProtocolMagic (..))

Expand Down
42 changes: 20 additions & 22 deletions chain/cardano-sl-chain.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ library
Pos.Chain.Txp.Toil.Utxo
Pos.Chain.Txp.Toil.Utxo.Functions
Pos.Chain.Txp.Toil.Utxo.Util
Pos.Chain.Txp.Tx
Pos.Chain.Txp.TxAux
Pos.Chain.Txp.TxMsg
Pos.Chain.Txp.TxOutAux
Pos.Chain.Txp.TxPayload
Pos.Chain.Txp.TxProof
Pos.Chain.Txp.TxWitness
Pos.Chain.Txp.Undo

Pos.Chain.Lrc.Fts
Pos.Chain.Lrc.Types
Expand Down Expand Up @@ -207,14 +215,19 @@ test-suite test
Test.Pos.Chain.Ssc.Gen
Test.Pos.Chain.Ssc.Json
Test.Pos.Chain.Ssc.Arbitrary
Test.Pos.Chain.Txp.Arbitrary
Test.Pos.Chain.Txp.Arbitrary.Unsafe
Test.Pos.Chain.Txp.Bi
Test.Pos.Chain.Txp.CoreSpec
Test.Pos.Chain.Txp.Gen
Test.Pos.Chain.Txp.Json
Test.Pos.Chain.Txp.Example
Test.Pos.Chain.Txp.Toil.UtxoSpec
Test.Pos.Chain.Update.Arbitrary
Test.Pos.Chain.Update.Arbitrary.Core

build-depends: base
, base16-bytestring
, bytestring
, cardano-crypto
, cardano-sl-binary
Expand All @@ -227,6 +240,7 @@ test-suite test
, cardano-sl-util
, cardano-sl-util-test
, containers
, data-default
, fmt
, formatting
, generic-arbitrary
Expand All @@ -242,29 +256,8 @@ test-suite test
, unordered-containers
, vector
default-language: Haskell2010
default-extensions: DeriveDataTypeable
DeriveGeneric
GeneralizedNewtypeDeriving
StandaloneDeriving
FlexibleContexts
FlexibleInstances
MultiParamTypeClasses
FunctionalDependencies
DefaultSignatures
NoImplicitPrelude
default-extensions: NoImplicitPrelude
OverloadedStrings
RecordWildCards
TypeApplications
TupleSections
ViewPatterns
LambdaCase
MultiWayIf
ConstraintKinds
UndecidableInstances
BangPatterns
TemplateHaskell
ScopedTypeVariables
MonadFailDesugaring

benchmark block-bench
main-is: block-bench.hs
Expand All @@ -277,6 +270,7 @@ benchmark block-bench
Test.Pos.Chain.Block.Arbitrary.Generate
Test.Pos.Chain.Delegation.Arbitrary
Test.Pos.Chain.Ssc.Arbitrary
Test.Pos.Chain.Txp.Arbitrary
Test.Pos.Chain.Update.Arbitrary
Test.Pos.Chain.Update.Arbitrary.Core

Expand All @@ -292,10 +286,14 @@ benchmark block-bench
, cardano-sl-core-test
, cardano-sl-crypto-test
, cardano-sl-util-test
, data-default
, deepseq
, formatting
, generic-arbitrary
, random
, text
, universum
, unordered-containers
, vector
default-extensions: NoImplicitPrelude
OverloadedStrings
2 changes: 1 addition & 1 deletion chain/src/Pos/Chain/Block/BHelpers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ import Pos.Chain.Block.Union (Block, BlockHeader (..),
MainConsensusData (..), MainToSign (..),
mainBlockEBDataProof)
import Pos.Chain.Ssc (verifySscPayload)
import Pos.Chain.Txp (checkTxPayload)
import Pos.Core.Configuration (HasProtocolConstants)
import Pos.Core.Delegation (LightDlgIndices (..), checkDlgPayload)
import Pos.Core.Slotting (SlotId (..))
import Pos.Core.Ssc (checkSscPayload)
import Pos.Core.Txp (checkTxPayload)
import Pos.Core.Update (checkSoftwareVersion, checkUpdatePayload)
import Pos.Crypto (ProtocolMagic, ProxySignature (..), SignTag (..),
checkSig, hash, isSelfSignedPsk, proxyVerify)
Expand Down
2 changes: 1 addition & 1 deletion chain/src/Pos/Chain/Block/JsonLog.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import Pos.Chain.Block.Blockchain (gbHeader, gbhPrevBlock)
import Pos.Chain.Block.Genesis (genBlockEpoch)
import Pos.Chain.Block.Union (Block, HeaderHash, headerHash,
headerHashF, mainBlockSlot, mainBlockTxPayload)
import Pos.Chain.Txp (txpTxs)
import Pos.Core (HasConfiguration, SlotId (..), getEpochIndex,
getSlotIndex, mkLocalSlotIndex)
import Pos.Core.JsonLog.LogEvents (JLBlock (..), JLEvent (..))
import Pos.Core.Txp (txpTxs)
import Pos.Crypto (hash, hashHexF)

-- | Return event of created block.
Expand Down
3 changes: 2 additions & 1 deletion chain/src/Pos/Chain/Block/Main/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ import qualified Formatting.Buildable as Buildable

import Pos.Binary.Class (Bi (..), Cons (..), Field (..),
deriveSimpleBi, encodeListLen, enforceSize)
import Pos.Chain.Txp.TxPayload (TxPayload)
import Pos.Chain.Txp.TxProof (TxProof)
import Pos.Core.Attributes (Attributes, areAttributesKnown)
import Pos.Core.Delegation (DlgPayload)
import Pos.Core.Ssc (SscPayload, SscProof)
import Pos.Core.Txp (TxPayload, TxProof)
import Pos.Core.Update (BlockVersion, SoftwareVersion, UpdatePayload,
UpdateProof)
import Pos.Crypto (Hash)
Expand Down
2 changes: 1 addition & 1 deletion chain/src/Pos/Chain/Block/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import Pos.Binary.Class (Cons (..), Field (..), deriveSimpleBi)
import Pos.Chain.Block.Slog.Types (SlogUndo (..))
import Pos.Chain.Block.Union (Block, BlockHeader, HasHeaderHash (..))
import Pos.Chain.Delegation (DlgUndo)
import Pos.Chain.Txp (TxpUndo)
import Pos.Chain.Update (USUndo)
import Pos.Core (HasConfiguration, HasDifficulty (..))
import Pos.Core.Txp (TxpUndo)
import Pos.Util.Util (HasLens (..))

-- | Structure for undo block during rollback
Expand Down
6 changes: 4 additions & 2 deletions chain/src/Pos/Chain/Block/Union/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,15 @@ import Pos.Chain.Block.Genesis.Types (GenesisBody (..),
import Pos.Chain.Block.Main.Types (BlockBodyAttributes,
BlockHeaderAttributes, MainBody (..), MainExtraBodyData,
MainExtraHeaderData, MainProof (..))
import Pos.Chain.Txp.Tx (Tx)
import Pos.Chain.Txp.TxPayload (TxPayload, txpTxs, txpWitnesses)
import Pos.Chain.Txp.TxProof (mkTxProof)
import Pos.Chain.Txp.TxWitness (TxWitness)
import Pos.Core.Common (ChainDifficulty, HasDifficulty (..))
import Pos.Core.Delegation (DlgPayload, ProxySigHeavy, ProxySigLight)
import Pos.Core.Slotting (EpochOrSlot (..), HasEpochIndex (..),
HasEpochOrSlot (..), SlotId (..), slotIdF)
import Pos.Core.Ssc (SscPayload, mkSscProof)
import Pos.Core.Txp (Tx, TxPayload, TxWitness, mkTxProof, txpTxs,
txpWitnesses)
import Pos.Core.Update (BlockVersion, HasBlockVersion (..),
HasSoftwareVersion (..), SoftwareVersion, UpdatePayload,
mkUpdateProof)
Expand Down
2 changes: 1 addition & 1 deletion chain/src/Pos/Chain/Script.hs
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ import System.IO.Unsafe (unsafePerformIO)
import qualified Utils.Names as PL

import qualified Pos.Binary.Class as Bi
import Pos.Chain.Txp.TxWitness (TxSigData (..))
import Pos.Core.Binary ()
import Pos.Core.Common (Script (..), ScriptVersion)
import Pos.Core.Script ()
import Pos.Core.Txp (TxSigData (..))

{- NOTE
Expand Down
2 changes: 1 addition & 1 deletion chain/src/Pos/Chain/Script/Examples.hs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ import Serokell.Util.Base16 (base16F)
import Universum

import Pos.Chain.Script (Script, parseRedeemer, parseValidator)
import Pos.Chain.Txp (TxSigData)
import Pos.Core (StakeholderId)
import Pos.Core.Txp (TxSigData)
import Pos.Crypto (SafeSigner, SignTag (SignTx), deterministicKeyGen,
fullPublicKeyHexF, fullSignatureHexF, hashHexF, safeSign,
safeToPublic, signRaw, signTag)
Expand Down
29 changes: 15 additions & 14 deletions chain/src/Pos/Chain/Txp.hs
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
-- | Txp system reexports.

module Pos.Chain.Txp
( module Pos.Core.Txp
, module Pos.Chain.Txp.Base
, module Pos.Chain.Txp.Configuration
, module Pos.Chain.Txp.Error
, module Pos.Chain.Txp.Toil
, module Pos.Chain.Txp.Topsort
, module Pos.Chain.Txp.GenesisUtxo
( module X
) where

import Pos.Chain.Txp.Base
import Pos.Chain.Txp.Configuration
import Pos.Chain.Txp.Error
import Pos.Chain.Txp.GenesisUtxo
import Pos.Chain.Txp.Toil
import Pos.Chain.Txp.Topsort
import Pos.Core.Txp
import Pos.Chain.Txp.Base as X
import Pos.Chain.Txp.Configuration as X
import Pos.Chain.Txp.Error as X
import Pos.Chain.Txp.GenesisUtxo as X
import Pos.Chain.Txp.Toil as X
import Pos.Chain.Txp.Topsort as X
import Pos.Chain.Txp.Tx as X
import Pos.Chain.Txp.TxAux as X
import Pos.Chain.Txp.TxMsg as X
import Pos.Chain.Txp.TxOutAux as X
import Pos.Chain.Txp.TxPayload as X
import Pos.Chain.Txp.TxProof as X
import Pos.Chain.Txp.TxWitness as X
import Pos.Chain.Txp.Undo as X
6 changes: 4 additions & 2 deletions chain/src/Pos/Chain/Txp/Base.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ import qualified Data.HashSet as HS
import Data.List (zipWith)
import qualified Data.Map.Strict as M

import Pos.Chain.Txp.Tx (TxOut (..))
import Pos.Chain.Txp.TxAux (TxAux (..))
import Pos.Chain.Txp.TxOutAux (TxOutAux (..))
import Pos.Chain.Txp.TxPayload (TxPayload (..), mkTxPayload)
import Pos.Core (AddrStakeDistribution (..), Address (..), Coin,
CoinPortion, StakeholderId, StakesList,
aaStakeDistribution, addrAttributesUnwrapped,
applyCoinPortionDown, coinToInteger, mkCoin, sumCoins,
unsafeAddCoin, unsafeGetCoin, unsafeIntegerToCoin)
import Pos.Core.Genesis (GenesisWStakeholders (..))
import Pos.Core.Txp (TxAux (..), TxOut (..), TxOutAux (..),
TxPayload (..), mkTxPayload)
import Pos.Crypto (hash)
import Pos.Crypto.Random (deterministic, randomNumber)

Expand Down
3 changes: 2 additions & 1 deletion chain/src/Pos/Chain/Txp/GenesisUtxo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ import qualified Data.HashMap.Strict as HM
import qualified Data.Map.Strict as Map

import Pos.Chain.Txp.Toil (GenesisUtxo (..), utxoToStakes)
import Pos.Chain.Txp.Tx (TxIn (..), TxOut (..))
import Pos.Chain.Txp.TxOutAux (TxOutAux (..))
import Pos.Core (Address, Coin, HasGenesisData, StakesMap,
genesisData, makeRedeemAddress)
import Pos.Core.Genesis (GenesisData (..), getGenesisAvvmBalances,
getGenesisNonAvvmBalances)
import Pos.Core.Txp (TxIn (..), TxOut (..), TxOutAux (..))
import Pos.Crypto (unsafeHash)


Expand Down
3 changes: 2 additions & 1 deletion chain/src/Pos/Chain/Txp/Toil/Failure.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ import Serokell.Util (listJson)
import Pos.Chain.Block.Union (HeaderHash)
import Pos.Chain.Script (PlutusError)
import Pos.Chain.Txp.Toil.Types (TxFee)
import Pos.Chain.Txp.Tx (TxIn, TxOut (..))
import Pos.Chain.Txp.TxWitness (TxInWitness)
import Pos.Core (Address, ScriptVersion, TxFeePolicy,
addressDetailedF, addressF)
import Pos.Core.Attributes (UnparsedFields)
import Pos.Core.Txp (TxIn, TxInWitness, TxOut (..))
import Pos.Util (DisallowException)

----------------------------------------------------------------------------
Expand Down
6 changes: 4 additions & 2 deletions chain/src/Pos/Chain/Txp/Toil/Logic.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,16 @@ import Pos.Chain.Txp.Toil.Types (TxFee (..))
import Pos.Chain.Txp.Toil.Utxo (VerifyTxUtxoRes (..))
import qualified Pos.Chain.Txp.Toil.Utxo as Utxo
import Pos.Chain.Txp.Topsort (topsortTxs)
import Pos.Chain.Txp.Tx (Tx (..), TxId, TxOut (..), txOutAddress)
import Pos.Chain.Txp.TxAux (TxAux (..), checkTxAux)
import Pos.Chain.Txp.TxOutAux (toaOut)
import Pos.Chain.Txp.Undo (TxUndo, TxpUndo)
import Pos.Core (AddrAttributes (..), AddrStakeDistribution (..),
Address, EpochIndex, HasGenesisData,
addrAttributesUnwrapped, isRedeemAddress)
import Pos.Core.Common (integerToCoin)
import qualified Pos.Core.Common as Fee (TxFeePolicy (..),
calculateTxSizeLinear)
import Pos.Core.Txp (Tx (..), TxAux (..), TxId, TxOut (..), TxUndo,
TxpUndo, checkTxAux, toaOut, txOutAddress)
import Pos.Core.Update (BlockVersionData (..), isBootstrapEraBVD)
import Pos.Crypto (ProtocolMagic, WithHash (..), hash)
import Pos.Util (liftEither)
Expand Down
5 changes: 4 additions & 1 deletion chain/src/Pos/Chain/Txp/Toil/Monad.hs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,11 @@ import System.Wlog (NamedPureLogger, WithLogger, launchNamedPureLog)
import Pos.Chain.Txp.Toil.Types (MemPool, StakesView, UndoMap,
UtxoLookup, UtxoModifier, mpLocalTxs, mpSize, svStakes,
svTotal)
import Pos.Chain.Txp.Tx (TxId, TxIn)
import Pos.Chain.Txp.TxAux (TxAux)
import Pos.Chain.Txp.TxOutAux (TxOutAux)
import Pos.Chain.Txp.Undo (TxUndo)
import Pos.Core.Common (Coin, StakeholderId)
import Pos.Core.Txp (TxAux, TxId, TxIn, TxOutAux, TxUndo)
import Pos.Util (type (~>))
import qualified Pos.Util.Modifier as MM

Expand Down
Loading

0 comments on commit 088a005

Please sign in to comment.