From 88e4621f8c3de5f84e737938b40196dac1a23935 Mon Sep 17 00:00:00 2001 From: Jordan Millar Date: Tue, 10 Mar 2020 15:33:10 +0000 Subject: [PATCH] Update dependencies --- cabal.project | 132 +++++++++--------- .../src/Cardano/Tracing/ToObjectOrphans.hs | 8 +- cardano-node/src/Cardano/CLI/Genesis.hs | 22 +-- cardano-node/src/Cardano/CLI/Ops.hs | 45 +++--- cardano-node/src/Cardano/Chairman.hs | 43 +++--- cardano-node/src/Cardano/Node/Submission.hs | 66 ++++----- cardano-node/src/Cardano/Tracing/Tracers.hs | 2 +- .../Benchmarking/GeneratorTx/NodeToNode.hs | 38 ++--- .../Benchmarking/GeneratorTx/Submission.hs | 77 +++++----- stack.yaml | 14 +- 10 files changed, 226 insertions(+), 221 deletions(-) diff --git a/cabal.project b/cabal.project index 370992d0b48..b70e6238050 100644 --- a/cabal.project +++ b/cabal.project @@ -23,29 +23,29 @@ package ouroboros-consensus-mock source-repository-package type: git location: https://github.com/input-output-hk/cardano-base - tag: a7b403c1762a6a122a691df816c26563b7e547f8 - --sha256: 0j87xb20xkl2h5vbqhn9af7dqjwwcbp60nwsp1yablzv295gnxwi + tag: f869bee9b08ba1044b1476737c9d65083e1c6c7f + --sha256: 0df3bdf13cwx3hd8n4q53g9hybb0w8mh837y64ydd88xhdfaf6a3 subdir: binary source-repository-package type: git location: https://github.com/input-output-hk/cardano-base - tag: a7b403c1762a6a122a691df816c26563b7e547f8 - --sha256: 0j87xb20xkl2h5vbqhn9af7dqjwwcbp60nwsp1yablzv295gnxwi + tag: f869bee9b08ba1044b1476737c9d65083e1c6c7f + --sha256: 0df3bdf13cwx3hd8n4q53g9hybb0w8mh837y64ydd88xhdfaf6a3 subdir: binary/test source-repository-package type: git location: https://github.com/input-output-hk/cardano-base - tag: a7b403c1762a6a122a691df816c26563b7e547f8 - --sha256: 0j87xb20xkl2h5vbqhn9af7dqjwwcbp60nwsp1yablzv295gnxwi + tag: f869bee9b08ba1044b1476737c9d65083e1c6c7f + --sha256: 0df3bdf13cwx3hd8n4q53g9hybb0w8mh837y64ydd88xhdfaf6a3 subdir: cardano-crypto-class source-repository-package type: git location: https://github.com/input-output-hk/cardano-base - tag: a7b403c1762a6a122a691df816c26563b7e547f8 - --sha256: 0j87xb20xkl2h5vbqhn9af7dqjwwcbp60nwsp1yablzv295gnxwi + tag: f869bee9b08ba1044b1476737c9d65083e1c6c7f + --sha256: 0df3bdf13cwx3hd8n4q53g9hybb0w8mh837y64ydd88xhdfaf6a3 subdir: slotting source-repository-package @@ -57,63 +57,63 @@ source-repository-package source-repository-package type: git location: https://github.com/input-output-hk/cardano-ledger - tag: 86f0cb4705f46307e4c89e7ef4c90142882cce54 - --sha256: 0sxklkwawyrsdvbb7hrg7r8sdiqc8ab2c5wdl1nb91zrvzs08z9m + tag: 1368966fd6d806d8eb65cd1ba193548c402355f6 + --sha256: 0mrgby1sw2yawfhkj20zg8wl7k3v9jkcv43prfxxlakikpdkjzhp subdir: cardano-ledger source-repository-package type: git location: https://github.com/input-output-hk/cardano-ledger - tag: 86f0cb4705f46307e4c89e7ef4c90142882cce54 - --sha256: 0sxklkwawyrsdvbb7hrg7r8sdiqc8ab2c5wdl1nb91zrvzs08z9m + tag: 1368966fd6d806d8eb65cd1ba193548c402355f6 + --sha256: 0mrgby1sw2yawfhkj20zg8wl7k3v9jkcv43prfxxlakikpdkjzhp subdir: crypto source-repository-package type: git location: https://github.com/input-output-hk/cardano-ledger - tag: 86f0cb4705f46307e4c89e7ef4c90142882cce54 - --sha256: 0sxklkwawyrsdvbb7hrg7r8sdiqc8ab2c5wdl1nb91zrvzs08z9m + tag: 1368966fd6d806d8eb65cd1ba193548c402355f6 + --sha256: 0mrgby1sw2yawfhkj20zg8wl7k3v9jkcv43prfxxlakikpdkjzhp subdir: cardano-ledger/test source-repository-package type: git location: https://github.com/input-output-hk/cardano-ledger - tag: 86f0cb4705f46307e4c89e7ef4c90142882cce54 - --sha256: 0sxklkwawyrsdvbb7hrg7r8sdiqc8ab2c5wdl1nb91zrvzs08z9m + tag: 1368966fd6d806d8eb65cd1ba193548c402355f6 + --sha256: 0mrgby1sw2yawfhkj20zg8wl7k3v9jkcv43prfxxlakikpdkjzhp subdir: crypto/test source-repository-package type: git location: https://github.com/input-output-hk/cardano-ledger-specs - tag: 318f5a1594a23aedadb3977ddd5a32230c8be4fe - --sha256: 09zmg09v6r9jr1jl2xim29nc8g4ys2pjisbm66xj2409znn5n19q + tag: 647cd71e3c4630488e71596f5e9c26fee598b541 + --sha256: 08vkca171019z7xql2z7lg9piz6bgy5nn7h0ja6ab0s4ngf83gii subdir: byron/chain/executable-spec source-repository-package type: git location: https://github.com/input-output-hk/cardano-ledger-specs - tag: 318f5a1594a23aedadb3977ddd5a32230c8be4fe - --sha256: 09zmg09v6r9jr1jl2xim29nc8g4ys2pjisbm66xj2409znn5n19q + tag: 647cd71e3c4630488e71596f5e9c26fee598b541 + --sha256: 08vkca171019z7xql2z7lg9piz6bgy5nn7h0ja6ab0s4ngf83gii subdir: byron/ledger/executable-spec source-repository-package type: git location: https://github.com/input-output-hk/cardano-ledger-specs - tag: 318f5a1594a23aedadb3977ddd5a32230c8be4fe - --sha256: 09zmg09v6r9jr1jl2xim29nc8g4ys2pjisbm66xj2409znn5n19q + tag: 647cd71e3c4630488e71596f5e9c26fee598b541 + --sha256: 08vkca171019z7xql2z7lg9piz6bgy5nn7h0ja6ab0s4ngf83gii subdir: byron/semantics/executable-spec source-repository-package type: git location: https://github.com/input-output-hk/cardano-prelude - tag: 2440fd0dc3d5ba109c4f16a87d98dc80a66d1b8e - --sha256: 04ppqc7n197gk0j9yiqhwdnlxfd2cw7ak4fi03gchyqf9cag5f8k + tag: fe76ec64f6b45259cc407a6d840dad79ee6063b6 + --sha256: 1w39806djx7vmps47vvc72i20w4dkam3l8687kkw5ih1isvl671x source-repository-package type: git location: https://github.com/input-output-hk/cardano-prelude - tag: 2440fd0dc3d5ba109c4f16a87d98dc80a66d1b8e - --sha256: 04ppqc7n197gk0j9yiqhwdnlxfd2cw7ak4fi03gchyqf9cag5f8k + tag: fe76ec64f6b45259cc407a6d840dad79ee6063b6 + --sha256: 1w39806djx7vmps47vvc72i20w4dkam3l8687kkw5ih1isvl671x subdir: test source-repository-package @@ -138,141 +138,141 @@ source-repository-package source-repository-package type: git location: https://github.com/input-output-hk/iohk-monitoring-framework - tag: 43a912b94498dcdeaaad71c37a6b58dceefaf1ca - --sha256: 0lnfqvrna4x5sqxq71m5717adrp0qfhzjc9g2wr0rflh6d1yb9ag + tag: 3e45d5dd4942c295f0ea4bfed7c407b914b15447 + --sha256: 0vik0qqw0p5xdrl2r84fz8jhmlzcx0b3cxpvb434ldb8xnlx8q8i subdir: iohk-monitoring source-repository-package type: git location: https://github.com/input-output-hk/iohk-monitoring-framework - tag: 43a912b94498dcdeaaad71c37a6b58dceefaf1ca - --sha256: 0lnfqvrna4x5sqxq71m5717adrp0qfhzjc9g2wr0rflh6d1yb9ag + tag: 3e45d5dd4942c295f0ea4bfed7c407b914b15447 + --sha256: 0vik0qqw0p5xdrl2r84fz8jhmlzcx0b3cxpvb434ldb8xnlx8q8i subdir: contra-tracer source-repository-package type: git location: https://github.com/input-output-hk/iohk-monitoring-framework - tag: 43a912b94498dcdeaaad71c37a6b58dceefaf1ca - --sha256: 0lnfqvrna4x5sqxq71m5717adrp0qfhzjc9g2wr0rflh6d1yb9ag + tag: 3e45d5dd4942c295f0ea4bfed7c407b914b15447 + --sha256: 0vik0qqw0p5xdrl2r84fz8jhmlzcx0b3cxpvb434ldb8xnlx8q8i subdir: plugins/scribe-systemd source-repository-package type: git location: https://github.com/input-output-hk/iohk-monitoring-framework - tag: 43a912b94498dcdeaaad71c37a6b58dceefaf1ca - --sha256: 0lnfqvrna4x5sqxq71m5717adrp0qfhzjc9g2wr0rflh6d1yb9ag + tag: 3e45d5dd4942c295f0ea4bfed7c407b914b15447 + --sha256: 0vik0qqw0p5xdrl2r84fz8jhmlzcx0b3cxpvb434ldb8xnlx8q8i subdir: plugins/backend-aggregation source-repository-package type: git location: https://github.com/input-output-hk/iohk-monitoring-framework - tag: 43a912b94498dcdeaaad71c37a6b58dceefaf1ca - --sha256: 0lnfqvrna4x5sqxq71m5717adrp0qfhzjc9g2wr0rflh6d1yb9ag + tag: 3e45d5dd4942c295f0ea4bfed7c407b914b15447 + --sha256: 0vik0qqw0p5xdrl2r84fz8jhmlzcx0b3cxpvb434ldb8xnlx8q8i subdir: plugins/backend-ekg source-repository-package type: git location: https://github.com/input-output-hk/iohk-monitoring-framework - tag: 43a912b94498dcdeaaad71c37a6b58dceefaf1ca - --sha256: 0lnfqvrna4x5sqxq71m5717adrp0qfhzjc9g2wr0rflh6d1yb9ag + tag: 3e45d5dd4942c295f0ea4bfed7c407b914b15447 + --sha256: 0vik0qqw0p5xdrl2r84fz8jhmlzcx0b3cxpvb434ldb8xnlx8q8i subdir: plugins/backend-monitoring source-repository-package type: git location: https://github.com/input-output-hk/iohk-monitoring-framework - tag: 43a912b94498dcdeaaad71c37a6b58dceefaf1ca - --sha256: 0lnfqvrna4x5sqxq71m5717adrp0qfhzjc9g2wr0rflh6d1yb9ag + tag: 3e45d5dd4942c295f0ea4bfed7c407b914b15447 + --sha256: 0vik0qqw0p5xdrl2r84fz8jhmlzcx0b3cxpvb434ldb8xnlx8q8i subdir: tracer-transformers source-repository-package type: git location: https://github.com/input-output-hk/ouroboros-network - tag: d0f3b7d44ef4212f3e60bf3b07a03bc543962409 - --sha256: 00i0y1lxlmzh8r3bsnzkns8cmkc3g5jqkzfr2ic05ngimnam7nh6 + tag: a85bd4751ca5c81c0507482848358980814e9ca3 + --sha256: 1fhv6p1rkim6acp5m7gfkzmv9hxmpmg07qc4k03y0sxm1zgwbcjk subdir: ouroboros-network source-repository-package type: git location: https://github.com/input-output-hk/ouroboros-network - tag: d0f3b7d44ef4212f3e60bf3b07a03bc543962409 - --sha256: 00i0y1lxlmzh8r3bsnzkns8cmkc3g5jqkzfr2ic05ngimnam7nh6 + tag: a85bd4751ca5c81c0507482848358980814e9ca3 + --sha256: 1fhv6p1rkim6acp5m7gfkzmv9hxmpmg07qc4k03y0sxm1zgwbcjk subdir: io-sim source-repository-package type: git location: https://github.com/input-output-hk/ouroboros-network - tag: d0f3b7d44ef4212f3e60bf3b07a03bc543962409 - --sha256: 00i0y1lxlmzh8r3bsnzkns8cmkc3g5jqkzfr2ic05ngimnam7nh6 + tag: a85bd4751ca5c81c0507482848358980814e9ca3 + --sha256: 1fhv6p1rkim6acp5m7gfkzmv9hxmpmg07qc4k03y0sxm1zgwbcjk subdir: ouroboros-network-testing source-repository-package type: git location: https://github.com/input-output-hk/ouroboros-network - tag: d0f3b7d44ef4212f3e60bf3b07a03bc543962409 - --sha256: 00i0y1lxlmzh8r3bsnzkns8cmkc3g5jqkzfr2ic05ngimnam7nh6 + tag: a85bd4751ca5c81c0507482848358980814e9ca3 + --sha256: 1fhv6p1rkim6acp5m7gfkzmv9hxmpmg07qc4k03y0sxm1zgwbcjk subdir: ouroboros-consensus source-repository-package type: git location: https://github.com/input-output-hk/ouroboros-network - tag: d0f3b7d44ef4212f3e60bf3b07a03bc543962409 - --sha256: 00i0y1lxlmzh8r3bsnzkns8cmkc3g5jqkzfr2ic05ngimnam7nh6 + tag: a85bd4751ca5c81c0507482848358980814e9ca3 + --sha256: 1fhv6p1rkim6acp5m7gfkzmv9hxmpmg07qc4k03y0sxm1zgwbcjk subdir: ouroboros-consensus/ouroboros-consensus-mock source-repository-package type: git location: https://github.com/input-output-hk/ouroboros-network - tag: d0f3b7d44ef4212f3e60bf3b07a03bc543962409 - --sha256: 00i0y1lxlmzh8r3bsnzkns8cmkc3g5jqkzfr2ic05ngimnam7nh6 + tag: a85bd4751ca5c81c0507482848358980814e9ca3 + --sha256: 1fhv6p1rkim6acp5m7gfkzmv9hxmpmg07qc4k03y0sxm1zgwbcjk subdir: ouroboros-consensus-byron source-repository-package type: git location: https://github.com/input-output-hk/ouroboros-network - tag: d0f3b7d44ef4212f3e60bf3b07a03bc543962409 - --sha256: 00i0y1lxlmzh8r3bsnzkns8cmkc3g5jqkzfr2ic05ngimnam7nh6 + tag: a85bd4751ca5c81c0507482848358980814e9ca3 + --sha256: 1fhv6p1rkim6acp5m7gfkzmv9hxmpmg07qc4k03y0sxm1zgwbcjk subdir: ouroboros-consensus-cardano source-repository-package type: git location: https://github.com/input-output-hk/ouroboros-network - tag: d0f3b7d44ef4212f3e60bf3b07a03bc543962409 - --sha256: 00i0y1lxlmzh8r3bsnzkns8cmkc3g5jqkzfr2ic05ngimnam7nh6 + tag: a85bd4751ca5c81c0507482848358980814e9ca3 + --sha256: 1fhv6p1rkim6acp5m7gfkzmv9hxmpmg07qc4k03y0sxm1zgwbcjk subdir: typed-protocols source-repository-package type: git location: https://github.com/input-output-hk/ouroboros-network - tag: d0f3b7d44ef4212f3e60bf3b07a03bc543962409 - --sha256: 00i0y1lxlmzh8r3bsnzkns8cmkc3g5jqkzfr2ic05ngimnam7nh6 + tag: a85bd4751ca5c81c0507482848358980814e9ca3 + --sha256: 1fhv6p1rkim6acp5m7gfkzmv9hxmpmg07qc4k03y0sxm1zgwbcjk subdir: typed-protocols-examples source-repository-package type: git location: https://github.com/input-output-hk/ouroboros-network - tag: d0f3b7d44ef4212f3e60bf3b07a03bc543962409 - --sha256: 00i0y1lxlmzh8r3bsnzkns8cmkc3g5jqkzfr2ic05ngimnam7nh6 + tag: a85bd4751ca5c81c0507482848358980814e9ca3 + --sha256: 1fhv6p1rkim6acp5m7gfkzmv9hxmpmg07qc4k03y0sxm1zgwbcjk subdir: ouroboros-network-framework source-repository-package type: git location: https://github.com/input-output-hk/ouroboros-network - tag: d0f3b7d44ef4212f3e60bf3b07a03bc543962409 - --sha256: 00i0y1lxlmzh8r3bsnzkns8cmkc3g5jqkzfr2ic05ngimnam7nh6 + tag: a85bd4751ca5c81c0507482848358980814e9ca3 + --sha256: 1fhv6p1rkim6acp5m7gfkzmv9hxmpmg07qc4k03y0sxm1zgwbcjk subdir: network-mux source-repository-package type: git location: https://github.com/input-output-hk/ouroboros-network - tag: d0f3b7d44ef4212f3e60bf3b07a03bc543962409 - --sha256: 00i0y1lxlmzh8r3bsnzkns8cmkc3g5jqkzfr2ic05ngimnam7nh6 + tag: a85bd4751ca5c81c0507482848358980814e9ca3 + --sha256: 1fhv6p1rkim6acp5m7gfkzmv9hxmpmg07qc4k03y0sxm1zgwbcjk subdir: io-sim-classes source-repository-package type: git location: https://github.com/input-output-hk/ouroboros-network - tag: d0f3b7d44ef4212f3e60bf3b07a03bc543962409 - --sha256: 00i0y1lxlmzh8r3bsnzkns8cmkc3g5jqkzfr2ic05ngimnam7nh6 + tag: a85bd4751ca5c81c0507482848358980814e9ca3 + --sha256: 1fhv6p1rkim6acp5m7gfkzmv9hxmpmg07qc4k03y0sxm1zgwbcjk subdir: Win32-network source-repository-package diff --git a/cardano-config/src/Cardano/Tracing/ToObjectOrphans.hs b/cardano-config/src/Cardano/Tracing/ToObjectOrphans.hs index 82852b08897..9705b0f0455 100644 --- a/cardano-config/src/Cardano/Tracing/ToObjectOrphans.hs +++ b/cardano-config/src/Cardano/Tracing/ToObjectOrphans.hs @@ -289,8 +289,8 @@ instance DefinePrivacyAnnotation (TraceTxSubmissionOutbound (GenTxId blk) (GenTx instance DefineSeverity (TraceTxSubmissionOutbound (GenTxId blk) (GenTx blk)) where defineSeverity _ = Info -instance DefinePrivacyAnnotation (WithAddr Socket.SockAddr ErrorPolicyTrace) -instance DefineSeverity (WithAddr Socket.SockAddr ErrorPolicyTrace) where +instance DefinePrivacyAnnotation (WithAddr addr ErrorPolicyTrace) +instance DefineSeverity (WithAddr addr ErrorPolicyTrace) where defineSeverity (WithAddr _ ev) = case ev of ErrorPolicySuspendPeer {} -> Warning -- peer misbehaved ErrorPolicySuspendConsumer {} -> Notice -- peer temporarily not useful @@ -467,7 +467,7 @@ instance (Show (GenTxId blk), Show (GenTx blk)) => Transformable Text IO (TraceTxSubmissionOutbound (GenTxId blk) (GenTx blk)) where trTransformer = defaultTextTransformer -instance Transformable Text IO (WithAddr Socket.SockAddr ErrorPolicyTrace) where +instance Show addr => Transformable Text IO (WithAddr addr ErrorPolicyTrace) where trTransformer = defaultTextTransformer instance Transformable Text IO (WithDomainName (SubscriptionTrace Socket.SockAddr)) where @@ -1330,7 +1330,7 @@ instance (Show (GenTx blk), Show (GenTxId blk)) [ "kind" .= String "TraceTxSubmissionOutboundSendMsgReplyTxs" ] -instance ToObject (WithAddr Socket.SockAddr ErrorPolicyTrace) where +instance Show addr => ToObject (WithAddr addr ErrorPolicyTrace) where toObject _verb (WithAddr addr ev) = mkObject [ "kind" .= String "ErrorPolicyTrace" , "address" .= show addr diff --git a/cardano-node/src/Cardano/CLI/Genesis.hs b/cardano-node/src/Cardano/CLI/Genesis.hs index 5ce196dd298..783b0a569fe 100644 --- a/cardano-node/src/Cardano/CLI/Genesis.hs +++ b/cardano-node/src/Cardano/CLI/Genesis.hs @@ -21,7 +21,10 @@ import Control.Monad.Trans.Except.Extra import qualified Data.ByteString.Lazy as LB import qualified Data.Map.Strict as Map import Data.String (IsString) +import Data.Text.Encoding (encodeUtf8) +import Data.Text.Lazy.Builder (toLazyText) import Data.Time (UTCTime) +import Formatting.Buildable import Text.Printf (printf) import System.Directory (createDirectory, doesPathExist) @@ -72,8 +75,6 @@ mkGenesisSpec gp = do genesisDelegation <- withExceptT (DelegationError) $ Genesis.mkGenesisDelegation [] - seed <- lift . getSeed $ gpSeed gp - withExceptT GenesisSpecError $ ExceptT . pure $ Genesis.mkGenesisSpec (Genesis.GenesisAvvmBalances mempty) @@ -81,21 +82,16 @@ mkGenesisSpec gp = do protocolParameters (gpK gp) (gpProtocolMagic gp) - (mkGenesisInitialiser True seed) + (mkGenesisInitialiser True) where - mkGenesisInitialiser :: Bool -> Integer -> Genesis.GenesisInitializer - mkGenesisInitialiser useHeavyDlg seed = + mkGenesisInitialiser :: Bool -> Genesis.GenesisInitializer + mkGenesisInitialiser useHeavyDlg = Genesis.GenesisInitializer (gpTestnetBalance gp) (gpFakeAvvmOptions gp) (Common.lovelacePortionToRational (gpAvvmBalanceFactor gp)) useHeavyDlg - seed - - getSeed :: Maybe Integer -> IO Integer - getSeed (Just x) = pure x - getSeed Nothing = Crypto.runSecureRandom . Crypto.randomNumber $ shiftL 1 32 -- | Generate a genesis, for given blockchain start time, protocol parameters, -- security parameter, protocol magic, testnet balance options, fake AVVM options, @@ -135,7 +131,7 @@ dumpGenesis ptcl (NewDirectory outDir) genesisData gs = do liftIO $ wOut "delegate-keys" "key" (pure . serialiseDelegateKey ptcl) (gsRichSecrets gs) liftIO $ wOut "poor-keys" "key" (pure . serialisePoorKey ptcl) (gsPoorSecrets gs) liftIO $ wOut "delegation-cert" "json" (pure . serialiseDelegationCert ptcl) dlgCerts - liftIO $ wOut "avvm-seed" "seed" (pure . (Right <$> LB.fromStrict)) (gsFakeAvvmSeeds gs) + liftIO $ wOut "avvm-secrets" "secret" (pure . printFakeAvvmSecrets) (gsFakeAvvmSecrets gs) where dlgCertMap :: Map Common.KeyHash Certificate dlgCertMap = Genesis.unGenesisDelegation $ Genesis.gdHeavyDelegation genesisData @@ -147,6 +143,10 @@ dumpGenesis ptcl (NewDirectory outDir) genesisData gs = do Just x -> right x genesisJSONFile :: FilePath genesisJSONFile = outDir <> "/genesis.json" + + printFakeAvvmSecrets :: Crypto.RedeemSigningKey -> Either CliError LB.ByteString + printFakeAvvmSecrets rskey = Right . LB.fromStrict . encodeUtf8 . toStrict . toLazyText $ build rskey + -- Compare a given 'SigningKey' with a 'Certificate' 'VerificationKey' isCertForSK :: SigningKey -> Certificate -> Bool isCertForSK sk cert = delegateVK cert == Crypto.toVerification sk diff --git a/cardano-node/src/Cardano/CLI/Ops.hs b/cardano-node/src/Cardano/CLI/Ops.hs index 4dc91c6635d..16b53d0236e 100644 --- a/cardano-node/src/Cardano/CLI/Ops.hs +++ b/cardano-node/src/Cardano/CLI/Ops.hs @@ -82,9 +82,11 @@ import Ouroboros.Network.Mux (AppType(InitiatorApp), OuroborosApplication(..), MuxPeer(..), RunMiniProtocol(..)) import Ouroboros.Network.NodeToClient - (AssociateWithIOCP, NetworkConnectTracers(..), nodeToClientProtocols - , NodeToClientVersionData(..), NodeToClientVersion(NodeToClientV_1), connectTo - , localTxSubmissionClientNull, nodeToClientCodecCBORTerm ) + (AssociateWithIOCP, NetworkConnectTracers(..), NodeToClientProtocols(..), + nodeToClientProtocols, NodeToClientVersionData(..), + NodeToClientVersion(NodeToClientV_1), + connectTo, localSnocket, + localTxSubmissionClientNull, nodeToClientCodecCBORTerm) import Ouroboros.Network.Protocol.ChainSync.Client (ChainSyncClient(..), ClientStIdle(..), ClientStNext(..) , chainSyncClientPeer, recvMsgRollForward) @@ -95,9 +97,8 @@ import Ouroboros.Network.Protocol.LocalTxSubmission.Type (LocalTxSubmission) import Ouroboros.Network.Protocol.LocalTxSubmission.Client (localTxSubmissionClientPeer) -import Ouroboros.Network.Snocket (socketSnocket) -import Cardano.Common.LocalSocket +import Cardano.Common.LocalSocket (chooseSocketPath) import Cardano.Config.Protocol (Protocol(..), ProtocolInstantiationError , SomeProtocol(..), fromProtocol, renderProtocolInstantiationError) @@ -387,14 +388,13 @@ createNodeConnection -> AssociateWithIOCP -> SocketPath -> IO () -createNodeConnection proxy ptcl iocp socketPath = do - addr <- localSocketPath socketPath - let ProtocolInfo{pInfoConfig} = Consensus.protocolInfo ptcl +createNodeConnection proxy ptcl iocp (SocketFile path) = + let ProtocolInfo{pInfoConfig} = Consensus.protocolInfo ptcl in connectTo - (socketSnocket iocp) + (localSnocket iocp path) (NetworkConnectTracers nullTracer nullTracer) (localInitiatorNetworkApplication proxy pInfoConfig) - addr + path `catch` handleMuxError handleMuxError :: MuxError -> IO () @@ -419,16 +419,21 @@ localInitiatorNetworkApplication proxy cfg = (DictVersion nodeToClientCodecCBORTerm) $ \_peerid -> nodeToClientProtocols - (InitiatorProtocolOnly $ - MuxPeer - nullTracer - localTxSubmissionCodec - (localTxSubmissionClientPeer localTxSubmissionClientNull)) - (InitiatorProtocolOnly $ - MuxPeer - nullTracer - localChainSyncCodec - (chainSyncClientPeer chainSyncClient)) + NodeToClientProtocols { + localChainSyncProtocol = + InitiatorProtocolOnly $ + MuxPeer + nullTracer + localChainSyncCodec + (chainSyncClientPeer chainSyncClient) + + , localTxSubmissionProtocol = + InitiatorProtocolOnly $ + MuxPeer + nullTracer + localTxSubmissionCodec + (localTxSubmissionClientPeer localTxSubmissionClientNull) + } where localChainSyncCodec :: Codec (ChainSync (Serialised blk) (Tip blk)) DeserialiseFailure m LB.ByteString localChainSyncCodec = pcLocalChainSyncCodec . protocolCodecs cfg $ mostRecentNetworkProtocolVersion proxy diff --git a/cardano-node/src/Cardano/Chairman.hs b/cardano-node/src/Cardano/Chairman.hs index 6208732c8ff..567c64b30d8 100644 --- a/cardano-node/src/Cardano/Chairman.hs +++ b/cardano-node/src/Cardano/Chairman.hs @@ -59,10 +59,8 @@ import Ouroboros.Network.Protocol.ChainSync.Client import Ouroboros.Network.Protocol.ChainSync.Codec import Ouroboros.Network.Protocol.Handshake.Version import Ouroboros.Network.NodeToClient -import Ouroboros.Network.Snocket (socketSnocket) -import Cardano.Common.LocalSocket -import Cardano.Config.Types (SocketPath) +import Cardano.Config.Types (SocketPath(..)) import Cardano.Tracing.Tracers (TraceConstraints) -- | Run chairman: connect with all the core nodes. Chairman will store the @@ -136,11 +134,10 @@ createConnection maxBlockNo tracer cfg - iocp - socketPath = do - path <- localSocketPath socketPath + iomgr + socketPath@(SocketFile path) = connectTo - (socketSnocket iocp) + (localSnocket iomgr path) NetworkConnectTracers { nctMuxTracer = nullTracer, nctHandshakeTracer = nullTracer @@ -385,20 +382,24 @@ localInitiatorNetworkApplication sockPath chainsVar securityParam maxBlockNo cha (NodeToClientVersionData (nodeNetworkMagic (Proxy @blk) cfg)) (DictVersion nodeToClientCodecCBORTerm) $ \_peerid -> - nodeToClientProtocols - (InitiatorProtocolOnly $ - MuxPeer - localTxSubmissionTracer - localTxSubmissionCodec - (localTxSubmissionClientPeer localTxSubmissionClientNull)) - (InitiatorProtocolOnly $ - MuxPeer - chainSyncTracer - (localChainSyncCodec cfg) - (chainSyncClientPeer $ - chainSyncClient chairmanTracer sockPath chainsVar - securityParam maxBlockNo)) - + nodeToClientProtocols $ + NodeToClientProtocols { + localChainSyncProtocol = + InitiatorProtocolOnly $ + MuxPeer + chainSyncTracer + (localChainSyncCodec cfg) + (chainSyncClientPeer $ + chainSyncClient chairmanTracer sockPath chainsVar + securityParam maxBlockNo) + + , localTxSubmissionProtocol = + InitiatorProtocolOnly $ + MuxPeer + localTxSubmissionTracer + localTxSubmissionCodec + (localTxSubmissionClientPeer localTxSubmissionClientNull) + } -- -- Codecs diff --git a/cardano-node/src/Cardano/Node/Submission.hs b/cardano-node/src/Cardano/Node/Submission.hs index 26655608bac..73e4de89633 100644 --- a/cardano-node/src/Cardano/Node/Submission.hs +++ b/cardano-node/src/Cardano/Node/Submission.hs @@ -49,14 +49,12 @@ import Ouroboros.Network.Protocol.Handshake.Version ( Versions , simpleSingletonVersions) import Ouroboros.Network.NodeToClient ( AssociateWithIOCP , NetworkConnectTracers (..)) -import qualified Ouroboros.Network.NodeToClient as NodeToClient -import Ouroboros.Network.Snocket (socketSnocket) +import qualified Ouroboros.Network.NodeToClient as NtC import Cardano.BM.Data.Tracer (DefinePrivacyAnnotation (..), DefineSeverity (..), ToObject (..), TracingFormatting (..), TracingVerbosity (..), Transformable (..), emptyObject, mkObject, trStructured) -import Cardano.Common.LocalSocket import Cardano.Config.Types (SocketPath(..)) -- | Low-tevel tracer @@ -111,16 +109,15 @@ submitTx :: ( RunNode blk -> GenTx blk -> Tracer IO TraceLowLevelSubmit -> IO () -submitTx iocp targetSocketFp cfg tx tracer = do - targetSocketFp' <- localSocketPath targetSocketFp - NodeToClient.connectTo - (socketSnocket iocp) +submitTx iocp (SocketFile path) cfg tx tracer = + NtC.connectTo + (NtC.localSnocket iocp path) NetworkConnectTracers { nctMuxTracer = nullTracer, nctHandshakeTracer = nullTracer } (localInitiatorNetworkApplication tracer cfg tx) - targetSocketFp' + path localInitiatorNetworkApplication :: forall blk m peer. @@ -133,33 +130,38 @@ localInitiatorNetworkApplication => Tracer m TraceLowLevelSubmit -> TopLevelConfig blk -> GenTx blk - -> Versions NodeToClient.NodeToClientVersion NodeToClient.DictVersion + -> Versions NtC.NodeToClientVersion NtC.DictVersion (peer -> OuroborosApplication InitiatorApp ByteString m () Void) localInitiatorNetworkApplication tracer cfg tx = simpleSingletonVersions - NodeToClient.NodeToClientV_1 - (NodeToClient.NodeToClientVersionData - { NodeToClient.networkMagic = Node.nodeNetworkMagic (Proxy @blk) cfg }) - (NodeToClient.DictVersion NodeToClient.nodeToClientCodecCBORTerm) $ \_peerid -> - - NodeToClient.nodeToClientProtocols - (InitiatorProtocolOnly $ - MuxPeer - nullTracer - (localChainSyncCodec @blk cfg) - (chainSyncClientPeer NodeToClient.chainSyncClientNull)) - (InitiatorProtocolOnly $ - MuxPeerRaw $ \channel -> do - traceWith tracer TraceLowLevelSubmitting - result <- runPeer - nullTracer -- (contramap show tracer) - localTxSubmissionCodec - channel - (LocalTxSub.localTxSubmissionClientPeer - (txSubmissionClientSingle tx)) - case result of - Nothing -> traceWith tracer TraceLowLevelAccepted - Just msg -> traceWith tracer (TraceLowLevelRejected $ show msg)) + NtC.NodeToClientV_1 + (NtC.NodeToClientVersionData + { NtC.networkMagic = Node.nodeNetworkMagic (Proxy @blk) cfg }) + (NtC.DictVersion NtC.nodeToClientCodecCBORTerm) $ \_peerid -> + + NtC.nodeToClientProtocols + NtC.NodeToClientProtocols { + NtC.localChainSyncProtocol = + InitiatorProtocolOnly $ + MuxPeer + nullTracer + (localChainSyncCodec @blk cfg) + (chainSyncClientPeer NtC.chainSyncClientNull) + + , NtC.localTxSubmissionProtocol = + InitiatorProtocolOnly $ + MuxPeerRaw $ \channel -> do + traceWith tracer TraceLowLevelSubmitting + result <- runPeer + nullTracer -- (contramap show tracer) + localTxSubmissionCodec + channel + (LocalTxSub.localTxSubmissionClientPeer + (txSubmissionClientSingle tx)) + case result of + Nothing -> traceWith tracer TraceLowLevelAccepted + Just msg -> traceWith tracer (TraceLowLevelRejected $ show msg) + } -- | A 'LocalTxSubmissionClient' that submits exactly one transaction, and then -- disconnects, returning the confirmation or rejection. diff --git a/cardano-node/src/Cardano/Tracing/Tracers.hs b/cardano-node/src/Cardano/Tracing/Tracers.hs index c88d1866cc1..74d9ba50e02 100644 --- a/cardano-node/src/Cardano/Tracing/Tracers.hs +++ b/cardano-node/src/Cardano/Tracing/Tracers.hs @@ -91,7 +91,7 @@ data Tracers peer localPeer blk = Tracers -- | Trace error policy resolution , errorPolicyTracer :: Tracer IO (NtN.WithAddr Socket.SockAddr NtN.ErrorPolicyTrace) -- | Trace local error policy resolution - , localErrorPolicyTracer :: Tracer IO (NtN.WithAddr Socket.SockAddr NtN.ErrorPolicyTrace) + , localErrorPolicyTracer :: Tracer IO (NtN.WithAddr NtC.LocalAddress NtN.ErrorPolicyTrace) -- | Trace the Mux , muxTracer :: Tracer IO (WithMuxBearer peer MuxTrace) , handshakeTracer :: Tracer IO NtN.HandshakeTr diff --git a/cardano-tx-generator/src/Cardano/Benchmarking/GeneratorTx/NodeToNode.hs b/cardano-tx-generator/src/Cardano/Benchmarking/GeneratorTx/NodeToNode.hs index c19342dc842..861e8af23fc 100644 --- a/cardano-tx-generator/src/Cardano/Benchmarking/GeneratorTx/NodeToNode.hs +++ b/cardano-tx-generator/src/Cardano/Benchmarking/GeneratorTx/NodeToNode.hs @@ -115,7 +115,7 @@ instance ToObject (SendRecvTxSubmission ByronBlock) where TS.MsgReplyTxs _ -> mkObject ["kind" .= String "TxSubmissionRecvReplyTxs"] TS.MsgDone -> emptyObject -- No useful information. - toObject MaximalVerbosity t = + toObject MaximalVerbosity t = case t of TraceSendMsg (AnyMessage msg) -> case msg of @@ -225,29 +225,31 @@ benchmarkConnectTxSubmit iocp trs cfg localAddr remoteAddr myTxSubClient = do peerMultiplex :: Versions NtN.NodeToNodeVersion NtN.DictVersion (NtN.ConnectionId SockAddr -> - OuroborosApplication InitiatorApp ByteString m () Void) + OuroborosApplication InitiatorApp ByteString m () Void) peerMultiplex = simpleSingletonVersions NtN.NodeToNodeV_1 (NtN.NodeToNodeVersionData { NtN.networkMagic = nodeNetworkMagic (Proxy @blk) cfg}) (NtN.DictVersion NtN.nodeToNodeCodecCBORTerm) $ \_ -> - NtN.nodeToNodeProtocols - (InitiatorProtocolOnly $ - MuxPeer - nullTracer - (pcChainSyncCodec myCodecs) - (chainSyncClientPeer chainSyncClientNull)) - (InitiatorProtocolOnly $ - MuxPeer - nullTracer - (pcBlockFetchCodec myCodecs) - (blockFetchClientPeer blockFetchClientNull)) - (InitiatorProtocolOnly $ - MuxPeer - (trSendRecvTxSubmission trs) - (pcTxSubmissionCodec myCodecs) - (txSubmissionClientPeer myTxSubClient)) + NtN.nodeToNodeProtocols NtN.defaultMiniProtocolParameters $ + NtN.NodeToNodeProtocols + { NtN.chainSyncProtocol = InitiatorProtocolOnly $ + MuxPeer + nullTracer + (pcChainSyncCodec myCodecs) + (chainSyncClientPeer chainSyncClientNull) + , NtN.blockFetchProtocol = InitiatorProtocolOnly $ + MuxPeer + nullTracer + (pcBlockFetchCodec myCodecs) + (blockFetchClientPeer blockFetchClientNull) + , NtN.txSubmissionProtocol = InitiatorProtocolOnly $ + MuxPeer + (trSendRecvTxSubmission trs) + (pcTxSubmissionCodec myCodecs) + (txSubmissionClientPeer myTxSubClient) + } -- the null block fetch client blockFetchClientNull :: forall block m a. MonadTimer m diff --git a/cardano-tx-generator/src/Cardano/Benchmarking/GeneratorTx/Submission.hs b/cardano-tx-generator/src/Cardano/Benchmarking/GeneratorTx/Submission.hs index 0eb93ca0073..df3da40f35e 100644 --- a/cardano-tx-generator/src/Cardano/Benchmarking/GeneratorTx/Submission.hs +++ b/cardano-tx-generator/src/Cardano/Benchmarking/GeneratorTx/Submission.hs @@ -90,14 +90,10 @@ import Ouroboros.Network.Protocol.TxSubmission.Type (BlockingReplyList TokBlockingStyle(..)) import Ouroboros.Network.NodeToClient ( AssociateWithIOCP , NetworkConnectTracers (..)) -import qualified Ouroboros.Network.NodeToClient as NodeToClient -import Ouroboros.Network.Snocket (socketSnocket) +import qualified Ouroboros.Network.NodeToClient as NtC import Cardano.Config.Types (SocketPath(..)) -import System.Directory (createDirectoryIfMissing) -import System.FilePath (takeDirectory) - -- | Bulk submisson of transactions. -- -- This is intended to be used as a seperate process that interfaces @@ -540,23 +536,15 @@ submitTx :: ( RunNode blk -> GenTx blk -> Tracer IO TraceLowLevelSubmit -> IO () -submitTx iocp targetSocketFp cfg tx tracer = do - targetSocketFp' <- localSocketPath targetSocketFp - NodeToClient.connectTo - (socketSnocket iocp) +submitTx iocp (SocketFile path) cfg tx tracer = + NtC.connectTo + (NtC.localSnocket iocp path) NetworkConnectTracers { nctMuxTracer = nullTracer, nctHandshakeTracer = nullTracer } (localInitiatorNetworkApplication tracer cfg tx) - targetSocketFp' - --- | Provide an filepath intended for a socket situated in 'socketDir'. --- When 'mkdir' is 'MkdirIfMissing', the directory is created. -localSocketPath :: SocketPath -> IO FilePath -localSocketPath (SocketFile fp) = do - createDirectoryIfMissing True $ takeDirectory fp - return fp + path localInitiatorNetworkApplication :: forall blk m peer. @@ -569,33 +557,40 @@ localInitiatorNetworkApplication => Tracer m TraceLowLevelSubmit -> TopLevelConfig blk -> GenTx blk - -> Versions NodeToClient.NodeToClientVersion NodeToClient.DictVersion + -> Versions NtC.NodeToClientVersion NtC.DictVersion (peer -> OuroborosApplication InitiatorApp ByteString m () Void) localInitiatorNetworkApplication tracer cfg tx = simpleSingletonVersions - NodeToClient.NodeToClientV_1 - (NodeToClient.NodeToClientVersionData - { NodeToClient.networkMagic = Node.nodeNetworkMagic (Proxy @blk) cfg }) - (NodeToClient.DictVersion NodeToClient.nodeToClientCodecCBORTerm) $ \_peerid -> - - NodeToClient.nodeToClientProtocols - (InitiatorProtocolOnly $ - MuxPeer - nullTracer - (localChainSyncCodec @blk cfg) - (chainSyncClientPeer NodeToClient.chainSyncClientNull)) - (InitiatorProtocolOnly $ - MuxPeerRaw $ \channel -> do - traceWith tracer TraceLowLevelSubmitting - result <- runPeer - nullTracer -- (contramap show tracer) - localTxSubmissionCodec - channel - (LocalTxSub.localTxSubmissionClientPeer - (txSubmissionClientSingle tx)) - case result of - Nothing -> traceWith tracer TraceLowLevelAccepted - Just msg -> traceWith tracer (TraceLowLevelRejected $ show msg)) + NtC.NodeToClientV_1 + (NtC.NodeToClientVersionData + { NtC.networkMagic = Node.nodeNetworkMagic (Proxy @blk) cfg }) + (NtC.DictVersion NtC.nodeToClientCodecCBORTerm) $ \_peerid -> + + NtC.nodeToClientProtocols + NtC.NodeToClientProtocols { + NtC.localChainSyncProtocol = + InitiatorProtocolOnly $ + MuxPeer + nullTracer + (localChainSyncCodec @blk cfg) + (chainSyncClientPeer NtC.chainSyncClientNull) + + , NtC.localTxSubmissionProtocol = + InitiatorProtocolOnly $ + MuxPeerRaw $ \channel -> do + traceWith tracer TraceLowLevelSubmitting + result <- runPeer + nullTracer -- (contramap show tracer) + localTxSubmissionCodec + channel + (LocalTxSub.localTxSubmissionClientPeer + (txSubmissionClientSingle tx)) + case result of + Nothing -> traceWith tracer TraceLowLevelAccepted + Just msg -> traceWith tracer (TraceLowLevelRejected $ show msg) + } + + -- | A 'LocalTxSubmissionClient' that submits exactly one transaction, and then -- disconnects, returning the confirmation or rejection. diff --git a/stack.yaml b/stack.yaml index 337a09af19a..208de26202b 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,4 +1,4 @@ -resolver: https://raw.githubusercontent.com/input-output-hk/cardano-prelude/2440fd0dc3d5ba109c4f16a87d98dc80a66d1b8e/snapshot.yaml +resolver: https://raw.githubusercontent.com/input-output-hk/cardano-prelude/fe76ec64f6b45259cc407a6d840dad79ee6063b6/snapshot.yaml compiler: ghc-8.6.5 packages: @@ -56,7 +56,7 @@ extra-deps: # Cardano-ledger dependencies - git: https://github.com/input-output-hk/cardano-ledger - commit: 86f0cb4705f46307e4c89e7ef4c90142882cce54 + commit: 1368966fd6d806d8eb65cd1ba193548c402355f6 subdirs: - cardano-ledger - cardano-ledger/test @@ -64,7 +64,7 @@ extra-deps: - crypto/test - git: https://github.com/input-output-hk/cardano-ledger-specs - commit: 318f5a1594a23aedadb3977ddd5a32230c8be4fe + commit: 647cd71e3c4630488e71596f5e9c26fee598b541 subdirs: # small-steps - byron/semantics/executable-spec @@ -74,13 +74,13 @@ extra-deps: - byron/chain/executable-spec - git: https://github.com/input-output-hk/cardano-prelude - commit: 2440fd0dc3d5ba109c4f16a87d98dc80a66d1b8e + commit: fe76ec64f6b45259cc407a6d840dad79ee6063b6 subdirs: - . - test - git: https://github.com/input-output-hk/cardano-base - commit: a7b403c1762a6a122a691df816c26563b7e547f8 + commit: f869bee9b08ba1044b1476737c9d65083e1c6c7f subdirs: - binary - binary/test @@ -99,7 +99,7 @@ extra-deps: # iohk-monitoring-framework currently not pinned to a release - git: https://github.com/input-output-hk/iohk-monitoring-framework - commit: 43a912b94498dcdeaaad71c37a6b58dceefaf1ca + commit: 3e45d5dd4942c295f0ea4bfed7c407b914b15447 subdirs: - contra-tracer - iohk-monitoring @@ -121,7 +121,7 @@ extra-deps: #Ouroboros-network dependencies - git: https://github.com/input-output-hk/ouroboros-network - commit: d0f3b7d44ef4212f3e60bf3b07a03bc543962409 + commit: a85bd4751ca5c81c0507482848358980814e9ca3 subdirs: - io-sim - io-sim-classes