Add transaction generation to db-synthesizer #1048
Draft
IOG Hydra / ci/hydra-build:x86_64-linux.native.formatting.stylish
failed
Apr 10, 2024 in 7s
Build failed
1 failed steps
Details
Failed Steps
Step 1
Derivation
/nix/store/i0g0b7p0da05mhsjvkih2rr9q50si661-check-stylish-haskell-exe-stylish-haskell.drv
Log
unpacking source archive /nix/store/r49h3qh07x70fvnywxhv47fzkv22bxi0-va0av63q65w4qp493v7pbggigj7hzib1-source
source root is va0av63q65w4qp493v7pbggigj7hzib1-source
The custom options for formatting this repo are:
> - module_header:
> indent: 2
> sort: true
> separate_lists: true
> break_where: single
> open_bracket: same_line
> list_align: with_module_name
> pad_module_names: false
> group_imports: true
> - match: "."
> language_extensions:
> - BangPatterns
> - ConstraintKinds
> - DataKinds
> - DefaultSignatures
> - DeriveDataTypeable
> - DeriveGeneric
> - ExistentialQuantification
> - FlexibleContexts
> - FlexibleInstances
> - FunctionalDependencies
> - GADTs
> - GeneralizedNewtypeDeriving
> - LambdaCase
> - MultiParamTypeClasses
> - MultiWayIf
> - NoImplicitPrelude
> - OverloadedStrings
> - PolyKinds
> - RecordWildCards
> - ScopedTypeVariables
> - StandaloneDeriving
> - TemplateHaskell
> - TupleSections
> - TypeApplications
> - TypeFamilies
> - ViewPatterns
> - ExplicitNamespaces
> cabal: false
Formatting haskell files...
diff -ru /nix/store/r49h3qh07x70fvnywxhv47fzkv22bxi0-va0av63q65w4qp493v7pbggigj7hzib1-source/ouroboros-consensus-cardano/app/DBSynthesizer/Parsers.hs ./ouroboros-consensus-cardano/app/DBSynthesizer/Parsers.hs
--- /nix/store/r49h3qh07x70fvnywxhv47fzkv22bxi0-va0av63q65w4qp493v7pbggigj7hzib1-source/ouroboros-consensus-cardano/app/DBSynthesizer/Parsers.hs 1970-01-01 00:00:01.000000000 +0000
+++ ./ouroboros-consensus-cardano/app/DBSynthesizer/Parsers.hs 2024-04-10 15:35:43.708271773 +0000
@@ -1,21 +1,21 @@
-{-# LANGUAGE LambdaCase #-}
+{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NamedFieldPuns #-}
module DBSynthesizer.Parsers (parseCommandLine) where
-import Cardano.Tools.DBSynthesizer.Types
-import Data.Word (Word64)
-import Options.Applicative as Opt
-import Cardano.Tools.DBSynthesizer.Tx
-import Cardano.Ledger.Crypto
-import Cardano.Ledger.Shelley.Genesis
import Cardano.Api.Any
-import Cardano.Api.KeysShelley
import Cardano.Api.Key
+import Cardano.Api.KeysShelley
import Cardano.Api.SerialiseTextEnvelope
-import Cardano.Ledger.Credential
-import Cardano.Ledger.Keys
import Cardano.Ledger.Address
import Cardano.Ledger.BaseTypes
+import Cardano.Ledger.Credential
+import Cardano.Ledger.Crypto
+import Cardano.Ledger.Keys
+import Cardano.Ledger.Shelley.Genesis
+import Cardano.Tools.DBSynthesizer.Tx
+import Cardano.Tools.DBSynthesizer.Types
+import Data.Word (Word64)
+import Options.Applicative as Opt
parseCommandLine :: IO (NodeFilePaths, NodeCredentials, DBSynthesizerOptions, OwnedTxIn StandardCrypto)
parseCommandLine = do
diff -ru /nix/store/r49h3qh07x70fvnywxhv47fzkv22bxi0-va0av63q65w4qp493v7pbggigj7hzib1-source/ouroboros-consensus-cardano/app/db-synthesizer.hs ./ouroboros-consensus-cardano/app/db-synthesizer.hs
--- /nix/store/r49h3qh07x70fvnywxhv47fzkv22bxi0-va0av63q65w4qp493v7pbggigj7hzib1-source/ouroboros-consensus-cardano/app/db-synthesizer.hs 1970-01-01 00:00:01.000000000 +0000
+++ ./ouroboros-consensus-cardano/app/db-synthesizer.hs 2024-04-10 15:35:43.596273069 +0000
@@ -26,9 +26,9 @@
import Cardano.Crypto.Init (cryptoInit)
import Cardano.Tools.DBSynthesizer.Run
import Cardano.Tools.DBSynthesizer.Tx
+import qualified Data.Set as Set
import DBSynthesizer.Parsers
import Main.Utf8 (withStdTerminalHandles)
-import qualified Data.Set as Set
import System.Exit
diff -ru /nix/store/r49h3qh07x70fvnywxhv47fzkv22bxi0-va0av63q65w4qp493v7pbggigj7hzib1-source/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Node/Protocol/Cardano.hs ./ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Node/Protocol/Cardano.hs
--- /nix/store/r49h3qh07x70fvnywxhv47fzkv22bxi0-va0av63q65w4qp493v7pbggigj7hzib1-source/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Node/Protocol/Cardano.hs 1970-01-01 00:00:01.000000000 +0000
+++ ./ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Node/Protocol/Cardano.hs 2024-04-10 15:35:45.757248064 +0000
@@ -11,8 +11,8 @@
-- DUPLICATE -- adapted from: cardano-node/src/Cardano/Node/Protocol/Cardano.hs
module Cardano.Node.Protocol.Cardano (
- mkSomeConsensusProtocolCardano
- , mkConsensusProtocolCardano
+ mkConsensusProtocolCardano
+ , mkSomeConsensusProtocolCardano
-- * Errors
, CardanoProtocolInstantiationError (..)
) where
@@ -37,8 +37,8 @@
import Ouroboros.Consensus.Cardano.Node (CardanoProtocolParams)
import Ouroboros.Consensus.Config (emptyCheckpointsMap)
import Ouroboros.Consensus.HardFork.Combinator.Condense ()
-import Ouroboros.Consensus.Shelley.Crypto (StandardCrypto)
import qualified Ouroboros.Consensus.Mempool as Mempool
+import Ouroboros.Consensus.Shelley.Crypto (StandardCrypto)
------------------------------------------------------------------------------
diff -ru /nix/store/r49h3qh07x70fvnywxhv47fzkv22bxi0-va0av63q65w4qp493v7pbggigj7hzib1-source/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/DBSynthesizer/Forging.hs ./ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/DBSynthesizer/Forging.hs
--- /nix/store/r49h3qh07x70fvnywxhv47fzkv22bxi0-va0av63q65w4qp493v7pbggigj7hzib1-source/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/DBSynthesizer/Forging.hs 1970-01-01 00:00:01.000000000 +0000
+++ ./ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/DBSynthesizer/Forging.hs 2024-04-10 15:35:45.255253878 +0000
@@ -4,9 +4,11 @@
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
-module Cardano.Tools.DBSynthesizer.Forging (runForge, GenTxs) where
+module Cardano.Tools.DBSynthesizer.Forging (
+ GenTxs
+ , runForge
+ ) where
-import Data.Time
import Cardano.Tools.DBSynthesizer.Types (ForgeLimit (..),
ForgeResult (..))
import Control.Monad (when)
@@ -17,6 +19,7 @@
import Data.Either (isRight)
import Data.Maybe (isJust)
import Data.Proxy
+import Data.Time
import Data.Word (Word64)
import Ouroboros.Consensus.Block.Abstract as Block
import Ouroboros.Consensus.Block.Forging as Block (BlockForging (..),
@@ -183,7 +186,7 @@
exitEarly' "block not adopted"
now <- lift $ getCurrentTime
lift . putStrLn $ show now ++ ": forged block " ++ show bcBlockNo ++ " at slot " ++ show currentSlot
-
+
-- | Context required to forge a block
data BlockContext blk = BlockContext
diff -ru /nix/store/r49h3qh07x70fvnywxhv47fzkv22bxi0-va0av63q65w4qp493v7pbggigj7hzib1-source/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/DBSynthesizer/Run.hs ./ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/DBSynthesizer/Run.hs
--- /nix/store/r49h3qh07x70fvnywxhv47fzkv22bxi0-va0av63q65w4qp493v7pbggigj7hzib1-source/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/DBSynthesizer/Run.hs 1970-01-01 00:00:01.000000000 +0000
+++ ./ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/DBSynthesizer/Run.hs 2024-04-10 15:35:45.230254167 +0000
@@ -22,7 +22,7 @@
import Data.ByteString as BS (ByteString, readFile)
import Ouroboros.Consensus.Cardano.Block
import Ouroboros.Consensus.Cardano.Node
-import Ouroboros.Consensus.Config (configStorage, TopLevelConfig)
+import Ouroboros.Consensus.Config (TopLevelConfig, configStorage)
import qualified Ouroboros.Consensus.Fragment.InFuture as InFuture (dontCheck)
import qualified Ouroboros.Consensus.Node as Node (mkChainDbArgs,
stdMkChainDbHasFS)
diff -ru /nix/store/r49h3qh07x70fvnywxhv47fzkv22bxi0-va0av63q65w4qp493v7pbggigj7hzib1-source/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/DBSynthesizer/Tx.hs ./ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/DBSynthesizer/Tx.hs
--- /nix/store/r49h3qh07x70fvnywxhv47fzkv22bxi0-va0av63q65w4qp493v7pbggigj7hzib1-source/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/DBSynthesizer/Tx.hs 1970-01-01 00:00:01.000000000 +0000
+++ ./ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/DBSynthesizer/Tx.hs 2024-04-10 15:35:45.217254317 +0000
@@ -1,101 +1,101 @@
-{-# LANGUAGE RankNTypes #-}
-{-# LANGUAGE LambdaCase #-}
+{-# LANGUAGE ConstraintKinds #-}
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE ExistentialQuantification #-}
-{-# LANGUAGE StandaloneDeriving #-}
-{-# LANGUAGE DerivingStrategies #-}
-{-# LANGUAGE UndecidableInstances #-}
-{-# LANGUAGE DuplicateRecordFields #-}
-{-# LANGUAGE TypeApplications #-}
-{-# LANGUAGE NamedFieldPuns #-}
-{-# LANGUAGE MultiParamTypeClasses #-}
-{-# LANGUAGE ScopedTypeVariables #-}
-{-# LANGUAGE FlexibleInstances #-}
-{-# LANGUAGE OverloadedRecordDot #-}
-{-# LANGUAGE DataKinds #-}
-{-# LANGUAGE FlexibleContexts #-}
-{-# LANGUAGE MonoLocalBinds #-}
-{-# LANGUAGE TypeOperators #-}
-{-# LANGUAGE ConstraintKinds #-}
-
-module Cardano.Tools.DBSynthesizer.Tx
- ( makeGenTxs
- , OwnedTxIn(..)
- , UTxOSetSpec
- , TxOutsSpec(..)
- , TxOutSpec(..)
- , DelegationSpec(..)
- , NativeAssetMintsSpec(..)
- , DatumSpec(..)
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE LambdaCase #-}
+{-# LANGUAGE MonoLocalBinds #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NamedFieldPuns #-}
+{-# LANGUAGE OverloadedRecordDot #-}
+{-# LANGUAGE RankNTypes #-}
+{-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Cardano.Tools.DBSynthesizer.Tx (
+ AddTxException (..)
+ , DatumSpec (..)
+ , DelegationSpec (..)
+ , NativeAssetMintsSpec (..)
+ , NoV2Support (..)
+ , OwnedTxIn (..)
, TxGenCompatibleEra
- , NoV2Support(..)
- , AddTxException(..)
+ , TxOutSpec (..)
+ , TxOutsSpec (..)
+ , UTxOSetSpec
+ , makeGenTxs
) where
-import Data.Typeable
-import Data.SOP.Strict.NS
-import Cardano.Ledger.Plutus.ExUnits
import qualified Cardano.Crypto.DSIGN.Class as Crypto
-import Cardano.Ledger.Api.Tx (calcMinFeeTx)
-import Cardano.Ledger.Api.Tx.Wits
-import Cardano.Ledger.Api.Tx.Out
-import Cardano.Ledger.SafeHash
-import Cardano.Ledger.Keys
-import Cardano.Ledger.Crypto
-import Control.Monad.Trans.Except
-import Data.SOP.Classes
-import Data.SOP.BasicFunctors
-import Ouroboros.Consensus.Byron.Ledger.Block
-import Ouroboros.Consensus.Cardano.CanHardFork
-import Ouroboros.Consensus.TypeFamilyWrappers
-import Control.Exception
-import Ouroboros.Consensus.Ledger.SupportsMempool
-import Ouroboros.Consensus.Config
-import Cardano.Tools.DBSynthesizer.Forging
-import Ouroboros.Consensus.Ledger.Basics
-import Cardano.Ledger.Alonzo.TxBody
-import Cardano.Ledger.Alonzo.Tx
-import Data.Group
-import Universe
-import Data.Default
-import Cardano.Ledger.Credential
-import Control.Concurrent.MVar
-import Cardano.Ledger.Coin
-import Cardano.Ledger.Shelley.LedgerState hiding (LedgerState)
-import Ouroboros.Consensus.Shelley.Ledger
-import Cardano.Ledger.Api.PParams
-import Cardano.Ledger.Plutus.Language
-import Cardano.Ledger.Alonzo.Scripts
-import Data.Word
-import Cardano.Ledger.Api.Scripts
+import Cardano.Ledger.Alonzo.Scripts
+import Cardano.Ledger.Alonzo.Tx
+import Cardano.Ledger.Alonzo.TxBody
+import Cardano.Ledger.Api.PParams
+import Cardano.Ledger.Api.Scripts
+import Cardano.Ledger.Api.Tx (calcMinFeeTx)
+import Cardano.Ledger.Api.Tx.Out
+import Cardano.Ledger.Api.Tx.Wits
+import Cardano.Ledger.Coin
+import Cardano.Ledger.Core
+import Cardano.Ledger.Credential
+import Cardano.Ledger.Crypto
+import Cardano.Ledger.Keys
+import Cardano.Ledger.Mary.Value
+import Cardano.Ledger.Plutus.Data as PData
+import Cardano.Ledger.Plutus.ExUnits
+import Cardano.Ledger.Plutus.Language
+import Cardano.Ledger.SafeHash
+import Cardano.Ledger.Shelley.LedgerState hiding (LedgerState)
+import Cardano.Ledger.TxIn
+import Cardano.Ledger.UTxO hiding (balance)
+import Cardano.Tools.DBSynthesizer.Forging
+import Control.Concurrent.MVar
+import Control.Exception
+import Control.Monad.Trans.Except
+import qualified Data.ByteString as BS
+import qualified Data.ByteString.Short as SBS
+import Data.Coerce
+import Data.Default
+import Data.Group
+import qualified Data.Map.Strict as Map
+import Data.Sequence.Strict as Seq
+import qualified Data.Set as Set
+import Data.SOP.BasicFunctors
+import Data.SOP.Classes
+import Data.SOP.Strict.NS
+import Data.Typeable
+import Data.Word
+import Lens.Micro
+import Numeric.Natural
+import Ouroboros.Consensus.Byron.Ledger.Block
import Ouroboros.Consensus.Cardano.Block
+import Ouroboros.Consensus.Cardano.CanHardFork
+import Ouroboros.Consensus.Config
import Ouroboros.Consensus.HardFork.Combinator
import Ouroboros.Consensus.HardFork.Combinator.AcrossEras
import Ouroboros.Consensus.HardFork.Combinator.State
-import Data.Coerce
-import Lens.Micro
-import qualified Data.Map.Strict as Map
-import Cardano.Ledger.TxIn
-import Cardano.Ledger.UTxO hiding (balance)
-import Cardano.Ledger.Core
-import Ouroboros.Consensus.Protocol.Praos
-import Ouroboros.Consensus.Shelley.HFEras ()
-import qualified Data.Set as Set
-import Cardano.Ledger.Mary.Value
-import Data.Sequence.Strict as Seq
-import Numeric.Natural
-import PlutusLedgerApi.V1 hiding (TxOut, ScriptHash, Value)
-import PlutusCore.Version
-import UntypedPlutusCore hiding (Constr)
-import qualified Data.ByteString.Short as SBS
-import qualified Data.ByteString as BS
-import Cardano.Ledger.Plutus.Data as PData
+import Ouroboros.Consensus.Ledger.Basics
+import Ouroboros.Consensus.Ledger.SupportsMempool
+import Ouroboros.Consensus.Protocol.Praos
+import Ouroboros.Consensus.Shelley.HFEras ()
+import Ouroboros.Consensus.Shelley.Ledger
+import Ouroboros.Consensus.TypeFamilyWrappers
+import PlutusCore.Version
+import PlutusLedgerApi.V1 hiding (ScriptHash, TxOut, Value)
+import Universe
+import UntypedPlutusCore hiding (Constr)
-- TODO: Distributions
-- TODO: reference scripts
data TxOutSpec = TxOutSpec
{ nativeAssets :: ![NativeAssetMintsSpec]
- , datum :: !(Maybe DatumSpec)
- , delegation :: !DelegationSpec
+ , datum :: !(Maybe DatumSpec)
+ , delegation :: !DelegationSpec
} deriving stock Show
-- Intentionally omit Pointers
@@ -109,7 +109,7 @@
data TxOutsSpec = TxOutsSpec
{ duplicates :: !Natural
- , txOut :: !TxOutSpec
+ , txOut :: !TxOutSpec
} deriving stock Show
type UTxOSetSpec = [TxOutsSpec]
@@ -124,7 +124,7 @@
script = fromPlutusScript pScript
pScript = case mkPlutusScript taggedSerialized of
Nothing -> throw NoV2Support
- Just s -> s
+ Just s -> s
taggedSerialized = Plutus @'PlutusV2 $ PlutusBinary serialized
serialized = serialiseUPLC prog
prog = Program () plcVersion100 $ LamAbs () (DeBruijn 0)
@@ -156,7 +156,7 @@
}
data AddTxException proto era = AddTxException
- { tx :: !(GenTx (ShelleyBlock proto era))
+ { tx :: !(GenTx (ShelleyBlock proto era))
, err :: !(ApplyTxError era)
}
@@ -224,21 +224,21 @@
data OwnedTxIn c = OwnedTxIn
{ owned :: !(TxIn c)
- , skey :: !(Crypto.SignKeyDSIGN (DSIGN c))
+ , skey :: !(Crypto.SignKeyDSIGN (DSIGN c))
}
deriving stock instance (Crypto c) => Show (OwnedTxIn c)
data ProducingState c = ProducingState
- { spec :: !UTxOSetSpec
- , uTxOIn :: !(TxIn c)
- , addr :: !(Addr c)
+ { spec :: !UTxOSetSpec
+ , uTxOIn :: !(TxIn c)
+ , addr :: !(Addr c)
, balance :: !Coin
} deriving stock Show
data InitState c = InitState
{ initSpec :: !UTxOSetSpec
- , initIn :: !(TxIn c)
+ , initIn :: !(TxIn c)
} deriving stock Show
data MakeGenTxsState c
@@ -310,7 +310,7 @@
-- Validate the transaction we've constructed
(nextTls, vtx) = case runExcept eVtx of
Left err -> throw $ AddTxException { tx = gtx, err } -- TODO put makeTxs in IO and throwIO here?
- Right x -> x
+ Right x -> x
eVtx = applyTx
(extractLedgerConfig $ configLedger cfg)
Intervene
@@ -372,7 +372,7 @@
-- Set the destination address of this UTxO by our spec
nextAddr = case txOut.delegation of
DelegateHash -> delegAddr
- NoDelegate -> undelegAddr
+ NoDelegate -> undelegAddr
-- Initialize the UTxO with the specified address and datum
noMA = mkBasicTxOut nextAddr mempty
@@ -426,7 +426,7 @@
& bodyTxL . feeTxBodyL .~ neededFee
& bodyTxL . outputsTxBodyL %~ setChange neededChange
(change, unsignedTx) = setMinFee noFeeTx
- setChange _ Seq.Empty = Seq.Empty
+ setChange _ Seq.Empty = Seq.Empty
setChange c (x :<| outs) = (x & coinTxOutL .~ c) :<| outs
-- Witness the transaction
diff -ru /nix/store/r49h3qh07x70fvnywxhv47fzkv22bxi0-va0av63q65w4qp493v7pbggigj7hzib1-source/ouroboros-consensus-cardano/test/tools-test/Main.hs ./ouroboros-consensus-cardano/test/tools-test/Main.hs
--- /nix/store/r49h3qh07x70fvnywxhv47fzkv22bxi0-va0av63q65w4qp493v7pbggigj7hzib1-source/ouroboros-consensus-cardano/test/tools-test/Main.hs 1970-01-01 00:00:01.000000000 +0000
+++ ./ouroboros-consensus-cardano/test/tools-test/Main.hs 2024-04-10 15:35:44.913257834 +0000
@@ -1,23 +1,23 @@
-{-# LANGUAGE LambdaCase #-}
+{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NamedFieldPuns #-}
module Main (main) where
-import qualified Data.Set as Set
-import Cardano.Ledger.Credential
-import Cardano.Ledger.Keys
-import Cardano.Api.Any
-import Cardano.Api.Key
-import Cardano.Ledger.Address
-import Cardano.Ledger.BaseTypes
-import Cardano.Ledger.Shelley.Genesis
-import Cardano.Api.KeysShelley
-import Cardano.Api.SerialiseTextEnvelope
+import Cardano.Api.Any
+import Cardano.Api.Key
+import Cardano.Api.KeysShelley
+import Cardano.Api.SerialiseTextEnvelope
+import Cardano.Ledger.Address
+import Cardano.Ledger.BaseTypes
+import Cardano.Ledger.Credential
+import Cardano.Ledger.Keys
+import Cardano.Ledger.Shelley.Genesis
import qualified Cardano.Tools.DBAnalyser.Block.Cardano as Cardano
import qualified Cardano.Tools.DBAnalyser.Run as DBAnalyser
import Cardano.Tools.DBAnalyser.Types
import qualified Cardano.Tools.DBSynthesizer.Run as DBSynthesizer
-import Cardano.Tools.DBSynthesizer.Types
import Cardano.Tools.DBSynthesizer.Tx
+import Cardano.Tools.DBSynthesizer.Types
+import qualified Data.Set as Set
import Ouroboros.Consensus.Cardano.Block
import Test.Tasty
import Test.Tasty.HUnit
*** stylish-haskell-exe-stylish-haskell-0.14.6.0 found changes that need addressed first
Loading