├── .buildkite └── pipeline.yml ├── .editorconfig ├── .gitignore ├── .hindent.yaml ├── .nonsense ├── .stylish-haskell.yaml ├── CHANGELOG.md ├── CODEOWNERS ├── CONTRIBUTING.md ├── HLint.hs ├── LICENSE ├── README.md ├── Setup.hs ├── appveyor.yml ├── auxx ├── LICENSE ├── Main.hs ├── README.md ├── Setup.hs ├── cardano-sl-auxx.cabal ├── src │ ├── AuxxOptions.hs │ ├── Command.hs │ ├── Command │ │ ├── BlockGen.hs │ │ ├── Help.hs │ │ ├── Proc.hs │ │ ├── Rollback.hs │ │ ├── Tx.hs │ │ ├── TyProjection.hs │ │ └── Update.hs │ ├── Lang.hs │ ├── Lang │ │ ├── Argument.hs │ │ ├── Command.hs │ │ ├── DisplayError.hs │ │ ├── Interpreter.hs │ │ ├── Lexer.hs │ │ ├── Name.hs │ │ ├── Parser.hs │ │ ├── Syntax.hs │ │ └── Value.hs │ ├── Mode.hs │ ├── Plugin.hs │ └── Repl.hs └── test │ ├── Spec.hs │ ├── Test.hs │ └── Test │ └── Auxx │ └── Lang │ ├── ArgumentSpec.hs │ ├── LexerSpec.hs │ └── ParserSpec.hs ├── benchmarks ├── check_fork.sh ├── parse.hs ├── plots.r └── xblocks.sh ├── binary ├── LICENSE ├── Pos │ └── Binary │ │ ├── Class.hs │ │ └── Class │ │ ├── Core.hs │ │ ├── Primitive.hs │ │ └── TH.hs ├── README.md ├── Setup.hs ├── Test │ └── Pos │ │ └── Cbor │ │ ├── Canonicity.hs │ │ └── RefImpl.hs └── cardano-sl-binary.cabal ├── block ├── LICENSE ├── README.md ├── Setup.hs ├── bench │ └── Block.hs ├── cardano-sl-block.cabal └── src │ └── Pos │ ├── Arbitrary │ ├── Block.hs │ └── Block │ │ ├── Generate.hs │ │ └── Message.hs │ ├── Binary │ └── Block │ │ ├── Network.hs │ │ └── Types.hs │ ├── Block │ ├── BHelpers.hs │ ├── BListener.hs │ ├── Base.hs │ ├── BlockWorkMode.hs │ ├── Configuration.hs │ ├── Error.hs │ ├── Logic.hs │ ├── Logic │ │ ├── Creation.hs │ │ ├── Header.hs │ │ ├── Integrity.hs │ │ ├── Internal.hs │ │ ├── Util.hs │ │ └── VAR.hs │ ├── Network.hs │ ├── Network │ │ ├── Logic.hs │ │ ├── Retrieval.hs │ │ └── Types.hs │ ├── RetrievalQueue.hs │ ├── Slog.hs │ ├── Slog │ │ ├── Context.hs │ │ ├── Logic.hs │ │ └── Types.hs │ ├── Types.hs │ └── Worker.hs │ ├── DB │ ├── Block.hs │ └── Block │ │ └── Load.hs │ ├── GState │ ├── BlockExtra.hs │ └── SanityCheck.hs │ ├── Lrc.hs │ └── Lrc │ ├── Consumers.hs │ ├── DB.hs │ ├── DB │ ├── Leaders.hs │ ├── Lrc.hs │ └── Richmen.hs │ ├── Genesis.hs │ ├── Logic.hs │ └── Worker.hs ├── blockchain-importer ├── CHANGELOG.md ├── LICENSE ├── PULL_REQUEST_TEMPLATE.md ├── README.md ├── Setup.hs ├── bench │ ├── Bench │ │ └── Pos │ │ │ └── BlockchainImporter │ │ │ └── ServerBench.hs │ ├── Main.hs │ └── results │ │ └── ServerBackend.html ├── cardano-sl-blockchain-importer.cabal ├── log-config.yaml ├── scripts │ ├── build.sh │ ├── fetch_dependencies.sh │ ├── generate_cabal2nix.sh │ └── launch │ │ ├── external-consistency-from-blk.sh │ │ ├── internal-consistency.sh │ │ ├── mainnet-test-results.txt │ │ ├── qa.sh │ │ ├── restart-consistency.sh │ │ ├── setup-localDB.sh │ │ ├── staging-test-results.txt │ │ ├── staging.sh │ │ └── utils.sh ├── src │ ├── Pos │ │ ├── Arbitrary │ │ │ └── BlockchainImporter.hs │ │ ├── Binary │ │ │ └── BlockchainImporter.hs │ │ ├── BlockchainImporter │ │ │ ├── Aeson │ │ │ │ └── ClientTypes.hs │ │ │ ├── BListener.hs │ │ │ ├── BlockchainImporterMode.hs │ │ │ ├── Configuration.hs │ │ │ ├── Core.hs │ │ │ ├── Core │ │ │ │ └── Types.hs │ │ │ ├── ExtraContext.hs │ │ │ ├── Recovery.hs │ │ │ ├── Tables │ │ │ │ ├── BestBlockTable.hs │ │ │ │ ├── TxAddrTable.hs │ │ │ │ ├── TxsTable.hs │ │ │ │ ├── Utils.hs │ │ │ │ └── UtxosTable.hs │ │ │ ├── TestUtil.hs │ │ │ ├── Txp.hs │ │ │ ├── Txp │ │ │ │ ├── Global.hs │ │ │ │ ├── Local.hs │ │ │ │ ├── Toil.hs │ │ │ │ └── Toil │ │ │ │ │ ├── Logic.hs │ │ │ │ │ ├── Monad.hs │ │ │ │ │ └── Types.hs │ │ │ ├── Web.hs │ │ │ └── Web │ │ │ │ ├── Api.hs │ │ │ │ ├── ClientTypes.hs │ │ │ │ ├── Error.hs │ │ │ │ ├── Server.hs │ │ │ │ ├── TestServer.hs │ │ │ │ └── Transform.hs │ │ └── ImporterDBConsistency │ │ │ ├── ConsistencyChecker.hs │ │ │ ├── Properties.hs │ │ │ └── Utils.hs │ ├── blockchain-importer │ │ ├── BlockchainImporterNodeOptions.hs │ │ └── Main.hs │ ├── documentation │ │ └── Main.hs │ ├── importer-db-consistency │ │ ├── ImporterDBConsistencyNodeOptions.hs │ │ └── Main.hs │ └── mock │ │ └── Main.hs ├── start-dev.sh └── test │ ├── Spec.hs │ ├── Test.hs │ └── Test │ └── Pos │ └── BlockchainImporter │ ├── BListenerSpec.hs.unused │ ├── Identity │ └── BinarySpec.hs │ ├── MockFactory.hs │ └── Web │ └── ServerSpec.hs ├── client ├── LICENSE ├── README.md ├── Setup.hs ├── cardano-sl-client.cabal ├── src │ └── Pos │ │ └── Client │ │ ├── KeyStorage.hs │ │ ├── Txp.hs │ │ ├── Txp │ │ ├── Addresses.hs │ │ ├── Balances.hs │ │ ├── History.hs │ │ ├── Network.hs │ │ └── Util.hs │ │ ├── Update.hs │ │ └── Update │ │ └── Network.hs └── test │ ├── Spec.hs │ ├── Test.hs │ └── Test │ └── Pos │ └── Client │ └── Txp │ ├── Mode.hs │ └── UtilSpec.hs ├── core ├── LICENSE ├── README.md ├── Setup.hs ├── cardano-sl-core.cabal ├── src │ └── Pos │ │ ├── Aeson │ │ ├── Core.hs │ │ ├── Core │ │ │ └── Configuration.hs │ │ ├── Fee.hs │ │ └── Genesis.hs │ │ ├── Arbitrary │ │ ├── Core.hs │ │ └── Core │ │ │ └── Unsafe.hs │ │ ├── Binary │ │ ├── Core.hs │ │ ├── Core │ │ │ ├── Address.hs │ │ │ ├── Block.hs │ │ │ ├── Blockchain.hs │ │ │ ├── Common.hs │ │ │ ├── Delegation.hs │ │ │ ├── Fee.hs │ │ │ ├── Script.hs │ │ │ ├── Slotting.hs │ │ │ ├── Ssc.hs │ │ │ ├── Txp.hs │ │ │ └── Update.hs │ │ └── Merkle.hs │ │ ├── Core.hs │ │ ├── Core │ │ ├── Block.hs │ │ ├── Block │ │ │ ├── Blockchain.hs │ │ │ ├── Genesis.hs │ │ │ ├── Genesis │ │ │ │ ├── Chain.hs │ │ │ │ ├── Instances.hs │ │ │ │ ├── Lens.hs │ │ │ │ └── Types.hs │ │ │ ├── Main.hs │ │ │ ├── Main │ │ │ │ ├── Chain.hs │ │ │ │ ├── Instances.hs │ │ │ │ ├── Lens.hs │ │ │ │ └── Types.hs │ │ │ ├── Union.hs │ │ │ └── Union │ │ │ │ ├── Instances.hs │ │ │ │ └── Types.hs │ │ ├── Class.hs │ │ ├── Common.hs │ │ ├── Common │ │ │ ├── Address.hs │ │ │ ├── Coin.hs │ │ │ ├── Fee.hs │ │ │ └── Types.hs │ │ ├── Configuration.hs │ │ ├── Configuration │ │ │ ├── BlockVersionData.hs │ │ │ ├── Core.hs │ │ │ ├── GeneratedSecrets.hs │ │ │ ├── GenesisData.hs │ │ │ ├── GenesisHash.hs │ │ │ └── Protocol.hs │ │ ├── Constants.hs │ │ ├── Context.hs │ │ ├── Context │ │ │ └── PrimaryKey.hs │ │ ├── Delegation.hs │ │ ├── Genesis.hs │ │ ├── Genesis │ │ │ ├── Canonical.hs │ │ │ ├── Generate.hs │ │ │ ├── Helpers.hs │ │ │ └── Types.hs │ │ ├── ProtocolConstants.hs │ │ ├── Script.hs │ │ ├── Slotting.hs │ │ ├── Slotting │ │ │ ├── Timestamp.hs │ │ │ ├── Types.hs │ │ │ └── Util.hs │ │ ├── Ssc.hs │ │ ├── Ssc │ │ │ ├── Types.hs │ │ │ ├── Util.hs │ │ │ └── Vss.hs │ │ ├── Txp.hs │ │ ├── Update.hs │ │ └── Update │ │ │ ├── Types.hs │ │ │ └── Util.hs │ │ ├── Data │ │ └── Attributes.hs │ │ ├── Exception.hs │ │ ├── Merkle.hs │ │ └── System │ │ └── Metrics │ │ └── Constants.hs └── test │ ├── Spec.hs │ ├── Test │ └── Pos │ │ └── Core │ │ ├── AddressSpec.hs │ │ └── CoinSpec.hs │ └── test.hs ├── crypto ├── LICENSE ├── Pos │ ├── Aeson │ │ └── Crypto.hs │ ├── Binary │ │ └── Crypto.hs │ ├── Crypto.hs │ └── Crypto │ │ ├── AsBinary.hs │ │ ├── Configuration.hs │ │ ├── Encryption.hs │ │ ├── HD.hs │ │ ├── Hashing.hs │ │ ├── Random.hs │ │ ├── Scrypt.hs │ │ ├── SecretSharing.hs │ │ ├── Signing.hs │ │ └── Signing │ │ ├── Check.hs │ │ ├── Redeem.hs │ │ ├── Safe.hs │ │ ├── Signing.hs │ │ ├── Tag.hs │ │ ├── Types.hs │ │ └── Types │ │ ├── Redeem.hs │ │ ├── Safe.hs │ │ ├── Signing.hs │ │ └── Tag.hs ├── README.md ├── Setup.hs ├── cardano-sl-crypto.cabal ├── test │ ├── Spec.hs │ ├── Test │ │ └── Pos │ │ │ └── Crypto │ │ │ └── CryptoSpec.hs │ └── test.hs └── tests │ ├── LICENSE │ ├── Setup.hs │ ├── Test │ └── Pos │ │ └── Crypto │ │ ├── Arbitrary.hs │ │ └── Arbitrary │ │ └── Unsafe.hs │ └── cardano-sl-crypto-test.cabal ├── db ├── LICENSE ├── Pos │ ├── DB.hs │ └── DB │ │ ├── BatchOp.hs │ │ ├── BlockIndex.hs │ │ ├── Class.hs │ │ ├── Error.hs │ │ ├── Functions.hs │ │ ├── GState │ │ ├── Common.hs │ │ └── Stakes.hs │ │ ├── Misc │ │ └── Common.hs │ │ ├── Pure.hs │ │ ├── Rocks.hs │ │ ├── Rocks │ │ ├── Functions.hs │ │ └── Types.hs │ │ └── Sum.hs ├── README.md ├── Setup.hs └── cardano-sl-db.cabal ├── default.nix ├── delegation ├── LICENSE ├── README.md ├── Setup.hs ├── cardano-sl-delegation.cabal └── src │ └── Pos │ ├── Arbitrary │ └── Delegation.hs │ ├── Binary │ └── Delegation.hs │ ├── Delegation.hs │ └── Delegation │ ├── Cede.hs │ ├── Cede │ ├── Class.hs │ ├── Holders.hs │ ├── Logic.hs │ └── Types.hs │ ├── Class.hs │ ├── Configuration.hs │ ├── DB.hs │ ├── Listeners.hs │ ├── Logic.hs │ ├── Logic │ ├── Common.hs │ ├── Mempool.hs │ └── VAR.hs │ ├── Lrc.hs │ ├── Types.hs │ └── Worker.hs ├── docker.nix ├── docs ├── PULL_REQUEST_TEMPLATE.md ├── README.md ├── auxx.md ├── block-processing │ ├── overall.md │ ├── slog.md │ ├── txp.md │ ├── types.md │ ├── us-bv-states.png │ ├── us-proposal-states.png │ └── us.md ├── code-organisation-guidelines.md ├── configuration.md ├── databases.md ├── docker.md ├── exceptions.md ├── exchange-onboarding.md ├── hd.md ├── how-to │ ├── README.md │ ├── build-cardano-sl-and-daedalus-from-source-code.md │ ├── connect-to-cluster.md │ ├── deploy-cluster.md │ ├── generate-blockchain.md │ ├── generate-genesis.md │ ├── push-update-on-mainnet.md │ ├── rollback-blocks.md │ ├── run-explorer-web-ui.md │ ├── send-requests-to-explorer-api.md │ ├── send-requests-to-wallet-api.md │ ├── test-update-system-locally.md │ └── test-update-system.md ├── launcher.md ├── monads.md ├── network │ ├── example-topologies │ │ ├── behind-nat-no-dns.yaml │ │ ├── behind-nat-with-dns.yaml │ │ ├── mainnet-staging.yaml │ │ ├── p2p.yaml │ │ ├── static-no-dns.yaml │ │ ├── static-with-dns.yaml │ │ └── traditional.yaml │ ├── policy.md │ ├── shelly │ │ └── shelley │ │ │ ├── BlockRetrievalRecovery.md │ │ │ ├── CommunicationPatterns.md │ │ │ ├── CoreDIF.md │ │ │ ├── CoreDIF_Questions.md │ │ │ ├── DeltaQ.md │ │ │ ├── Discovery.md │ │ │ ├── Interface.hs │ │ │ ├── Interface.md │ │ │ ├── Serialization.md │ │ │ └── UI.md │ └── topology-configuration.md ├── profiling.md ├── proposals │ ├── block-storage.md │ ├── csl-2104-crypto-scheme-changes-in-address.md │ ├── fast-sync │ │ └── README.md │ ├── serialization.md │ └── update-downloader.md ├── rollback-reaction.md ├── style-guide.md └── tx │ ├── binary-format.md │ ├── processing.md │ └── signing.md ├── explorer ├── CHANGELOG.md ├── CODEOWNERS ├── LICENSE ├── PULL_REQUEST_TEMPLATE.md ├── README.md ├── Setup.hs ├── bench │ ├── Bench │ │ └── Pos │ │ │ └── Explorer │ │ │ └── ServerBench.hs │ ├── Main.hs │ └── results │ │ └── ServerBackend.html ├── cardano-sl-explorer.cabal ├── frontend │ ├── .gitignore │ ├── .gitmodules │ ├── README.md │ ├── bower.json │ ├── default.nix │ ├── nix │ │ ├── bower-generated.nix │ │ ├── generate-frontend-deps.hs │ │ ├── purescript-derive-lenses.nix │ │ └── shell.nix │ ├── package.json │ ├── postcss.config.js │ ├── scripts │ │ ├── build-explorer-frontend.sh │ │ ├── build.sh │ │ └── generate-explorer-lenses.sh │ ├── src │ │ ├── Control │ │ │ └── SocketIO │ │ │ │ ├── Client.js │ │ │ │ └── Client.purs │ │ ├── Data │ │ │ └── Time │ │ │ │ ├── NominalDiffTime.Test.purs │ │ │ │ └── NominalDiffTime.purs │ │ ├── Explorer │ │ │ ├── Api │ │ │ │ ├── Helper.purs │ │ │ │ ├── Http.purs │ │ │ │ ├── Socket.Test.purs │ │ │ │ ├── Socket.purs │ │ │ │ └── Types.purs │ │ │ ├── I18n │ │ │ │ ├── DE.purs │ │ │ │ ├── EN.purs │ │ │ │ ├── JP.purs │ │ │ │ ├── Lang.js │ │ │ │ ├── Lang.purs │ │ │ │ └── Types.purs │ │ │ ├── Images.purs │ │ │ ├── Routes.Test.purs │ │ │ ├── Routes.purs │ │ │ ├── State.Test.purs │ │ │ ├── State.purs │ │ │ ├── Types │ │ │ │ ├── Actions.purs │ │ │ │ ├── App.purs │ │ │ │ └── State.purs │ │ │ ├── Update.Test.purs │ │ │ ├── Update.purs │ │ │ ├── Util │ │ │ │ ├── Config.Test.purs │ │ │ │ ├── Config.js │ │ │ │ ├── Config.purs │ │ │ │ ├── DOM.js │ │ │ │ ├── DOM.purs │ │ │ │ ├── Data.Test.purs │ │ │ │ ├── Data.purs │ │ │ │ ├── Factory.purs │ │ │ │ ├── QRCode.js │ │ │ │ ├── QRCode.purs │ │ │ │ ├── String.Test.purs │ │ │ │ ├── String.js │ │ │ │ ├── String.purs │ │ │ │ ├── Time.Test.purs │ │ │ │ └── Time.purs │ │ │ └── View │ │ │ │ ├── Address.purs │ │ │ │ ├── Block.purs │ │ │ │ ├── Blocks.purs │ │ │ │ ├── CSS.Test.purs │ │ │ │ ├── CSS.purs │ │ │ │ ├── Calculator.purs │ │ │ │ ├── Common.Test.purs │ │ │ │ ├── Common.purs │ │ │ │ ├── Dashboard │ │ │ │ ├── Api.purs │ │ │ │ ├── Blocks.purs │ │ │ │ ├── Dashboard.purs │ │ │ │ ├── Hero.purs │ │ │ │ ├── Lenses.purs │ │ │ │ ├── Network.purs │ │ │ │ ├── Offer.purs │ │ │ │ ├── Shared.purs │ │ │ │ ├── Transactions.purs │ │ │ │ ├── Types.purs │ │ │ │ ├── api.css │ │ │ │ ├── dashboard.css │ │ │ │ ├── hero.css │ │ │ │ └── transactions.css │ │ │ │ ├── Footer.purs │ │ │ │ ├── GenesisBlock.purs │ │ │ │ ├── Header.purs │ │ │ │ ├── Layout.purs │ │ │ │ ├── NotFound.purs │ │ │ │ ├── Playground.purs │ │ │ │ ├── Search.purs │ │ │ │ ├── Transaction.purs │ │ │ │ ├── Types.purs │ │ │ │ ├── address.css │ │ │ │ ├── block.css │ │ │ │ ├── blocks.css │ │ │ │ ├── calculator.css │ │ │ │ ├── common.css │ │ │ │ ├── footer.css │ │ │ │ ├── genesis.css │ │ │ │ ├── header.css │ │ │ │ ├── layout.css │ │ │ │ ├── notfound.css │ │ │ │ ├── search.css │ │ │ │ └── transaction.css │ │ ├── Lib │ │ │ ├── BigNumber │ │ │ │ ├── BigNumber.Test.purs │ │ │ │ ├── BigNumber.js │ │ │ │ └── BigNumber.purs │ │ │ └── Waypoints │ │ │ │ ├── Waypoints.js │ │ │ │ └── Waypoints.purs │ │ ├── Main.Test.purs │ │ ├── Main.purs │ │ ├── Test │ │ │ └── MockFactory.purs │ │ ├── global.css │ │ ├── index.css │ │ ├── index.js │ │ └── index.tpl.html │ ├── static │ │ ├── favicon.ico │ │ ├── favicon.svg │ │ ├── fonts │ │ │ ├── Montserrat-ExtraBold.otf │ │ │ ├── Montserrat-ExtraLight.otf │ │ │ ├── Montserrat-Medium.otf │ │ │ ├── Montserrat-SemiBold.otf │ │ │ ├── Montserrat-Thin.otf │ │ │ ├── MontserratAlternates-Black.otf │ │ │ ├── MontserratAlternates-Bold.otf │ │ │ ├── MontserratAlternates-ExtraBold.otf │ │ │ ├── MontserratAlternates-ExtraLight.otf │ │ │ ├── MontserratAlternates-Light.otf │ │ │ ├── MontserratAlternates-Medium.otf │ │ │ ├── MontserratAlternates-Regular.otf │ │ │ ├── MontserratAlternates-SemiBold.otf │ │ │ ├── MontserratAlternates-Thin.otf │ │ │ ├── montserrat-black_[allfont.ru].ttf │ │ │ ├── montserrat-bold_[allfont.ru].ttf │ │ │ ├── montserrat-hairline_[allfont.ru].ttf │ │ │ ├── montserrat-light_[allfont.ru].ttf │ │ │ └── montserrat_[allfont.ru].ttf │ │ └── images │ │ │ ├── ada-currency-symbol-dark.svg │ │ │ ├── ada-currency-symbol.svg │ │ │ ├── arrow-bottom.svg │ │ │ ├── arrow-right.svg │ │ │ ├── arrow-up.svg │ │ │ ├── cardano-logo-name.svg │ │ │ ├── cardano-logo.svg │ │ │ ├── header_300517.jpg │ │ │ ├── icon-cross.svg │ │ │ ├── icon-email.svg │ │ │ ├── icon-github.svg │ │ │ ├── icon-lang-de.svg │ │ │ ├── icon-lang-en.svg │ │ │ ├── icon-lang-ja.svg │ │ │ ├── icon-menu.svg │ │ │ ├── icon-search.svg │ │ │ ├── icon-twitter.svg │ │ │ ├── image-404.svg │ │ │ ├── iohk-logo.svg │ │ │ ├── transaction-arrow-blue.svg │ │ │ ├── triangle-right.svg │ │ │ └── usd-currency-symbol-dark.svg │ ├── test │ │ ├── rename-placeholders.js │ │ └── setup.js │ ├── webpack.config.babel.js │ └── yarn.lock ├── log-config.yaml ├── scripts │ ├── build.sh │ ├── fetch_dependencies.sh │ ├── generate_cabal2nix.sh │ └── launch │ │ ├── qa.sh │ │ └── staging.sh ├── src │ ├── Pos │ │ ├── Arbitrary │ │ │ └── Explorer.hs │ │ ├── Binary │ │ │ └── Explorer.hs │ │ └── Explorer │ │ │ ├── Aeson │ │ │ └── ClientTypes.hs │ │ │ ├── BListener.hs │ │ │ ├── Core.hs │ │ │ ├── Core │ │ │ └── Types.hs │ │ │ ├── DB.hs │ │ │ ├── ExplorerMode.hs │ │ │ ├── ExtraContext.hs │ │ │ ├── Socket.hs │ │ │ ├── Socket │ │ │ ├── App.hs │ │ │ ├── Holder.hs │ │ │ ├── Methods.hs │ │ │ └── Util.hs │ │ │ ├── TestUtil.hs │ │ │ ├── Txp.hs │ │ │ ├── Txp │ │ │ ├── Common.hs │ │ │ ├── Global.hs │ │ │ ├── Local.hs │ │ │ ├── Toil.hs │ │ │ └── Toil │ │ │ │ ├── Logic.hs │ │ │ │ ├── Monad.hs │ │ │ │ └── Types.hs │ │ │ ├── Web.hs │ │ │ └── Web │ │ │ ├── Api.hs │ │ │ ├── ClientTypes.hs │ │ │ ├── Error.hs │ │ │ ├── Server.hs │ │ │ ├── TestServer.hs │ │ │ └── Transform.hs │ ├── documentation │ │ └── Main.hs │ ├── explorer │ │ ├── ExplorerNodeOptions.hs │ │ └── Main.hs │ ├── mock │ │ └── Main.hs │ └── purescript │ │ ├── Main.hs │ │ ├── PSOptions.hs │ │ └── PSTypes.hs ├── start-dev.sh └── test │ ├── Spec.hs │ ├── Test.hs │ └── Test │ └── Pos │ └── Explorer │ ├── BListenerSpec.hs.unused │ ├── Identity │ └── BinarySpec.hs │ ├── MockFactory.hs │ ├── Socket │ ├── AppSpec.hs │ ├── MethodsSpec.hs │ └── UtilSpec.hs │ └── Web │ ├── ClientTypesSpec.hs │ └── ServerSpec.hs ├── fetch-nixpkgs.nix ├── fetchNixpkgs.nix ├── generator ├── LICENSE ├── README.md ├── Setup.hs ├── cardano-sl-generator.cabal ├── src │ ├── Pos │ │ ├── Generator.hs │ │ └── Generator │ │ │ ├── Block.hs │ │ │ ├── Block │ │ │ ├── Error.hs │ │ │ ├── Logic.hs │ │ │ ├── Mode.hs │ │ │ ├── Param.hs │ │ │ └── Payload.hs │ │ │ ├── BlockEvent.hs │ │ │ └── BlockEvent │ │ │ └── DSL.hs │ └── Test │ │ └── Pos │ │ └── Block │ │ └── Logic │ │ ├── Emulation.hs │ │ ├── Event.hs │ │ ├── Mode.hs │ │ └── Util.hs └── test │ ├── Spec.hs │ ├── Test.hs │ └── Test │ └── Pos │ ├── Block │ ├── Logic │ │ ├── CreationSpec.hs │ │ └── VarSpec.hs │ └── Property.hs │ └── Lrc │ └── WorkerSpec.hs ├── infra ├── LICENSE ├── Pos │ ├── Arbitrary │ │ ├── Infra.hs │ │ └── Slotting.hs │ ├── Binary │ │ ├── Infra.hs │ │ └── Infra │ │ │ ├── DHTModel.hs │ │ │ ├── Relay.hs │ │ │ └── Slotting.hs │ ├── Communication │ │ ├── BiP.hs │ │ ├── Constants.hs │ │ ├── Limits │ │ │ ├── Instances.hs │ │ │ └── Types.hs │ │ ├── Listener.hs │ │ ├── Protocol.hs │ │ ├── Relay.hs │ │ ├── Relay │ │ │ ├── Class.hs │ │ │ ├── Logic.hs │ │ │ ├── Types.hs │ │ │ └── Util.hs │ │ ├── Specs.hs │ │ └── Types │ │ │ ├── Protocol.hs │ │ │ └── Relay.hs │ ├── DHT.hs │ ├── DHT │ │ ├── Constants.hs │ │ ├── Model.hs │ │ ├── Model │ │ │ └── Types.hs │ │ ├── Real.hs │ │ ├── Real │ │ │ ├── CLI.hs │ │ │ ├── Param.hs │ │ │ ├── Real.hs │ │ │ └── Types.hs │ │ └── Workers.hs │ ├── Diffusion │ │ ├── Subscription │ │ │ ├── Common.hs │ │ │ ├── Dht.hs │ │ │ ├── Dns.hs │ │ │ └── Subscriber.hs │ │ ├── Transport │ │ │ └── TCP.hs │ │ └── Types.hs │ ├── Discovery.hs │ ├── Discovery │ │ └── Model │ │ │ ├── Class.hs │ │ │ └── Neighbors.hs │ ├── HealthCheck │ │ └── Route53.hs │ ├── KnownPeers.hs │ ├── Network │ │ ├── CLI.hs │ │ ├── DnsDomains.hs │ │ ├── Policy.hs │ │ ├── Types.hs │ │ ├── Windows │ │ │ └── DnsDomains.hs │ │ └── Yaml.hs │ ├── Ntp.hs │ ├── Ntp │ │ └── Configuration.hs │ ├── Recovery │ │ └── Info.hs │ ├── Reporting.hs │ ├── Reporting │ │ ├── Ekg.hs │ │ ├── Exceptions.hs │ │ ├── Health │ │ │ └── Types.hs │ │ ├── MemState.hs │ │ ├── Methods.hs │ │ ├── Metrics.hs │ │ └── Statsd.hs │ ├── Shutdown.hs │ ├── Shutdown │ │ ├── Class.hs │ │ ├── Logic.hs │ │ └── Types.hs │ ├── Slotting.hs │ ├── Slotting │ │ ├── Class.hs │ │ ├── Error.hs │ │ ├── Impl.hs │ │ ├── Impl │ │ │ ├── Simple.hs │ │ │ └── Util.hs │ │ ├── MemState.hs │ │ ├── Types.hs │ │ └── Util.hs │ ├── StateLock.hs │ ├── Statistics.hs │ ├── Statistics │ │ ├── Ekg.hs │ │ └── Statsd.hs │ └── Util │ │ ├── JsonLog │ │ └── Events.hs │ │ ├── LogSafe.hs │ │ ├── Monitor.hs │ │ ├── SigHandler.hs │ │ ├── TimeLimit.hs │ │ └── TimeWarp.hs ├── README.md ├── Setup.hs └── cardano-sl-infra.cabal ├── lib.nix ├── lib ├── LICENSE ├── README.md ├── Setup.hs ├── bench │ ├── Bench │ │ ├── Configuration.hs │ │ └── Pos │ │ │ └── Criterion │ │ │ ├── FollowTheSatoshiBench.hs │ │ │ └── TxSigningBench.hs │ └── Local │ │ └── Criterion.hs ├── cardano-sl.cabal ├── configuration.yaml ├── mainnet-genesis-dryrun-with-stakeholders.json ├── mainnet-genesis.json ├── mainnet-staging-short-epoch-genesis.json ├── src │ ├── Pos │ │ ├── Aeson.hs │ │ ├── Aeson │ │ │ └── Types.hs │ │ ├── AllSecrets.hs │ │ ├── Behavior.hs │ │ ├── Binary.hs │ │ ├── Binary │ │ │ └── Communication.hs │ │ ├── Client │ │ │ ├── CLI.hs │ │ │ └── CLI │ │ │ │ ├── NodeOptions.hs │ │ │ │ ├── Options.hs │ │ │ │ ├── Params.hs │ │ │ │ ├── Secrets.hs │ │ │ │ └── Util.hs │ │ ├── Communication.hs │ │ ├── Communication │ │ │ ├── Limits.hs │ │ │ ├── Message.hs │ │ │ ├── Server.hs │ │ │ └── Types.hs │ │ ├── Configuration.hs │ │ ├── Constants.hs │ │ ├── Context.hs │ │ ├── Context │ │ │ └── Context.hs │ │ ├── Crypto │ │ │ └── HDDiscovery.hs │ │ ├── DB │ │ │ └── DB.hs │ │ ├── Diffusion │ │ │ ├── Full.hs │ │ │ └── Full │ │ │ │ ├── Block.hs │ │ │ │ ├── Delegation.hs │ │ │ │ ├── Ssc.hs │ │ │ │ ├── Txp.hs │ │ │ │ └── Update.hs │ │ ├── GState.hs │ │ ├── GState │ │ │ ├── Context.hs │ │ │ └── GState.hs │ │ ├── Launcher.hs │ │ ├── Launcher │ │ │ ├── Configuration.hs │ │ │ ├── Launcher.hs │ │ │ ├── Mode.hs │ │ │ ├── Param.hs │ │ │ ├── Resource.hs │ │ │ ├── Runner.hs │ │ │ └── Scenario.hs │ │ ├── Logic │ │ │ ├── Full.hs │ │ │ ├── Pure.hs │ │ │ └── Types.hs │ │ ├── Recovery.hs │ │ ├── Recovery │ │ │ └── Instance.hs │ │ ├── SafeCopy.hs │ │ ├── Util │ │ │ ├── Config.hs │ │ │ ├── Mockable.hs │ │ │ ├── OutboundQueue.hs │ │ │ ├── Servant.hs │ │ │ └── UserSecret.hs │ │ ├── Web.hs │ │ ├── Web │ │ │ ├── Api.hs │ │ │ ├── Mode.hs │ │ │ ├── Server.hs │ │ │ └── Types.hs │ │ ├── WorkMode.hs │ │ ├── WorkMode │ │ │ └── Class.hs │ │ └── Worker.hs │ └── Test │ │ └── Pos │ │ ├── Configuration.hs │ │ └── Helpers.hs ├── test │ ├── Spec.hs │ ├── Test.hs │ └── Test │ │ └── Pos │ │ ├── Block │ │ └── Identity │ │ │ └── SafeCopySpec.hs │ │ ├── Cbor │ │ └── CborSpec.hs │ │ ├── ConstantsSpec.hs │ │ ├── Core │ │ ├── SeedSpec.hs │ │ └── SlottingSpec.hs │ │ ├── CryptoSpec.hs │ │ ├── Genesis │ │ └── CanonicalSpec.hs │ │ ├── MerkleSpec.hs │ │ ├── Slotting │ │ └── TypesSpec.hs │ │ ├── SlottingSpec.hs.unused │ │ ├── Ssc │ │ ├── ComputeSharesSpec.hs │ │ ├── Identity │ │ │ └── SafeCopySpec.hs │ │ ├── SeedSpec.hs │ │ ├── Toss │ │ │ ├── BaseSpec.hs │ │ │ └── PureSpec.hs │ │ └── VssCertDataSpec.hs │ │ ├── Txp │ │ ├── CoreSpec.hs │ │ └── Toil │ │ │ └── UtxoSpec.hs │ │ ├── Types │ │ ├── BlockSpec.hs │ │ └── Identity │ │ │ ├── SafeCopySpec.hs │ │ │ └── ShowReadSpec.hs │ │ └── Update │ │ ├── Identity │ │ └── SafeCopySpec.hs │ │ ├── MemStateSpec.hs │ │ └── PollSpec.hs └── testnet-genesis.json ├── log-configs ├── cluster.yaml ├── connect-to-cluster.yaml ├── daedalus.yaml ├── greppable.yaml └── template-demo.yaml ├── lrc ├── LICENSE ├── README.md ├── Setup.hs ├── cardano-sl-lrc.cabal ├── src │ └── Pos │ │ ├── Arbitrary │ │ └── Lrc.hs │ │ └── Lrc │ │ ├── Consumer.hs │ │ ├── Context.hs │ │ ├── Core.hs │ │ ├── DB │ │ ├── Common.hs │ │ ├── Issuers.hs │ │ ├── RichmenBase.hs │ │ └── Seed.hs │ │ ├── Error.hs │ │ ├── Fts.hs │ │ ├── Mode.hs │ │ ├── RichmenComponent.hs │ │ └── Types.hs └── test │ ├── Test.hs │ └── Test │ └── Pos │ └── Lrc │ └── FtsSpec.hs ├── networking ├── LICENSE ├── QUEUE_METRICS.md ├── README.md ├── bench │ ├── LogReader │ │ ├── LogReaderOptions.hs │ │ └── Main.hs │ ├── Receiver │ │ ├── Main.hs │ │ └── ReceiverOptions.hs │ ├── Sender │ │ ├── Main.hs │ │ └── SenderOptions.hs │ ├── calc-template.ods │ ├── launch.sh │ └── logging.yaml ├── cardano-sl-networking.cabal ├── examples │ ├── Discovery.hs │ ├── PingPong.hs │ └── abuse │ │ ├── Main.hs │ │ └── README.md ├── src │ ├── Bench │ │ └── Network │ │ │ └── Commons.hs │ ├── Data │ │ └── NonEmptySet.hs │ ├── JsonLog.hs │ ├── JsonLog │ │ ├── CanJsonLog.hs │ │ ├── Event.hs │ │ └── JsonLogT.hs │ ├── Mockable.hs │ ├── Mockable │ │ ├── Channel.hs │ │ ├── Class.hs │ │ ├── Concurrent.hs │ │ ├── CurrentTime.hs │ │ ├── Instances.hs │ │ ├── Metrics.hs │ │ ├── Monad.hs │ │ ├── Production.hs │ │ ├── SharedAtomic.hs │ │ └── SharedExclusive.hs │ ├── Network │ │ ├── Broadcast │ │ │ ├── OutboundQueue.hs │ │ │ └── OutboundQueue │ │ │ │ ├── ConcurrentMultiQueue.hs │ │ │ │ ├── Demo.hs │ │ │ │ └── Types.hs │ │ ├── Discovery │ │ │ ├── Abstract.hs │ │ │ └── Transport │ │ │ │ ├── InMemory.hs │ │ │ │ └── Kademlia.hs │ │ ├── QDisc │ │ │ ├── Fair.hs │ │ │ └── Simulation.hs │ │ └── Transport │ │ │ └── ConnectionBuffers.hs │ ├── Node.hs │ ├── Node │ │ ├── Conversation.hs │ │ ├── Internal.hs │ │ ├── Message │ │ │ ├── Binary.hs │ │ │ ├── Class.hs │ │ │ └── Decoder.hs │ │ └── Util │ │ │ └── Monitor.hs │ └── Ntp │ │ ├── Client.hs │ │ ├── Packet.hs │ │ └── Util.hs └── test │ ├── Spec.hs │ ├── Test.hs │ └── Test │ ├── Network │ └── Broadcast │ │ └── OutboundQueueSpec.hs │ ├── NodeSpec.hs │ └── Util.hs ├── nixos-tests ├── default.nix └── wallet-api.nix ├── nixpkgs-src.json ├── node-ipc ├── LICENSE ├── Setup.hs ├── node-ipc.cabal ├── server.js ├── shell.nix └── src │ └── Cardano │ └── NodeIPC.hs ├── node ├── LICENSE ├── Main.hs ├── README.md └── cardano-sl-node.cabal ├── pkgs ├── cryptonite-segfault-blake.patch ├── default.nix ├── generate.sh └── hfsevents.nix ├── release.nix ├── sample-wallet-config.nix ├── scripts ├── README.md ├── analyze │ ├── block-events.sh │ └── logs.hs ├── avvm-files │ ├── avvm-utxo.json │ └── utxo-dump-last-new.json ├── bench │ ├── buildbench.sh │ ├── count_tps_sent.sh │ ├── count_tps_written.sh │ ├── runbench.sh │ └── topology │ │ ├── kademlia4.yaml │ │ ├── kademlia5.yaml │ │ ├── topology.yaml │ │ ├── topology0.yaml │ │ ├── topology1.yaml │ │ ├── topology2.yaml │ │ ├── topology3.yaml │ │ ├── topology4.yaml │ │ └── topology5.yaml ├── build │ └── cardano-sl.sh ├── check-stack2nix.sh ├── check_deps.sh ├── ci │ ├── appveyor-retry.cmd │ ├── check-hydra.sh │ ├── ci.sh │ ├── nix-shell.sh │ ├── update-cli-docs.sh │ ├── update-explorer-web-api-docs.sh │ ├── update-haddock.sh │ └── update-wallet-web-api-docs.sh ├── clean │ ├── all.sh │ ├── db.sh │ └── explorer-bridge.sh ├── common-functions.sh ├── deps_checksum ├── generate │ ├── blockImporterTables-beta.sql │ └── certificates.sh ├── grep.sh ├── hash-installer.sh ├── haskell │ ├── dependencies.sh │ ├── lint.sh │ ├── recover-from-stack-clean.sh │ ├── stylish.sh │ └── update-cabal-versions.sh ├── js │ ├── avvm-utxo-to-yaml.js │ ├── genesis-hash.js │ └── package.json ├── launch │ ├── Test.hs │ ├── auxx.sh │ ├── connect-to-cluster │ │ ├── README.md │ │ ├── default.nix │ │ └── mainnet-staging.sh │ ├── daedalus-example.sh │ ├── demo-cluster │ │ └── default.nix │ ├── demo-with-new-wallet-api.sh │ ├── demo-with-wallet-api.sh │ ├── demo.sh │ ├── explorer-with-nodes.sh │ ├── explorer.sh │ ├── kill-demo.sh │ ├── ui-simulator.sh │ └── us-test.sh ├── policies │ ├── policy_core.yaml │ ├── policy_edge_exchange.yaml │ ├── policy_edge_nat.yaml │ ├── policy_edge_p2p.yaml │ └── policy_relay.yaml ├── prepare-genesis │ ├── README.md │ ├── build-cardano.sh │ ├── gen-avvm-seeds.sh │ ├── gen-delegate-keys.sh │ ├── genesis-prep-test.sh │ └── keys-and-certs.sh ├── set_nixpath.sh ├── test │ └── wallet │ │ ├── integration.sh │ │ ├── integration │ │ ├── build-test.nix │ │ └── default.nix │ │ ├── many-addrs-test.sh │ │ ├── many-tx-test.sh │ │ └── multi-integration.sh ├── tls-files │ ├── ca.crt │ ├── server.crt │ └── server.key └── workflow │ └── merge_master.sh ├── secrets └── mainnet-staging-short-epoch │ ├── generated-keys │ ├── dlg-issuers │ │ ├── key0.sk │ │ ├── key1.sk │ │ └── key2.sk │ └── rich │ │ ├── key0.sk │ │ ├── key1.sk │ │ └── key2.sk │ └── keys-fakeavvm │ ├── fake-0.seed │ ├── fake-1.seed │ ├── fake-2.seed │ ├── fake-3.seed │ └── fake-4.seed ├── shell.nix ├── ssc ├── LICENSE ├── Pos │ ├── Arbitrary │ │ └── Ssc.hs │ ├── Binary │ │ ├── Ssc.hs │ │ └── Ssc │ │ │ ├── Relay.hs │ │ │ ├── Toss.hs │ │ │ └── Types.hs │ ├── Security │ │ ├── Params.hs │ │ └── Util.hs │ ├── Ssc.hs │ └── Ssc │ │ ├── Base.hs │ │ ├── Behavior.hs │ │ ├── Configuration.hs │ │ ├── DB.hs │ │ ├── Error.hs │ │ ├── Error │ │ ├── Seed.hs │ │ └── Verify.hs │ │ ├── Functions.hs │ │ ├── Logic.hs │ │ ├── Logic │ │ ├── Global.hs │ │ ├── Local.hs │ │ └── VAR.hs │ │ ├── Lrc.hs │ │ ├── Mem.hs │ │ ├── Message.hs │ │ ├── Mode.hs │ │ ├── SecretStorage.hs │ │ ├── Seed.hs │ │ ├── Shares.hs │ │ ├── State.hs │ │ ├── State │ │ ├── Global.hs │ │ └── Local.hs │ │ ├── Toss.hs │ │ ├── Toss │ │ ├── Base.hs │ │ ├── Class.hs │ │ ├── Logic.hs │ │ ├── Pure.hs │ │ ├── Trans.hs │ │ └── Types.hs │ │ ├── Types.hs │ │ ├── VssCertData.hs │ │ └── Worker.hs ├── README.md ├── Setup.hs └── cardano-sl-ssc.cabal ├── stack.yaml ├── tools ├── LICENSE ├── Launcher │ ├── Environment.hs │ └── Logging.hs ├── README.md ├── cardano-sl-tools.cabal ├── src │ ├── addr-convert │ │ └── Main.hs │ ├── blockchain-analyser │ │ ├── Main.hs │ │ ├── Options.hs │ │ ├── Rendering.hs │ │ └── Types.hs │ ├── cli-docs │ │ └── Main.hs │ ├── dbgen │ │ ├── CLI.hs │ │ ├── Lib.hs │ │ ├── Main.hs │ │ ├── QueryMethods.hs │ │ ├── README.md │ │ ├── Rendering.hs │ │ ├── Stats.hs │ │ ├── Types.hs │ │ └── config.json │ ├── dht-keygen │ │ └── Main.hs │ ├── genupdate │ │ └── Main.hs │ ├── keygen │ │ ├── Dump.hs │ │ ├── KeygenOptions.hs │ │ └── Main.hs │ ├── launcher │ │ ├── Main.hs │ │ └── launcher-config.yaml │ └── post-mortem │ │ ├── JSONLog.hs │ │ ├── Main.hs │ │ ├── Options.hs │ │ ├── Statistics.hs │ │ ├── Statistics │ │ ├── Block.hs │ │ ├── CSV.hs │ │ ├── Chart.hs │ │ ├── Focus.hs │ │ ├── Graph.hs │ │ ├── MemPool.hs │ │ ├── Report.hs │ │ ├── Throughput.hs │ │ └── Tx.hs │ │ ├── Types.hs │ │ └── Util │ │ ├── Aeson.hs │ │ ├── Pipes.hs │ │ └── Safe.hs └── test │ ├── Spec.hs │ ├── Test.hs │ └── Test │ └── Launcher │ └── Environment.hs ├── txp ├── LICENSE ├── Pos │ ├── Aeson │ │ └── Txp.hs │ ├── Arbitrary │ │ ├── Txp.hs │ │ └── Txp │ │ │ ├── Network.hs │ │ │ └── Unsafe.hs │ ├── Binary │ │ ├── Txp.hs │ │ └── Txp │ │ │ └── Network.hs │ ├── Script.hs │ ├── Script │ │ └── Examples.hs │ ├── Txp.hs │ └── Txp │ │ ├── Base.hs │ │ ├── Configuration.hs │ │ ├── DB.hs │ │ ├── DB │ │ ├── Stakes.hs │ │ └── Utxo.hs │ │ ├── Error.hs │ │ ├── GenesisUtxo.hs │ │ ├── Logic.hs │ │ ├── Logic │ │ ├── Common.hs │ │ ├── Global.hs │ │ └── Local.hs │ │ ├── MemState.hs │ │ ├── MemState │ │ ├── Class.hs │ │ ├── Holder.hs │ │ ├── Metrics.hs │ │ └── Types.hs │ │ ├── Network.hs │ │ ├── Network │ │ ├── Listeners.hs │ │ └── Types.hs │ │ ├── Settings.hs │ │ ├── Settings │ │ └── Global.hs │ │ ├── Toil.hs │ │ ├── Toil │ │ ├── Failure.hs │ │ ├── Logic.hs │ │ ├── Monad.hs │ │ ├── Stakes.hs │ │ ├── Types.hs │ │ ├── Utxo.hs │ │ └── Utxo │ │ │ ├── Functions.hs │ │ │ └── Util.hs │ │ └── Topsort.hs ├── README.md ├── Setup.hs └── cardano-sl-txp.cabal ├── update ├── LICENSE ├── Pos │ ├── Aeson │ │ └── Update.hs │ ├── Arbitrary │ │ ├── Update.hs │ │ └── Update │ │ │ ├── Core.hs │ │ │ ├── MemState.hs │ │ │ ├── Network.hs │ │ │ └── Poll.hs │ ├── Binary │ │ ├── Update.hs │ │ └── Update │ │ │ ├── Poll.hs │ │ │ └── Relay.hs │ ├── Update.hs │ └── Update │ │ ├── BlockVersion.hs │ │ ├── Configuration.hs │ │ ├── Constants.hs │ │ ├── Context.hs │ │ ├── DB.hs │ │ ├── DB │ │ └── Misc.hs │ │ ├── Download.hs │ │ ├── Logic.hs │ │ ├── Logic │ │ ├── Global.hs │ │ └── Local.hs │ │ ├── Lrc.hs │ │ ├── MemState.hs │ │ ├── MemState │ │ ├── Functions.hs │ │ └── Types.hs │ │ ├── Mode.hs │ │ ├── Network.hs │ │ ├── Network │ │ └── Listeners.hs │ │ ├── Params.hs │ │ ├── Poll.hs │ │ ├── Poll │ │ ├── Class.hs │ │ ├── DBPoll.hs │ │ ├── Failure.hs │ │ ├── Logic.hs │ │ ├── Logic │ │ │ ├── Apply.hs │ │ │ ├── Base.hs │ │ │ ├── Normalize.hs │ │ │ ├── Rollback.hs │ │ │ ├── Softfork.hs │ │ │ └── Version.hs │ │ ├── Modifier.hs │ │ ├── PollState.hs │ │ ├── Pure.hs │ │ ├── RollTrans.hs │ │ ├── Trans.hs │ │ └── Types.hs │ │ └── Worker.hs ├── README.md ├── Setup.hs └── cardano-sl-update.cabal ├── util ├── LICENSE ├── Pos │ ├── Util.hs │ └── Util │ │ ├── AssertMode.hs │ │ ├── Chrono.hs │ │ ├── CompileInfo.hs │ │ ├── Concurrent.hs │ │ ├── Concurrent │ │ ├── PriorityLock.hs │ │ └── RWLock.hs │ │ ├── Filesystem.hs │ │ ├── Future.hs │ │ ├── Justify.hs │ │ ├── LRU.hs │ │ ├── Lens.hs │ │ ├── Limits.hs │ │ ├── LoggerName.hs │ │ ├── Modifier.hs │ │ ├── OptParse.hs │ │ ├── Orphans.hs │ │ ├── Queue.hs │ │ ├── Some.hs │ │ ├── Timer.hs │ │ ├── Trace.hs │ │ └── Util.hs ├── README.md ├── Setup.hs ├── cardano-sl-util.cabal └── test │ ├── LICENSE │ ├── Setup.hs │ ├── Spec.hs │ ├── Test │ ├── Pos.hs │ └── Pos │ │ ├── Util │ │ ├── Chrono.hs │ │ ├── LimitsSpec.hs │ │ ├── Modifier.hs │ │ ├── ModifierSpec.hs │ │ ├── Orphans.hs │ │ ├── QuickCheck.hs │ │ ├── QuickCheck │ │ │ ├── Arbitrary.hs │ │ │ └── Property.hs │ │ └── TimerSpec.hs │ │ └── UtilSpec.hs │ ├── cardano-sl-util-test.cabal │ └── test.hs ├── wallet-new ├── .gitignore ├── LICENSE ├── Makefile ├── README.md ├── Setup.hs ├── bench │ ├── Bench │ │ └── Cardano │ │ │ └── Wallet │ │ │ ├── Config.hs │ │ │ ├── Config │ │ │ ├── CLI.hs │ │ │ ├── Endpoints.hs │ │ │ └── Wallets.hs │ │ │ ├── Random.hs │ │ │ ├── Run.hs │ │ │ └── Types.hs │ ├── Client │ │ └── Cardano │ │ │ └── Wallet │ │ │ └── Web │ │ │ ├── Analyze.hs │ │ │ ├── Api.hs │ │ │ ├── Endpoint.hs │ │ │ ├── Endpoint │ │ │ ├── GetAccounts.hs │ │ │ ├── GetHistory.hs │ │ │ ├── GetSyncProgress.hs │ │ │ ├── GetWallet.hs │ │ │ ├── GetWallets.hs │ │ │ ├── IsValidAddress.hs │ │ │ ├── NewAddress.hs │ │ │ ├── NewPayment.hs │ │ │ └── NewWallet.hs │ │ │ └── Run.hs │ ├── Main.hs │ ├── README.md │ ├── config │ │ ├── Endpoints.csv │ │ └── Wallets.yaml │ ├── report │ │ ├── pdf │ │ │ ├── build.sh │ │ │ ├── report.pdf │ │ │ └── template.tex │ │ └── report.md │ └── results │ │ └── .empty ├── cardano-sl-wallet-new.cabal ├── default.nix ├── docs │ ├── .gitignore │ ├── references.bib │ ├── spec.dict │ ├── spec.tex │ └── updates.md ├── integration │ ├── AddressSpecs.hs │ ├── CLI.hs │ ├── Error.hs │ ├── Functions.hs │ ├── Main.hs │ ├── QuickCheckSpecs.hs │ ├── TransactionSpecs.hs │ ├── Types.hs │ ├── Util.hs │ └── WalletSpecs.hs ├── server │ └── Main.hs ├── src │ └── Cardano │ │ └── Wallet │ │ ├── API.hs │ │ ├── API │ │ ├── Development.hs │ │ ├── Development │ │ │ ├── Handlers.hs │ │ │ ├── Helpers.hs │ │ │ └── LegacyHandlers.hs │ │ ├── Indices.hs │ │ ├── Request.hs │ │ ├── Request │ │ │ ├── Filter.hs │ │ │ ├── Pagination.hs │ │ │ ├── Parameters.hs │ │ │ └── Sort.hs │ │ ├── Response.hs │ │ ├── Response │ │ │ ├── Filter │ │ │ │ ├── IxSet.hs │ │ │ │ └── Legacy.hs │ │ │ ├── JSend.hs │ │ │ └── Sort │ │ │ │ └── IxSet.hs │ │ ├── Types.hs │ │ ├── Types │ │ │ └── UnitOfMeasure.hs │ │ ├── V0.hs │ │ ├── V0 │ │ │ ├── Handlers.hs │ │ │ └── Types.hs │ │ ├── V1.hs │ │ └── V1 │ │ │ ├── Accounts.hs │ │ │ ├── Addresses.hs │ │ │ ├── Errors.hs │ │ │ ├── Generic.hs │ │ │ ├── Handlers.hs │ │ │ ├── Info.hs │ │ │ ├── LegacyHandlers.hs │ │ │ ├── LegacyHandlers │ │ │ ├── Accounts.hs │ │ │ ├── Addresses.hs │ │ │ ├── Info.hs │ │ │ ├── Settings.hs │ │ │ ├── Transactions.hs │ │ │ └── Wallets.hs │ │ │ ├── Migration.hs │ │ │ ├── Migration │ │ │ ├── Monads.hs │ │ │ └── Types.hs │ │ │ ├── Parameters.hs │ │ │ ├── Settings.hs │ │ │ ├── Swagger.hs │ │ │ ├── Swagger │ │ │ └── Example.hs │ │ │ ├── Transactions.hs │ │ │ ├── Types.hs │ │ │ └── Wallets.hs │ │ ├── Client.hs │ │ ├── Client │ │ └── Http.hs │ │ ├── Kernel.hs │ │ ├── Kernel │ │ ├── Actions.hs │ │ ├── DB │ │ │ ├── AcidState.hs │ │ │ ├── BlockMeta.hs │ │ │ ├── HdWallet.hs │ │ │ ├── HdWallet │ │ │ │ ├── Create.hs │ │ │ │ ├── Delete.hs │ │ │ │ ├── Read.hs │ │ │ │ └── Update.hs │ │ │ ├── InDb.hs │ │ │ ├── Resolved.hs │ │ │ ├── Spec.hs │ │ │ ├── Spec │ │ │ │ └── Update.hs │ │ │ ├── TxMeta.hs │ │ │ └── Util │ │ │ │ ├── AcidState.hs │ │ │ │ └── IxSet.hs │ │ ├── Diffusion.hs │ │ ├── Mode.hs │ │ ├── PrefilterTx.hs │ │ └── Types.hs │ │ ├── LegacyServer.hs │ │ ├── Orphans.hs │ │ ├── Orphans │ │ ├── Aeson.hs │ │ ├── Arbitrary.hs │ │ └── Bi.hs │ │ ├── Server.hs │ │ ├── Server │ │ ├── CLI.hs │ │ └── Plugins.hs │ │ ├── TypeLits.hs │ │ ├── Util.hs │ │ ├── WalletLayer.hs │ │ └── WalletLayer │ │ ├── Error.hs │ │ ├── Kernel.hs │ │ ├── Legacy.hs │ │ ├── QuickCheck.hs │ │ ├── README.md │ │ └── Types.hs ├── test │ ├── APISpec.hs │ ├── DevelopmentSpec.hs │ ├── MarshallingSpec.hs │ ├── RequestSpec.hs │ ├── Spec.hs │ ├── SwaggerSpec.hs │ ├── WalletHandlersSpec.hs │ ├── golden │ │ └── api-layout.txt │ └── unit │ │ ├── Test │ │ ├── Infrastructure │ │ │ ├── Generator.hs │ │ │ └── Genesis.hs │ │ └── Spec │ │ │ ├── Kernel.hs │ │ │ ├── Models.hs │ │ │ ├── Translation.hs │ │ │ └── WalletWorker.hs │ │ ├── UTxO │ │ ├── Bootstrap.hs │ │ ├── Context.hs │ │ ├── Crypto.hs │ │ ├── DSL.hs │ │ ├── Generator.hs │ │ ├── Interpreter.hs │ │ ├── Translate.hs │ │ └── Verify.hs │ │ ├── Util.hs │ │ ├── Util │ │ ├── Buildable.hs │ │ ├── Buildable │ │ │ ├── Hspec.hs │ │ │ └── QuickCheck.hs │ │ └── Validated.hs │ │ ├── Wallet │ │ ├── Abstract.hs │ │ ├── Basic.hs │ │ ├── Incremental.hs │ │ ├── Inductive.hs │ │ ├── Inductive │ │ │ ├── Cardano.hs │ │ │ ├── Generator.hs │ │ │ ├── Interpreter.hs │ │ │ ├── Invariants.hs │ │ │ └── Validation.hs │ │ ├── Prefiltered.hs │ │ └── Rollback │ │ │ ├── Basic.hs │ │ │ └── Full.hs │ │ └── WalletUnitTest.hs └── topology-examples │ └── testnet.yaml └── wallet ├── LICENSE ├── README.md ├── cardano-sl-wallet.cabal ├── node ├── Main.hs └── NodeOptions.hs ├── src └── Pos │ ├── Arbitrary │ └── Wallet │ │ └── Web │ │ └── ClientTypes.hs │ ├── Util │ ├── BackupPhrase.hs │ └── Mnemonics.hs │ ├── Wallet.hs │ └── Wallet │ ├── Aeson.hs │ ├── Aeson │ ├── ClientTypes.hs │ ├── Options.hs │ ├── Storage.hs │ └── WalletBackup.hs │ ├── Redirect.hs │ ├── WalletMode.hs │ ├── Web.hs │ └── Web │ ├── Account.hs │ ├── Api.hs │ ├── Assurance.hs │ ├── Backup.hs │ ├── ClientTypes.hs │ ├── ClientTypes │ ├── Functions.hs │ ├── Instances.hs │ └── Types.hs │ ├── Error.hs │ ├── Error │ ├── Types.hs │ └── Util.hs │ ├── Methods.hs │ ├── Methods │ ├── Backup.hs │ ├── History.hs │ ├── Info.hs │ ├── Logic.hs │ ├── Misc.hs │ ├── Payment.hs │ ├── Redeem.hs │ ├── Reporting.hs │ ├── Restore.hs │ └── Txp.hs │ ├── Mode.hs │ ├── Pending.hs │ ├── Pending │ ├── Functions.hs │ ├── Submission.hs │ ├── Types.hs │ ├── Util.hs │ └── Worker.hs │ ├── Server.hs │ ├── Server │ ├── Handlers.hs │ ├── Launcher.hs │ └── Runner.hs │ ├── Sockets.hs │ ├── Sockets │ ├── ConnSet.hs │ ├── Connection.hs │ ├── Notifier.hs │ └── Types.hs │ ├── State.hs │ ├── State │ ├── Acidic.hs │ ├── State.hs │ ├── Storage.hs │ ├── Transactions.hs │ └── Util.hs │ ├── Swagger.hs │ ├── Swagger │ ├── Instances │ │ ├── Schema.hs │ │ └── Swagger.hs │ └── Spec.hs │ ├── Tracking.hs │ ├── Tracking │ ├── BListener.hs │ ├── Decrypt.hs │ ├── Modifier.hs │ ├── Restore.hs │ ├── Sync.hs │ └── Types.hs │ └── Util.hs ├── test ├── Spec.hs ├── Test.hs └── Test │ └── Pos │ └── Wallet │ ├── MigrationSpec.hs │ └── Web │ ├── AddressSpec.hs │ ├── Methods │ ├── BackupDefaultAddressesSpec.hs │ ├── LogicSpec.hs │ └── PaymentSpec.hs │ ├── Mode.hs │ ├── Tracking │ └── SyncSpec.hs │ └── Util.hs └── web-api-swagger └── Main.hs /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.hs] 12 | indent_size = 4 13 | max_line_length = 80 14 | -------------------------------------------------------------------------------- /.hindent.yaml: -------------------------------------------------------------------------------- 1 | indent-size: 4 2 | line-length: 80 3 | force-trailing-newline: true 4 | -------------------------------------------------------------------------------- /.nonsense: -------------------------------------------------------------------------------- 1 | File with no meaning, just to trigger CI rebuild 2 | trigger! 3 | 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | lib/LICENSE -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Project Icarus Importer 2 | 3 | Icarus, a reference implementation for a lightweight wallet developed by the IOHK Engineering Team. This code base can be used as a point of reference to enable developers to create their own secure light and mobile wallets for Cardano. Icarus is a fully open-source code base that will be the first step in a range of open source initiatives to provide developers with a suite of tools to integrate with Cardano. 4 | 5 | Icarus Importer allows wallet users to access blockchain data. 6 | 7 | ## Installation 8 | 9 | For specific instructions, please refer to the following [`README`](blockchain-importer/README.md) 10 | 11 | ## License 12 | 13 | This project is Copyright 2018 IOHK and licensed under the [MIT](lib/LICENSE) 14 | -------------------------------------------------------------------------------- /Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /auxx/README.md: -------------------------------------------------------------------------------- 1 | # cardano-sl-auxx 2 | 3 | This package implements a tool and language for connecting to Cardano SL node 4 | running locally and performing operations like inspecting the node's state and 5 | sending commands to the node. 6 | 7 | It is documented more fully in the file [docs/auxx.md] of the git repository. 8 | -------------------------------------------------------------------------------- /auxx/Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /auxx/src/Command.hs: -------------------------------------------------------------------------------- 1 | -- | Command. 2 | 3 | module Command 4 | ( module Command.BlockGen 5 | , module Command.Help 6 | , module Command.Proc 7 | , module Command.Rollback 8 | , module Command.Tx 9 | , module Command.TyProjection 10 | , module Command.Update 11 | ) where 12 | 13 | import Command.BlockGen 14 | import Command.Help 15 | import Command.Proc 16 | import Command.Rollback 17 | import Command.Tx 18 | import Command.TyProjection 19 | import Command.Update -------------------------------------------------------------------------------- /auxx/src/Lang.hs: -------------------------------------------------------------------------------- 1 | -- | Language. 2 | 3 | module Lang 4 | ( module Lang.Value 5 | , module Lang.Argument 6 | , module Lang.Command 7 | , module Lang.DisplayError 8 | , module Lang.Interpreter 9 | , module Lang.Lexer 10 | , module Lang.Name 11 | , module Lang.Parser 12 | , module Lang.Syntax 13 | ) where 14 | 15 | import Lang.Value 16 | import Lang.Argument 17 | import Lang.Command 18 | import Lang.DisplayError 19 | import Lang.Interpreter 20 | import Lang.Lexer 21 | import Lang.Name 22 | import Lang.Parser 23 | import Lang.Syntax -------------------------------------------------------------------------------- /auxx/test/Spec.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_GHC -F -pgmF hspec-discover -optF --module-name=Spec #-} 2 | -------------------------------------------------------------------------------- /auxx/test/Test.hs: -------------------------------------------------------------------------------- 1 | import Universum 2 | 3 | import Test.Hspec (hspec) 4 | 5 | import Spec (spec) 6 | 7 | main :: IO () 8 | main = hspec spec 9 | -------------------------------------------------------------------------------- /auxx/test/Test/Auxx/Lang/ParserSpec.hs: -------------------------------------------------------------------------------- 1 | module Test.Auxx.Lang.ParserSpec 2 | ( spec 3 | ) where 4 | 5 | import Universum 6 | 7 | import Test.Hspec (Expectation, Spec, describe, it, shouldSatisfy) 8 | 9 | import Lang.Parser (parse) 10 | 11 | spec :: Spec 12 | spec = describe "Auxx.Lang.Parser" $ do 13 | it "handles sample-1" unitParserSample1 14 | 15 | unitParserSample1 :: Expectation 16 | unitParserSample1 = parse input `shouldSatisfy` isRight 17 | where 18 | input = "wait (epoch 6);; propose-patak kek:15 \"lel\" mem:(epoch 7) zaz:(get (rekt mem: to-next ses: \"zaz\" ))" 19 | -------------------------------------------------------------------------------- /benchmarks/check_fork.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ## needs 'gnused' from Nix on MacOSX 4 | 5 | if [ $# -lt 1 ]; then 6 | echo "$0 " 7 | exit 1 8 | fi 9 | 10 | BASEDIR=`dirname $0` 11 | REPFILE=$1 12 | BLIDs= 13 | NODES="c-a-1 c-a-2 c-a-3 c-b-1 c-b-2 c-c-1 c-c-2" 14 | 15 | BLIDs=`awk '/transactions in fork:/{start=1;next} start; !NF && start{start=0}' $REPFILE \ 16 | | cut -d " " -f 2 | sort | uniq | sed -ne '2,$p' | paste -s -d " " -` 17 | 18 | 19 | echo -n " " 20 | for BLID in ${BLIDs}; do 21 | echo -n " ${BLID} " 22 | done 23 | echo 24 | for NODE in ${NODES}; do 25 | echo -n "$NODE" 26 | FN="${NODE}.log" 27 | ${BASEDIR}/xblocks.sh $FN > ${FN}.blocks 28 | for BLID in ${BLIDs}; do 29 | #CNT=`fgrep "previous block: ${BLID}" $FN | wc -l` 30 | CNT=`cat ${FN}.blocks | ${BASEDIR}/parse.hs ${BLID} | tail -1 | cut -d " " -f 1` 31 | echo -n " ${CNT}" 32 | done 33 | echo 34 | done 35 | -------------------------------------------------------------------------------- /benchmarks/xblocks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ## needs 'gnused' from Nix on MacOSX 4 | 5 | if [ $# -ne 1 ]; then 6 | echo "$0 " 7 | exit 1 8 | fi 9 | 10 | # BASE BLOCK -> NEW BLOCK 11 | sed -ne '/^MainBlockHeader:/{ 12 | n 13 | N 14 | s/hash: \([0-9a-f]\+\).*previous block: \([0-9a-f]\+\)/("\2", "\1")/p 15 | }' $1 16 | -------------------------------------------------------------------------------- /binary/Pos/Binary/Class.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_GHC -Wno-unused-imports #-} 2 | {-# OPTIONS_GHC -Wno-dodgy-exports #-} 3 | 4 | module Pos.Binary.Class 5 | ( module Pos.Binary.Class.Core 6 | , module Pos.Binary.Class.Primitive 7 | , module Pos.Binary.Class.TH 8 | ) where 9 | 10 | import Pos.Binary.Class.Core 11 | import Pos.Binary.Class.Primitive 12 | import Pos.Binary.Class.TH -------------------------------------------------------------------------------- /binary/README.md: -------------------------------------------------------------------------------- 1 | # cardano-sl-binary 2 | 3 | Binary serialisation and deserialisation for Cardano SL. 4 | 5 | This library is built on top of the [binary] and [cborg] packages and implement 6 | space efficient serialising and deserialising of Haskell data types to and from 7 | binary representations via a `Bi` type class and associated machinery. 8 | 9 | The library includes ability the derive `Bi` instances (requires a `Typeable` 10 | constraint). 11 | 12 | [binary]: https://hackage.haskell.org/package/binary 13 | [cborg]: https://hackage.haskell.org/package/cborg 14 | -------------------------------------------------------------------------------- /binary/Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /block/README.md: -------------------------------------------------------------------------------- 1 | # cardano-sl-block 2 | 3 | This package defines functions that operate on blocks for Cardano SL. 4 | 5 | The block type is defined in the cardano-sl-core package, but this is the package 6 | with functions for: 7 | 8 | * Creating blocks. 9 | * Validating blocks. 10 | * Applying blocks to the blockchain and rolling them back. 11 | * Calculating chain quality (number of main blocks divided by number of slots so 12 | far). 13 | * Code to retrieve block headers and blocks from the Cardano network. 14 | * Functions for iterating over a chain of blocks. 15 | -------------------------------------------------------------------------------- /block/Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /block/src/Pos/Binary/Block/Network.hs: -------------------------------------------------------------------------------- 1 | -- | Network and block processing related communication stuff. 2 | 3 | module Pos.Binary.Block.Network 4 | ( msgBlockPrefix 5 | ) where 6 | 7 | import Universum 8 | 9 | import qualified Codec.CBOR.Write as CBOR (toStrictByteString) 10 | 11 | import Pos.Binary.Class (Bi (..), encodeListLen) 12 | 13 | -- | Get an encoded MsgBlock from an encoded block. 14 | msgBlockPrefix :: ByteString 15 | msgBlockPrefix = CBOR.toStrictByteString prefix 16 | where 17 | prefix = encodeListLen 2 <> encode (0 :: Word8) 18 | -------------------------------------------------------------------------------- /block/src/Pos/Block/Logic.hs: -------------------------------------------------------------------------------- 1 | -- | This module re-exports everything from 'Pos.Block.Logic.*'. 2 | module Pos.Block.Logic 3 | ( module Pos.Block.Logic.VAR 4 | , module Pos.Block.Logic.Util 5 | , module Pos.Block.Logic.Internal 6 | , module Pos.Block.Logic.Header 7 | , module Pos.Block.Logic.Creation 8 | , module Pos.Block.Logic.Integrity 9 | ) where 10 | 11 | import Pos.Block.Logic.VAR 12 | import Pos.Block.Logic.Util 13 | import Pos.Block.Logic.Internal 14 | import Pos.Block.Logic.Header 15 | import Pos.Block.Logic.Creation 16 | import Pos.Block.Logic.Integrity 17 | -------------------------------------------------------------------------------- /block/src/Pos/Block/Network.hs: -------------------------------------------------------------------------------- 1 | -- | Re-export of Pos.Block.Network.* 2 | module Pos.Block.Network 3 | ( module Pos.Block.Network.Logic 4 | , module Pos.Block.Network.Retrieval 5 | , module Pos.Block.Network.Types 6 | ) where 7 | 8 | import Pos.Block.Network.Logic 9 | import Pos.Block.Network.Retrieval 10 | import Pos.Block.Network.Types 11 | -------------------------------------------------------------------------------- /block/src/Pos/Block/Slog.hs: -------------------------------------------------------------------------------- 1 | -- | You can treat this part as another block component which deals 2 | -- with all data not related directly to any other component, while 3 | -- another part of 'Pos.Block' is dedicated to whole blocks. 4 | 5 | module Pos.Block.Slog 6 | ( module Pos.Block.Slog.Context 7 | , module Pos.Block.Slog.Logic 8 | , module Pos.Block.Slog.Types 9 | ) where 10 | 11 | import Pos.Block.Slog.Context 12 | import Pos.Block.Slog.Logic 13 | import Pos.Block.Slog.Types 14 | -------------------------------------------------------------------------------- /block/src/Pos/Lrc/Consumers.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE AllowAmbiguousTypes #-} 2 | {-# LANGUAGE RankNTypes #-} 3 | 4 | module Pos.Lrc.Consumers 5 | ( 6 | allLrcConsumers 7 | ) where 8 | 9 | import Pos.Delegation.Lrc (dlgLrcConsumer) 10 | import Pos.Lrc.Consumer (LrcConsumer) 11 | import Pos.Lrc.Mode (LrcMode) 12 | import Pos.Ssc.Lrc (sscLrcConsumer) 13 | import Pos.Ssc.Message (SscMessageConstraints) 14 | import Pos.Update.Lrc (usLrcConsumer) 15 | import Pos.Core (HasGenesisBlockVersionData) 16 | 17 | allLrcConsumers 18 | :: forall ctx m. (SscMessageConstraints, LrcMode ctx m, HasGenesisBlockVersionData) 19 | => [LrcConsumer m] 20 | allLrcConsumers = [dlgLrcConsumer, usLrcConsumer, sscLrcConsumer] 21 | -------------------------------------------------------------------------------- /block/src/Pos/Lrc/DB.hs: -------------------------------------------------------------------------------- 1 | -- | LRC DB stores leaders and richmen, i. e. data computed by LRC. 2 | 3 | module Pos.Lrc.DB 4 | ( 5 | module Pos.Lrc.DB.Common 6 | , module Pos.Lrc.DB.Issuers 7 | , module Pos.Lrc.DB.Leaders 8 | , module Pos.Lrc.DB.Lrc 9 | , module Pos.Lrc.DB.Richmen 10 | , module Pos.Lrc.DB.Seed 11 | ) where 12 | 13 | import Pos.Lrc.DB.Common (getEpoch, putEpoch) 14 | import Pos.Lrc.DB.Issuers 15 | import Pos.Lrc.DB.Leaders 16 | import Pos.Lrc.DB.Lrc 17 | import Pos.Lrc.DB.Richmen 18 | import Pos.Lrc.DB.Seed 19 | -------------------------------------------------------------------------------- /blockchain-importer/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | -------------------------------------------------------------------------------- /blockchain-importer/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | # PR 2 | 3 | --- 4 | 5 | Youtrack issue URL - **LINK** 6 | 7 | --- 8 | 9 | Short description - **DESCRIBE** 10 | 11 | --- 12 | 13 | How did I test this new functionality/bug fix? 14 | 15 | 1. branch I used 16 | 2. how did I run the project - was it on _DEV_, _TESTNET_, something else? 17 | 3. steps to reproduce the new behaviour, if I have additional tests, please write them down 18 | 19 | --- 20 | 21 | - [ ] PR was tested, and is linted. 22 | 23 | -------------------------------------------------------------------------------- /blockchain-importer/Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /blockchain-importer/bench/Main.hs: -------------------------------------------------------------------------------- 1 | module Main 2 | ( main 3 | ) where 4 | 5 | import Universum 6 | 7 | import System.IO (hSetEncoding, stdout, utf8) 8 | 9 | import qualified Bench.Pos.BlockchainImporter.ServerBench as SB 10 | 11 | -- stack bench cardano-sl-blockchain-importer 12 | main :: IO () 13 | main = do 14 | hSetEncoding stdout utf8 15 | 16 | SB.runTimeBenchmark 17 | -- SB.runSpaceBenchmark 18 | -------------------------------------------------------------------------------- /blockchain-importer/log-config.yaml: -------------------------------------------------------------------------------- 1 | rotation: 2 | logLimit: 5242880 # 5MB 3 | keepFiles: 20 4 | severity: Debug 5 | file: blockchain-importer-node.log 6 | node: 7 | plugin: 8 | notifier: 9 | severity: Debug 10 | file: blockchain-importer.log 11 | socket-io: 12 | severity: Debug 13 | file: socket-io.log 14 | drop: 15 | severity: Error 16 | 17 | -------------------------------------------------------------------------------- /blockchain-importer/scripts/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | stack --nix build --fast --ghc-options="-j +RTS -A128m -n2m -RTS" 3 | -------------------------------------------------------------------------------- /blockchain-importer/scripts/launch/qa.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # clear old data, don't remove the databases since they may contains some data 4 | # that will help speed up the syncing process 5 | rm -rf run/* node-* *key* *.dump 6 | 7 | stack exec -- cardano-blockchain-importer \ 8 | --system-start 1501793381 \ 9 | --log-config log-config.yaml \ 10 | --logs-prefix "logs/testnet" \ 11 | --db-path db-testnet \ 12 | --kademlia-peer 52.58.131.170:3000 \ 13 | --kademlia-peer 35.158.246.75:3000 \ 14 | --kademlia-peer 34.249.252.215:3000 \ 15 | --kademlia-peer 52.211.65.215:3000 \ 16 | --listen 127.0.0.1:$((3000)) \ 17 | --static-peers \ 18 | $@ -------------------------------------------------------------------------------- /blockchain-importer/scripts/launch/setup-localDB.sh: -------------------------------------------------------------------------------- 1 | export DB_USER="postgres" 2 | export DB_HOST="localhost" 3 | export DB="icaruspocbackendservice" 4 | export DB_PASSWORD="mysecretpassword" 5 | export DB_PORT=5432 6 | -------------------------------------------------------------------------------- /blockchain-importer/src/Pos/Arbitrary/BlockchainImporter.hs: -------------------------------------------------------------------------------- 1 | -- | Arbitrary instances for BlockchainImporter types. 2 | 3 | module Pos.Arbitrary.BlockchainImporter () where 4 | 5 | import Test.QuickCheck (Arbitrary (..)) 6 | import Test.QuickCheck.Arbitrary.Generic (genericArbitrary, genericShrink) 7 | 8 | import Pos.Core.Common (HeaderHash) 9 | import Pos.BlockchainImporter.Core.Types (TxExtra (..)) 10 | import Pos.Txp () 11 | 12 | instance Arbitrary HeaderHash => Arbitrary TxExtra where 13 | arbitrary = genericArbitrary 14 | shrink = genericShrink 15 | -------------------------------------------------------------------------------- /blockchain-importer/src/Pos/Binary/BlockchainImporter.hs: -------------------------------------------------------------------------------- 1 | -- | Binary instances for blockchainImporter types 2 | 3 | module Pos.Binary.BlockchainImporter () where 4 | 5 | import Universum 6 | 7 | import Pos.Binary () 8 | import Pos.Binary.Class (Cons (..), Field (..), deriveSimpleBi) 9 | import Pos.BlockchainImporter.Core.Types (TxExtra (..)) 10 | import Pos.Core (Timestamp, TxUndo) 11 | 12 | deriveSimpleBi ''TxExtra [ 13 | Cons 'TxExtra [ 14 | Field [| teTimestamp :: Maybe Timestamp |], 15 | Field [| teInputOutputs :: TxUndo |] 16 | ]] 17 | -------------------------------------------------------------------------------- /blockchain-importer/src/Pos/BlockchainImporter/Core.hs: -------------------------------------------------------------------------------- 1 | -- | Core of blockchainImporter. 2 | 3 | module Pos.BlockchainImporter.Core 4 | ( module Pos.BlockchainImporter.Core.Types 5 | ) where 6 | 7 | import Pos.Binary.BlockchainImporter () 8 | import Pos.BlockchainImporter.Core.Types 9 | -------------------------------------------------------------------------------- /blockchain-importer/src/Pos/BlockchainImporter/Core/Types.hs: -------------------------------------------------------------------------------- 1 | -- | Module containing blockchainImporter-specific datatypes 2 | 3 | module Pos.BlockchainImporter.Core.Types 4 | ( TxExtra (..) 5 | ) where 6 | 7 | import Universum 8 | 9 | import Pos.Core (Timestamp) 10 | import Pos.Core.Txp (TxUndo) 11 | 12 | data TxExtra = TxExtra 13 | { teTimestamp :: !(Maybe Timestamp) 14 | -- non-strict on purpose, see comment in `processTxDo` in Pos.BlockchainImporter.Txp.Local 15 | , teInputOutputs :: TxUndo 16 | } deriving (Show, Generic, Eq) 17 | -------------------------------------------------------------------------------- /blockchain-importer/src/Pos/BlockchainImporter/Txp.hs: -------------------------------------------------------------------------------- 1 | -- | BlockchainImporter's Txp. 2 | 3 | module Pos.BlockchainImporter.Txp 4 | ( module Pos.BlockchainImporter.Txp.Global 5 | , module Pos.BlockchainImporter.Txp.Local 6 | , module Pos.BlockchainImporter.Txp.Toil 7 | ) where 8 | 9 | import Pos.BlockchainImporter.Txp.Global 10 | import Pos.BlockchainImporter.Txp.Local 11 | import Pos.BlockchainImporter.Txp.Toil 12 | -------------------------------------------------------------------------------- /blockchain-importer/src/Pos/BlockchainImporter/Txp/Toil.hs: -------------------------------------------------------------------------------- 1 | -- | BlockchainImporter's toil. 2 | 3 | module Pos.BlockchainImporter.Txp.Toil 4 | ( module Pos.BlockchainImporter.Txp.Toil.Logic 5 | , module Pos.BlockchainImporter.Txp.Toil.Monad 6 | , module Pos.BlockchainImporter.Txp.Toil.Types 7 | ) where 8 | 9 | import Pos.BlockchainImporter.Txp.Toil.Logic 10 | import Pos.BlockchainImporter.Txp.Toil.Monad 11 | import Pos.BlockchainImporter.Txp.Toil.Types 12 | -------------------------------------------------------------------------------- /blockchain-importer/src/Pos/BlockchainImporter/Web.hs: -------------------------------------------------------------------------------- 1 | -- | Web API parts of cardano-blockchain-importer 2 | 3 | module Pos.BlockchainImporter.Web 4 | ( module Web 5 | ) where 6 | 7 | import Pos.BlockchainImporter.Web.Server as Web 8 | import Pos.BlockchainImporter.Web.Transform as Web 9 | -------------------------------------------------------------------------------- /blockchain-importer/src/Pos/BlockchainImporter/Web/Error.hs: -------------------------------------------------------------------------------- 1 | -- | Types describing runtime errors related to BlockchainImporter 2 | 3 | module Pos.BlockchainImporter.Web.Error 4 | ( BlockchainImporterError (..) 5 | ) where 6 | 7 | import qualified Data.Text.Buildable 8 | import Formatting (bprint, stext, (%)) 9 | import Universum 10 | 11 | newtype BlockchainImporterError = 12 | -- | Some internal error. 13 | Internal Text 14 | deriving (Show, Generic) 15 | 16 | instance Exception BlockchainImporterError 17 | 18 | instance Buildable BlockchainImporterError where 19 | build (Internal msg) = bprint ("Internal blockchainImporter error ("%stext%")") msg 20 | -------------------------------------------------------------------------------- /blockchain-importer/src/Pos/ImporterDBConsistency/Utils.hs: -------------------------------------------------------------------------------- 1 | module Pos.ImporterDBConsistency.Utils where 2 | 3 | import Universum 4 | 5 | import Pos.Core (HeaderHash) 6 | import Pos.Crypto (decodeHash) 7 | 8 | decodeBlkHash :: Text -> Maybe HeaderHash 9 | decodeBlkHash = rightToMaybe . decodeHash 10 | 11 | maybeT :: Monad m => m (Maybe a) -> m b -> (a -> m b) -> m b 12 | maybeT maybeM nothingValue justFn = do 13 | maybeA <- maybeM 14 | case maybeA of 15 | Nothing -> nothingValue 16 | Just a -> justFn a 17 | -------------------------------------------------------------------------------- /blockchain-importer/start-dev.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Remove logs 4 | rm *.log 5 | 6 | # Optional path for `cardano-sl` 7 | cardano_path=${1:-../} 8 | 9 | system_start=$((`date +%s` + 1)) 10 | 11 | ./scripts/run.sh $cardano_path/scripts/common-functions.sh & PIDEX=$! 12 | WALLET_TEST=1 $cardano_path/scripts/launch/demo-with-wallet-api.sh & PIDNODE=$! 13 | 14 | wait $PIDEX 15 | wait $PIDNODE 16 | -------------------------------------------------------------------------------- /blockchain-importer/test/Spec.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_GHC -F -pgmF hspec-discover -optF --module-name=Spec #-} 2 | -------------------------------------------------------------------------------- /blockchain-importer/test/Test.hs: -------------------------------------------------------------------------------- 1 | import Universum 2 | 3 | import Spec (spec) 4 | import Test.Hspec (hspec) 5 | 6 | main :: IO () 7 | main = hspec spec 8 | -------------------------------------------------------------------------------- /blockchain-importer/test/Test/Pos/BlockchainImporter/Identity/BinarySpec.hs: -------------------------------------------------------------------------------- 1 | -- | This module tests Binary instances for 'Pos.BlockchainImporter' types. 2 | 3 | module Test.Pos.BlockchainImporter.Identity.BinarySpec 4 | ( spec 5 | ) where 6 | 7 | import Universum 8 | 9 | import Test.Hspec (Spec, describe) 10 | 11 | import Pos.Arbitrary.BlockchainImporter () 12 | import Pos.BlockchainImporter.Core (TxExtra) 13 | import Test.Pos.Configuration (withDefConfiguration) 14 | import Test.Pos.Helpers (binaryTest) 15 | 16 | spec :: Spec 17 | spec = withDefConfiguration $ describe "BlockchainImporter types" $ do 18 | describe "Bi instances" $ do 19 | binaryTest @TxExtra 20 | -------------------------------------------------------------------------------- /blockchain-importer/test/Test/Pos/BlockchainImporter/MockFactory.hs: -------------------------------------------------------------------------------- 1 | 2 | -- | Factory to create mock objects 3 | -- | It might be merged with other factories or test utilities of others modules 4 | -- | such as `Test.Pos.Client.Txp.UtilSpec`. 5 | 6 | module Test.Pos.BlockchainImporter.MockFactory 7 | ( mkTxOut 8 | , testLoggerName 9 | ) where 10 | 11 | import Universum 12 | 13 | import System.Wlog (LoggerName) 14 | 15 | import Pos.Core (Address, unsafeIntegerToCoin) 16 | import Pos.Core.Txp (TxOut (..)) 17 | 18 | -- | Factory to create `TxOut` 19 | -- | It is mostly taken from `makeTxOutAux` in `Test.Pos.Client.Txp.UtilSpec` 20 | mkTxOut :: Integer -> Address -> TxOut 21 | mkTxOut amount addr = 22 | let coin = unsafeIntegerToCoin amount in 23 | TxOut addr coin 24 | 25 | -- | Logger name for testing 26 | testLoggerName :: LoggerName 27 | testLoggerName = "test" 28 | -------------------------------------------------------------------------------- /client/README.md: -------------------------------------------------------------------------------- 1 | # cardano-sl-client 2 | 3 | This package implements some of the functionality required for a client of the 4 | Cardano SL network. This includes: 5 | 6 | * Generation of addresses and change addresses. 7 | * Calculating coin balances. 8 | * Calculating transactions history. 9 | * Preparing and submitting new transactions to the network. 10 | -------------------------------------------------------------------------------- /client/Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /client/src/Pos/Client/Txp.hs: -------------------------------------------------------------------------------- 1 | -- | Reexport of Pos.Client.Txp.* modules. 2 | 3 | module Pos.Client.Txp 4 | ( module Pos.Client.Txp.Addresses 5 | , module Pos.Client.Txp.Balances 6 | , module Pos.Client.Txp.History 7 | , module Pos.Client.Txp.Network 8 | , module Pos.Client.Txp.Util 9 | ) where 10 | 11 | import Pos.Client.Txp.Addresses 12 | import Pos.Client.Txp.Balances 13 | import Pos.Client.Txp.History 14 | import Pos.Client.Txp.Network 15 | import Pos.Client.Txp.Util 16 | 17 | -------------------------------------------------------------------------------- /client/src/Pos/Client/Txp/Addresses.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE TypeFamilies #-} 2 | 3 | module Pos.Client.Txp.Addresses 4 | ( MonadAddresses (..) 5 | ) where 6 | 7 | import Universum 8 | 9 | import Pos.Core (Address) 10 | 11 | -- | A class which have the method to generate a new address 12 | class Monad m => MonadAddresses m where 13 | type AddrData m :: * 14 | 15 | -- | Generate new address using given 'AddrData' (e.g. password + 16 | -- account id). 17 | getNewAddress :: AddrData m -> m Address 18 | 19 | -- | Generate a “fake” change address. Its size must be greater 20 | -- than or equal to the maximal possible size of address generated 21 | -- by 'getNewAddress'. 22 | getFakeChangeAddress :: m Address 23 | -------------------------------------------------------------------------------- /client/src/Pos/Client/Update.hs: -------------------------------------------------------------------------------- 1 | -- | Reexport of Pos.Client.Update.* modules. 2 | 3 | module Pos.Client.Update 4 | ( module Pos.Client.Update.Network 5 | ) where 6 | 7 | import Pos.Client.Update.Network 8 | 9 | -------------------------------------------------------------------------------- /client/test/Spec.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_GHC -F -pgmF hspec-discover -optF --module-name=Spec #-} 2 | -------------------------------------------------------------------------------- /client/test/Test.hs: -------------------------------------------------------------------------------- 1 | import Universum 2 | 3 | import Test.Hspec (hspec) 4 | 5 | import Spec (spec) 6 | import Test.Pos.Configuration (defaultTestConf) 7 | 8 | main :: IO () 9 | main = do 10 | putText $ "default configuration: " <> show defaultTestConf 11 | hspec spec 12 | -------------------------------------------------------------------------------- /core/README.md: -------------------------------------------------------------------------------- 1 | # cardano-sl-core 2 | 3 | Core components of Cardano SL, including types and operations for the following 4 | concepts: 5 | 6 | * A `Coin` type which is used to denominate the currency. 7 | * An `Address` type which is the source and destination for transactions. 8 | * Blockchain related components like `Block`, `BlockHeader`, `HeaderHash` (the hash 9 | of a block header) etc. 10 | * Handling of stakeholder and delegation (of stake) for Proof-of-Stake operations. 11 | * Epochs, a finite period of time for which slot leaders are predetermined. 12 | * Slots, a period of time during which at most one block is minted/mined. 13 | * Shared Seed Computation (SSC) which is used in the process of electing a slot 14 | leaders where slot leaders get to mine/mint the block for the slot they lead. 15 | * Software updates, including proposals for updating and voting on updates. 16 | -------------------------------------------------------------------------------- /core/Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /core/src/Pos/Aeson/Core/Configuration.hs: -------------------------------------------------------------------------------- 1 | -- | Derived FromJSON instance for Pos.Core.Configuration.Configuration 2 | 3 | module Pos.Aeson.Core.Configuration 4 | ( 5 | ) where 6 | 7 | import Data.Aeson.TH (deriveJSON) 8 | import Serokell.Aeson.Options (defaultOptions) 9 | 10 | import Pos.Aeson.Genesis () 11 | import Pos.Core.Configuration.Core (CoreConfiguration (..), GenesisConfiguration (..)) 12 | 13 | deriveJSON defaultOptions ''GenesisConfiguration 14 | deriveJSON defaultOptions ''CoreConfiguration 15 | -------------------------------------------------------------------------------- /core/src/Pos/Binary/Core/Delegation.hs: -------------------------------------------------------------------------------- 1 | -- | Delegation types serialization. 2 | 3 | module Pos.Binary.Core.Delegation () where 4 | 5 | import Universum 6 | 7 | import Pos.Binary.Class (Bi (..)) 8 | import Pos.Binary.Core.Slotting () 9 | import Pos.Binary.Crypto () 10 | import Pos.Core.Delegation (DlgPayload (..), HeavyDlgIndex (..), LightDlgIndices (..)) 11 | 12 | instance Bi HeavyDlgIndex where 13 | encode = encode . getHeavyDlgIndex 14 | decode = HeavyDlgIndex <$> decode 15 | 16 | instance Bi LightDlgIndices where 17 | encode = encode . getLightDlgIndices 18 | decode = LightDlgIndices <$> decode 19 | 20 | instance Bi DlgPayload where 21 | encode = encode . getDlgPayload 22 | decode = UnsafeDlgPayload <$> decode 23 | -------------------------------------------------------------------------------- /core/src/Pos/Binary/Merkle.hs: -------------------------------------------------------------------------------- 1 | -- | Merkle tree-related serialization 2 | 3 | module Pos.Binary.Merkle () where 4 | 5 | import Universum 6 | 7 | import Pos.Binary.Class (Bi (..), Raw) 8 | import Pos.Crypto.Hashing (Hash) 9 | import Pos.Merkle (MerkleRoot (..), MerkleTree (..), mkMerkleTree) 10 | 11 | -- This instance is both faster and more space-efficient (as confirmed by a 12 | -- benchmark). Hashing turns out to be faster than decoding extra data. 13 | instance (Bi a, Bi (Hash Raw)) => Bi (MerkleTree a) where 14 | encode = encode . toList 15 | decode = mkMerkleTree <$> decode 16 | 17 | instance (Bi a, Bi (Hash Raw)) => Bi (MerkleRoot a) where 18 | encode = encode . getMerkleRoot 19 | decode = MerkleRoot <$> decode 20 | -------------------------------------------------------------------------------- /core/src/Pos/Core/Block.hs: -------------------------------------------------------------------------------- 1 | -- | Reexport module 2 | module Pos.Core.Block 3 | ( module Pos.Core.Block.Union 4 | , module Pos.Core.Block.Main 5 | , module Pos.Core.Block.Genesis 6 | , module Pos.Core.Block.Blockchain 7 | ) where 8 | 9 | import Pos.Core.Block.Blockchain 10 | import Pos.Core.Block.Genesis 11 | import Pos.Core.Block.Main 12 | import Pos.Core.Block.Union -------------------------------------------------------------------------------- /core/src/Pos/Core/Block/Genesis.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_GHC -Wno-unused-imports #-} 2 | {-# OPTIONS_GHC -Wno-dodgy-exports #-} 3 | 4 | module Pos.Core.Block.Genesis 5 | ( module Pos.Core.Block.Genesis.Chain 6 | , module Pos.Core.Block.Genesis.Instances 7 | , module Pos.Core.Block.Genesis.Lens 8 | , module Pos.Core.Block.Genesis.Types 9 | ) where 10 | 11 | import Pos.Core.Block.Genesis.Chain 12 | import Pos.Core.Block.Genesis.Instances 13 | import Pos.Core.Block.Genesis.Lens 14 | import Pos.Core.Block.Genesis.Types -------------------------------------------------------------------------------- /core/src/Pos/Core/Block/Main.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_GHC -Wno-unused-imports #-} 2 | {-# OPTIONS_GHC -Wno-dodgy-exports #-} 3 | 4 | module Pos.Core.Block.Main 5 | ( module Pos.Core.Block.Main.Chain 6 | , module Pos.Core.Block.Main.Instances 7 | , module Pos.Core.Block.Main.Lens 8 | , module Pos.Core.Block.Main.Types 9 | ) where 10 | 11 | import Pos.Core.Block.Main.Chain 12 | import Pos.Core.Block.Main.Instances 13 | import Pos.Core.Block.Main.Lens 14 | import Pos.Core.Block.Main.Types 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /core/src/Pos/Core/Block/Union.hs: -------------------------------------------------------------------------------- 1 | module Pos.Core.Block.Union 2 | ( module Pos.Core.Block.Union.Instances 3 | , module Pos.Core.Block.Union.Types 4 | ) where 5 | 6 | import Pos.Core.Block.Union.Instances 7 | import Pos.Core.Block.Union.Types -------------------------------------------------------------------------------- /core/src/Pos/Core/Common.hs: -------------------------------------------------------------------------------- 1 | module Pos.Core.Common 2 | ( module Pos.Core.Common.Address 3 | , module Pos.Core.Common.Coin 4 | , module Pos.Core.Common.Fee 5 | , module Pos.Core.Common.Types 6 | ) where 7 | 8 | import Pos.Core.Common.Address 9 | import Pos.Core.Common.Coin 10 | import Pos.Core.Common.Fee 11 | import Pos.Core.Common.Types -------------------------------------------------------------------------------- /core/src/Pos/Core/Configuration/BlockVersionData.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE Rank2Types #-} 2 | 3 | module Pos.Core.Configuration.BlockVersionData 4 | ( HasGenesisBlockVersionData 5 | , withGenesisBlockVersionData 6 | , genesisBlockVersionData 7 | ) where 8 | 9 | 10 | import Data.Reflection (Given (..), give) 11 | 12 | import Pos.Core.Update.Types (BlockVersionData) 13 | 14 | type HasGenesisBlockVersionData = Given BlockVersionData 15 | 16 | withGenesisBlockVersionData :: BlockVersionData -> (HasGenesisBlockVersionData => r) -> r 17 | withGenesisBlockVersionData = give 18 | 19 | genesisBlockVersionData :: HasGenesisBlockVersionData => BlockVersionData 20 | genesisBlockVersionData = given 21 | -------------------------------------------------------------------------------- /core/src/Pos/Core/Configuration/GenesisData.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE Rank2Types #-} 2 | 3 | module Pos.Core.Configuration.GenesisData 4 | ( HasGenesisData 5 | , withGenesisData 6 | , genesisData 7 | , genesisVssCerts 8 | ) where 9 | 10 | import Universum 11 | 12 | import Data.Reflection (Given (..), give) 13 | import Pos.Core.Genesis.Types (GenesisData (..), getGenesisVssCertificatesMap) 14 | import Pos.Core.Ssc.Types (VssCertificatesMap) 15 | 16 | type HasGenesisData = Given GenesisData 17 | 18 | withGenesisData :: GenesisData -> (HasGenesisData => r) -> r 19 | withGenesisData = give 20 | 21 | genesisData :: HasGenesisData => GenesisData 22 | genesisData = given 23 | 24 | genesisVssCerts :: HasGenesisData => VssCertificatesMap 25 | genesisVssCerts = getGenesisVssCertificatesMap $ gdVssCerts genesisData 26 | -------------------------------------------------------------------------------- /core/src/Pos/Core/Configuration/GenesisHash.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE Rank2Types #-} 2 | 3 | module Pos.Core.Configuration.GenesisHash 4 | ( HasGenesisHash 5 | , withGenesisHash 6 | , GenesisHash (..) 7 | , genesisHash 8 | ) where 9 | 10 | import Data.Coerce (coerce) 11 | import Data.Reflection (Given (..), give) 12 | 13 | import Pos.Binary.Class (Raw) 14 | import Pos.Crypto.Hashing (Hash) 15 | 16 | newtype GenesisHash = GenesisHash { getGenesisHash :: forall a . Hash a } 17 | 18 | type HasGenesisHash = Given GenesisHash 19 | 20 | withGenesisHash :: (Hash Raw) -> (HasGenesisHash => r) -> r 21 | withGenesisHash gh = give (GenesisHash (coerce gh)) 22 | 23 | genesisHash :: HasGenesisHash => Hash a 24 | genesisHash = getGenesisHash given 25 | -------------------------------------------------------------------------------- /core/src/Pos/Core/Context.hs: -------------------------------------------------------------------------------- 1 | module Pos.Core.Context 2 | ( 3 | module Pos.Core.Context.PrimaryKey 4 | ) where 5 | 6 | import Pos.Core.Context.PrimaryKey 7 | -------------------------------------------------------------------------------- /core/src/Pos/Core/Genesis.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_GHC -Wno-unused-imports #-} 2 | {-# OPTIONS_GHC -Wno-dodgy-exports #-} 3 | 4 | module Pos.Core.Genesis 5 | ( module Pos.Core.Genesis.Canonical 6 | , module Pos.Core.Genesis.Generate 7 | , module Pos.Core.Genesis.Helpers 8 | , module Pos.Core.Genesis.Types 9 | 10 | ) where 11 | 12 | import Pos.Core.Genesis.Canonical 13 | import Pos.Core.Genesis.Generate 14 | import Pos.Core.Genesis.Helpers 15 | import Pos.Core.Genesis.Types -------------------------------------------------------------------------------- /core/src/Pos/Core/Slotting.hs: -------------------------------------------------------------------------------- 1 | module Pos.Core.Slotting 2 | ( module Pos.Core.Slotting.Timestamp 3 | , module Pos.Core.Slotting.Types 4 | , module Pos.Core.Slotting.Util 5 | ) where 6 | 7 | import Pos.Core.Slotting.Timestamp 8 | import Pos.Core.Slotting.Types 9 | import Pos.Core.Slotting.Util 10 | 11 | -------------------------------------------------------------------------------- /core/src/Pos/Core/Ssc.hs: -------------------------------------------------------------------------------- 1 | module Pos.Core.Ssc 2 | ( module Pos.Core.Ssc.Types 3 | , module Pos.Core.Ssc.Util 4 | , module Pos.Core.Ssc.Vss 5 | ) where 6 | import Pos.Core.Ssc.Types 7 | import Pos.Core.Ssc.Util 8 | import Pos.Core.Ssc.Vss -------------------------------------------------------------------------------- /core/src/Pos/Core/Update.hs: -------------------------------------------------------------------------------- 1 | module Pos.Core.Update 2 | ( module Pos.Core.Update.Types 3 | , module Pos.Core.Update.Util 4 | ) where 5 | 6 | import Pos.Core.Update.Types 7 | import Pos.Core.Update.Util -------------------------------------------------------------------------------- /core/src/Pos/System/Metrics/Constants.hs: -------------------------------------------------------------------------------- 1 | module Pos.System.Metrics.Constants ( 2 | cardanoNamespace 3 | , withCardanoNamespace 4 | ) where 5 | 6 | import Universum 7 | 8 | cardanoNamespace :: Text 9 | cardanoNamespace = "cardano" 10 | 11 | withCardanoNamespace :: Text -> Text 12 | withCardanoNamespace label = cardanoNamespace <> "." <> label 13 | -------------------------------------------------------------------------------- /core/test/Spec.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_GHC -F -pgmF hspec-discover -optF --module-name=Spec #-} 2 | -------------------------------------------------------------------------------- /core/test/test.hs: -------------------------------------------------------------------------------- 1 | import Universum 2 | 3 | import Test.Hspec (hspec) 4 | 5 | import Spec (spec) 6 | 7 | main :: IO () 8 | main = 9 | hspec spec 10 | -------------------------------------------------------------------------------- /crypto/Pos/Crypto/Signing.hs: -------------------------------------------------------------------------------- 1 | module Pos.Crypto.Signing 2 | ( module Pos.Crypto.Signing.Check 3 | , module Pos.Crypto.Signing.Redeem 4 | , module Pos.Crypto.Signing.Safe 5 | , module Pos.Crypto.Signing.Signing 6 | , module Pos.Crypto.Signing.Tag 7 | , module Pos.Crypto.Signing.Types 8 | ) where 9 | 10 | import Pos.Crypto.Signing.Check 11 | import Pos.Crypto.Signing.Redeem 12 | import Pos.Crypto.Signing.Safe 13 | import Pos.Crypto.Signing.Signing 14 | import Pos.Crypto.Signing.Tag 15 | import Pos.Crypto.Signing.Types 16 | 17 | -------------------------------------------------------------------------------- /crypto/Pos/Crypto/Signing/Types.hs: -------------------------------------------------------------------------------- 1 | module Pos.Crypto.Signing.Types 2 | ( module Pos.Crypto.Signing.Types.Redeem 3 | , module Pos.Crypto.Signing.Types.Safe 4 | , module Pos.Crypto.Signing.Types.Signing 5 | , module Pos.Crypto.Signing.Types.Tag 6 | ) where 7 | 8 | import Pos.Crypto.Signing.Types.Redeem 9 | import Pos.Crypto.Signing.Types.Safe 10 | import Pos.Crypto.Signing.Types.Signing 11 | import Pos.Crypto.Signing.Types.Tag 12 | -------------------------------------------------------------------------------- /crypto/Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /crypto/test/Spec.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_GHC -F -pgmF hspec-discover -optF --module-name=Spec #-} 2 | -------------------------------------------------------------------------------- /crypto/test/test.hs: -------------------------------------------------------------------------------- 1 | import Universum 2 | 3 | import Test.Hspec (hspec) 4 | 5 | import Spec (spec) 6 | 7 | main :: IO () 8 | main = 9 | hspec spec 10 | -------------------------------------------------------------------------------- /crypto/tests/Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /db/Pos/DB.hs: -------------------------------------------------------------------------------- 1 | -- | Re-exports of Pos.DB functionality. 2 | module Pos.DB 3 | ( module Pos.DB.Sum 4 | , module Pos.DB.Rocks 5 | , module Pos.DB.Pure 6 | , module Pos.DB.Functions 7 | , module Pos.DB.Error 8 | , module Pos.DB.Class 9 | , module Pos.DB.BlockIndex 10 | , module Pos.DB.BatchOp 11 | , module Pos.DB.Misc.Common 12 | , module Pos.DB.GState.Common 13 | , module Pos.DB.GState.Stakes 14 | ) where 15 | 16 | import Pos.DB.Sum 17 | import Pos.DB.Rocks 18 | import Pos.DB.Pure 19 | import Pos.DB.Functions 20 | import Pos.DB.Error 21 | import Pos.DB.Class 22 | import Pos.DB.BlockIndex 23 | import Pos.DB.BatchOp 24 | import Pos.DB.Misc.Common 25 | import Pos.DB.GState.Common 26 | import Pos.DB.GState.Stakes 27 | 28 | -------------------------------------------------------------------------------- /db/Pos/DB/Misc/Common.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE RankNTypes #-} 2 | 3 | -- | Common functionality related to Misc DB. 4 | 5 | module Pos.DB.Misc.Common 6 | ( miscGetBi 7 | , miscPutBi 8 | ) where 9 | 10 | import Universum 11 | 12 | import Pos.Binary.Class (Bi) 13 | import Pos.DB.Class (DBTag (..), MonadDB, MonadDBRead) 14 | import Pos.DB.Functions (dbGetBi, dbPutBi) 15 | 16 | miscGetBi 17 | :: forall v m . (MonadDBRead m, Bi v) 18 | => ByteString -> m (Maybe v) 19 | miscGetBi = dbGetBi MiscDB 20 | 21 | miscPutBi 22 | :: forall v m . (MonadDB m, Bi v) 23 | => ByteString -> v -> m () 24 | miscPutBi = dbPutBi MiscDB 25 | -------------------------------------------------------------------------------- /db/Pos/DB/Rocks.hs: -------------------------------------------------------------------------------- 1 | -- | Reexports of "Pos.DB.Rocks.*". 2 | module Pos.DB.Rocks 3 | ( module Pos.DB.Rocks.Functions 4 | , module Pos.DB.Rocks.Types 5 | ) where 6 | import Pos.DB.Rocks.Functions 7 | import Pos.DB.Rocks.Types -------------------------------------------------------------------------------- /db/README.md: -------------------------------------------------------------------------------- 1 | # cardano-sl-db 2 | 3 | Database operations for Cardano SL. 4 | 5 | A Cardano node has a database that is used to store: 6 | 7 | * The blocks that make up the blockchain and a block index to make queries on 8 | the blocks easier and more efficient. 9 | * UTXOs (unspent transaction outputs). 10 | * LRC (leaders and richmen computation) data required for Proof-of-Stake. 11 | * Other miscellaneous data. 12 | 13 | A cardano node stores its data in a [RocksDB] database. Since [RocksDB] is 14 | written in C++, it is accessed from Haskell via the [rocksdb-haskell-ng] library. 15 | 16 | In addition, this library provides a pure database interface built on top 17 | of `Data.Map` that mirrors the RocksDB data base so that one can be tested 18 | against the other. 19 | 20 | 21 | [RocksDB]: http://rocksdb.org/ 22 | [rocksdb-haskell-ng]: https://github.com/input-output-hk/rocksdb-haskell-ng 23 | -------------------------------------------------------------------------------- /db/Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /delegation/README.md: -------------------------------------------------------------------------------- 1 | # cardano-sl-delegation 2 | 3 | This library implements the mechanisms by which a holder of coins can delegate 4 | their their stake to a staking pool for delegated Proof-of-Stake. Stake delegation 5 | is described more fully in [this document](https://cardanodocs.com/technical/delegation/). 6 | 7 | 8 | -------------------------------------------------------------------------------- /delegation/Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /delegation/src/Pos/Binary/Delegation.hs: -------------------------------------------------------------------------------- 1 | -- | Delegation types serialization. 2 | 3 | module Pos.Binary.Delegation 4 | ( 5 | ) where 6 | 7 | import Universum 8 | 9 | import Pos.Binary.Class (Bi (..), Cons (..), Field (..), deriveSimpleBi) 10 | import Pos.Binary.Core () 11 | import Pos.Binary.Crypto () 12 | import Pos.Communication.Types.Relay (DataMsg (..)) 13 | import Pos.Core (ProxySKHeavy, StakeholderId) 14 | import Pos.Delegation.Types (DlgUndo (..)) 15 | 16 | deriveSimpleBi ''DlgUndo [ 17 | Cons 'DlgUndo [ 18 | Field [| duPsks :: [ProxySKHeavy] |], 19 | Field [| duPrevEpochPosted :: HashSet StakeholderId |] 20 | ]] 21 | 22 | instance Bi (DataMsg ProxySKHeavy) where 23 | encode = encode . dmContents 24 | decode = DataMsg <$> decode 25 | -------------------------------------------------------------------------------- /delegation/src/Pos/Delegation.hs: -------------------------------------------------------------------------------- 1 | -- | Reexport module 2 | 3 | module Pos.Delegation 4 | ( module Pos.Delegation.Worker 5 | , module Pos.Delegation.Types 6 | , module Pos.Delegation.Lrc 7 | , module Pos.Delegation.Logic 8 | , module Pos.Delegation.Listeners 9 | , module Pos.Delegation.DB 10 | , module Pos.Delegation.Configuration 11 | , module Pos.Delegation.Class 12 | , module Pos.Delegation.Cede 13 | ) where 14 | 15 | import Pos.Delegation.Worker 16 | import Pos.Delegation.Types 17 | import Pos.Delegation.Lrc 18 | import Pos.Delegation.Logic 19 | import Pos.Delegation.Listeners 20 | import Pos.Delegation.DB 21 | import Pos.Delegation.Configuration 22 | import Pos.Delegation.Class 23 | import Pos.Delegation.Cede 24 | 25 | 26 | -------------------------------------------------------------------------------- /delegation/src/Pos/Delegation/Cede.hs: -------------------------------------------------------------------------------- 1 | -- | Re-exports of everything from 'Pos.Delegation.Cede*'. 2 | 3 | module Pos.Delegation.Cede 4 | ( module Pos.Delegation.Cede.Class 5 | , module Pos.Delegation.Cede.Holders 6 | , module Pos.Delegation.Cede.Logic 7 | , module Pos.Delegation.Cede.Types 8 | ) where 9 | 10 | import Pos.Delegation.Cede.Class 11 | import Pos.Delegation.Cede.Holders 12 | import Pos.Delegation.Cede.Logic 13 | import Pos.Delegation.Cede.Types 14 | 15 | 16 | -------------------------------------------------------------------------------- /delegation/src/Pos/Delegation/Logic.hs: -------------------------------------------------------------------------------- 1 | -- | Re-exports of everything from 'Pos.Delegation.Logic.*'. 2 | 3 | module Pos.Delegation.Logic 4 | ( module Pos.Delegation.Logic.Common 5 | , module Pos.Delegation.Logic.Mempool 6 | , module Pos.Delegation.Logic.VAR 7 | ) where 8 | 9 | import Pos.Delegation.Logic.Common 10 | import Pos.Delegation.Logic.Mempool 11 | import Pos.Delegation.Logic.VAR 12 | 13 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | ## Internal Technical Documentation 2 | 3 | Official documentation for Cardano SL can be found at [cardanodocs.com](https://cardanodocs.com/). 4 | 5 | The purpose of this directory is to store our **internal** developers-oriented technical documentation. 6 | -------------------------------------------------------------------------------- /docs/block-processing/us-bv-states.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/input-output-hk/project-icarus-importer/36342f277bcb7f1902e677a02d1ce93e4cf224f0/docs/block-processing/us-bv-states.png -------------------------------------------------------------------------------- /docs/block-processing/us-proposal-states.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/input-output-hk/project-icarus-importer/36342f277bcb7f1902e677a02d1ce93e4cf224f0/docs/block-processing/us-proposal-states.png -------------------------------------------------------------------------------- /docs/docker.md: -------------------------------------------------------------------------------- 1 | create a volume for the wallet&logs 2 | 3 | `docker volume create cardano-state-1` 4 | 5 | load the docker image downloaded from hydra 6 | 7 | `docker load < image.tar.gz` 8 | 9 | run cardano with the volume and bring port 8090 out to the host 10 | 11 | `docker run --rm -it -p 127.0.0.1:8090:8090 -v cardano-state-1:/wallet cardano-container-mainnet-1.0:latest` 12 | 13 | (`-it` is optional) 14 | 15 | `docker container ls` and `docker cp jolly_gates:/wallet/tls/server.cert ./server.cert` to extract the auto-generated cert from the container 16 | 17 | `curl --cacert server.cert https://localhost:8090/api/settings/version` to confirm the api is working 18 | -------------------------------------------------------------------------------- /docs/how-to/README.md: -------------------------------------------------------------------------------- 1 | ## How-To 2 | 3 | This directory contains short manuals with step-by-step instructions for common tasks. 4 | -------------------------------------------------------------------------------- /docs/how-to/generate-blockchain.md: -------------------------------------------------------------------------------- 1 | # How to Generate Blockchain 2 | 3 | It is possible situation when blockchain is not advanced for more than `k` slots. 4 | In this case we should generate it. Use `cardano-auxx` and command `generate-blocks` for it. 5 | 6 | Launch `cardano-auxx`: 7 | 8 | ``` 9 | $ stack exec -- cardano-auxx \ 10 | --system-start 0 \ 11 | --configuration-file node/configuration.yaml \ 12 | --configuration-key mainnet_full \ 13 | --db-path some-db \ 14 | repl 15 | ``` 16 | 17 | Then ensure you have all the needed keys imported (see `add-key` and 18 | `add-key-pool` commands). Next is running `generate-blocks ` command, where 19 | `` is number of blocks to generate. Transaction payload generation is 20 | disabled by default. 21 | -------------------------------------------------------------------------------- /docs/how-to/run-explorer-web-ui.md: -------------------------------------------------------------------------------- 1 | # How to run Explorer Web UI 2 | 3 | ## Build frontend 4 | 5 | You should build frontend part of Explorer to work with web UI via browser. Assumed that you already cloned [`cardano-sl`](https://github.com/input-output-hk/cardano-sl) repository. 6 | 7 | Please make sure you have installed [`yarn`](https://yarnpkg.com/lang/en/docs/install/) program (at least `0.27.5` version). 8 | 9 | Then do: 10 | 11 | ``` 12 | $ cd cardano-sl/explorer/frontend 13 | $ ./scripts/build-explorer-frontend.sh 14 | ``` 15 | 16 | ## Run frontend 17 | 18 | Now run frontend (from within `explorer/frontend` subdirectory): 19 | 20 | ``` 21 | $ yarn start 22 | ``` 23 | 24 | It will take some time. 25 | 26 | After that go to [localhost:3100](http://localhost:3100/). 27 | -------------------------------------------------------------------------------- /docs/network/example-topologies/behind-nat-no-dns.yaml: -------------------------------------------------------------------------------- 1 | wallet: 2 | relays: [[{"addr": "10.0.0.1"},{"addr": "10.0.0.2", "port": 1234}]] 3 | -------------------------------------------------------------------------------- /docs/network/example-topologies/behind-nat-with-dns.yaml: -------------------------------------------------------------------------------- 1 | wallet: 2 | relays: [[{"host": "domain1"},{"host": "domain2", "port": 1234}]] 3 | valency: 3 # optional 4 | fallbacks: 2 # optional 5 | -------------------------------------------------------------------------------- /docs/network/example-topologies/mainnet-staging.yaml: -------------------------------------------------------------------------------- 1 | # Topology for connecting to the mainnet-staging cluster. 2 | 3 | wallet: 4 | relays: [[{ host: relays.awstest.iohkdev.io }]] 5 | valency: 1 6 | fallbacks: 7 7 | -------------------------------------------------------------------------------- /docs/network/example-topologies/p2p.yaml: -------------------------------------------------------------------------------- 1 | p2p: 2 | variant: normal 3 | valency: 3 4 | fallbacks: 1 5 | -------------------------------------------------------------------------------- /docs/network/example-topologies/static-no-dns.yaml: -------------------------------------------------------------------------------- 1 | nodes: 2 | "node0": 3 | type: core 4 | region: undefined 5 | static-routes: [["node1"], ["node2"]] 6 | addr: 127.0.0.1 7 | port: 3000 8 | "node1": 9 | type: core 10 | region: undefined 11 | static-routes: [["node0"], ["node2"]] 12 | addr: 127.0.0.1 13 | port: 3001 14 | "node2": 15 | type: core 16 | region: undefined 17 | static-routes: [["node0"], ["node1"]] 18 | addr: 127.0.0.1 19 | # default port 20 | -------------------------------------------------------------------------------- /docs/network/example-topologies/static-with-dns.yaml: -------------------------------------------------------------------------------- 1 | nodes: 2 | node0: 3 | type: core 4 | region: eu-central-1 5 | static-routes: [["node1"], ["node2"]] 6 | host: node0.local 7 | # default port 8 | node1: 9 | type: core 10 | region: eu-west-1 11 | static-routes: [["node0"], ["node2"]] 12 | addr: 12.34.56.78 13 | # default port 14 | node2: 15 | type: relay 16 | region: eu-west-2 17 | static-routes: [["node0"], ["node1"]] 18 | # uses 'node2' as the hostname 19 | port: 3000 20 | kademlia: true 21 | -------------------------------------------------------------------------------- /docs/network/example-topologies/traditional.yaml: -------------------------------------------------------------------------------- 1 | p2p: 2 | variant: traditional 3 | valency: 3 4 | fallbacks: 1 5 | -------------------------------------------------------------------------------- /docs/network/shelly/shelley/UI.md: -------------------------------------------------------------------------------- 1 | From slack: 2 | Duncan Coutts @alexvieth a couple extra minor requirements that the UI folks would like: how many peers we're connected to, and what bandwidth we're getting from the block cache layer during a blockchain sync operation. 3 | -------------------------------------------------------------------------------- /docs/style-guide.md: -------------------------------------------------------------------------------- 1 | # Haskell Style Guide 2 | 3 | There are really only 5 things you need to know: 4 | 5 | 1. Use 4 spaces. 6 | 2. Use [`stylish-haskell`](https://github.com/jaspervdj/stylish-haskell) for imports. 7 | 3. Use spaces around all operators in all cases (exception: `(%)` from `Formatting`). 8 | 4. Use `!` for all fields in `data` types. 9 | 5. All imports should be either qualified or explicit, i.e. with enumeration of stuff that you're importing (exceptions: `Universum` and `Prelude`). 10 | 11 | The rest of the style guide can be found [here](https://github.com/serokell/serokell-core/blob/master/serokell-style.md). 12 | -------------------------------------------------------------------------------- /explorer/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Unless a later match takes precedence, @akegalj will be requested 2 | # for review when someone opens a pull request. 3 | 4 | * @akegalj 5 | 6 | # Order is important; the last matching pattern takes the most precedence. 7 | 8 | *.purs @sectore 9 | frontend/ @sectore 10 | 11 | src/ @ksaric 12 | src/Pos/Explorer/Socket/ @martoon 13 | test/ @ksaric 14 | -------------------------------------------------------------------------------- /explorer/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | # PR 2 | 3 | --- 4 | 5 | Youtrack issue URL - **LINK** 6 | 7 | --- 8 | 9 | Short description - **DESCRIBE** 10 | 11 | --- 12 | 13 | How did I test this new functionality/bug fix? 14 | 15 | 1. branch I used 16 | 2. how did I run the project - was it on _DEV_, _TESTNET_, something else? 17 | 3. steps to reproduce the new behaviour, if I have additional tests, please write them down 18 | 19 | --- 20 | 21 | - [ ] PR was tested, and is linted. 22 | 23 | -------------------------------------------------------------------------------- /explorer/Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /explorer/bench/Main.hs: -------------------------------------------------------------------------------- 1 | module Main 2 | ( main 3 | ) where 4 | 5 | import Universum 6 | 7 | import System.IO (hSetEncoding, stdout, utf8) 8 | 9 | import qualified Bench.Pos.Explorer.ServerBench as SB 10 | 11 | -- stack bench cardano-sl-explorer 12 | main :: IO () 13 | main = do 14 | hSetEncoding stdout utf8 15 | 16 | SB.runTimeBenchmark 17 | -- SB.runSpaceBenchmark 18 | -------------------------------------------------------------------------------- /explorer/frontend/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | bower_components 3 | dist 4 | output 5 | .DS_Store 6 | typings 7 | npm-debug.log 8 | package-lock.json 9 | .psc-ide-port 10 | .psci_modules 11 | # generated backend types + lenses 12 | src/Generated/* 13 | # generated lenses 14 | src/Data/Time/Lenses/* 15 | src/Explorer/I18n/Lenses.purs 16 | src/Explorer/Lenses/* 17 | src/Explorer/View/Lenses/* 18 | -------------------------------------------------------------------------------- /explorer/frontend/.gitmodules: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/input-output-hk/project-icarus-importer/36342f277bcb7f1902e677a02d1ce93e4cf224f0/explorer/frontend/.gitmodules -------------------------------------------------------------------------------- /explorer/frontend/nix/purescript-derive-lenses.nix: -------------------------------------------------------------------------------- 1 | { mkDerivation, array, base, boxes, fetchgit, optparse-generic 2 | , purescript, split, stdenv, text 3 | }: 4 | mkDerivation { 5 | pname = "purescript-derive-lenses"; 6 | version = "0.10.5.0"; 7 | src = fetchgit { 8 | url = "https://github.com/paf31/purescript-derive-lenses.git"; 9 | sha256 = "0p53kdw1bcqpl0sls4c7ds0zf9ks5ivdgv23vbhdfcfl0bf107na"; 10 | rev = "02457e610789263326b936ebdfa72edbb6599094"; 11 | }; 12 | isLibrary = false; 13 | isExecutable = true; 14 | executableHaskellDepends = [ 15 | array base boxes optparse-generic purescript split text 16 | ]; 17 | description = "A tool to derive lenses for PureScript data types"; 18 | license = stdenv.lib.licenses.mit; 19 | } 20 | -------------------------------------------------------------------------------- /explorer/frontend/nix/shell.nix: -------------------------------------------------------------------------------- 1 | let 2 | localLib = import ../../../lib.nix; 3 | in 4 | { system ? builtins.currentSystem 5 | , config ? {} 6 | , pkgs ? (import (localLib.fetchNixPkgs) { inherit system config; }) 7 | }: 8 | 9 | let 10 | ghc = pkgs.haskellPackages.ghcWithPackages (ps: [ps.turtle ps.universum]); 11 | 12 | in 13 | # This is an environment for running the frontend deps regeneration script. 14 | pkgs.stdenv.mkDerivation { 15 | name = "explorer-frontend-shell"; 16 | buildInputs = with pkgs; [ nodePackages.bower2nix ghc coreutils ]; 17 | shellHook = "eval $(egrep ^export ${ghc}/bin/ghc)"; 18 | src = null; 19 | } 20 | -------------------------------------------------------------------------------- /explorer/frontend/scripts/build-explorer-frontend.sh: -------------------------------------------------------------------------------- 1 | rm -rf .psci_modules/ .pulp-cache/ node_modules/ bower_components/ output/ 2 | yarn install 3 | ./scripts/generate-explorer-lenses.sh 4 | yarn build:prod 5 | echo "Done generating explorer purescript frontend." 6 | -------------------------------------------------------------------------------- /explorer/frontend/src/Control/SocketIO/Client.js: -------------------------------------------------------------------------------- 1 | 2 | exports.connectImpl = function (url) { 3 | return function() { 4 | const s = require('socket.io-client'); 5 | return s(url); 6 | }; 7 | } 8 | 9 | exports.emitImpl = function(socket, eventName) { 10 | // console.log("emit eventName ", eventName); 11 | return function() { 12 | socket.emit(eventName); 13 | }; 14 | } 15 | 16 | exports.emitDataImpl = function(socket, eventName, data) { 17 | // console.log("emit eventName ", eventName); 18 | return function() { 19 | socket.emit(eventName, data); 20 | }; 21 | } 22 | 23 | exports.onImpl = function(socket, eventName, callback) { 24 | // console.log("on eventName ", eventName); 25 | return function() { 26 | socket.on(eventName, function(data) { 27 | callback(data)(); 28 | }); 29 | }; 30 | } 31 | -------------------------------------------------------------------------------- /explorer/frontend/src/Data/Time/NominalDiffTime.purs: -------------------------------------------------------------------------------- 1 | module Data.Time.NominalDiffTime 2 | ( NominalDiffTime (..) 3 | , mkTime 4 | , unwrapSeconds 5 | ) where 6 | 7 | import Prelude 8 | import Data.Generic (class Generic, gShow) 9 | import Data.Newtype (class Newtype, unwrap) 10 | import Data.Time.Duration (Seconds(..)) 11 | 12 | newtype NominalDiffTime = NominalDiffTime Seconds 13 | 14 | derive instance newtypeNominalDiffTime :: Newtype NominalDiffTime _ 15 | derive instance genericNominalDiffTime :: Generic NominalDiffTime 16 | derive instance eqNominalDiffTime :: Eq NominalDiffTime 17 | derive instance ordNominalDiffTime :: Ord NominalDiffTime 18 | instance showNominalDiffTime :: Show NominalDiffTime where 19 | show = gShow 20 | 21 | mkTime :: Number -> NominalDiffTime 22 | mkTime = NominalDiffTime <<< Seconds 23 | 24 | unwrapSeconds :: NominalDiffTime -> Number 25 | unwrapSeconds = unwrap <<< unwrap 26 | -------------------------------------------------------------------------------- /explorer/frontend/src/Explorer/Api/Socket.Test.purs: -------------------------------------------------------------------------------- 1 | module Explorer.Api.Socket.Test where 2 | 3 | import Prelude 4 | 5 | import Control.Monad.Aff (Aff) 6 | import Control.Monad.State (StateT) 7 | import Data.Identity (Identity) 8 | import Explorer.Api.Socket (toEvent) 9 | import Pos.Explorer.Socket.Methods (ClientEvent(..), ServerEvent(..)) 10 | import Test.Spec (Group, describe, it) 11 | import Test.Spec.Assertions (shouldEqual) 12 | 13 | 14 | testApiSocket :: forall r. StateT (Array (Group (Aff r Unit))) Identity Unit 15 | testApiSocket = 16 | describe "Explorer.Api.Socket" do 17 | describe "toEvent" do 18 | it "converts a ClientEvent to an 'event' string" do 19 | (toEvent CallMe) `shouldEqual` "CallMe" 20 | it "converts a ServerEvent to an 'event' string " do 21 | (toEvent AddrUpdated) `shouldEqual` "AddrUpdated" 22 | -------------------------------------------------------------------------------- /explorer/frontend/src/Explorer/I18n/Lang.js: -------------------------------------------------------------------------------- 1 | 2 | // -- Based on https://github.com/input-output-hk/vending-application/blob/master/web-client/src/Data/I18N.js 3 | 4 | exports.detectLocaleImpl = function() { 5 | return window.navigator.languages ? 6 | window.navigator.languages[0] : 7 | window.navigator.language || window.navigator.userLanguage; 8 | } 9 | -------------------------------------------------------------------------------- /explorer/frontend/src/Explorer/Images.purs: -------------------------------------------------------------------------------- 1 | module Explorer.Images where 2 | 3 | import Prelude ((<>)) 4 | 5 | imagePath :: String -> String 6 | imagePath = (<>) "/images/" 7 | 8 | examplePath :: String 9 | examplePath = imagePath "any-image.jpg" 10 | -------------------------------------------------------------------------------- /explorer/frontend/src/Explorer/Types/App.purs: -------------------------------------------------------------------------------- 1 | module Explorer.Types.App where 2 | 3 | import Control.Monad.Eff.Console (CONSOLE) 4 | import Control.Monad.Eff.Now (NOW) 5 | import Control.SocketIO.Client (SocketIO) 6 | import DOM (DOM) 7 | import DOM.HTML.Types (HISTORY) 8 | import Network.HTTP.Affjax (AJAX) 9 | import Waypoints (WAYPOINT) 10 | 11 | type AppEffects eff = 12 | ( dom :: DOM 13 | , ajax :: AJAX 14 | , socket :: SocketIO 15 | , now :: NOW 16 | , waypoint :: WAYPOINT 17 | , history :: HISTORY 18 | , console :: CONSOLE 19 | | eff 20 | ) 21 | -------------------------------------------------------------------------------- /explorer/frontend/src/Explorer/Util/Config.js: -------------------------------------------------------------------------------- 1 | exports.versionImpl = $VERSION; // set by webpack 2 | exports.commitHashImpl = $COMMIT_HASH; // set by webpack 3 | exports.isProductionImpl = $PRODUCTION; // set by webpack 4 | -------------------------------------------------------------------------------- /explorer/frontend/src/Explorer/Util/DOM.js: -------------------------------------------------------------------------------- 1 | 2 | exports.scrollTopImpl = function() { 3 | return window.scrollTo(0, 0); 4 | } 5 | 6 | exports.classList = function (element) { 7 | return function () { 8 | return element.classList; 9 | }; 10 | }; 11 | 12 | exports.addClassImpl = function(clazzList, clazz) { 13 | return clazzList.add(clazz); 14 | } 15 | 16 | exports.removeClassImpl = function(clazzList, clazz) { 17 | return clazzList.remove(clazz); 18 | } 19 | -------------------------------------------------------------------------------- /explorer/frontend/src/Explorer/Util/Factory.purs: -------------------------------------------------------------------------------- 1 | module Explorer.Util.Factory where 2 | 3 | import Prelude 4 | import Pos.Core.Slotting.Types (EpochIndex(..), LocalSlotIndex(..)) 5 | import Pos.Explorer.Web.ClientTypes (CAddress(..), CCoin(..), CHash(..), CTxId(..)) 6 | 7 | 8 | mkCHash :: String -> CHash 9 | mkCHash = CHash 10 | 11 | mkCTxId :: String -> CTxId 12 | mkCTxId = 13 | CTxId <<< mkCHash 14 | 15 | mkCoin :: String -> CCoin 16 | mkCoin coin = 17 | CCoin {getCoin: coin} 18 | 19 | mkCAddress :: String -> CAddress 20 | mkCAddress = CAddress 21 | 22 | mkEpochIndex :: Int -> EpochIndex 23 | mkEpochIndex index = EpochIndex {getEpochIndex: index} 24 | 25 | mkLocalSlotIndex :: Int -> LocalSlotIndex 26 | mkLocalSlotIndex index = UnsafeLocalSlotIndex {getSlotIndex: index} 27 | -------------------------------------------------------------------------------- /explorer/frontend/src/Explorer/Util/String.js: -------------------------------------------------------------------------------- 1 | 2 | // Based on sformat by underscore.string 3 | // https://github.com/prantlf/underscore.string/blob/sformat/lib/underscore.string.js#L192 4 | exports.substituteImpl = function(str) { 5 | return function(args) { 6 | return str.replace(/\{\{|\}\}|\{(\d+)\}/g, function (match, group) { 7 | var value = args[parseInt(group, 10)]; 8 | return value ? value.toString() : ""; 9 | }); 10 | }; 11 | }; 12 | -------------------------------------------------------------------------------- /explorer/frontend/src/Explorer/View/Common.Test.purs: -------------------------------------------------------------------------------- 1 | module Explorer.View.Common.Test where 2 | 3 | import Prelude 4 | import Control.Monad.Aff (Aff) 5 | import Control.Monad.State (StateT) 6 | import Data.Identity (Identity) 7 | import Explorer.View.Common (getMaxPaginationNumber) 8 | import Test.Spec (Group, describe, it) 9 | import Test.Spec.Assertions (shouldEqual) 10 | 11 | testCommonViews :: forall r. StateT (Array (Group (Aff r Unit))) Identity Unit 12 | testCommonViews = 13 | describe "Explorer.View.Common" do 14 | 15 | describe "getMaxPaginationNumber" do 16 | it "rounds not to upper number" 17 | let result = getMaxPaginationNumber 530 10 18 | in result `shouldEqual` 53 19 | it "rounds to upper number" 20 | let result = getMaxPaginationNumber 539 10 21 | in result `shouldEqual` 54 22 | -------------------------------------------------------------------------------- /explorer/frontend/src/Explorer/View/Dashboard/Lenses.purs: -------------------------------------------------------------------------------- 1 | module Explorer.View.Dashboard.Lenses where 2 | 3 | import Prelude 4 | import Data.Lens (Lens') 5 | import Explorer.Lenses.State (dbViewBlocksExpanded, dashboard, dbViewSelectedApiCode, dbViewTxsExpanded, viewStates) 6 | import Explorer.Types.State (DashboardAPICode, DashboardViewState, State) 7 | 8 | -- lenses 9 | 10 | dashboardViewState :: Lens' State DashboardViewState 11 | dashboardViewState = viewStates <<< dashboard 12 | 13 | dashboardBlocksExpanded :: Lens' State Boolean 14 | dashboardBlocksExpanded = dashboardViewState <<< dbViewBlocksExpanded 15 | 16 | dashboardTransactionsExpanded :: Lens' State Boolean 17 | dashboardTransactionsExpanded = dashboardViewState <<< dbViewTxsExpanded 18 | 19 | dashboardSelectedApiCode :: Lens' State DashboardAPICode 20 | dashboardSelectedApiCode = dashboardViewState <<< dbViewSelectedApiCode 21 | -------------------------------------------------------------------------------- /explorer/frontend/src/Explorer/View/Dashboard/Types.purs: -------------------------------------------------------------------------------- 1 | module Explorer.View.Dashboard.Types where 2 | 3 | import Data.Maybe (Maybe) 4 | import Explorer.Types.Actions (Action) 5 | 6 | 7 | newtype HeaderOptions = HeaderOptions 8 | { headline :: String 9 | , link :: Maybe HeaderLink 10 | } 11 | 12 | newtype HeaderLink = HeaderLink 13 | { label :: String 14 | , action :: Action 15 | } 16 | -------------------------------------------------------------------------------- /explorer/frontend/src/Explorer/View/Playground.purs: -------------------------------------------------------------------------------- 1 | module Explorer.View.Playground where 2 | 3 | import Prelude 4 | 5 | import Explorer.Types.Actions (Action) 6 | import Explorer.Types.State (State) 7 | import Pux.DOM.HTML (HTML) as P 8 | import Text.Smolder.HTML (div) as S 9 | import Text.Smolder.HTML.Attributes (className) as S 10 | import Text.Smolder.Markup ((!)) 11 | import Text.Smolder.Markup (text) as S 12 | 13 | playgroundView :: State -> P.HTML Action 14 | playgroundView state = 15 | S.div ! S.className "explorer-calculator" 16 | $ S.div ! S.className "explorer-calculator__container" 17 | $ S.text "" 18 | -------------------------------------------------------------------------------- /explorer/frontend/src/Explorer/View/Types.purs: -------------------------------------------------------------------------------- 1 | module Exporer.View.Types where 2 | 3 | import Data.Maybe (Maybe) 4 | import Data.Time.NominalDiffTime (NominalDiffTime) 5 | import Data.Tuple (Tuple) 6 | import Pos.Explorer.Web.ClientTypes (CCoin, CAddress, CTxId) 7 | 8 | -- put all view related types here in this file to generate lenses from it 9 | 10 | newtype TxHeaderViewProps = TxHeaderViewProps 11 | { txhHash :: CTxId 12 | , txhTimeIssued :: Maybe NominalDiffTime 13 | , txhAmount :: CCoin 14 | } 15 | 16 | 17 | newtype TxBodyViewProps = TxBodyViewProps 18 | { txbInputs :: Array (Maybe (Tuple CAddress CCoin)) 19 | , txbOutputs :: Array (Tuple CAddress CCoin) 20 | , txbAmount :: CCoin 21 | } 22 | -------------------------------------------------------------------------------- /explorer/frontend/src/Explorer/View/calculator.css: -------------------------------------------------------------------------------- 1 | 2 | .explorer-calculator { 3 | background-color: var(--color4); 4 | 5 | &__container { 6 | @extend .outer-container; 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /explorer/frontend/src/Explorer/View/layout.css: -------------------------------------------------------------------------------- 1 | 2 | .explorer-bg__container { 3 | position: absolute; 4 | top: 0; 5 | left: 0; 6 | right: 0; 7 | bottom: 0; 8 | background-color: var(--color2); 9 | background-image: var(--bg-header-url); 10 | background-repeat: no-repeat; 11 | background-size: 100% var(--min-height-header-bg-image); 12 | } 13 | 14 | .explorer-content__wrapper { 15 | position: absolute; 16 | top: 0; 17 | left: 0; 18 | right: 0; 19 | bottom: 0; 20 | } 21 | 22 | .explorer-content { 23 | padding-top: var(--height-header-top-mobile); 24 | } 25 | 26 | @media (--md) { 27 | .explorer-content { 28 | padding-top: var(--height-header-top); 29 | } 30 | } 31 | 32 | @media (--md) { 33 | .explorer-route-dashboard { 34 | .explorer-content { 35 | padding-top: 0; 36 | } 37 | } 38 | } 39 | 40 | .label-count { 41 | color: var(--color1); 42 | } 43 | -------------------------------------------------------------------------------- /explorer/frontend/src/Explorer/View/notfound.css: -------------------------------------------------------------------------------- 1 | 2 | .explorer-404 { 3 | 4 | &__wrapper { 5 | background-color: var(--color4); 6 | } 7 | 8 | &__container { 9 | @extend .outer-container; 10 | padding: 56px 48px 48px 48px; 11 | box: vertical center; 12 | } 13 | 14 | .bg-image-404 { 15 | padding-top: 222px; 16 | padding-bottom: 222px; 17 | width: 267.5px; 18 | height: 152.5px; 19 | box-item: center; 20 | display: block; 21 | } 22 | 23 | @media (--xs) { 24 | .bg-image-404 { 25 | padding-top: 222px; 26 | padding-bottom: 222px; 27 | width: 133.75px; 28 | height: 76.25px; 29 | box-item: center; 30 | } 31 | } 32 | 33 | .description { 34 | padding: 0 24px 24px 24px; 35 | font-family: var(--fontFamily0-Regular); 36 | color: var(--color8); 37 | font-size: 10px; 38 | font-weight: normal; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /explorer/frontend/src/Lib/Waypoints/Waypoints.js: -------------------------------------------------------------------------------- 1 | require('@noframework.waypoints'); 2 | 3 | exports.waypointImpl = function (elementId, callback, offset) { 4 | return new Waypoint({ 5 | element: document.getElementById(elementId), 6 | handler: function(direction) { 7 | callback(direction)(); 8 | }, 9 | offset: offset 10 | }); 11 | } 12 | 13 | exports.destroyImpl = function (waypoint) { 14 | return waypoint.destroy(); 15 | } 16 | -------------------------------------------------------------------------------- /explorer/frontend/src/index.css: -------------------------------------------------------------------------------- 1 | /* cardano-sl explorer*/ 2 | @import "animate.css"; 3 | @import "global.css"; 4 | @import "./Explorer/View/common.css"; 5 | @import "./Explorer/View/search.css"; 6 | @import "./Explorer/View/layout.css"; 7 | @import "./Explorer/View/header.css"; 8 | @import "./Explorer/View/footer.css"; 9 | @import "./Explorer/View/Dashboard/dashboard.css"; 10 | @import "./Explorer/View/Dashboard/api.css"; 11 | @import "./Explorer/View/Dashboard/hero.css"; 12 | @import "./Explorer/View/Dashboard/transactions.css"; 13 | @import "./Explorer/View/address.css"; 14 | @import "./Explorer/View/calculator.css"; 15 | @import "./Explorer/View/transaction.css"; 16 | @import "./Explorer/View/block.css"; 17 | @import "./Explorer/View/blocks.css"; 18 | @import "./Explorer/View/genesis.css"; 19 | @import "./Explorer/View/notfound.css"; 20 | 21 | /* normalize */ 22 | @reset-global pc; 23 | @reset-global mobile; 24 | -------------------------------------------------------------------------------- /explorer/frontend/src/index.js: -------------------------------------------------------------------------------- 1 | // styles 2 | import './index.css'; 3 | // app 4 | import Main from './Main.purs'; 5 | import {initialState} from './Explorer/State.purs'; 6 | 7 | // HMR 8 | if(module.hot) { 9 | var main = Main.main(window.__puxLastState || initialState)() 10 | main.state.subscribe(function (state) { 11 | window.__puxLastState = state; 12 | }); 13 | module.hot.accept(); 14 | } else { 15 | Main.main(initialState)(); 16 | } 17 | -------------------------------------------------------------------------------- /explorer/frontend/src/index.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Cardano Blockchain Explorer 6 | 7 | 8 | 9 | 10 | 13 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /explorer/frontend/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/input-output-hk/project-icarus-importer/36342f277bcb7f1902e677a02d1ce93e4cf224f0/explorer/frontend/static/favicon.ico -------------------------------------------------------------------------------- /explorer/frontend/static/fonts/Montserrat-ExtraBold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/input-output-hk/project-icarus-importer/36342f277bcb7f1902e677a02d1ce93e4cf224f0/explorer/frontend/static/fonts/Montserrat-ExtraBold.otf -------------------------------------------------------------------------------- /explorer/frontend/static/fonts/Montserrat-ExtraLight.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/input-output-hk/project-icarus-importer/36342f277bcb7f1902e677a02d1ce93e4cf224f0/explorer/frontend/static/fonts/Montserrat-ExtraLight.otf -------------------------------------------------------------------------------- /explorer/frontend/static/fonts/Montserrat-Medium.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/input-output-hk/project-icarus-importer/36342f277bcb7f1902e677a02d1ce93e4cf224f0/explorer/frontend/static/fonts/Montserrat-Medium.otf -------------------------------------------------------------------------------- /explorer/frontend/static/fonts/Montserrat-SemiBold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/input-output-hk/project-icarus-importer/36342f277bcb7f1902e677a02d1ce93e4cf224f0/explorer/frontend/static/fonts/Montserrat-SemiBold.otf -------------------------------------------------------------------------------- /explorer/frontend/static/fonts/Montserrat-Thin.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/input-output-hk/project-icarus-importer/36342f277bcb7f1902e677a02d1ce93e4cf224f0/explorer/frontend/static/fonts/Montserrat-Thin.otf -------------------------------------------------------------------------------- /explorer/frontend/static/fonts/MontserratAlternates-Black.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/input-output-hk/project-icarus-importer/36342f277bcb7f1902e677a02d1ce93e4cf224f0/explorer/frontend/static/fonts/MontserratAlternates-Black.otf -------------------------------------------------------------------------------- /explorer/frontend/static/fonts/MontserratAlternates-Bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/input-output-hk/project-icarus-importer/36342f277bcb7f1902e677a02d1ce93e4cf224f0/explorer/frontend/static/fonts/MontserratAlternates-Bold.otf -------------------------------------------------------------------------------- /explorer/frontend/static/fonts/MontserratAlternates-ExtraBold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/input-output-hk/project-icarus-importer/36342f277bcb7f1902e677a02d1ce93e4cf224f0/explorer/frontend/static/fonts/MontserratAlternates-ExtraBold.otf -------------------------------------------------------------------------------- /explorer/frontend/static/fonts/MontserratAlternates-ExtraLight.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/input-output-hk/project-icarus-importer/36342f277bcb7f1902e677a02d1ce93e4cf224f0/explorer/frontend/static/fonts/MontserratAlternates-ExtraLight.otf -------------------------------------------------------------------------------- /explorer/frontend/static/fonts/MontserratAlternates-Light.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/input-output-hk/project-icarus-importer/36342f277bcb7f1902e677a02d1ce93e4cf224f0/explorer/frontend/static/fonts/MontserratAlternates-Light.otf -------------------------------------------------------------------------------- /explorer/frontend/static/fonts/MontserratAlternates-Medium.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/input-output-hk/project-icarus-importer/36342f277bcb7f1902e677a02d1ce93e4cf224f0/explorer/frontend/static/fonts/MontserratAlternates-Medium.otf -------------------------------------------------------------------------------- /explorer/frontend/static/fonts/MontserratAlternates-Regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/input-output-hk/project-icarus-importer/36342f277bcb7f1902e677a02d1ce93e4cf224f0/explorer/frontend/static/fonts/MontserratAlternates-Regular.otf -------------------------------------------------------------------------------- /explorer/frontend/static/fonts/MontserratAlternates-SemiBold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/input-output-hk/project-icarus-importer/36342f277bcb7f1902e677a02d1ce93e4cf224f0/explorer/frontend/static/fonts/MontserratAlternates-SemiBold.otf -------------------------------------------------------------------------------- /explorer/frontend/static/fonts/MontserratAlternates-Thin.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/input-output-hk/project-icarus-importer/36342f277bcb7f1902e677a02d1ce93e4cf224f0/explorer/frontend/static/fonts/MontserratAlternates-Thin.otf -------------------------------------------------------------------------------- /explorer/frontend/static/fonts/montserrat-black_[allfont.ru].ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/input-output-hk/project-icarus-importer/36342f277bcb7f1902e677a02d1ce93e4cf224f0/explorer/frontend/static/fonts/montserrat-black_[allfont.ru].ttf -------------------------------------------------------------------------------- /explorer/frontend/static/fonts/montserrat-bold_[allfont.ru].ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/input-output-hk/project-icarus-importer/36342f277bcb7f1902e677a02d1ce93e4cf224f0/explorer/frontend/static/fonts/montserrat-bold_[allfont.ru].ttf -------------------------------------------------------------------------------- /explorer/frontend/static/fonts/montserrat-hairline_[allfont.ru].ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/input-output-hk/project-icarus-importer/36342f277bcb7f1902e677a02d1ce93e4cf224f0/explorer/frontend/static/fonts/montserrat-hairline_[allfont.ru].ttf -------------------------------------------------------------------------------- /explorer/frontend/static/fonts/montserrat-light_[allfont.ru].ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/input-output-hk/project-icarus-importer/36342f277bcb7f1902e677a02d1ce93e4cf224f0/explorer/frontend/static/fonts/montserrat-light_[allfont.ru].ttf -------------------------------------------------------------------------------- /explorer/frontend/static/fonts/montserrat_[allfont.ru].ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/input-output-hk/project-icarus-importer/36342f277bcb7f1902e677a02d1ce93e4cf224f0/explorer/frontend/static/fonts/montserrat_[allfont.ru].ttf -------------------------------------------------------------------------------- /explorer/frontend/static/images/arrow-up.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /explorer/frontend/static/images/header_300517.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/input-output-hk/project-icarus-importer/36342f277bcb7f1902e677a02d1ce93e4cf224f0/explorer/frontend/static/images/header_300517.jpg -------------------------------------------------------------------------------- /explorer/frontend/static/images/icon-cross.svg: -------------------------------------------------------------------------------- 1 | 2 | 453C10ED-A8D9-4AA9-BC7C-B4885F94A321 3 | 4 | 5 | -------------------------------------------------------------------------------- /explorer/frontend/static/images/icon-lang-de.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /explorer/frontend/static/images/icon-lang-ja.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /explorer/frontend/static/images/icon-menu.svg: -------------------------------------------------------------------------------- 1 | 2 | 2084171A-1988-4FFF-AE90-C04B51F95A2C 3 | 4 | 5 | -------------------------------------------------------------------------------- /explorer/frontend/static/images/triangle-right.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /explorer/frontend/test/rename-placeholders.js: -------------------------------------------------------------------------------- 1 | /* 2 | Helper script to rename 'Webpack' placeholders 3 | It is needed to run tests with `Node.js`, but without `Webpack` 4 | */ 5 | 6 | const replace = require('replace-in-file'); 7 | 8 | const options = { 9 | files: './output/Explorer.Util.Config/foreign.js', 10 | from: [ /\$VERSION/g 11 | , /\$COMMIT_HASH/g 12 | , /\$PRODUCTION/g 13 | ], 14 | to: [ '0' 15 | , '0' 16 | , false 17 | ] 18 | }; 19 | 20 | replace(options) 21 | .then(changedFiles => { 22 | console.log('Placeholder replaced in:', changedFiles.join(', ')); 23 | }) 24 | .catch(error => { 25 | console.error('Error while replacing placeholders:', error); 26 | }); 27 | -------------------------------------------------------------------------------- /explorer/frontend/test/setup.js: -------------------------------------------------------------------------------- 1 | 2 | /* Helper function to run test "headless" (w/o a browser) */ 3 | exports.setup = function () { 4 | // Note: `module-alias/register` is needed to alias `@noframework.waypoints` 5 | // because we don't have `webpack` running here ... 6 | // TODO (jk) That ^ can be improved in any future. 7 | var ma = require('module-alias/register'); 8 | 9 | var JSDOM = require('jsdom').JSDOM; 10 | var jsdom = new JSDOM(''); 11 | global.window = jsdom.window; 12 | global.document = jsdom.window.document; 13 | global.navigator = jsdom.window.navigator; 14 | global.runTestSuite = true; 15 | } 16 | -------------------------------------------------------------------------------- /explorer/log-config.yaml: -------------------------------------------------------------------------------- 1 | rotation: 2 | logLimit: 5242880 # 5MB 3 | keepFiles: 20 4 | severity: Debug 5 | file: explorer-node.log 6 | node: 7 | plugin: 8 | notifier: 9 | severity: Debug 10 | file: explorer.log 11 | socket-io: 12 | severity: Debug 13 | file: socket-io.log 14 | drop: 15 | severity: Error 16 | 17 | -------------------------------------------------------------------------------- /explorer/scripts/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | stack --nix build --fast --ghc-options="-j +RTS -A128m -n2m -RTS" 3 | -------------------------------------------------------------------------------- /explorer/scripts/launch/qa.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # clear old data, don't remove the databases since they may contains some data 4 | # that will help speed up the syncing process 5 | rm -rf run/* node-* *key* *.dump 6 | 7 | stack exec -- cardano-explorer \ 8 | --system-start 1501793381 \ 9 | --log-config log-config.yaml \ 10 | --logs-prefix "logs/testnet" \ 11 | --db-path db-testnet \ 12 | --kademlia-peer 52.58.131.170:3000 \ 13 | --kademlia-peer 35.158.246.75:3000 \ 14 | --kademlia-peer 34.249.252.215:3000 \ 15 | --kademlia-peer 52.211.65.215:3000 \ 16 | --listen 127.0.0.1:$((3000)) \ 17 | --static-peers \ 18 | $@ -------------------------------------------------------------------------------- /explorer/src/Pos/Arbitrary/Explorer.hs: -------------------------------------------------------------------------------- 1 | -- | Arbitrary instances for Explorer types. 2 | 3 | module Pos.Arbitrary.Explorer () where 4 | 5 | import Test.QuickCheck (Arbitrary (..)) 6 | import Test.QuickCheck.Arbitrary.Generic (genericArbitrary, genericShrink) 7 | 8 | import Pos.Core.Common (HeaderHash) 9 | import Pos.Explorer.Core.Types (TxExtra (..)) 10 | import Pos.Txp () 11 | 12 | instance Arbitrary HeaderHash => Arbitrary TxExtra where 13 | arbitrary = genericArbitrary 14 | shrink = genericShrink 15 | -------------------------------------------------------------------------------- /explorer/src/Pos/Binary/Explorer.hs: -------------------------------------------------------------------------------- 1 | -- | Binary instances for explorer types 2 | 3 | module Pos.Binary.Explorer () where 4 | 5 | import Universum 6 | 7 | import Pos.Binary () 8 | import Pos.Binary.Class (Cons (..), Field (..), deriveSimpleBi) 9 | import Pos.Core (HeaderHash, Timestamp, TxUndo) 10 | import Pos.Explorer.Core.Types (TxExtra (..)) 11 | 12 | deriveSimpleBi ''TxExtra [ 13 | Cons 'TxExtra [ 14 | Field [| teBlockchainPlace :: Maybe (HeaderHash, Word32) |], 15 | Field [| teReceivedTime :: Maybe Timestamp |], 16 | Field [| teInputOutputs :: TxUndo |] 17 | ]] 18 | -------------------------------------------------------------------------------- /explorer/src/Pos/Explorer/Core.hs: -------------------------------------------------------------------------------- 1 | -- | Core of explorer. 2 | 3 | module Pos.Explorer.Core 4 | ( module Pos.Explorer.Core.Types 5 | ) where 6 | 7 | import Pos.Binary.Explorer () 8 | import Pos.Explorer.Core.Types 9 | -------------------------------------------------------------------------------- /explorer/src/Pos/Explorer/Core/Types.hs: -------------------------------------------------------------------------------- 1 | -- | Module containing explorer-specific datatypes 2 | 3 | module Pos.Explorer.Core.Types 4 | ( TxExtra (..) 5 | , AddrHistory 6 | ) where 7 | 8 | import Universum 9 | 10 | import Pos.Core (HeaderHash, Timestamp) 11 | import Pos.Core.Txp (TxId, TxUndo) 12 | import Pos.Util.Chrono (NewestFirst) 13 | 14 | type AddrHistory = NewestFirst [] TxId 15 | 16 | data TxExtra = TxExtra 17 | { teBlockchainPlace :: !(Maybe (HeaderHash, Word32)) 18 | , teReceivedTime :: !(Maybe Timestamp) 19 | -- non-strict on purpose, see comment in `processTxDo` in Pos.Explorer.Txp.Local 20 | , teInputOutputs :: TxUndo 21 | } deriving (Show, Generic, Eq) 22 | -------------------------------------------------------------------------------- /explorer/src/Pos/Explorer/Socket.hs: -------------------------------------------------------------------------------- 1 | -- | Web API parts of cardano-explorer 2 | 3 | module Pos.Explorer.Socket 4 | ( module Socket 5 | ) where 6 | 7 | import Pos.Explorer.Socket.App as Socket 8 | import Pos.Explorer.Socket.Methods as Socket 9 | import Pos.Explorer.Socket.Util as Socket 10 | -------------------------------------------------------------------------------- /explorer/src/Pos/Explorer/Txp.hs: -------------------------------------------------------------------------------- 1 | -- | Explorer's Txp. 2 | 3 | module Pos.Explorer.Txp 4 | ( module Pos.Explorer.Txp.Global 5 | , module Pos.Explorer.Txp.Local 6 | , module Pos.Explorer.Txp.Toil 7 | ) where 8 | 9 | import Pos.Explorer.Txp.Global 10 | import Pos.Explorer.Txp.Local 11 | import Pos.Explorer.Txp.Toil 12 | -------------------------------------------------------------------------------- /explorer/src/Pos/Explorer/Txp/Toil.hs: -------------------------------------------------------------------------------- 1 | -- | Explorer's toil. 2 | 3 | module Pos.Explorer.Txp.Toil 4 | ( module Pos.Explorer.Txp.Toil.Logic 5 | , module Pos.Explorer.Txp.Toil.Monad 6 | , module Pos.Explorer.Txp.Toil.Types 7 | ) where 8 | 9 | import Pos.Explorer.Txp.Toil.Logic 10 | import Pos.Explorer.Txp.Toil.Monad 11 | import Pos.Explorer.Txp.Toil.Types 12 | -------------------------------------------------------------------------------- /explorer/src/Pos/Explorer/Web.hs: -------------------------------------------------------------------------------- 1 | -- | Web API parts of cardano-explorer 2 | 3 | module Pos.Explorer.Web 4 | ( module Web 5 | ) where 6 | 7 | import Pos.Explorer.Web.Server as Web 8 | import Pos.Explorer.Web.Transform as Web 9 | -------------------------------------------------------------------------------- /explorer/src/Pos/Explorer/Web/Error.hs: -------------------------------------------------------------------------------- 1 | -- | Types describing runtime errors related to Explorer 2 | 3 | module Pos.Explorer.Web.Error 4 | ( ExplorerError (..) 5 | ) where 6 | 7 | import qualified Data.Text.Buildable 8 | import Formatting (bprint, stext, (%)) 9 | import Universum 10 | 11 | newtype ExplorerError = 12 | -- | Some internal error. 13 | Internal Text 14 | deriving (Show, Generic) 15 | 16 | instance Exception ExplorerError 17 | 18 | instance Buildable ExplorerError where 19 | build (Internal msg) = bprint ("Internal explorer error ("%stext%")") msg 20 | -------------------------------------------------------------------------------- /explorer/src/purescript/PSTypes.hs: -------------------------------------------------------------------------------- 1 | module PSTypes 2 | ( psPosixTime 3 | ) where 4 | 5 | import Language.PureScript.Bridge.TypeInfo (PSType, TypeInfo (..)) 6 | 7 | psPosixTime :: PSType 8 | psPosixTime = TypeInfo "" "Data.Time.NominalDiffTime" "NominalDiffTime" [] 9 | -------------------------------------------------------------------------------- /explorer/start-dev.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Remove logs 4 | rm *.log 5 | 6 | # Optional path for `cardano-sl` 7 | cardano_path=${1:-../} 8 | 9 | system_start=$((`date +%s` + 1)) 10 | 11 | ./scripts/run.sh $cardano_path/scripts/common-functions.sh & PIDEX=$! 12 | WALLET_TEST=1 $cardano_path/scripts/launch/demo-with-wallet-api.sh & PIDNODE=$! 13 | 14 | wait $PIDEX 15 | wait $PIDNODE 16 | -------------------------------------------------------------------------------- /explorer/test/Spec.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_GHC -F -pgmF hspec-discover -optF --module-name=Spec #-} 2 | -------------------------------------------------------------------------------- /explorer/test/Test.hs: -------------------------------------------------------------------------------- 1 | import Universum 2 | 3 | import Spec (spec) 4 | import Test.Hspec (hspec) 5 | 6 | main :: IO () 7 | main = hspec spec 8 | -------------------------------------------------------------------------------- /explorer/test/Test/Pos/Explorer/Identity/BinarySpec.hs: -------------------------------------------------------------------------------- 1 | -- | This module tests Binary instances for 'Pos.Explorer' types. 2 | 3 | module Test.Pos.Explorer.Identity.BinarySpec 4 | ( spec 5 | ) where 6 | 7 | import Universum 8 | 9 | import Test.Hspec (Spec, describe) 10 | 11 | import Pos.Arbitrary.Explorer () 12 | import Pos.Explorer.Core (TxExtra) 13 | import Test.Pos.Configuration (withDefConfiguration) 14 | import Test.Pos.Helpers (binaryTest) 15 | 16 | spec :: Spec 17 | spec = withDefConfiguration $ describe "Explorer types" $ do 18 | describe "Bi instances" $ do 19 | binaryTest @TxExtra 20 | -------------------------------------------------------------------------------- /explorer/test/Test/Pos/Explorer/MockFactory.hs: -------------------------------------------------------------------------------- 1 | 2 | -- | Factory to create mock objects 3 | -- | It might be merged with other factories or test utilities of others modules 4 | -- | such as `Test.Pos.Client.Txp.UtilSpec`. 5 | 6 | module Test.Pos.Explorer.MockFactory 7 | ( mkTxOut 8 | , testLoggerName 9 | ) where 10 | 11 | import Universum 12 | 13 | import System.Wlog (LoggerName) 14 | 15 | import Pos.Core (Address, unsafeIntegerToCoin) 16 | import Pos.Core.Txp (TxOut (..)) 17 | 18 | -- | Factory to create `TxOut` 19 | -- | It is mostly taken from `makeTxOutAux` in `Test.Pos.Client.Txp.UtilSpec` 20 | mkTxOut :: Integer -> Address -> TxOut 21 | mkTxOut amount addr = 22 | let coin = unsafeIntegerToCoin amount in 23 | TxOut addr coin 24 | 25 | -- | Logger name for testing 26 | testLoggerName :: LoggerName 27 | testLoggerName = "test" 28 | -------------------------------------------------------------------------------- /fetch-nixpkgs.nix: -------------------------------------------------------------------------------- 1 | let 2 | # temporary hack until scripts/nix-shell.sh ceases to use -p 3 | pkgs_path = import ./fetchNixpkgs.nix (builtins.fromJSON (builtins.readFile ./nixpkgs-src.json)); 4 | pkgs = import pkgs_path { config = {}; overlays = []; }; 5 | wrapped = pkgs.runCommand "nixpkgs" {} '' 6 | ln -sv ${pkgs_path} $out 7 | ''; 8 | in if 0 <= builtins.compareVersions builtins.nixVersion "1.12" then wrapped else pkgs_path 9 | -------------------------------------------------------------------------------- /generator/README.md: -------------------------------------------------------------------------------- 1 | # cardano-sl-generator 2 | 3 | This package defines types and functions to generate random but valid blocks 4 | for Cardano SL. 5 | -------------------------------------------------------------------------------- /generator/Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /generator/src/Pos/Generator.hs: -------------------------------------------------------------------------------- 1 | -- | Generators of arbitrary data. 2 | 3 | module Pos.Generator 4 | ( module Pos.Generator.BlockEvent 5 | , module Pos.Generator.BlockEvent.DSL 6 | , module Pos.Generator.Block 7 | ) 8 | where 9 | 10 | import Pos.Generator.BlockEvent 11 | import Pos.Generator.BlockEvent.DSL 12 | import Pos.Generator.Block 13 | -------------------------------------------------------------------------------- /generator/src/Pos/Generator/Block.hs: -------------------------------------------------------------------------------- 1 | -- | Arbitrary blockchain generation. 2 | 3 | module Pos.Generator.Block 4 | ( module Pos.Generator.Block.Error 5 | , module Pos.Generator.Block.Logic 6 | , module Pos.Generator.Block.Mode 7 | , module Pos.Generator.Block.Param 8 | , module Pos.Generator.Block.Payload 9 | ) where 10 | 11 | import Pos.Generator.Block.Error 12 | import Pos.Generator.Block.Logic 13 | import Pos.Generator.Block.Mode 14 | import Pos.Generator.Block.Param 15 | import Pos.Generator.Block.Payload 16 | -------------------------------------------------------------------------------- /generator/test/Spec.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_GHC -F -pgmF hspec-discover -optF --module-name=Spec #-} 2 | -------------------------------------------------------------------------------- /generator/test/Test.hs: -------------------------------------------------------------------------------- 1 | import Universum 2 | 3 | import Test.Hspec (hspec) 4 | 5 | import Spec (spec) 6 | import Test.Pos.Configuration (defaultTestConf) 7 | 8 | main :: IO () 9 | main = do 10 | putText $ "default configuration: " <> show defaultTestConf 11 | hspec spec 12 | -------------------------------------------------------------------------------- /infra/Pos/Arbitrary/Slotting.hs: -------------------------------------------------------------------------------- 1 | -- | Arbitrary instances for Pos.Slotting types (infra package) 2 | 3 | module Pos.Arbitrary.Slotting () where 4 | 5 | import Universum 6 | 7 | import Test.QuickCheck (Arbitrary (..), arbitrary, oneof) 8 | import Test.QuickCheck.Arbitrary.Generic (genericArbitrary, genericShrink) 9 | 10 | import Pos.Arbitrary.Core () 11 | import Pos.Slotting.Types (EpochSlottingData (..), SlottingData, createInitSlottingData) 12 | 13 | instance Arbitrary EpochSlottingData where 14 | arbitrary = genericArbitrary 15 | shrink = genericShrink 16 | 17 | instance Arbitrary SlottingData where 18 | -- Fixed instance since it's impossible to create and instance 19 | -- where one creates @SlottingData@ without at least two parameters. 20 | arbitrary = oneof [ createInitSlottingData <$> arbitrary <*> arbitrary ] 21 | 22 | -------------------------------------------------------------------------------- /infra/Pos/Binary/Infra.hs: -------------------------------------------------------------------------------- 1 | module Pos.Binary.Infra () where 2 | 3 | import Pos.Binary.Infra.DHTModel () 4 | import Pos.Binary.Infra.Relay () 5 | import Pos.Binary.Infra.Slotting () 6 | -------------------------------------------------------------------------------- /infra/Pos/Communication/Constants.hs: -------------------------------------------------------------------------------- 1 | module Pos.Communication.Constants 2 | ( maxReqSize 3 | , maxMempoolMsgSize 4 | , maxInvSize 5 | ) where 6 | 7 | import Universum 8 | 9 | maxReqSize :: Word32 10 | maxReqSize = 102 11 | 12 | maxMempoolMsgSize :: Word32 13 | maxMempoolMsgSize = 100 14 | 15 | maxInvSize :: Word32 16 | maxInvSize = 102 17 | -------------------------------------------------------------------------------- /infra/Pos/Communication/Relay.hs: -------------------------------------------------------------------------------- 1 | module Pos.Communication.Relay 2 | ( module Pos.Communication.Relay.Class 3 | , module Pos.Communication.Relay.Logic 4 | , module Pos.Communication.Relay.Types 5 | , module Pos.Communication.Relay.Util 6 | ) where 7 | 8 | import Pos.Communication.Relay.Class 9 | import Pos.Communication.Relay.Logic 10 | import Pos.Communication.Relay.Types 11 | import Pos.Communication.Relay.Util 12 | -------------------------------------------------------------------------------- /infra/Pos/Communication/Relay/Util.hs: -------------------------------------------------------------------------------- 1 | module Pos.Communication.Relay.Util 2 | ( expectInv 3 | , expectData 4 | ) where 5 | 6 | import Universum 7 | 8 | import Pos.Communication.Relay.Types (RelayError (UnexpectedData, UnexpectedInv)) 9 | import Pos.Communication.Types.Relay (DataMsg, InvMsg, InvOrData) 10 | 11 | expectInv 12 | :: MonadThrow m 13 | => (InvMsg key -> m a) -> InvOrData key contents -> m a 14 | expectInv call = either call (\_ -> throwM UnexpectedData) 15 | 16 | expectData 17 | :: MonadThrow m 18 | => (DataMsg contents -> m a) -> InvOrData key contents -> m a 19 | expectData call = either (\_ -> throwM UnexpectedInv) call 20 | -------------------------------------------------------------------------------- /infra/Pos/DHT.hs: -------------------------------------------------------------------------------- 1 | module Pos.DHT 2 | ( module X 3 | ) where 4 | 5 | import Pos.DHT.Model as X 6 | import Pos.DHT.Real as X 7 | -------------------------------------------------------------------------------- /infra/Pos/DHT/Constants.hs: -------------------------------------------------------------------------------- 1 | module Pos.DHT.Constants 2 | ( enhancedMessageTimeout 3 | , neighborsSendThreshold 4 | , kademliaDumpInterval 5 | , enhancedMessageBroadcast 6 | ) where 7 | 8 | import Universum 9 | 10 | -- | Minimum number of neighbours to send to. 11 | neighborsSendThreshold :: (Integral a) => a 12 | neighborsSendThreshold = 2 13 | 14 | -- | Interval for dumping state of Kademlia in slots 15 | kademliaDumpInterval :: (Integral a) => a 16 | kademliaDumpInterval = 4 17 | 18 | -- | Broadcast to nodes whose were pinged at most @enhancedMessageTimeout@ seconds ago. 19 | enhancedMessageTimeout :: (Integral a) => a 20 | enhancedMessageTimeout = 360 21 | 22 | -- | Number of nodes from batch for enhanced bessage broadcast 23 | enhancedMessageBroadcast :: (Integral a) => a 24 | enhancedMessageBroadcast = 2 25 | -------------------------------------------------------------------------------- /infra/Pos/DHT/Model.hs: -------------------------------------------------------------------------------- 1 | -- | Distributed Hash Table for peer discovery. 2 | 3 | module Pos.DHT.Model 4 | ( module Pos.DHT.Model.Types 5 | ) where 6 | 7 | import Pos.DHT.Model.Types 8 | -------------------------------------------------------------------------------- /infra/Pos/DHT/Real.hs: -------------------------------------------------------------------------------- 1 | {-| Implementation of peer discovery using using Kademlia Distributed Hash Table. 2 | For more details regarding DHT see this package on hackage: 3 | 4 | -} 5 | 6 | module Pos.DHT.Real 7 | ( module Pos.DHT.Real.CLI 8 | , module Pos.DHT.Real.Param 9 | , module Pos.DHT.Real.Real 10 | , module Pos.DHT.Real.Types 11 | ) where 12 | 13 | import Pos.DHT.Real.CLI 14 | import Pos.DHT.Real.Param 15 | import Pos.DHT.Real.Real 16 | import Pos.DHT.Real.Types 17 | 18 | -------------------------------------------------------------------------------- /infra/Pos/Discovery.hs: -------------------------------------------------------------------------------- 1 | module Pos.Discovery 2 | ( module Pos.Discovery.Model.Class 3 | , module Pos.Discovery.Model.Neighbours 4 | ) where 5 | 6 | import Pos.Discovery.Model.Class 7 | import Pos.Discovery.Model.Neighbours -------------------------------------------------------------------------------- /infra/Pos/HealthCheck/Route53.hs: -------------------------------------------------------------------------------- 1 | module Pos.HealthCheck.Route53 2 | ( route53HealthCheckOption 3 | ) where 4 | 5 | import qualified Options.Applicative as Opt 6 | import Pos.Util.TimeWarp (NetworkAddress, addrParser) 7 | import Pos.Util.OptParse (fromParsec) 8 | import Universum 9 | 10 | route53HealthCheckOption :: Opt.Parser NetworkAddress 11 | route53HealthCheckOption = Opt.option (fromParsec addrParser) $ 12 | Opt.long "route53-health-check" <> 13 | Opt.metavar "IP:PORT" <> 14 | Opt.help "Host and port for the Route53 DNS health check." 15 | -------------------------------------------------------------------------------- /infra/Pos/Ntp.hs: -------------------------------------------------------------------------------- 1 | -- | Reexports of error reporting functionality 2 | module Pos.Ntp 3 | ( module Pos.Ntp.Configuration 4 | ) where 5 | 6 | import Pos.Ntp.Configuration -------------------------------------------------------------------------------- /infra/Pos/Reporting.hs: -------------------------------------------------------------------------------- 1 | -- | Reexports of error reporting functionality 2 | 3 | module Pos.Reporting 4 | ( module Pos.Reporting.Ekg 5 | , module Pos.Reporting.Exceptions 6 | , module Pos.Reporting.MemState 7 | , module Pos.Reporting.Methods 8 | , module Pos.Reporting.Metrics 9 | , module Pos.Reporting.Statsd 10 | , module Pos.Reporting.Health.Types 11 | ) where 12 | 13 | import Pos.Reporting.Health.Types 14 | import Pos.Reporting.Ekg 15 | import Pos.Reporting.Exceptions 16 | import Pos.Reporting.MemState 17 | import Pos.Reporting.Methods 18 | import Pos.Reporting.Metrics 19 | import Pos.Reporting.Statsd 20 | 21 | -------------------------------------------------------------------------------- /infra/Pos/Reporting/Health/Types.hs: -------------------------------------------------------------------------------- 1 | -- | Types relevant to health reporting. 2 | 3 | module Pos.Reporting.Health.Types 4 | ( HealthStatus (..) 5 | ) where 6 | 7 | import Data.Text (Text) 8 | 9 | data HealthStatus = HSHealthy Text | HSUnhealthy Text 10 | -------------------------------------------------------------------------------- /infra/Pos/Shutdown.hs: -------------------------------------------------------------------------------- 1 | module Pos.Shutdown 2 | ( module Pos.Shutdown.Class 3 | , module Pos.Shutdown.Logic 4 | , module Pos.Shutdown.Types 5 | ) where 6 | 7 | import Pos.Shutdown.Class 8 | import Pos.Shutdown.Logic 9 | import Pos.Shutdown.Types 10 | -------------------------------------------------------------------------------- /infra/Pos/Shutdown/Class.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE TypeFamilies #-} 2 | 3 | module Pos.Shutdown.Class 4 | ( HasShutdownContext(..) 5 | ) where 6 | 7 | import Universum 8 | 9 | import Pos.Shutdown.Types (ShutdownContext) 10 | import Control.Lens.Lens (lens) 11 | 12 | class HasShutdownContext ctx where 13 | shutdownContext :: Lens' ctx ShutdownContext 14 | 15 | instance HasShutdownContext ShutdownContext where 16 | shutdownContext = lens identity (\_ x -> x) 17 | -------------------------------------------------------------------------------- /infra/Pos/Shutdown/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE TemplateHaskell #-} 2 | 3 | module Pos.Shutdown.Types 4 | ( ShutdownContext (..) 5 | , shdnIsTriggered 6 | ) where 7 | 8 | import Universum 9 | 10 | import Control.Lens (makeLenses) 11 | 12 | data ShutdownContext = ShutdownContext 13 | { _shdnIsTriggered :: !(TVar Bool) 14 | -- ^ If this flag is `True`, then workers should stop. 15 | } 16 | 17 | makeLenses ''ShutdownContext 18 | -------------------------------------------------------------------------------- /infra/Pos/Slotting.hs: -------------------------------------------------------------------------------- 1 | -- | Slotting functionality. 2 | 3 | module Pos.Slotting 4 | ( module Pos.Slotting.Class 5 | , module Pos.Slotting.Error 6 | , module Pos.Slotting.Impl 7 | , module Pos.Slotting.MemState 8 | , module Pos.Core.Slotting 9 | , module Pos.Slotting.Util 10 | ) where 11 | 12 | import Pos.Core.Slotting 13 | import Pos.Slotting.Class 14 | import Pos.Slotting.Error 15 | import Pos.Slotting.Impl 16 | import Pos.Slotting.MemState 17 | import Pos.Slotting.Util 18 | -------------------------------------------------------------------------------- /infra/Pos/Slotting/Impl.hs: -------------------------------------------------------------------------------- 1 | -- | This module re-exports slotting implementations. 2 | 3 | module Pos.Slotting.Impl 4 | ( module Pos.Slotting.Impl.Simple 5 | , module Pos.Slotting.Impl.Util 6 | ) where 7 | 8 | import Pos.Slotting.Impl.Simple 9 | import Pos.Slotting.Impl.Util -------------------------------------------------------------------------------- /infra/Pos/Statistics.hs: -------------------------------------------------------------------------------- 1 | -- | Implementation of statistics gathering and processing utilities. 2 | 3 | module Pos.Statistics 4 | ( module Pos.Statistics.Ekg 5 | , module Pos.Statistics.Statsd 6 | ) where 7 | 8 | import Pos.Statistics.Ekg 9 | import Pos.Statistics.Statsd 10 | -------------------------------------------------------------------------------- /infra/README.md: -------------------------------------------------------------------------------- 1 | # cardano-sl-infra 2 | 3 | A library implementing the network infrastructure for the Cardano SL network. 4 | 5 | This library contains: 6 | 7 | * The diffusion layer; the mechanism by which nodes on the Cardano network 8 | communicate with one another. 9 | * An implementation of peer discovery using using Kademlia Distributed Hash Table 10 | using the [kademlia] library. 11 | * Management of a list of peers on the Cardano network. 12 | * Code for checking that the system clock on a node is not too far out of sync 13 | with others on the network using NTP (Network Time Protocol). 14 | * Code for safely shutting down a node. 15 | * Code for monitoring and collecting the internal state of a node, generating 16 | statistics and reporting this data. 17 | * Code for dealing with slots within an epoch. 18 | 19 | [kademlia]: https://hackage.haskell.org/package/kademlia 20 | -------------------------------------------------------------------------------- /infra/Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /lib.nix: -------------------------------------------------------------------------------- 1 | let 2 | # Allow overriding pinned nixpkgs for debugging purposes via cardano_pkgs 3 | fetchNixPkgs = let try = builtins.tryEval ; 4 | in if try.success 5 | then builtins.trace "using host " try.value 6 | else import ./fetch-nixpkgs.nix; 7 | 8 | maybeEnv = env: default: 9 | let 10 | result = builtins.getEnv env; 11 | in if result != "" 12 | then result 13 | else default; 14 | 15 | pkgs = import fetchNixPkgs {}; 16 | lib = pkgs.lib; 17 | in lib // (rec { 18 | inherit fetchNixPkgs; 19 | }) 20 | -------------------------------------------------------------------------------- /lib/README.md: -------------------------------------------------------------------------------- 1 | # cardano-sl-lib 2 | 3 | Higher level components of Cardano SL, including types and operations for the 4 | following concepts: 5 | 6 | * Higher level inter node message definitions. 7 | * Management of the run-time context of a node. 8 | * Searching the UTXO set for addresses which correspond to specified HD passphrase. 9 | * High level code for setting up and running the diffusion layer. 10 | * High level code for dealing with GState (the result of applying some blocks the 11 | initial genesis state). 12 | * Code for configuring and launching a node. 13 | * Higher level crypto and blockchain code. 14 | * Definitions of the REST API endpoints exposed by a node. 15 | -------------------------------------------------------------------------------- /lib/Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /lib/bench/Bench/Configuration.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE Rank2Types #-} 2 | 3 | module Bench.Configuration (benchConf, giveCoreConf) where 4 | 5 | import Universum 6 | 7 | import qualified Data.Aeson as J 8 | import Pos.Core (HasConfiguration, withGenesisSpec) 9 | import Pos.Launcher.Configuration (Configuration (..)) 10 | import Pos.Util.Config (embedYamlConfigCT) 11 | 12 | benchConf :: Configuration 13 | benchConf = case J.fromJSON $ J.Object jobj of 14 | J.Error str -> error $ toText str 15 | J.Success conf -> conf 16 | where 17 | jobj = $(embedYamlConfigCT (Proxy @J.Object) "configuration.yaml" "configuration.yaml" "test") 18 | 19 | giveCoreConf :: (HasConfiguration => r) -> r 20 | giveCoreConf = withGenesisSpec 0 (ccCore benchConf) 21 | -------------------------------------------------------------------------------- /lib/bench/Local/Criterion.hs: -------------------------------------------------------------------------------- 1 | module Main 2 | ( main 3 | ) where 4 | 5 | import Universum 6 | 7 | import System.IO (hSetEncoding, stdout, utf8) 8 | 9 | import qualified Bench.Pos.Criterion.FollowTheSatoshiBench as FTS 10 | import qualified Bench.Pos.Criterion.TxSigningBench as TS 11 | 12 | main :: IO () 13 | main = do 14 | hSetEncoding stdout utf8 15 | FTS.runBenchmark 16 | TS.runBenchmark 17 | -------------------------------------------------------------------------------- /lib/src/Pos/Aeson.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CPP #-} 2 | 3 | -- | Module for exposing JSON instances for Cardano types 4 | 5 | module Pos.Aeson 6 | ( 7 | ) where 8 | 9 | import Pos.Aeson.Crypto () 10 | import Pos.Aeson.Types () 11 | -------------------------------------------------------------------------------- /lib/src/Pos/Aeson/Types.hs: -------------------------------------------------------------------------------- 1 | module Pos.Aeson.Types 2 | ( 3 | ) where 4 | 5 | import Data.Aeson.TH (defaultOptions, deriveToJSON) 6 | 7 | import Pos.Web.Types (SscStage) 8 | 9 | -- NOTE: some of these types are used on frontend (PureScript). 10 | -- We are automatically deriving instances there and they are 11 | -- compitable now with `deriveToJSON defaultOptions ''Y`. 12 | -- If datatype is used on frontend, please use this instead of 13 | -- any other way of deriving if possible. 14 | 15 | deriveToJSON defaultOptions ''SscStage 16 | -------------------------------------------------------------------------------- /lib/src/Pos/Binary.hs: -------------------------------------------------------------------------------- 1 | -- | Reexports of Pos.Binary.* classes 2 | 3 | module Pos.Binary 4 | ( 5 | module Pos.Binary.Class 6 | ) where 7 | 8 | import Pos.Binary.Class 9 | import Pos.Binary.Communication () 10 | import Pos.Binary.Core () 11 | import Pos.Binary.Crypto () 12 | import Pos.Binary.Delegation () 13 | import Pos.Binary.Merkle () 14 | import Pos.Binary.Ssc () 15 | import Pos.Binary.Txp () 16 | import Pos.Binary.Update () 17 | -------------------------------------------------------------------------------- /lib/src/Pos/Client/CLI.hs: -------------------------------------------------------------------------------- 1 | 2 | module Pos.Client.CLI 3 | ( module Pos.Client.CLI.NodeOptions 4 | , module Pos.Client.CLI.Options 5 | , module Pos.Client.CLI.Params 6 | , module Pos.Client.CLI.Secrets 7 | , module Pos.Client.CLI.Util 8 | ) where 9 | 10 | import Pos.Client.CLI.NodeOptions 11 | import Pos.Client.CLI.Options 12 | import Pos.Client.CLI.Params 13 | import Pos.Client.CLI.Secrets 14 | import Pos.Client.CLI.Util 15 | -------------------------------------------------------------------------------- /lib/src/Pos/Communication.hs: -------------------------------------------------------------------------------- 1 | -- | Re-exports of Pos.Communication.* 2 | 3 | module Pos.Communication 4 | ( module M 5 | ) where 6 | 7 | import Pos.Communication.BiP as M 8 | import Pos.Communication.Limits as M 9 | import Pos.Communication.Listener as M 10 | import Pos.Communication.Protocol as M 11 | import Pos.Communication.Relay as M 12 | import Pos.Communication.Server as M 13 | import Pos.Communication.Specs as M 14 | import Pos.Communication.Types as M 15 | -------------------------------------------------------------------------------- /lib/src/Pos/Communication/Server.hs: -------------------------------------------------------------------------------- 1 | -- | Server part. 2 | 3 | module Pos.Communication.Server 4 | ( serverLoggerName 5 | ) where 6 | 7 | import System.Wlog (LoggerName) 8 | 9 | -- | Logger name for server. 10 | serverLoggerName :: LoggerName 11 | serverLoggerName = "server" 12 | -------------------------------------------------------------------------------- /lib/src/Pos/Communication/Types.hs: -------------------------------------------------------------------------------- 1 | -- | Types used for communication. 2 | 3 | module Pos.Communication.Types 4 | ( -- * Messages and socket state 5 | module Pos.Communication.Types.Protocol 6 | , module Pos.Communication.Types.Relay 7 | , module Pos.Txp.Network.Types 8 | ) where 9 | 10 | import Pos.Communication.Types.Protocol 11 | import Pos.Communication.Types.Relay 12 | import Pos.Txp.Network.Types 13 | -------------------------------------------------------------------------------- /lib/src/Pos/Constants.hs: -------------------------------------------------------------------------------- 1 | {-| Constants used by algorithm. See paper for more details. 2 | -} 3 | 4 | module Pos.Constants 5 | ( 6 | module Pos.Core.Constants 7 | , module Pos.Core.Genesis 8 | , module Pos.Update.Constants 9 | ) where 10 | 11 | -- Reexports 12 | import Pos.Core.Constants 13 | import Pos.Core.Genesis 14 | import Pos.Update.Constants 15 | -------------------------------------------------------------------------------- /lib/src/Pos/Context.hs: -------------------------------------------------------------------------------- 1 | -- | Re-exports of Pos.Context.* functionality. 2 | 3 | module Pos.Context 4 | ( module Pos.Context.Context 5 | , module Pos.Core.Context 6 | , module Pos.Recovery.Info 7 | ) where 8 | 9 | import Pos.Context.Context 10 | import Pos.Core.Context 11 | import Pos.Recovery.Info 12 | -------------------------------------------------------------------------------- /lib/src/Pos/GState.hs: -------------------------------------------------------------------------------- 1 | -- | This module re-exports everything related to GState. GState is 2 | -- basically the result of application of some blocks to the initial 3 | -- (genesis) state. 4 | 5 | module Pos.GState 6 | ( module Pos.DB.GState.Stakes 7 | , module Pos.DB.GState.Common 8 | , module Pos.Delegation.DB 9 | , module Pos.GState.BlockExtra 10 | , module Pos.GState.Context 11 | , module Pos.GState.GState 12 | , module Pos.Txp.DB 13 | , module Pos.Update.DB 14 | ) where 15 | 16 | import Pos.DB.GState.Common 17 | import Pos.DB.GState.Stakes 18 | import Pos.Delegation.DB 19 | import Pos.GState.BlockExtra 20 | import Pos.GState.Context 21 | import Pos.GState.GState 22 | import Pos.Txp.DB 23 | import Pos.Update.DB 24 | -------------------------------------------------------------------------------- /lib/src/Pos/Launcher.hs: -------------------------------------------------------------------------------- 1 | -- | High-level code capable of running various scenarios in various modes. 2 | 3 | module Pos.Launcher 4 | ( module Pos.Launcher.Configuration 5 | , module Pos.Launcher.Launcher 6 | , module Pos.Launcher.Mode 7 | , module Pos.Launcher.Param 8 | , module Pos.Launcher.Resource 9 | , module Pos.Launcher.Runner 10 | , module Pos.Launcher.Scenario 11 | ) where 12 | 13 | import Pos.Launcher.Configuration 14 | import Pos.Launcher.Launcher 15 | import Pos.Launcher.Mode 16 | import Pos.Launcher.Param 17 | import Pos.Launcher.Resource 18 | import Pos.Launcher.Runner 19 | import Pos.Launcher.Scenario -------------------------------------------------------------------------------- /lib/src/Pos/Recovery.hs: -------------------------------------------------------------------------------- 1 | -- | Information about recovery/synchronization status. 2 | 3 | module Pos.Recovery 4 | ( module Pos.Recovery.Info 5 | ) where 6 | 7 | import Pos.Recovery.Info 8 | import Pos.Recovery.Instance () 9 | -------------------------------------------------------------------------------- /lib/src/Pos/Web.hs: -------------------------------------------------------------------------------- 1 | -- | Web-related part of cardano-sl. 2 | 3 | module Pos.Web 4 | ( module Pos.Web.Api 5 | , module Pos.Web.Mode 6 | , module Pos.Web.Server 7 | , module Pos.Web.Types 8 | ) where 9 | 10 | import Pos.Web.Api 11 | import Pos.Web.Mode 12 | import Pos.Web.Server 13 | import Pos.Web.Types -------------------------------------------------------------------------------- /lib/test/Spec.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_GHC -F -pgmF hspec-discover -optF --module-name=Spec #-} 2 | -------------------------------------------------------------------------------- /lib/test/Test.hs: -------------------------------------------------------------------------------- 1 | import Universum 2 | 3 | import Test.Hspec (hspec) 4 | 5 | import Spec (spec) 6 | 7 | import Test.Pos.Configuration (defaultTestConf) 8 | 9 | main :: IO () 10 | main = do 11 | putText $ "default configuration: " <> show defaultTestConf 12 | hspec spec 13 | -------------------------------------------------------------------------------- /lib/test/Test/Pos/Ssc/Identity/SafeCopySpec.hs: -------------------------------------------------------------------------------- 1 | -- | This module tests SafeCopy instances. 2 | 3 | module Test.Pos.Ssc.Identity.SafeCopySpec 4 | ( spec 5 | ) where 6 | 7 | import Test.Hspec (Spec, describe) 8 | import Universum 9 | 10 | import Pos.Arbitrary.Ssc () 11 | import qualified Pos.Core.Ssc as Ssc 12 | import Pos.SafeCopy () 13 | 14 | import Test.Pos.Helpers (safeCopyTest) 15 | import Test.Pos.Configuration (withDefConfiguration) 16 | 17 | spec :: Spec 18 | spec = withDefConfiguration $ describe "Ssc" $ do 19 | describe "SafeCopy instances" $ do 20 | safeCopyTest @Ssc.Commitment 21 | safeCopyTest @Ssc.CommitmentSignature 22 | safeCopyTest @Ssc.SignedCommitment 23 | safeCopyTest @Ssc.Opening 24 | safeCopyTest @Ssc.SscPayload 25 | safeCopyTest @Ssc.SscProof 26 | -------------------------------------------------------------------------------- /lib/test/Test/Pos/Types/Identity/ShowReadSpec.hs: -------------------------------------------------------------------------------- 1 | -- | This module tests Show/Read instances. 2 | 3 | module Test.Pos.Types.Identity.ShowReadSpec 4 | ( spec 5 | ) where 6 | 7 | import Universum 8 | 9 | import Pos.Core (Timestamp (..)) 10 | import Test.Hspec (Spec, describe) 11 | 12 | import Test.Pos.Helpers (showReadTest) 13 | 14 | spec :: Spec 15 | spec = describe "Types" $ do 16 | describe "Show/Read instances" $ do 17 | showReadTest @Timestamp 18 | -------------------------------------------------------------------------------- /lib/test/Test/Pos/Update/Identity/SafeCopySpec.hs: -------------------------------------------------------------------------------- 1 | -- | This module tests SafeCopy instances. 2 | 3 | module Test.Pos.Update.Identity.SafeCopySpec 4 | ( spec 5 | ) where 6 | 7 | import Test.Hspec (Spec, describe) 8 | import Universum 9 | 10 | import Pos.SafeCopy () 11 | import qualified Pos.Update as U 12 | 13 | import Test.Pos.Configuration (withDefConfiguration) 14 | import Test.Pos.Helpers (safeCopyTest) 15 | 16 | spec :: Spec 17 | spec = withDefConfiguration $ describe "Update system" $ do 18 | describe "SafeCopy instances" $ do 19 | safeCopyTest @U.UpdateProposal 20 | safeCopyTest @U.UpdateVote 21 | safeCopyTest @U.UpdateData 22 | safeCopyTest @U.SystemTag 23 | -------------------------------------------------------------------------------- /log-configs/cluster.yaml: -------------------------------------------------------------------------------- 1 | # This config is used by cluster nodes (core, relay, explorer) 2 | 3 | loggerTree: 4 | severity: Debug+ 5 | files: 6 | - node.log 7 | -------------------------------------------------------------------------------- /log-configs/connect-to-cluster.yaml: -------------------------------------------------------------------------------- 1 | # This template is used in scripts to connect to a running cluster. 2 | # In particular, it's used by exchanges, so it should be maintained carefully. 3 | 4 | rotation: 5 | logLimit: 104857600 # 100MB 6 | keepFiles: 100 7 | loggerTree: 8 | severity: Debug+ 9 | files: 10 | - node.pub 11 | - node 12 | -------------------------------------------------------------------------------- /log-configs/daedalus.yaml: -------------------------------------------------------------------------------- 1 | # This config is used by Daedalus (in production). 2 | 3 | rotation: 4 | logLimit: 5242880 # 5MB 5 | keepFiles: 20 6 | loggerTree: 7 | severity: Debug+ 8 | files: 9 | - pub/node.pub 10 | - node 11 | -------------------------------------------------------------------------------- /log-configs/greppable.yaml: -------------------------------------------------------------------------------- 1 | # This template is used to grep the output. 2 | # It's used only for developers' needs. 3 | 4 | termSeveritiesOut: All 5 | -------------------------------------------------------------------------------- /log-configs/template-demo.yaml: -------------------------------------------------------------------------------- 1 | # This template is used in local demo. 2 | 3 | rotation: 4 | logLimit: 104857600 # 100 MB 5 | keepFiles: 20 6 | loggerTree: 7 | severity: Debug+ 8 | files: 9 | - {{file}}.pub 10 | - {{file}} 11 | -------------------------------------------------------------------------------- /lrc/README.md: -------------------------------------------------------------------------------- 1 | # cardano-sl-lrc 2 | 3 | Leaders and Richmen Computation (LRC) for Cardano SL. LRC is part of the 4 | [Ouroborous] Proof-of-Stake protocol including the "Follow the Satoshi" 5 | procedures for selecting slot leaders for the next epoch. 6 | 7 | [Ouroborous]: https://eprint.iacr.org/2016/889.pdf 8 | -------------------------------------------------------------------------------- /lrc/Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /lrc/src/Pos/Lrc/Mode.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE DataKinds #-} 2 | 3 | -- | Constraints for LRC; a restricted version of `WorkMode`. 4 | 5 | module Pos.Lrc.Mode 6 | ( LrcMode 7 | ) where 8 | 9 | import Universum 10 | 11 | import Mockable (Async, Concurrently, Delay, Mockables) 12 | import System.Wlog (WithLogger) 13 | import UnliftIO (MonadUnliftIO) 14 | 15 | import Pos.DB.Class (MonadDB, MonadGState) 16 | import Pos.Lrc.Context (HasLrcContext) 17 | 18 | -- | Set of constraints used by LRC. 19 | type LrcMode ctx m 20 | = ( WithLogger m 21 | , MonadMask m 22 | , MonadGState m 23 | , MonadDB m 24 | , MonadIO m 25 | , MonadUnliftIO m 26 | , Mockables m [Async, Concurrently, Delay] 27 | , MonadReader ctx m 28 | , HasLrcContext ctx 29 | ) 30 | -------------------------------------------------------------------------------- /lrc/src/Pos/Lrc/Types.hs: -------------------------------------------------------------------------------- 1 | -- | Types used in LRC. 2 | 3 | module Pos.Lrc.Types 4 | ( RichmenSet 5 | , RichmenStakes 6 | , FullRichmenData 7 | ) where 8 | 9 | import Universum 10 | 11 | import Pos.Core.Common (Coin, StakeholderId) 12 | 13 | -- | Hashset of richmen (i. e. stakeholders whose stake is greater 14 | -- than some threshold). 15 | type RichmenSet = HashSet StakeholderId 16 | 17 | -- | Richmen and their stakes. 18 | type RichmenStakes = HashMap StakeholderId Coin 19 | 20 | -- | Full richmen data consists of total stake at some point and stake 21 | -- distribution among richmen. 22 | type FullRichmenData = (Coin, RichmenStakes) 23 | -------------------------------------------------------------------------------- /lrc/test/Test.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_GHC -F -pgmF hspec-discover #-} 2 | -------------------------------------------------------------------------------- /networking/bench/calc-template.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/input-output-hk/project-icarus-importer/36342f277bcb7f1902e677a02d1ce93e4cf224f0/networking/bench/calc-template.ods -------------------------------------------------------------------------------- /networking/bench/launch.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo "Wait for 50 sec while gathering results..." 4 | (stack exec bench-receiver -- --port 5000 -d 50 > receiver0.log) & (stack exec bench-receiver -- --port 5001 -d 50 > receiver1.log) & (stack exec bench-receiver -- --port 5002 -d 50 > receiver2.log) & (sleep 1; stack exec bench-sender -- --peer 127.0.0.1:5000 --peer 127.0.0.1:5001 --peer 127.0.0.1:5002 -r 90 -m 10800 -d 50 +RTS -N -RTS > sender.log) 5 | echo "Analysing logs..." 6 | stack exec bench-log-reader -- -i sender.log -i receiver0.log -i receiver1.log -i receiver2.log 7 | echo "Copying results to clipboard" 8 | cat measures.csv | xclip -selection clipboard 9 | -------------------------------------------------------------------------------- /networking/bench/logging.yaml: -------------------------------------------------------------------------------- 1 | severity: Warning 2 | sender: 3 | severity: Info 4 | comm: 5 | severity: Error 6 | receiver: 7 | severity: Info 8 | comm: 9 | severity: Error 10 | 11 | -------------------------------------------------------------------------------- /networking/src/JsonLog.hs: -------------------------------------------------------------------------------- 1 | {-| 2 | Module : JsonLog 3 | Description : Logging to JSON files 4 | License: MIT 5 | Maintainer: lars.bruenjes@iohk.io 6 | Stability: experimental 7 | Portability: GHC 8 | 9 | This module provides types and functions to support 10 | logging to JSON files. 11 | -} 12 | 13 | module JsonLog 14 | ( module JsonLog.CanJsonLog 15 | , module JsonLog.Event 16 | , module JsonLog.JsonLogT 17 | ) where 18 | 19 | import JsonLog.CanJsonLog 20 | import JsonLog.Event 21 | import JsonLog.JsonLogT 22 | -------------------------------------------------------------------------------- /networking/src/Mockable.hs: -------------------------------------------------------------------------------- 1 | module Mockable 2 | ( module M 3 | ) where 4 | 5 | import Mockable.Channel as M 6 | import Mockable.Class as M 7 | import Mockable.Concurrent as M 8 | import Mockable.CurrentTime as M 9 | import Mockable.Instances as M 10 | import Mockable.Metrics as M 11 | import Mockable.Monad as M 12 | import Mockable.Production as M 13 | import Mockable.SharedAtomic as M 14 | import Mockable.SharedExclusive as M 15 | -------------------------------------------------------------------------------- /networking/test/Spec.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_GHC -F -pgmF hspec-discover -optF --module-name=Spec #-} 2 | -------------------------------------------------------------------------------- /networking/test/Test.hs: -------------------------------------------------------------------------------- 1 | import Spec (spec) 2 | import Test.Hspec (hspec) 3 | 4 | main :: IO () 5 | main = hspec spec 6 | -------------------------------------------------------------------------------- /nixos-tests/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | walletAPI = import ./wallet-api.nix; 3 | } 4 | -------------------------------------------------------------------------------- /nixpkgs-src.json: -------------------------------------------------------------------------------- 1 | { 2 | "rev": "61fbdb47a69f78998f55207e64122a0798047b5d", 3 | "sha256": "050r55sgpy121j5qs00jw43rg5pnqidbdbvvj4lr1i9lmv9f1vfv", 4 | "sha256unpacked": "14kl3g27hapfmnzjclhdc4aglyg4dhmz09syzx4ab1mfyfw7d06n" 5 | } 6 | -------------------------------------------------------------------------------- /node-ipc/Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /node-ipc/node-ipc.cabal: -------------------------------------------------------------------------------- 1 | name: node-ipc 2 | version: 0.1.0.0 3 | license: MIT 4 | license-file: LICENSE 5 | author: Michael Bishop 6 | maintainer: cleverca22@gmail.com 7 | build-type: Simple 8 | cabal-version: >=1.10 9 | 10 | 11 | library 12 | exposed-modules: 13 | Cardano.NodeIPC 14 | build-depends: base 15 | , aeson 16 | , binary 17 | , bytestring 18 | , cardano-sl-infra 19 | , Cabal 20 | , log-warper 21 | , mtl 22 | , universum 23 | default-extensions: NoImplicitPrelude 24 | hs-source-dirs: src 25 | default-language: Haskell2010 26 | -------------------------------------------------------------------------------- /node-ipc/shell.nix: -------------------------------------------------------------------------------- 1 | with import (import ../fetch-nixpkgs.nix) {}; 2 | with import ../. { gitrev = "gitrev"; }; 3 | runCommand "dummy" { buildInputs = [ nodejs cardano-sl-wallet-new ]; } ''echo only for use with nix-shell'' 4 | -------------------------------------------------------------------------------- /node/README.md: -------------------------------------------------------------------------------- 1 | # Cardano SL simple node 2 | 3 | This package provides a minimum working CSL node without wallet capabilities. 4 | -------------------------------------------------------------------------------- /pkgs/cryptonite-segfault-blake.patch: -------------------------------------------------------------------------------- 1 | diff --git a/Crypto/Hash/Blake2b.hs b/Crypto/Hash/Blake2b.hs 2 | index c22c284..19c68ba 100644 3 | --- a/Crypto/Hash/Blake2b.hs 4 | +++ b/Crypto/Hash/Blake2b.hs 5 | @@ -85,7 +85,7 @@ instance HashAlgorithm Blake2b_512 where 6 | foreign import ccall unsafe "cryptonite_blake2b_init" 7 | c_blake2b_init :: Ptr (Context a) -> Word32 -> IO () 8 | 9 | -foreign import ccall "cryptonite_blake2b_update" 10 | +foreign import ccall unsafe "cryptonite_blake2b_update" 11 | c_blake2b_update :: Ptr (Context a) -> Ptr Word8 -> Word32 -> IO () 12 | 13 | foreign import ccall unsafe "cryptonite_blake2b_finalize" 14 | -------------------------------------------------------------------------------- /pkgs/hfsevents.nix: -------------------------------------------------------------------------------- 1 | { mkDerivation, base, bytestring, cereal, Cocoa, CoreServices 2 | , fetchgit, mtl, stdenv, text, unix 3 | }: 4 | mkDerivation { 5 | pname = "hfsevents"; 6 | version = "0.1.6"; 7 | src = fetchgit { 8 | url = "https://github.com/luite/hfsevents.git"; 9 | sha256 = "0smpq3yd5m9jd9fpanaqvhadv6qcyp9y5bz0dya0rnxqg909m973"; 10 | rev = "25a53d417d7c7a8fc3116b63e3ba14ca7c8f188f"; 11 | }; 12 | libraryHaskellDepends = [ base bytestring cereal mtl text unix ]; 13 | librarySystemDepends = [ Cocoa ]; 14 | libraryToolDepends = [ CoreServices ]; 15 | homepage = "http://github.com/luite/hfsevents"; 16 | description = "File/folder watching for OS X"; 17 | license = stdenv.lib.licenses.bsd3; 18 | platforms = [ "x86_64-darwin" ]; 19 | } 20 | -------------------------------------------------------------------------------- /scripts/analyze/block-events.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | for f in node*.log; do 4 | grep -E 'New slot|I am leader|Created a new block|Received block has been adopted|chain has been adopted|considered useful' $f \ 5 | | sed -r 's/^(\S*)\s(.*)$/\2 \1/' | while read l; do 6 | echo "$l [$f]" 7 | done 8 | done|sort 9 | -------------------------------------------------------------------------------- /scripts/bench/buildbench.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | stack build --flag cardano-sl-core:-asserts cardano-sl cardano-sl-auxx cardano-sl-wallet cardano-sl-explorer cardano-sl-tools cardano-sl-blockchain-importer 4 | -------------------------------------------------------------------------------- /scripts/bench/count_tps_sent.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Count number of blocks sent by last invocation of the runbench 4 | 5 | cat tps-sent.csv | grep "submitted" | cut -f2 -d',' | awk '{s+=$1} END {print s}' 6 | -------------------------------------------------------------------------------- /scripts/bench/count_tps_written.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Count number of transactions that ended up in a block in latest logs/ 4 | 5 | last=`ls logs/ | sort | tail -1` 6 | 7 | jq -Mr '[.timestamp, .event.createdBlock.txs | length] | @csv' logs/$last/node*.json | grep -v ',0' | cut -f2 -d',' | awk '{s+=$1} END {print s}' 8 | -------------------------------------------------------------------------------- /scripts/bench/topology/kademlia4.yaml: -------------------------------------------------------------------------------- 1 | peers: 2 | - host: '127.0.0.1' 3 | port: 3004 4 | address: 5 | host: '127.0.0.1' 6 | port: 3004 7 | -------------------------------------------------------------------------------- /scripts/bench/topology/kademlia5.yaml: -------------------------------------------------------------------------------- 1 | peers: 2 | - host: '127.0.0.1' 3 | port: 3004 4 | address: 5 | host: '127.0.0.1' 6 | port: 3004 7 | -------------------------------------------------------------------------------- /scripts/bench/topology/topology0.yaml: -------------------------------------------------------------------------------- 1 | topology.yaml -------------------------------------------------------------------------------- /scripts/bench/topology/topology1.yaml: -------------------------------------------------------------------------------- 1 | topology.yaml -------------------------------------------------------------------------------- /scripts/bench/topology/topology2.yaml: -------------------------------------------------------------------------------- 1 | topology.yaml -------------------------------------------------------------------------------- /scripts/bench/topology/topology3.yaml: -------------------------------------------------------------------------------- 1 | wallet: 2 | relays: [[{"addr": "127.0.0.1", "port": 3005}]] 3 | -------------------------------------------------------------------------------- /scripts/bench/topology/topology4.yaml: -------------------------------------------------------------------------------- 1 | topology.yaml -------------------------------------------------------------------------------- /scripts/bench/topology/topology5.yaml: -------------------------------------------------------------------------------- 1 | topology.yaml -------------------------------------------------------------------------------- /scripts/ci/appveyor-retry.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem initiate the retry number 3 | set retryNumber=0 4 | set maxRetries=5 5 | 6 | :RUN 7 | %* 8 | set LastErrorLevel=%ERRORLEVEL% 9 | IF %LastErrorLevel% == 0 GOTO :EOF 10 | set /a retryNumber=%retryNumber%+1 11 | IF %reTryNumber% == %maxRetries% (GOTO :FAILED) 12 | 13 | :RETRY 14 | set /a retryNumberDisp=%retryNumber%+1 15 | @echo Command "%*" failed with exit code %LastErrorLevel%. Retrying %retryNumberDisp% of %maxRetries% 16 | GOTO :RUN 17 | 18 | : FAILED 19 | @echo Sorry, we tried running command for %maxRetries% times and all attempts were unsuccessful! 20 | EXIT /B %LastErrorLevel% 21 | -------------------------------------------------------------------------------- /scripts/ci/check-hydra.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | nix-build https://github.com/nixos/nixpkgs/archive/4fb198892d298452023ab176e7067da58d30772e.tar.gz -A hydra 4 | echo '~~~ Evaluating release.nix' 5 | ./result/bin/hydra-eval-jobs -I . release.nix 6 | -------------------------------------------------------------------------------- /scripts/ci/nix-shell.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -x 4 | 5 | case $(uname -s | tr A-Z a-z) in 6 | linux ) NIX_PROFILE_BINPATH=/run/current-system/sw/bin/;; 7 | darwin ) NIX_PROFILE_BINPATH=/nix/var/nix/profiles/default/bin;; 8 | * ) echo "Unsupported OS: $OS_NAME" >&2; exit 1;; 9 | esac 10 | 11 | # Bootstrap on OS X/NixOS: 12 | NIX_BUILD="$(type -P nix-build)" 13 | NIX_BUILD="${NIX_BUILD:-$NIX_PROFILE_BINPATH/nix-build}" 14 | NIX_SHELL="$(type -P nix-shell)" 15 | NIX_SHELL="${NIX_SHELL:-$NIX_PROFILE_BINPATH/nix-shell}" 16 | NIX_BUILD_SHELL="$(type -P bash)" 17 | NIX_BUILD_SHELL="${NIX_BUILD_SHELL:-$NIX_PROFILE_BINPATH/bash}" 18 | 19 | export NIX_REMOTE=daemon 20 | export NIX_PATH="nixpkgs=$(${NIX_BUILD} fetch-nixpkgs.nix -o nixpkgs)" 21 | export NIX_BUILD_SHELL 22 | 23 | ${NIX_SHELL} -p nix bash coreutils zlib gmp ncurses purescript "$@" 24 | -------------------------------------------------------------------------------- /scripts/clean/all.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | set -o pipefail 4 | 5 | echo "Cleaning all databases and artifacts..." 6 | 7 | echo "Are you sure you want to remove .stack-work directory? You will have to rebuild Cardano SL completely. Type 'yes' to continue..." 8 | read DECISION 9 | if [ "${DECISION}" == "yes" ]; then 10 | echo "Cleaning Cardano SL stack-work..." 11 | rm -rf .stack-work 12 | ./scripts/clean/db.sh 13 | ./scripts/clean/explorer-bridge.sh 14 | exit 0 15 | else 16 | echo "Abort."; 17 | exit 1 18 | fi 19 | -------------------------------------------------------------------------------- /scripts/clean/db.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | set -o pipefail 4 | 5 | # Cleans all data according to docs to prepare for wallets running: 6 | # https://cardanodocs.com/technical/wallets/ 7 | 8 | echo "Cleaning Cardano SL db..." 9 | 10 | rm -rf run/* 11 | rm -rf wallet-db/ 12 | rm -rf node-db/ 13 | rm -rf db-testnet-staging/ 14 | rm -rf wdb-testnet-staging/ 15 | rm -rf db-testnet-public/ 16 | rm -rf wdb-testnet-public/ 17 | rm -rf db-mainnet/ 18 | rm -rf wdb-mainnet/ 19 | rm -rf node-*.*key* 20 | rm -rf kademlia-abc.dump 21 | rm -rf kademlia.dump 22 | 23 | -------------------------------------------------------------------------------- /scripts/clean/explorer-bridge.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | set -o pipefail 4 | 5 | echo "Cleaning Explorer Bridge artifacts..." 6 | 7 | cd explorer/frontend 8 | rm -rf .psci_modules/ .pulp-cache/ node_modules/ bower_components/ output/ 9 | -------------------------------------------------------------------------------- /scripts/generate/certificates.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | genesis=$1 6 | 7 | if [[ ! -d "$genesis" ]]; then 8 | echo "No genesis" 9 | exit 1 10 | fi 11 | 12 | genesis_=`cd $genesis && pwd` 13 | 14 | postvend_app_dir=`pwd`/../postvend-app 15 | 16 | { for i in $genesis/keys-fakeavvm/*.seed; do cat $i; echo ''; done; } > $postvend_app_dir/seeds.txt 17 | 18 | DIR=`pwd` 19 | 20 | cd $postvend_app_dir 21 | 22 | rm -Rf paper-certs-* redeem-certs-* 23 | 24 | stack exec postvend-cli -- gen-test-certs --seeds-file seeds.txt 25 | 26 | mkdir $genesis_/certs 27 | 28 | mv paper-certs-mnem-* $genesis_/certs/paper-certs-mnem 29 | mv paper-certs-* $genesis_/certs/paper-certs 30 | mv redeem-certs-* $genesis_/certs/redeem-certs 31 | 32 | cd $DIR 33 | 34 | tar -czf `basename $genesis`-certs-secrets.tgz $genesis/certs $genesis/keys-testnet/poor 35 | -------------------------------------------------------------------------------- /scripts/grep.sh: -------------------------------------------------------------------------------- 1 | # This utility script searchs prints lines matching a pattern in 2 | # Haskell source code. 3 | # N.B. If you want to find something in all files in the repostiory, 4 | # consider using `git grep'. 5 | 6 | # grep --color=auto -r "$@" lib/src lib/test lib/bench core/Pos update/Pos db/Pos lrc/Pos infra/Pos ssc/Pos tools/src txp/Pos auxx/src auxx/*.hs wallet node/*hs explorer/src blockchain-importer/src --exclude-dir='.stack-work' 7 | grep --color=auto -r --exclude-dir={.stack-work,.git} --include \*.hs "$@" * 8 | -------------------------------------------------------------------------------- /scripts/hash-installer.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | cardano-auxx cmd --commands "hash-installer $1" --mode=light 3 | -------------------------------------------------------------------------------- /scripts/haskell/recover-from-stack-clean.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Useful if you're on Atom with haskell-ghc-mod since 4 | # installation of cabal-helper with stack is broken. See also: 5 | # * https://github.com/DanielG/cabal-helper/issues/28 6 | # * https://github.com/commercialhaskell/stack/issues/3202 7 | 8 | stack build cabal-helper 9 | 10 | # At this point, the cabal-helper-wrapper binary exists, 11 | # but Stack fails to locate it, so we copy it manually into 12 | # the bin/ directory. Example: 13 | # WRAPPER_PATH=./.stack-work/install/x86_64-linux/lts-8.13/8.0.2/libexec/x86_64-linux-ghc-8.0.2/cabal-helper-0.7.3.0/cabal-helper-wrapper 14 | # DEST_PATH=./.stack-work/install/x86_64-linux/lts-8.13/8.0.2/bin/ 15 | 16 | WRAPPER_PATH=$(find -name 'cabal-helper-wrapper' | head -n 1) 17 | DEST_PATH=$(echo $WRAPPER_PATH | sed 's/libexec.*/bin\//') 18 | 19 | cp $WRAPPER_PATH $DEST_PATH 20 | stack install cabal-helper hlint 21 | -------------------------------------------------------------------------------- /scripts/haskell/stylish.sh: -------------------------------------------------------------------------------- 1 | find . -type f -name "*hs" -not -path '.git' -not -path '*.stack-work*' -not -name 'HLint.hs' -exec stylish-haskell -i {} \; 2 | -------------------------------------------------------------------------------- /scripts/js/avvm-utxo-to-yaml.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var yaml = require('js-yaml'); 4 | 5 | var fs = require('fs') 6 | 7 | var avvmFile = fs.readFileSync(process.argv[2]); 8 | var avvmJson = JSON.parse(avvmFile.toString('ascii')) 9 | 10 | var avvmMap = {}; 11 | avvmJson.utxo.forEach(function(v){ 12 | avvmMap[v.address] = v.coin*1000000; 13 | }) 14 | 15 | console.log(yaml.dump(avvmMap)); 16 | -------------------------------------------------------------------------------- /scripts/js/genesis-hash.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var blake = require('blakejs'); 4 | var canonize = require('canonical-json') 5 | 6 | var fs = require('fs') 7 | 8 | var pretty = fs.readFileSync(process.argv[2]); 9 | var json = JSON.parse(pretty.toString('ascii')) 10 | var can = canonize(json) 11 | console.log(blake.blake2bHex(can, null, 32)) 12 | -------------------------------------------------------------------------------- /scripts/js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "csl-scripts", 3 | "version": "0.0.1", 4 | "description": "", 5 | "author": "Serokell", 6 | "license": "ISC", 7 | "dependencies": { 8 | "blakejs": "latest", 9 | "canonical-json": "latest", 10 | "js-yaml": "latest" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /scripts/launch/connect-to-cluster/README.md: -------------------------------------------------------------------------------- 1 | See `docs/how-to/connect-to-cluster.md` 2 | -------------------------------------------------------------------------------- /scripts/launch/daedalus-example.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | SCRIPT=$(readlink -f $0) 4 | SCRIPT_PATH=$(dirname $SCRIPT) 5 | 6 | NODE_TLS_REJECT_UNAUTHORIZED=0 $SCRIPT_PATH/../../daedalus/release/linux-x64/Daedalus-linux-x64/Daedalus 7 | -------------------------------------------------------------------------------- /scripts/launch/demo-with-new-wallet-api.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | base=$(dirname "$0") 4 | 5 | WALLET_EXTRA_ARGS="--new-wallet" WALLET_EXE_NAME='cardano-node' WALLET_TEST=1 "$base"/demo.sh $@ 6 | -------------------------------------------------------------------------------- /scripts/launch/demo-with-wallet-api.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | base=$(dirname "$0") 4 | 5 | WALLET_EXE_NAME='cardano-node' WALLET_TEST=1 "$base"/demo.sh $@ 6 | -------------------------------------------------------------------------------- /scripts/launch/explorer-with-nodes.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | system_start=$((`date +%s` + 15)) 4 | 5 | system_start=$system_start ./scripts/launch/demo.sh & PIDNODE=$! 6 | system_start=$system_start ./scripts/launch/explorer.sh & PIDEX=$! 7 | 8 | wait $PIDEX 9 | wait $PIDNODE 10 | -------------------------------------------------------------------------------- /scripts/launch/kill-demo.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # TODO (akegalj): use `tmux kill-session -t seassion-name` instead 4 | 5 | # Make sure we're in a tmux session. 6 | if ! [ -n "$TMUX" ]; then 7 | echo "There's no tmux session, so you cannot kill demo." 8 | exit 1 9 | fi 10 | 11 | tmux list-windows | \grep demo | awk -F ':' '{ print $1 }' | while read i 12 | do 13 | tmux kill-window -t "$i" 14 | done 15 | -------------------------------------------------------------------------------- /scripts/launch/ui-simulator.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | _ppid=$PPID 4 | 5 | echo "My pid $$, PPID=$PPID" 6 | 7 | if [[ "$1" == "" ]]; then 8 | v=$(uxterm -e "$(pwd)/$0 --" || echo bla) 9 | case $v in 10 | bla) 11 | echo "Update started" 12 | curl -X POST -kv https://127.0.0.1:8090/api/update/apply 13 | sleep 1s 14 | exit 20 15 | ;; 16 | *) 17 | echo "Normal exit" 18 | ;; 19 | esac 20 | else 21 | while read l; do 22 | case "$l" in 23 | update) 24 | echo "Starting update.." 25 | sleep 1s 26 | kill -15 $_ppid 27 | ;; 28 | exit) 29 | echo "Exiting.." 30 | sleep 1s 31 | exit 0 32 | ;; 33 | *) 34 | echo "Wrong command! Available: exit update" 35 | esac 36 | done 37 | fi 38 | 39 | -------------------------------------------------------------------------------- /scripts/set_nixpath.sh: -------------------------------------------------------------------------------- 1 | update_NIX_PATH() { 2 | local readlink=$(nix-instantiate --eval -E "/. + (import ).coreutils")/readlink 3 | local scriptDir=$(dirname -- "$($readlink -f -- "${BASH_SOURCE[0]}")") 4 | export NIX_PATH="nixpkgs=$(nix-build "${scriptDir}/../fetch-nixpkgs.nix" --no-out-link)" 5 | } 6 | update_NIX_PATH 7 | -------------------------------------------------------------------------------- /scripts/test/wallet/integration/build-test.nix: -------------------------------------------------------------------------------- 1 | {pkgs, stdenv, walletIntegrationTests }: 2 | stdenv.mkDerivation rec { 3 | name = "cardano-wallet-integration-tests"; 4 | buildInputs = with pkgs; [ jq curl ]; 5 | buildCommand = '' 6 | ${walletIntegrationTests} 7 | if [ $? == 0 ] 8 | then 9 | echo $? > $out 10 | fi 11 | ''; 12 | 13 | } 14 | -------------------------------------------------------------------------------- /scripts/test/wallet/multi-integration.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # This script can be run from ./cardano-sl in order to 4 | # run integration.sh for 100x times. If test integration 5 | # exited with failure, it will output its log into ./cardano-sl/integration-logs/run- 6 | 7 | rm -rf integration-logs 8 | mkdir integration-logs 9 | 10 | for i in {1..100} 11 | do 12 | echo "Running test $i... " 13 | ./scripts/test/wallet/integration.sh $1 &> integration-logs/run-$i 14 | done 15 | -------------------------------------------------------------------------------- /secrets/mainnet-staging-short-epoch/generated-keys/dlg-issuers/key0.sk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/input-output-hk/project-icarus-importer/36342f277bcb7f1902e677a02d1ce93e4cf224f0/secrets/mainnet-staging-short-epoch/generated-keys/dlg-issuers/key0.sk -------------------------------------------------------------------------------- /secrets/mainnet-staging-short-epoch/generated-keys/dlg-issuers/key1.sk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/input-output-hk/project-icarus-importer/36342f277bcb7f1902e677a02d1ce93e4cf224f0/secrets/mainnet-staging-short-epoch/generated-keys/dlg-issuers/key1.sk -------------------------------------------------------------------------------- /secrets/mainnet-staging-short-epoch/generated-keys/dlg-issuers/key2.sk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/input-output-hk/project-icarus-importer/36342f277bcb7f1902e677a02d1ce93e4cf224f0/secrets/mainnet-staging-short-epoch/generated-keys/dlg-issuers/key2.sk -------------------------------------------------------------------------------- /secrets/mainnet-staging-short-epoch/generated-keys/rich/key0.sk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/input-output-hk/project-icarus-importer/36342f277bcb7f1902e677a02d1ce93e4cf224f0/secrets/mainnet-staging-short-epoch/generated-keys/rich/key0.sk -------------------------------------------------------------------------------- /secrets/mainnet-staging-short-epoch/generated-keys/rich/key1.sk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/input-output-hk/project-icarus-importer/36342f277bcb7f1902e677a02d1ce93e4cf224f0/secrets/mainnet-staging-short-epoch/generated-keys/rich/key1.sk -------------------------------------------------------------------------------- /secrets/mainnet-staging-short-epoch/generated-keys/rich/key2.sk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/input-output-hk/project-icarus-importer/36342f277bcb7f1902e677a02d1ce93e4cf224f0/secrets/mainnet-staging-short-epoch/generated-keys/rich/key2.sk -------------------------------------------------------------------------------- /secrets/mainnet-staging-short-epoch/keys-fakeavvm/fake-0.seed: -------------------------------------------------------------------------------- 1 | n0RTZ0VtVhkxSkKj2oawAZR6/lmcK6mceaY0fjsiblo= -------------------------------------------------------------------------------- /secrets/mainnet-staging-short-epoch/keys-fakeavvm/fake-1.seed: -------------------------------------------------------------------------------- 1 | iFTo/8yiCxcwMLT6wrMWecAlsKyUjYgL7hcdAJrsGfY= -------------------------------------------------------------------------------- /secrets/mainnet-staging-short-epoch/keys-fakeavvm/fake-2.seed: -------------------------------------------------------------------------------- 1 | PWYWkB2soOIaeuPYAvfwm+iTV9JWbepHvwbnxskonrs= -------------------------------------------------------------------------------- /secrets/mainnet-staging-short-epoch/keys-fakeavvm/fake-3.seed: -------------------------------------------------------------------------------- 1 | giT+GyIpG6JHTxPvobyxyuXgXfuA6PIuEhkamt1+CjY= -------------------------------------------------------------------------------- /secrets/mainnet-staging-short-epoch/keys-fakeavvm/fake-4.seed: -------------------------------------------------------------------------------- 1 | VhSBqqHWINMD55PYXN4Cxyg8vBw2GTjCkTxrgP2Pwr4= -------------------------------------------------------------------------------- /shell.nix: -------------------------------------------------------------------------------- 1 | with import ((import ./lib.nix).fetchNixPkgs) { }; 2 | 3 | let 4 | hsPkgs = haskell.packages.ghc802; 5 | in 6 | haskell.lib.buildStackProject { 7 | name = "cardano-sl"; 8 | ghc = hsPkgs.ghc; 9 | buildInputs = [ 10 | zlib openssh autoreconfHook openssl 11 | gmp rocksdb git bsdiff ncurses 12 | hsPkgs.happy hsPkgs.cpphs lzma 13 | # cabal-install and stack pull in lots of dependencies on OSX so skip them 14 | # See https://github.com/NixOS/nixpkgs/issues/21200 15 | ] ++ (lib.optionals stdenv.isLinux [ cabal-install stack ]) 16 | ++ (lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ Cocoa CoreServices libcxx libiconv ])); 17 | } 18 | -------------------------------------------------------------------------------- /ssc/Pos/Binary/Ssc.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_GHC -Wno-unused-imports #-} 2 | {-# OPTIONS_GHC -Wno-dodgy-exports #-} 3 | 4 | module Pos.Binary.Ssc 5 | ( module Pos.Binary.Ssc.Relay 6 | , module Pos.Binary.Ssc.Toss 7 | , module Pos.Binary.Ssc.Types 8 | ) where 9 | 10 | import Pos.Binary.Ssc.Relay 11 | import Pos.Binary.Ssc.Toss 12 | import Pos.Binary.Ssc.Types () 13 | 14 | -------------------------------------------------------------------------------- /ssc/Pos/Ssc/Error.hs: -------------------------------------------------------------------------------- 1 | module Pos.Ssc.Error 2 | ( module Pos.Ssc.Error.Seed 3 | , module Pos.Ssc.Error.Verify 4 | ) where 5 | 6 | import Pos.Ssc.Error.Seed 7 | import Pos.Ssc.Error.Verify -------------------------------------------------------------------------------- /ssc/Pos/Ssc/Logic.hs: -------------------------------------------------------------------------------- 1 | module Pos.Ssc.Logic 2 | ( module Pos.Ssc.Logic.Global 3 | , module Pos.Ssc.Logic.Local 4 | , module Pos.Ssc.Logic.VAR 5 | ) where 6 | 7 | import Pos.Ssc.Logic.Global 8 | import Pos.Ssc.Logic.Local 9 | import Pos.Ssc.Logic.VAR -------------------------------------------------------------------------------- /ssc/Pos/Ssc/Toss.hs: -------------------------------------------------------------------------------- 1 | -- | Toss abstraction and logic. 2 | module Pos.Ssc.Toss 3 | ( module Pos.Ssc.Toss.Base 4 | , module Pos.Ssc.Toss.Class 5 | , module Pos.Ssc.Toss.Logic 6 | , module Pos.Ssc.Toss.Pure 7 | , module Pos.Ssc.Toss.Trans 8 | , module Pos.Ssc.Toss.Types 9 | ) where 10 | 11 | import Pos.Ssc.Toss.Base 12 | import Pos.Ssc.Toss.Class 13 | import Pos.Ssc.Toss.Logic 14 | import Pos.Ssc.Toss.Pure 15 | import Pos.Ssc.Toss.Trans 16 | import Pos.Ssc.Toss.Types 17 | import Pos.Binary.Ssc.Toss () 18 | 19 | -------------------------------------------------------------------------------- /ssc/README.md: -------------------------------------------------------------------------------- 1 | # cardano-sl-ssc 2 | 3 | A library to do the Shared Seed Computation (SSC) required for selection of 4 | slot leaders in the [Ouroborous] Proof-of-Stake protocol for Cardano SL. 5 | 6 | Code in this library types and functions for: 7 | 8 | * Generating random seeds 9 | * Communicating SSC state (using SSC specific messaging protocols) to other nodes 10 | in the network. 11 | * Storing and retrieving SSC state from the database. 12 | * Interacting with the LRC (Leaders and Richment Computation) 13 | * Ability to ignore network addresses and public key addresses which are thought 14 | to be attacking the Cardano network at the Proof-of-Stake protocol level. 15 | 16 | [Ouroborous]: https://eprint.iacr.org/2016/889.pdf 17 | -------------------------------------------------------------------------------- /ssc/Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /tools/README.md: -------------------------------------------------------------------------------- 1 | # cardano-sl-tools 2 | 3 | A collection of tools for interacting with the Cardano SL network. The tools 4 | include: 5 | 6 | * `cardano-dht-keygen` - Generate a DHT key. 7 | * `cardano-genupdate` - Generate an update for the Cardano SL network. 8 | * `cardano-keygen` - Generate keyfiles for the Cardano SL network. 9 | * `cardano-launcher` - A program that launches the Cardano SL code and the Daedalus 10 | wallet. 11 | * `cardano-addr-convert` - A tool to convert vending addresses between mainnet and 12 | testnet address format. 13 | * `cardano-cli-docs` - A tool to generate markdown documentation for Cardano SL 14 | executables. 15 | * `cardano-post-mortem` - Analyzes JSON logs. 16 | * `cardano-blockchain-analyser` - A tool to analyze a blockchain and spit out useful 17 | metrics. 18 | -------------------------------------------------------------------------------- /tools/src/dbgen/QueryMethods.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE GADTs #-} 2 | {-# LANGUAGE RankNTypes #-} 3 | 4 | module QueryMethods where 5 | 6 | import Universum 7 | 8 | import Pos.Wallet.Web.Methods.Logic (getWallets) 9 | import Text.Printf (printf) 10 | 11 | import Lib (timed) 12 | import Rendering (say) 13 | import Types (Method (..), UberMonad) 14 | 15 | queryMethods :: Maybe Method -> UberMonad () 16 | queryMethods Nothing = say "No valid method read from the CLI." 17 | queryMethods (Just method) = case method of 18 | GetWallets -> queryGetWallets 19 | 20 | 21 | queryGetWallets :: UberMonad () 22 | queryGetWallets = do 23 | wallets <- timed getWallets 24 | case wallets of 25 | [] -> say "No wallets returned." 26 | _ -> say $ printf "%d wallets found." (length wallets) 27 | 28 | -------------------------------------------------------------------------------- /tools/src/dbgen/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE GADTs #-} 3 | {-# LANGUAGE RankNTypes #-} 4 | 5 | module Types where 6 | 7 | import Universum 8 | 9 | import Data.Map (Map) 10 | import Pos.Wallet.Web.Mode (MonadWalletWebMode, WalletWebMode) 11 | 12 | type UberMonad a = forall ctx. MonadWalletWebMode ctx WalletWebMode => WalletWebMode a 13 | 14 | data Method = GetWallets 15 | deriving (Show, Read) 16 | 17 | type Methods = MonadWalletWebMode () WalletWebMode => Map Method (WalletWebMode ()) 18 | -------------------------------------------------------------------------------- /tools/src/dbgen/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "wallets":1, 3 | "walletSpec":{ 4 | "accounts":1, 5 | "accountSpec":{"addresses":100}, 6 | "fakeUtxoCoinDistr":{"type":"range","range":100,"amount":1000}, 7 | "fakeTxsHistory":{"type":"simple","txsCount":10015,"numOutgoingAddress":3} 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /tools/src/post-mortem/Types.hs: -------------------------------------------------------------------------------- 1 | module Types 2 | ( TxHash 3 | , BlockHash 4 | , Timestamp 5 | , Slot 6 | , NodeId 7 | ) where 8 | 9 | import Data.Time.Units (Microsecond) 10 | import Universum 11 | 12 | type TxHash = Text 13 | type BlockHash = Text 14 | type Timestamp = Microsecond 15 | type Slot = (Word64, Word16) 16 | type NodeId = Text 17 | -------------------------------------------------------------------------------- /tools/src/post-mortem/Util/Aeson.hs: -------------------------------------------------------------------------------- 1 | module Util.Aeson 2 | ( parseJSONP 3 | ) where 4 | 5 | import Data.Aeson (FromJSON, Result (..), fromJSON) 6 | import Data.Aeson.Parser (json) 7 | import Pipes 8 | import Pipes.Prelude (map) 9 | 10 | import Universum hiding (map) 11 | import Util.Pipes (parseP) 12 | 13 | parseJSONP:: (FromJSON a, Monad m) => Pipe ByteString a m b 14 | parseJSONP = parseP json >-> map (fromResult . fromJSON) 15 | where 16 | fromResult :: Result a -> a 17 | fromResult (Success a) = a 18 | fromResult (Error e) = error $ toText e 19 | -------------------------------------------------------------------------------- /tools/src/post-mortem/Util/Safe.hs: -------------------------------------------------------------------------------- 1 | module Util.Safe 2 | ( runWithFiles 3 | ) where 4 | 5 | import Pipes.Safe (runSafeT) 6 | import Pipes.Safe.Prelude (withFile) 7 | 8 | import Universum hiding (withFile) 9 | 10 | runWithFile :: (MonadIO m, MonadMask m) => FilePath -> IOMode -> (Handle -> m r) -> m r 11 | runWithFile fp mode f = runSafeT $ withFile fp mode $ lift . f 12 | 13 | runWithFiles :: (MonadIO m, MonadMask m) => [(a, FilePath)] -> IOMode -> ([(a, Handle)]-> m r) -> m r 14 | runWithFiles [] _ f = f [] 15 | runWithFiles ((a, fp) : xs) mode f = runWithFile fp mode $ \h -> 16 | runWithFiles xs mode $ \ys -> f $ (a, h) : ys 17 | -------------------------------------------------------------------------------- /tools/test/Spec.hs: -------------------------------------------------------------------------------- 1 | module Spec (spec) where 2 | 3 | import Test.Hspec 4 | 5 | import qualified Test.Launcher.Environment 6 | 7 | spec :: Spec 8 | spec = Test.Launcher.Environment.spec 9 | -------------------------------------------------------------------------------- /tools/test/Test.hs: -------------------------------------------------------------------------------- 1 | import Test.Hspec (hspec) 2 | 3 | import Spec (spec) 4 | 5 | main :: IO () 6 | main = hspec spec 7 | -------------------------------------------------------------------------------- /txp/Pos/Arbitrary/Txp/Network.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE TemplateHaskell #-} 2 | 3 | -- | 'Arbitrary' instances for 'Pos.Txp.Network' types defined in 'src' 4 | 5 | module Pos.Arbitrary.Txp.Network () where 6 | 7 | import Universum 8 | 9 | import Test.QuickCheck (Arbitrary (..)) 10 | import Test.QuickCheck.Arbitrary.Generic (genericArbitrary, genericShrink) 11 | 12 | import Pos.Arbitrary.Txp () 13 | import Pos.Communication.Types.Relay (DataMsg (..)) 14 | import Pos.Core (HasProtocolMagic) 15 | import Pos.Txp.Network.Types (TxMsgContents (..)) 16 | 17 | instance HasProtocolMagic => Arbitrary TxMsgContents where 18 | arbitrary = genericArbitrary 19 | shrink = genericShrink 20 | 21 | instance HasProtocolMagic => Arbitrary (DataMsg TxMsgContents) where 22 | arbitrary = DataMsg <$> arbitrary 23 | shrink = genericShrink 24 | -------------------------------------------------------------------------------- /txp/Pos/Arbitrary/Txp/Unsafe.hs: -------------------------------------------------------------------------------- 1 | -- | 'Arbitrary' unsafe instances for some types from Txp types 2 | 3 | module Pos.Arbitrary.Txp.Unsafe () where 4 | 5 | import Universum 6 | 7 | import Pos.Arbitrary.Core.Unsafe () 8 | import Pos.Core.Txp (TxOut (..)) 9 | 10 | import Test.Pos.Util.QuickCheck.Arbitrary (ArbitraryUnsafe (..)) 11 | 12 | instance ArbitraryUnsafe TxOut where 13 | arbitraryUnsafe = TxOut <$> arbitraryUnsafe <*> arbitraryUnsafe 14 | -------------------------------------------------------------------------------- /txp/Pos/Binary/Txp.hs: -------------------------------------------------------------------------------- 1 | -- | Binary serialization of Txp types. 2 | {-# OPTIONS_GHC -Wno-unused-imports #-} 3 | {-# OPTIONS_GHC -Wno-dodgy-exports #-} 4 | 5 | module Pos.Binary.Txp 6 | ( module Pos.Binary.Txp.Network 7 | ) where 8 | 9 | import Pos.Binary.Txp.Network 10 | -------------------------------------------------------------------------------- /txp/Pos/Binary/Txp/Network.hs: -------------------------------------------------------------------------------- 1 | -- | Binary serialization of network Txp types. 2 | 3 | module Pos.Binary.Txp.Network 4 | ( 5 | ) where 6 | 7 | import Universum 8 | 9 | import Pos.Binary.Class (Bi (..)) 10 | import Pos.Communication.Types.Relay (DataMsg (..)) 11 | import Pos.Txp.Network.Types (TxMsgContents (..)) 12 | 13 | ---------------------------------------------------------------------------- 14 | -- Network 15 | ---------------------------------------------------------------------------- 16 | 17 | instance Bi (DataMsg TxMsgContents) where 18 | encode (DataMsg (TxMsgContents txAux)) = encode txAux 19 | decode = DataMsg <$> (TxMsgContents <$> decode) 20 | -------------------------------------------------------------------------------- /txp/Pos/Txp/DB.hs: -------------------------------------------------------------------------------- 1 | -- | Txp-related part of GState DB. 2 | 3 | module Pos.Txp.DB 4 | ( module Pos.Txp.DB.Stakes 5 | , module Pos.Txp.DB.Utxo 6 | ) where 7 | 8 | import Pos.Txp.DB.Stakes 9 | import Pos.Txp.DB.Utxo 10 | -------------------------------------------------------------------------------- /txp/Pos/Txp/Error.hs: -------------------------------------------------------------------------------- 1 | -- | Types describing runtime errors related to Txp. 2 | 3 | module Pos.Txp.Error 4 | ( TxpError (..) 5 | ) where 6 | 7 | import Control.Exception.Safe (Exception (..)) 8 | import qualified Data.Text.Buildable 9 | import Formatting (bprint, stext, (%)) 10 | import Universum 11 | 12 | import Pos.Exception (cardanoExceptionFromException, cardanoExceptionToException) 13 | 14 | data TxpError 15 | = TxpInternalError !Text 16 | -- ^ Something bad happened inside Txp 17 | deriving (Show) 18 | 19 | instance Exception TxpError where 20 | toException = cardanoExceptionToException 21 | fromException = cardanoExceptionFromException 22 | displayException = toString . pretty 23 | 24 | instance Buildable TxpError where 25 | build (TxpInternalError msg) = 26 | bprint ("internal error in Transaction processing: "%stext) msg 27 | -------------------------------------------------------------------------------- /txp/Pos/Txp/Logic.hs: -------------------------------------------------------------------------------- 1 | -- | Impure logic of Txp. 2 | 3 | module Pos.Txp.Logic 4 | ( module Pos.Txp.Logic.Common 5 | , module Pos.Txp.Logic.Global 6 | , module Pos.Txp.Logic.Local 7 | ) where 8 | 9 | import Pos.Txp.Logic.Common 10 | import Pos.Txp.Logic.Global 11 | import Pos.Txp.Logic.Local 12 | 13 | -------------------------------------------------------------------------------- /txp/Pos/Txp/MemState.hs: -------------------------------------------------------------------------------- 1 | -- Pos.Txp.Memstate 2 | module Pos.Txp.MemState 3 | ( module Pos.Txp.MemState.Class 4 | , module Pos.Txp.MemState.Holder 5 | , module Pos.Txp.MemState.Metrics 6 | , module Pos.Txp.MemState.Types 7 | ) where 8 | 9 | import Pos.Txp.MemState.Class 10 | import Pos.Txp.MemState.Holder 11 | import Pos.Txp.MemState.Metrics 12 | import Pos.Txp.MemState.Types -------------------------------------------------------------------------------- /txp/Pos/Txp/Network.hs: -------------------------------------------------------------------------------- 1 | -- | Txp communication layer re-exports. 2 | 3 | module Pos.Txp.Network 4 | ( module Pos.Txp.Network.Types 5 | , module Pos.Txp.Network.Listeners 6 | ) where 7 | 8 | import Pos.Arbitrary.Txp.Network () 9 | import Pos.Txp.Network.Types 10 | import Pos.Txp.Network.Listeners 11 | -------------------------------------------------------------------------------- /txp/Pos/Txp/Network/Types.hs: -------------------------------------------------------------------------------- 1 | -- | Types used for communication about transactions. 2 | 3 | module Pos.Txp.Network.Types 4 | ( TxMsgContents (..) 5 | ) where 6 | 7 | import qualified Data.Text.Buildable as Buildable 8 | import Formatting (bprint, (%)) 9 | import Universum 10 | 11 | import Pos.Binary.Core () 12 | import Pos.Core.Txp (TxAux (..), txaF) 13 | 14 | -- | Data message. Can be used to send one transaction per message. 15 | -- Transaction is sent with auxilary data. 16 | newtype TxMsgContents = TxMsgContents 17 | { getTxMsgContents :: TxAux 18 | } deriving (Generic, Show, Eq) 19 | 20 | instance Buildable TxMsgContents where 21 | build (TxMsgContents txAux) = 22 | bprint ("TxMsgContents { txAux ="%txaF%", .. }") txAux 23 | -------------------------------------------------------------------------------- /txp/Pos/Txp/Settings.hs: -------------------------------------------------------------------------------- 1 | -- | Txp settings which allow customiization of Txp behavior. 2 | 3 | module Pos.Txp.Settings 4 | ( module Pos.Txp.Settings.Global 5 | ) where 6 | 7 | import Pos.Txp.Settings.Global 8 | -------------------------------------------------------------------------------- /txp/Pos/Txp/Toil.hs: -------------------------------------------------------------------------------- 1 | -- | Toil is a pure part of transaction processing. 2 | 3 | module Pos.Txp.Toil 4 | ( module Pos.Txp.Toil.Failure 5 | , module Pos.Txp.Toil.Logic 6 | , module Pos.Txp.Toil.Monad 7 | , module Pos.Txp.Toil.Types 8 | , module Pos.Txp.Toil.Utxo 9 | ) where 10 | 11 | import Pos.Txp.Toil.Failure 12 | import Pos.Txp.Toil.Logic 13 | import Pos.Txp.Toil.Monad 14 | import Pos.Txp.Toil.Types 15 | import Pos.Txp.Toil.Utxo 16 | -------------------------------------------------------------------------------- /txp/Pos/Txp/Toil/Utxo.hs: -------------------------------------------------------------------------------- 1 | -- | Utxo functionality re-exports. 2 | 3 | module Pos.Txp.Toil.Utxo 4 | ( module Pos.Txp.Toil.Utxo.Functions 5 | , module Pos.Txp.Toil.Utxo.Util 6 | ) where 7 | 8 | import Pos.Txp.Toil.Utxo.Functions 9 | import Pos.Txp.Toil.Utxo.Util -------------------------------------------------------------------------------- /txp/README.md: -------------------------------------------------------------------------------- 1 | # cardano-sl-txp 2 | 3 | This library implements transaction processing for Cardano SL. It includes: 4 | 5 | * Logic for verifying transactions, applying them the blockchain and rolling 6 | them back. 7 | * Logic for local and global transactions. Global transactions are ones that 8 | have already been added to the blockchain while local ones have not yet been 9 | added. 10 | * A database interface that stores UTXOs and stakes. 11 | * A wrapper over [Plutus], the scripting language used in transactions. 12 | * The mempool which holds the UTXOs (unspent transaction outputs) for a node. 13 | 14 | [Plutus]: https://github.com/input-output-hk/plutus-prototype 15 | -------------------------------------------------------------------------------- /txp/Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /update/Pos/Aeson/Update.hs: -------------------------------------------------------------------------------- 1 | module Pos.Aeson.Update 2 | ( 3 | ) where 4 | 5 | import Data.Aeson (FromJSON (..)) 6 | import Data.Aeson.TH (deriveToJSON) 7 | import Serokell.Aeson.Options (defaultOptions) 8 | import Universum 9 | 10 | import Pos.Core.Update (SystemTag (..)) 11 | 12 | instance FromJSON SystemTag where 13 | parseJSON v = SystemTag <$> parseJSON v 14 | 15 | deriveToJSON defaultOptions ''SystemTag 16 | -------------------------------------------------------------------------------- /update/Pos/Arbitrary/Update.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_GHC -Wno-unused-imports #-} 2 | {-# OPTIONS_GHC -Wno-dodgy-exports #-} 3 | -- | Arbitrary instances for Update System types. 4 | 5 | module Pos.Arbitrary.Update 6 | ( module Pos.Arbitrary.Update.Core 7 | , module Pos.Arbitrary.Update.MemState 8 | , module Pos.Arbitrary.Update.Network 9 | , module Pos.Arbitrary.Update.Poll 10 | ) where 11 | 12 | import Pos.Arbitrary.Update.Core 13 | import Pos.Arbitrary.Update.MemState 14 | import Pos.Arbitrary.Update.Network 15 | import Pos.Arbitrary.Update.Poll 16 | -------------------------------------------------------------------------------- /update/Pos/Arbitrary/Update/MemState.hs: -------------------------------------------------------------------------------- 1 | -- | Arbitrary instances for Update System types 2 | 3 | module Pos.Arbitrary.Update.MemState 4 | ( 5 | ) where 6 | 7 | import Universum 8 | 9 | import Test.QuickCheck (Arbitrary (..)) 10 | 11 | import Pos.Arbitrary.Update.Core () 12 | import Pos.Binary.Class (biSize) 13 | import Pos.Core.Configuration (HasProtocolMagic) 14 | import qualified Pos.Update.MemState as Upd 15 | 16 | import Test.Pos.Crypto.Arbitrary () 17 | 18 | instance HasProtocolMagic => Arbitrary Upd.MemPool where 19 | arbitrary = do 20 | proposals <- arbitrary 21 | votes <- arbitrary 22 | return $ Upd.MemPool proposals votes (biSize proposals + biSize votes) 23 | -------------------------------------------------------------------------------- /update/Pos/Binary/Update.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_GHC -Wno-unused-imports #-} 2 | {-# OPTIONS_GHC -Wno-dodgy-exports #-} 3 | -- | 'Bi' instances for various types from cardano-sl-update. 4 | 5 | module Pos.Binary.Update 6 | ( module Pos.Binary.Update.Poll 7 | , module Pos.Binary.Update.Relay 8 | ) where 9 | 10 | import Pos.Binary.Update.Poll 11 | import Pos.Binary.Update.Relay 12 | -------------------------------------------------------------------------------- /update/Pos/Update/DB/Misc.hs: -------------------------------------------------------------------------------- 1 | -- | Interface for the Misc DB 2 | 3 | module Pos.Update.DB.Misc 4 | ( isUpdateInstalled 5 | , affirmUpdateInstalled 6 | ) where 7 | 8 | import Universum 9 | 10 | import Formatting (sformat) 11 | 12 | import Pos.Binary.Class (Raw) 13 | import Pos.Crypto (Hash, hashHexF) 14 | import Pos.DB.Class (MonadDB) 15 | import Pos.DB.Misc.Common (miscGetBi, miscPutBi) 16 | 17 | isUpdateInstalled :: MonadDB m => Hash Raw -> m Bool 18 | isUpdateInstalled h = isJust <$> miscGetBi @() (updateTrackKey h) 19 | 20 | affirmUpdateInstalled :: MonadDB m => Hash Raw -> m () 21 | affirmUpdateInstalled h = miscPutBi (updateTrackKey h) () 22 | 23 | updateTrackKey :: Hash Raw -> ByteString 24 | updateTrackKey h = "updinst/" <> encodeUtf8 (sformat hashHexF h) 25 | -------------------------------------------------------------------------------- /update/Pos/Update/Logic.hs: -------------------------------------------------------------------------------- 1 | -- | Major logic of Update System (US). 2 | 3 | module Pos.Update.Logic 4 | ( module Pos.Update.Logic.Global 5 | , module Pos.Update.Logic.Local 6 | ) where 7 | 8 | import Pos.Update.Logic.Global 9 | import Pos.Update.Logic.Local 10 | -------------------------------------------------------------------------------- /update/Pos/Update/MemState.hs: -------------------------------------------------------------------------------- 1 | -- | In-memory state of Update System. 2 | 3 | module Pos.Update.MemState 4 | ( module Pos.Update.MemState.Functions 5 | , module Pos.Update.MemState.Types 6 | ) where 7 | 8 | import Pos.Update.MemState.Functions 9 | import Pos.Update.MemState.Types -------------------------------------------------------------------------------- /update/Pos/Update/Network.hs: -------------------------------------------------------------------------------- 1 | -- | Networking part of Update System. 2 | 3 | module Pos.Update.Network 4 | ( module Pos.Update.Network.Listeners 5 | ) where 6 | 7 | import Pos.Update.Network.Listeners -------------------------------------------------------------------------------- /update/Pos/Update/Params.hs: -------------------------------------------------------------------------------- 1 | module Pos.Update.Params 2 | ( UpdateParams(..) 3 | ) where 4 | 5 | import Universum 6 | 7 | data UpdateParams = UpdateParams 8 | { -- | Path to update installer executable, downloaded by update system 9 | upUpdatePath :: !FilePath 10 | , -- | If `True` then use installer update mechanism 11 | upUpdateWithPkg :: !Bool 12 | , -- | List of update server URLs 13 | upUpdateServers :: ![Text] 14 | } 15 | deriving (Show) 16 | -------------------------------------------------------------------------------- /update/Pos/Update/Poll/Logic.hs: -------------------------------------------------------------------------------- 1 | -- | Functions which operate on MonadPoll[Read]. Business logic of 2 | -- Update System. 3 | 4 | module Pos.Update.Poll.Logic 5 | ( verifyAndApplyUSPayload 6 | , rollbackUS 7 | , normalizePoll 8 | , refreshPoll 9 | , filterProposalsByThd 10 | 11 | -- * Base 12 | , canCreateBlockBV 13 | 14 | -- * Softfork resolution 15 | , processGenesisBlock 16 | , recordBlockIssuance 17 | ) where 18 | 19 | import Pos.Update.Poll.Logic.Apply 20 | import Pos.Update.Poll.Logic.Base 21 | import Pos.Update.Poll.Logic.Normalize 22 | import Pos.Update.Poll.Logic.Rollback 23 | import Pos.Update.Poll.Logic.Softfork 24 | -------------------------------------------------------------------------------- /update/README.md: -------------------------------------------------------------------------------- 1 | # cardano-sl-update 2 | 3 | This package contains the code which implements the mechanisms by which the 4 | Cardano SL network proposes software and protocol upgrades, votes on whether 5 | these upgrades should go ahead and applies them when voting has decided in 6 | favour of a proposal. Users of the network vote on proposals weighted by the 7 | amount of stake they hold and these voting rights can be delegated to other 8 | stakeholders. 9 | -------------------------------------------------------------------------------- /update/Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /util/Pos/Util/AssertMode.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CPP #-} 2 | 3 | -- | Ability to do something only in a specific mode (determined at 4 | -- compile-time). 5 | 6 | module Pos.Util.AssertMode 7 | ( inAssertMode 8 | ) where 9 | 10 | import Universum 11 | 12 | -- | This function performs checks at compile-time for different actions. 13 | -- May slowdown implementation. To disable such checks (especially in benchmarks) 14 | -- one should compile with: @stack build --flag cardano-sl-core:-asserts@ 15 | inAssertMode :: Applicative m => m a -> m () 16 | #ifdef ASSERTS_ON 17 | inAssertMode x = x *> pure () 18 | #else 19 | inAssertMode _ = pure () 20 | #endif 21 | {-# INLINE inAssertMode #-} 22 | -------------------------------------------------------------------------------- /util/Pos/Util/LRU.hs: -------------------------------------------------------------------------------- 1 | -- | Some utilities for 'Data.Cache.LRU' (from 'lrucache' package). 2 | 3 | module Pos.Util.LRU 4 | ( clearLRU 5 | , filterLRU 6 | ) where 7 | 8 | import Universum 9 | 10 | import qualified Data.Cache.LRU as LRU 11 | 12 | -- | Remove all items from LRU, retaining maxSize property. 13 | clearLRU :: Ord k => LRU.LRU k v -> LRU.LRU k v 14 | clearLRU = LRU.newLRU . LRU.maxSize 15 | 16 | -- | Filter LRU cache by given predicate. 17 | filterLRU :: Ord k => (v -> Bool) -> LRU.LRU k v -> LRU.LRU k v 18 | filterLRU predicate lru = 19 | LRU.fromList (LRU.maxSize lru) . filter (predicate . snd) . LRU.toList $ lru 20 | -------------------------------------------------------------------------------- /util/Pos/Util/LoggerName.hs: -------------------------------------------------------------------------------- 1 | module Pos.Util.LoggerName 2 | ( LoggerName 3 | , HasLoggerName'(..) 4 | , askLoggerNameDefault 5 | , modifyLoggerNameDefault 6 | ) where 7 | 8 | import Universum 9 | 10 | import System.Wlog (LoggerName) 11 | 12 | class HasLoggerName' ctx where 13 | loggerName :: Lens' ctx LoggerName 14 | 15 | askLoggerNameDefault 16 | :: (MonadReader ctx m, HasLoggerName' ctx) 17 | => m LoggerName 18 | askLoggerNameDefault = view loggerName 19 | 20 | modifyLoggerNameDefault 21 | :: (MonadReader ctx m, HasLoggerName' ctx) 22 | => (LoggerName -> LoggerName) 23 | -> m a 24 | -> m a 25 | modifyLoggerNameDefault f = local (loggerName %~ f) 26 | -------------------------------------------------------------------------------- /util/Pos/Util/OptParse.hs: -------------------------------------------------------------------------------- 1 | module Pos.Util.OptParse 2 | ( fromParsec 3 | ) where 4 | 5 | import Universum 6 | 7 | import Options.Applicative (ReadM, eitherReader) 8 | import Text.Parsec (Parsec, parse) 9 | 10 | fromParsec :: Parsec Text () a -> ReadM a 11 | fromParsec parser = 12 | eitherReader $ first show . parse parser "" . toText 13 | -------------------------------------------------------------------------------- /util/Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /util/test/Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /util/test/Spec.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_GHC -F -pgmF hspec-discover -optF --module-name=Spec #-} 2 | -------------------------------------------------------------------------------- /util/test/Test/Pos.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_GHC -F -pgmF hspec-discover -optF --module-name=Spec #-} 2 | -------------------------------------------------------------------------------- /util/test/Test/Pos/Util/Chrono.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE DeriveTraversable #-} 2 | {-# LANGUAGE TypeFamilies #-} 3 | 4 | -- | Chronological sequences. 5 | 6 | module Test.Pos.Util.Chrono 7 | ( 8 | ) where 9 | 10 | import Pos.Util.Chrono 11 | 12 | import Test.QuickCheck (Arbitrary) 13 | 14 | deriving instance Arbitrary (f a) => Arbitrary (NewestFirst f a) 15 | deriving instance Arbitrary (f a) => Arbitrary (OldestFirst f a) 16 | 17 | -------------------------------------------------------------------------------- /util/test/Test/Pos/Util/Modifier.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE GeneralizedNewtypeDeriving #-} 2 | 3 | module Test.Pos.Util.Modifier where 4 | 5 | import Pos.Util.Modifier 6 | 7 | import Test.QuickCheck (Arbitrary) 8 | import Test.QuickCheck.Instances () 9 | 10 | import Universum 11 | 12 | deriving instance (Eq k, Hashable k, Arbitrary k, Arbitrary v) => 13 | Arbitrary (MapModifier k v) 14 | 15 | -------------------------------------------------------------------------------- /util/test/Test/Pos/Util/QuickCheck.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_GHC -Wno-unused-imports #-} 2 | {-# OPTIONS_GHC -Wno-dodgy-exports #-} 3 | 4 | module Test.Pos.Util.QuickCheck 5 | ( module Test.Pos.Util.QuickCheck.Arbitrary 6 | , module Test.Pos.Util.QuickCheck.Property 7 | ) where 8 | 9 | import Test.Pos.Util.QuickCheck.Arbitrary 10 | import Test.Pos.Util.QuickCheck.Property 11 | -------------------------------------------------------------------------------- /util/test/test.hs: -------------------------------------------------------------------------------- 1 | import Universum 2 | 3 | import Test.Hspec (hspec) 4 | 5 | import Spec (spec) 6 | 7 | main :: IO () 8 | main = 9 | hspec spec 10 | -------------------------------------------------------------------------------- /wallet-new/.gitignore: -------------------------------------------------------------------------------- 1 | .stack-work 2 | .swagger-codegen* 3 | .dir-locals.el 4 | .stylish-haskell.yaml 5 | dist-newstyle 6 | -------------------------------------------------------------------------------- /wallet-new/Makefile: -------------------------------------------------------------------------------- 1 | help: ## Print documentation 2 | @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' 3 | 4 | ghcid: ## Run ghcid with the wallet-new project 5 | ghcid \ 6 | --command "stack ghci cardano-sl-wallet-new --ghci-options=-fno-code" 7 | 8 | ghcid-test: ## Have ghcid run the test suite for the wallet-new-specs on successful recompile 9 | ghcid \ 10 | --command "stack ghci cardano-sl-wallet-new:lib cardano-sl-wallet-new:test:wallet-new-specs --ghci-options=-fobject-code" \ 11 | --test "main" 12 | 13 | .PHONY: ghcid ghcid-test help 14 | -------------------------------------------------------------------------------- /wallet-new/Setup.hs: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env nix-shell 2 | #! nix-shell ./default.nix -i runghc 3 | import Distribution.Simple 4 | main = defaultMain 5 | -------------------------------------------------------------------------------- /wallet-new/bench/Bench/Cardano/Wallet/Config.hs: -------------------------------------------------------------------------------- 1 | -- | Configuration for benchmarking. 2 | 3 | module Bench.Cardano.Wallet.Config 4 | ( module Bench.Cardano.Wallet.Config.CLI 5 | , module Bench.Cardano.Wallet.Config.Endpoints 6 | , module Bench.Cardano.Wallet.Config.Wallets 7 | ) where 8 | 9 | import Bench.Cardano.Wallet.Config.CLI 10 | import Bench.Cardano.Wallet.Config.Endpoints 11 | import Bench.Cardano.Wallet.Config.Wallets -------------------------------------------------------------------------------- /wallet-new/bench/config/Endpoints.csv: -------------------------------------------------------------------------------- 1 | BenchName,NumberOfMeasures,MinDelayBetweenCalls,MaxDelayBetweenCalls,PathToReportFile,PathToResponseReportsFile 2 | GetWalletsBench,10,0.0,0.0,/home/denis/Code/cardano-sl/wallet-new/bench/results/GetWalletsBenchReport.csv,/home/denis/Code/cardano-sl/wallet-new/bench/results/GetWalletsResponseReports.txt 3 | -------------------------------------------------------------------------------- /wallet-new/bench/config/Wallets.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | Wallets: 3 | - 4 | Accounts: 5 | - 6 | Addresses: 7 | - DdzFFzCqrhsxJU8JeDDS7T7rjw4chfMR3p98y89zTNE4gPeyveRccWhJknr5eoeQAqrRjAXNPH5L7q39fFpA8SoETRD8bZn6RSDm2BR4 8 | - DdzFFzCqrhspW7t61NskUMMgVfA4Ru8CwpnpkPumrXiMn6TanduU2tZnc2mE46bsy1sPLScxnqh2KQyYqCHhueY5SVnLsbS1STTYJ5vX 9 | - DdzFFzCqrhsvjq72kpopPyxQzZZDPfnYegbUeQeqX1CHec9dheFK4hTHi331RKE6MDH9FLgNjEjRS8gwyCGjLi9W7zpYmGYzAVnSLMd4 10 | - DdzFFzCqrht6p7oRHgCaXxKsmZwvGN8syWqcyKRpA99AS134N7WgviTSACA4wXdbKpw78DpZcpyyshmvJvt2VBPeBXFGzWzyPykufq5c 11 | - DdzFFzCqrhsjRHnqeMzuyUJVWhv2ebpu1vupamkvfpqizShoRxVBm8FqWff674p115fZUHLFZ9jrBA2edhPnv5KQedQDEBK99NVQdE4t 12 | AccountId: Ae2tdPwUPEZEK5DvxPMtnTnUfQg8coWAAbNfLEvQ4GqWTe9h8d6AEkBDMce@2147483648 13 | WalletId: Ae2tdPwUPEZEK5DvxPMtnTnUfQg8coWAAbNfLEvQ4GqWTe9h8d6AEkBDMce 14 | -------------------------------------------------------------------------------- /wallet-new/bench/report/pdf/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | pandoc --pdf-engine=xelatex \ 4 | --template=template.tex \ 5 | -o report.pdf \ 6 | ../report.md 7 | -------------------------------------------------------------------------------- /wallet-new/bench/report/pdf/report.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/input-output-hk/project-icarus-importer/36342f277bcb7f1902e677a02d1ce93e4cf224f0/wallet-new/bench/report/pdf/report.pdf -------------------------------------------------------------------------------- /wallet-new/bench/results/.empty: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/input-output-hk/project-icarus-importer/36342f277bcb7f1902e677a02d1ce93e4cf224f0/wallet-new/bench/results/.empty -------------------------------------------------------------------------------- /wallet-new/default.nix: -------------------------------------------------------------------------------- 1 | # Running `nix-shell` on this file puts you in an environment where all the 2 | # dependencies needed to work on `wallet-new` using `Cabal` are available. 3 | # 4 | # Running `nix-build` builds the `wallet-new` code. 5 | let 6 | drv = (import ../. {}).cardano-sl-wallet-new; 7 | in 8 | if ((import {}).stdenv.lib.inNixShell) 9 | then drv.env 10 | else drv 11 | -------------------------------------------------------------------------------- /wallet-new/docs/.gitignore: -------------------------------------------------------------------------------- 1 | *.aux 2 | *.bbl 3 | *.blg 4 | *.lof 5 | *.log 6 | *.pdf 7 | *.toc 8 | *.out 9 | -------------------------------------------------------------------------------- /wallet-new/docs/spec.dict: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/input-output-hk/project-icarus-importer/36342f277bcb7f1902e677a02d1ce93e4cf224f0/wallet-new/docs/spec.dict -------------------------------------------------------------------------------- /wallet-new/src/Cardano/Wallet/API/Development/Handlers.hs: -------------------------------------------------------------------------------- 1 | module Cardano.Wallet.API.Development.Handlers 2 | ( handlers 3 | ) where 4 | 5 | import Universum 6 | 7 | import Cardano.Wallet.Server.CLI (RunMode (..)) 8 | 9 | import Servant 10 | 11 | import qualified Cardano.Wallet.API.Development as Dev 12 | 13 | -- TODO: Add handlers for new wallet 14 | handlers :: RunMode -> Server Dev.API 15 | handlers _ = error "TODO" 16 | -------------------------------------------------------------------------------- /wallet-new/src/Cardano/Wallet/API/Development/Helpers.hs: -------------------------------------------------------------------------------- 1 | module Cardano.Wallet.API.Development.Helpers where 2 | 3 | import Universum 4 | 5 | import Cardano.Wallet.Server.CLI (RunMode (..), isDebugMode) 6 | import Servant (err403) 7 | 8 | 9 | developmentOnly :: MonadThrow m => RunMode -> m a -> m a 10 | developmentOnly runMode api 11 | | isDebugMode runMode = api 12 | | otherwise = throwM err403 13 | -------------------------------------------------------------------------------- /wallet-new/src/Cardano/Wallet/API/Request/Parameters.hs: -------------------------------------------------------------------------------- 1 | -- | Enlists names of request parameters. 2 | -- To import only in /qualified/ way. 3 | 4 | module Cardano.Wallet.API.Request.Parameters where 5 | 6 | type Id = "id" 7 | 8 | type WalletId = "wallet_id" 9 | type CreatedAt = "created_at" 10 | type Balance = "balance" 11 | 12 | 13 | -------------------------------------------------------------------------------- /wallet-new/src/Cardano/Wallet/API/Types/UnitOfMeasure.hs: -------------------------------------------------------------------------------- 1 | 2 | module Cardano.Wallet.API.Types.UnitOfMeasure where 3 | 4 | import Universum 5 | 6 | -- | A finite sum type representing time units we might want to show to 7 | -- clients. The idea is that whenever we have a quantity represeting some 8 | -- form of time, we should render it together with the relevant unit, to 9 | -- not leave anything to guessing. 10 | data UnitOfMeasure = 11 | Seconds 12 | | Milliseconds 13 | | Microseconds 14 | -- | % ranging from 0 to 100. 15 | | Percentage100 16 | -- | Number of blocks. 17 | | Blocks 18 | -- | Number of blocks per second. 19 | | BlocksPerSecond 20 | deriving (Show, Eq) 21 | 22 | data MeasuredIn (a :: UnitOfMeasure) b = MeasuredIn b deriving (Eq, Show) 23 | -------------------------------------------------------------------------------- /wallet-new/src/Cardano/Wallet/API/V0.hs: -------------------------------------------------------------------------------- 1 | module Cardano.Wallet.API.V0 where 2 | 3 | import Cardano.Wallet.API.Types 4 | import Servant ((:>)) 5 | 6 | import qualified Pos.Wallet.Web.Api as V0 7 | 8 | -- | "Mount" the legacy API here. 9 | type API = Tags '["V0 (Deprecated)"] :> V0.WalletApiNoPrefix 10 | -------------------------------------------------------------------------------- /wallet-new/src/Cardano/Wallet/API/V0/Types.hs: -------------------------------------------------------------------------------- 1 | 2 | module Cardano.Wallet.API.V0.Types where 3 | -------------------------------------------------------------------------------- /wallet-new/src/Cardano/Wallet/API/V1.hs: -------------------------------------------------------------------------------- 1 | module Cardano.Wallet.API.V1 where 2 | 3 | 4 | import Servant ((:<|>)) 5 | 6 | import qualified Cardano.Wallet.API.V1.Accounts as Accounts 7 | import qualified Cardano.Wallet.API.V1.Addresses as Addresses 8 | import qualified Cardano.Wallet.API.V1.Info as Info 9 | import qualified Cardano.Wallet.API.V1.Settings as Settings 10 | import qualified Cardano.Wallet.API.V1.Transactions as Transactions 11 | import qualified Cardano.Wallet.API.V1.Wallets as Wallets 12 | 13 | type API = Addresses.API 14 | :<|> Wallets.API 15 | :<|> Accounts.API 16 | :<|> Transactions.API 17 | :<|> Settings.API 18 | :<|> Info.API 19 | -------------------------------------------------------------------------------- /wallet-new/src/Cardano/Wallet/API/V1/Handlers.hs: -------------------------------------------------------------------------------- 1 | module Cardano.Wallet.API.V1.Handlers (handlers) where 2 | 3 | import Universum 4 | import Servant 5 | 6 | import Cardano.Wallet.WalletLayer (ActiveWalletLayer) 7 | import qualified Cardano.Wallet.API.V1 as V1 8 | 9 | handlers :: forall m. ActiveWalletLayer m -> Server V1.API 10 | handlers _w = error "TODO" 11 | -------------------------------------------------------------------------------- /wallet-new/src/Cardano/Wallet/API/V1/Info.hs: -------------------------------------------------------------------------------- 1 | module Cardano.Wallet.API.V1.Info where 2 | 3 | import Cardano.Wallet.API.Response (ValidJSON, WalletResponse) 4 | import Cardano.Wallet.API.Types 5 | import Cardano.Wallet.API.V1.Types 6 | 7 | import Servant 8 | 9 | type API = Tags '["Info"] :> 10 | ( "node-info" :> Summary "Retrieves the dynamic information for this node." 11 | :> Get '[ValidJSON] (WalletResponse NodeInfo) 12 | ) 13 | -------------------------------------------------------------------------------- /wallet-new/src/Cardano/Wallet/API/V1/Settings.hs: -------------------------------------------------------------------------------- 1 | module Cardano.Wallet.API.V1.Settings where 2 | 3 | import Cardano.Wallet.API.Response (ValidJSON, WalletResponse) 4 | import Cardano.Wallet.API.Types 5 | import Cardano.Wallet.API.V1.Types 6 | 7 | import Servant 8 | 9 | type API = Tags '["Settings"] :> 10 | ( "node-settings" :> Summary "Retrieves the static settings for this node." 11 | :> Get '[ValidJSON] (WalletResponse NodeSettings) 12 | ) 13 | -------------------------------------------------------------------------------- /wallet-new/src/Cardano/Wallet/Kernel/DB/HdWallet/Delete.hs: -------------------------------------------------------------------------------- 1 | -- | DELETE operatiosn on HD wallets 2 | module Cardano.Wallet.Kernel.DB.HdWallet.Delete ( 3 | deleteHdRoot 4 | , deleteHdAccount 5 | ) where 6 | 7 | import Universum 8 | 9 | import Control.Lens (at, (.=)) 10 | 11 | import Cardano.Wallet.Kernel.DB.HdWallet 12 | import Cardano.Wallet.Kernel.DB.Util.AcidState 13 | 14 | {------------------------------------------------------------------------------- 15 | DELETE 16 | -------------------------------------------------------------------------------} 17 | 18 | -- | Delete a wallet 19 | deleteHdRoot :: HdRootId -> Update' HdWallets e () 20 | deleteHdRoot rootId = zoom hdWalletsRoots $ at rootId .= Nothing 21 | 22 | -- | Delete an account 23 | deleteHdAccount :: HdAccountId -> Update' HdWallets UnknownHdRoot () 24 | deleteHdAccount accId = zoom hdWalletsAccounts $ at accId .= Nothing 25 | -------------------------------------------------------------------------------- /wallet-new/src/Cardano/Wallet/Orphans.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_GHC -fno-warn-orphans #-} 2 | 3 | {- | 4 | An orphanage for all the non-interesting orphan instances. 5 | -} 6 | 7 | module Cardano.Wallet.Orphans where 8 | -------------------------------------------------------------------------------- /wallet-new/src/Cardano/Wallet/Orphans/Aeson.hs: -------------------------------------------------------------------------------- 1 | {- | Aeson Orphans. |-} 2 | 3 | {-# OPTIONS_GHC -fno-warn-orphans #-} 4 | module Cardano.Wallet.Orphans.Aeson where 5 | 6 | import Data.Aeson (ToJSON (..)) 7 | import Pos.Wallet.Web.ClientTypes.Types (CFilePath (..)) 8 | 9 | instance ToJSON CFilePath where 10 | toJSON (CFilePath c) = toJSON c 11 | 12 | -------------------------------------------------------------------------------- /wallet-new/src/Cardano/Wallet/Orphans/Bi.hs: -------------------------------------------------------------------------------- 1 | {- | Serialisation Orphans -} 2 | {-# OPTIONS_GHC -fno-warn-orphans #-} 3 | module Cardano.Wallet.Orphans.Bi where 4 | -------------------------------------------------------------------------------- /wallet-new/src/Cardano/Wallet/TypeLits.hs: -------------------------------------------------------------------------------- 1 | 2 | module Cardano.Wallet.TypeLits where 3 | 4 | import Universum 5 | 6 | import GHC.TypeLits (KnownSymbol, Symbol, symbolVal) 7 | 8 | -- | Shamelessly copied from: 9 | -- 10 | -- The idea is to extend `KnownSymbol` to a type-level list, so that it's possibly to reify at the value-level 11 | -- a `'[Symbol]` into a `[String]`. 12 | class KnownSymbols (xs :: [Symbol]) where 13 | symbolVals :: proxy xs -> [String] 14 | 15 | instance KnownSymbols ('[]) where 16 | symbolVals _ = [] 17 | 18 | instance (KnownSymbol a, KnownSymbols as) => KnownSymbols (a ': as) where 19 | symbolVals _ = 20 | symbolVal (Proxy :: Proxy a) : symbolVals (Proxy :: Proxy as) 21 | -------------------------------------------------------------------------------- /wallet-new/test/golden/api-layout.txt: -------------------------------------------------------------------------------- 1 | / 2 | ├─ addresses/ 3 | │ ├─• 4 | │ ┆ 5 | │ ├─• 6 | │ ┆ 7 | │ ┆ 8 | │ └─ / 9 | │ └─• 10 | ├─ node-info/ 11 | │ └─• 12 | ├─ node-settings/ 13 | │ └─• 14 | ├─ transactions/ 15 | │ ├─ fees/ 16 | │ │ └─• 17 | │ ├─• 18 | │ ┆ 19 | │ └─• 20 | └─ wallets/ 21 | ├─• 22 | ┆ 23 | ├─• 24 | ┆ 25 | ┆ 26 | ├─ / 27 | │ ├─ password/ 28 | │ │ └─• 29 | │ ├─• 30 | │ ┆ 31 | │ ├─• 32 | │ ┆ 33 | │ └─• 34 | ┆ 35 | └─ / 36 | └─ accounts/ 37 | ├─ / 38 | │ ├─• 39 | │ ┆ 40 | │ └─• 41 | ┆ 42 | ├─• 43 | ┆ 44 | ├─• 45 | ┆ 46 | ┆ 47 | └─ / 48 | └─• 49 | -------------------------------------------------------------------------------- /wallet-new/test/unit/Util/Buildable.hs: -------------------------------------------------------------------------------- 1 | -- | Utilities for dealing with 'Buildable' 2 | module Util.Buildable ( 3 | ShowThroughBuild(..) 4 | ) where 5 | 6 | import Formatting (build, sformat) 7 | import Prelude (Show (..)) 8 | import Universum 9 | 10 | newtype ShowThroughBuild a = STB { unSTB :: a } 11 | deriving (Eq) 12 | 13 | instance Buildable a => Show (ShowThroughBuild a) where 14 | show = toString . sformat build . unSTB 15 | -------------------------------------------------------------------------------- /wallet-new/topology-examples/testnet.yaml: -------------------------------------------------------------------------------- 1 | wallet: 2 | relays: [[{"host": "relays.awstest.iohkdev.io"}]] 3 | valency: 1 4 | fallbacks: 3 5 | -------------------------------------------------------------------------------- /wallet/README.md: -------------------------------------------------------------------------------- 1 | # cardano-sl-wallet 2 | 3 | This package implements the old version of the wallet which will be replaced 4 | with the version in the `wallet-new` package in this same repository. 5 | -------------------------------------------------------------------------------- /wallet/src/Pos/Wallet.hs: -------------------------------------------------------------------------------- 1 | module Pos.Wallet 2 | ( module Pos.Wallet.Web 3 | ) where 4 | 5 | import Pos.Wallet.Web 6 | -------------------------------------------------------------------------------- /wallet/src/Pos/Wallet/Aeson.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CPP #-} 2 | 3 | -- | Module for exposing JSON instances for Cardano types 4 | 5 | module Pos.Wallet.Aeson 6 | ( 7 | ) where 8 | 9 | import Pos.Wallet.Aeson.ClientTypes () 10 | import Pos.Wallet.Aeson.WalletBackup () 11 | -------------------------------------------------------------------------------- /wallet/src/Pos/Wallet/Aeson/Options.hs: -------------------------------------------------------------------------------- 1 | -- | Custom JSON serialisation options 2 | 3 | module Pos.Wallet.Aeson.Options 4 | ( customOptions 5 | , customOptionsWithTag 6 | ) where 7 | 8 | import Universum 9 | 10 | import Data.Aeson.TH (Options (..), SumEncoding (..), defaultOptions, defaultTaggedObject) 11 | 12 | -- Let's use something similar to this options one day 13 | customOptions :: Options 14 | customOptions = 15 | defaultOptions 16 | { -- avoid encoding to plain string for enumeration types 17 | allNullaryToStringTag = False 18 | -- allows to make newtypes trasparent for serialization 19 | , unwrapUnaryRecords = True 20 | } 21 | 22 | customOptionsWithTag :: String -> Options 23 | customOptionsWithTag tag = 24 | customOptions 25 | { sumEncoding = 26 | defaultTaggedObject 27 | { tagFieldName = tag 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /wallet/src/Pos/Wallet/Web/Assurance.hs: -------------------------------------------------------------------------------- 1 | -- | Assurance levels info. 2 | 3 | module Pos.Wallet.Web.Assurance 4 | ( AssuranceLevel (..) 5 | , assuredBlockDepth 6 | ) where 7 | 8 | import Pos.Core.Common (BlockCount) 9 | import Pos.Wallet.Web.ClientTypes (CWalletAssurance (..)) 10 | 11 | data AssuranceLevel 12 | = HighAssurance 13 | 14 | -- | For given assurance level, recommended transaction depth to assure that 15 | -- transaction won't be canceled by some fork. 16 | -- 17 | -- Values are taken from this table: 18 | -- https://cardanodocs.com/cardano/transaction-assurance/ 19 | assuredBlockDepth :: AssuranceLevel -> CWalletAssurance -> BlockCount 20 | assuredBlockDepth HighAssurance CWANormal = 9 21 | assuredBlockDepth HighAssurance CWAStrict = 15 22 | -------------------------------------------------------------------------------- /wallet/src/Pos/Wallet/Web/ClientTypes.hs: -------------------------------------------------------------------------------- 1 | -- | Wallet-specific types 2 | 3 | -- TODO [CSM-407] Name was preserved for compatibility with other PRs, 4 | -- better to rename to just 'Types' or smth like that. 5 | 6 | module Pos.Wallet.Web.ClientTypes 7 | ( 8 | module Pos.Wallet.Web.ClientTypes.Functions 9 | , module Pos.Wallet.Web.ClientTypes.Types 10 | ) where 11 | 12 | import Pos.Wallet.Web.ClientTypes.Functions 13 | import Pos.Wallet.Web.ClientTypes.Instances () 14 | import Pos.Wallet.Web.ClientTypes.Types 15 | -------------------------------------------------------------------------------- /wallet/src/Pos/Wallet/Web/Error.hs: -------------------------------------------------------------------------------- 1 | module Pos.Wallet.Web.Error 2 | ( module Pos.Wallet.Web.Error.Types 3 | , module Pos.Wallet.Web.Error.Util 4 | ) where 5 | 6 | import Pos.Wallet.Web.Error.Types 7 | import Pos.Wallet.Web.Error.Util 8 | -------------------------------------------------------------------------------- /wallet/src/Pos/Wallet/Web/Methods/Info.hs: -------------------------------------------------------------------------------- 1 | -- | Client information. 2 | 3 | module Pos.Wallet.Web.Methods.Info 4 | ( getClientInfo 5 | ) where 6 | 7 | import Universum 8 | 9 | import Paths_cardano_sl_wallet (version) 10 | import Pos.Update.Configuration (HasUpdateConfiguration, curSoftwareVersion) 11 | import Pos.Util.CompileInfo (HasCompileInfo, compileInfo, ctiGitRevision) 12 | import Pos.Wallet.Web.ClientTypes (ApiVersion (..), ClientInfo (..)) 13 | 14 | getClientInfo :: (HasCompileInfo, HasUpdateConfiguration, Applicative m) => m ClientInfo 15 | getClientInfo = 16 | pure 17 | ClientInfo 18 | { ciGitRevision = ctiGitRevision compileInfo 19 | , ciSoftwareVersion = curSoftwareVersion 20 | , ciCabalVersion = version 21 | , ciApiVersion = ApiVersion0 22 | } 23 | -------------------------------------------------------------------------------- /wallet/src/Pos/Wallet/Web/Methods/Reporting.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE TypeFamilies #-} 2 | 3 | -- | Crashes reporting 4 | 5 | module Pos.Wallet.Web.Methods.Reporting 6 | ( reportingInitialized 7 | ) where 8 | 9 | import Universum 10 | 11 | import Pos.Reporting.Methods (MonadReporting, reportInfo) 12 | import Pos.Wallet.Web.ClientTypes (CInitialized) 13 | import Servant.API.ContentTypes (NoContent (..)) 14 | 15 | -- REPORT:INFO Time to initialize Daedalus info (from start to main screen, from start to network connection established) 16 | reportingInitialized :: MonadReporting ctx m => CInitialized -> m NoContent 17 | reportingInitialized cinit = do 18 | reportInfo False (show cinit) 19 | return NoContent 20 | -------------------------------------------------------------------------------- /wallet/src/Pos/Wallet/Web/Pending.hs: -------------------------------------------------------------------------------- 1 | -- | Pending transactions. 2 | 3 | module Pos.Wallet.Web.Pending 4 | ( module Pos.Wallet.Web.Pending.Functions 5 | , module Pos.Wallet.Web.Pending.Submission 6 | , module Pos.Wallet.Web.Pending.Types 7 | , module Pos.Wallet.Web.Pending.Util 8 | , module Pos.Wallet.Web.Pending.Worker 9 | ) where 10 | 11 | import Pos.Wallet.Web.Pending.Functions 12 | import Pos.Wallet.Web.Pending.Submission 13 | import Pos.Wallet.Web.Pending.Types 14 | import Pos.Wallet.Web.Pending.Util 15 | import Pos.Wallet.Web.Pending.Worker 16 | -------------------------------------------------------------------------------- /wallet/src/Pos/Wallet/Web/Server.hs: -------------------------------------------------------------------------------- 1 | -- Pos.Wallet.Web.Server 2 | 3 | module Pos.Wallet.Web.Server 4 | ( module Pos.Wallet.Web.Server.Handlers 5 | , module Pos.Wallet.Web.Server.Launcher 6 | , module Pos.Wallet.Web.Server.Runner 7 | ) where 8 | 9 | import Pos.Wallet.Web.Server.Handlers 10 | import Pos.Wallet.Web.Server.Launcher 11 | import Pos.Wallet.Web.Server.Runner 12 | -------------------------------------------------------------------------------- /wallet/src/Pos/Wallet/Web/Sockets.hs: -------------------------------------------------------------------------------- 1 | -- | Wallet websockets notifier logic. 2 | 3 | module Pos.Wallet.Web.Sockets 4 | ( module Pos.Wallet.Web.Sockets.Connection 5 | , module Pos.Wallet.Web.Sockets.ConnSet 6 | , module Pos.Wallet.Web.Sockets.Notifier 7 | , module Pos.Wallet.Web.Sockets.Types 8 | ) where 9 | 10 | import Pos.Wallet.Web.Sockets.Connection 11 | import Pos.Wallet.Web.Sockets.ConnSet 12 | import Pos.Wallet.Web.Sockets.Notifier 13 | import Pos.Wallet.Web.Sockets.Types 14 | -------------------------------------------------------------------------------- /wallet/src/Pos/Wallet/Web/Sockets/Types.hs: -------------------------------------------------------------------------------- 1 | -- | Types for websockets 2 | 3 | module Pos.Wallet.Web.Sockets.Types 4 | ( WSConnection 5 | , NotifyEvent (..) 6 | ) where 7 | 8 | import Universum 9 | 10 | import qualified Network.WebSockets as WS 11 | 12 | import Pos.Core (ChainDifficulty) 13 | 14 | -- | Shortcut for websocket connection 15 | type WSConnection = WS.Connection 16 | 17 | -- | Possible notifications 18 | data NotifyEvent 19 | = ConnectionOpened 20 | -- _ | NewWalletTransaction CId 21 | -- _ | NewTransaction 22 | | NetworkDifficultyChanged ChainDifficulty -- ie new block or fork (rollback) 23 | | LocalDifficultyChanged ChainDifficulty -- ie new block or fork (rollback) 24 | | ConnectedPeersChanged Word 25 | | UpdateAvailable 26 | | ConnectionClosed 27 | deriving (Show, Generic) 28 | -------------------------------------------------------------------------------- /wallet/src/Pos/Wallet/Web/State.hs: -------------------------------------------------------------------------------- 1 | module Pos.Wallet.Web.State 2 | ( module Pos.Wallet.Web.State.State 3 | , module Pos.Wallet.Web.State.Util 4 | , Storage.WAddressMeta(..) 5 | , Storage.HasWAddressMeta(..) 6 | , Storage.wamAccount 7 | ) where 8 | 9 | import Pos.Wallet.Web.State.State hiding (applyModifierToWallet, 10 | rollbackModifierFromWallet) 11 | import qualified Pos.Wallet.Web.State.Storage as Storage 12 | import Pos.Wallet.Web.State.Util 13 | -------------------------------------------------------------------------------- /wallet/src/Pos/Wallet/Web/Swagger.hs: -------------------------------------------------------------------------------- 1 | -- | Wallet swagger implementation 2 | 3 | module Pos.Wallet.Web.Swagger 4 | ( module Pos.Wallet.Web.Swagger.Spec 5 | ) where 6 | 7 | import Pos.Wallet.Web.Swagger.Spec 8 | import Pos.Wallet.Web.Swagger.Instances.Schema () 9 | import Pos.Wallet.Web.Swagger.Instances.Swagger () 10 | -------------------------------------------------------------------------------- /wallet/src/Pos/Wallet/Web/Swagger/Instances/Swagger.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE ScopedTypeVariables #-} 2 | 3 | -- | Swagger instances 4 | 5 | module Pos.Wallet.Web.Swagger.Instances.Swagger where 6 | 7 | import Universum 8 | 9 | import Servant ((:>)) 10 | import Servant.Multipart (MultipartForm) 11 | import Servant.Swagger (HasSwagger (..)) 12 | 13 | instance HasSwagger api => HasSwagger (MultipartForm a :> api) where 14 | toSwagger Proxy = toSwagger $ Proxy @api 15 | -------------------------------------------------------------------------------- /wallet/src/Pos/Wallet/Web/Tracking.hs: -------------------------------------------------------------------------------- 1 | -- | Utilities which allow to keep wallet info up to date 2 | module Pos.Wallet.Web.Tracking 3 | ( module Pos.Wallet.Web.Tracking.BListener 4 | , module Pos.Wallet.Web.Tracking.Decrypt 5 | , module Pos.Wallet.Web.Tracking.Modifier 6 | , module Pos.Wallet.Web.Tracking.Restore 7 | , module Pos.Wallet.Web.Tracking.Sync 8 | , module Pos.Wallet.Web.Tracking.Types 9 | ) where 10 | 11 | import Pos.Wallet.Web.Tracking.BListener 12 | import Pos.Wallet.Web.Tracking.Decrypt 13 | import Pos.Wallet.Web.Tracking.Modifier 14 | import Pos.Wallet.Web.Tracking.Restore 15 | import Pos.Wallet.Web.Tracking.Sync 16 | import Pos.Wallet.Web.Tracking.Types 17 | 18 | 19 | -------------------------------------------------------------------------------- /wallet/test/Spec.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_GHC -F -pgmF hspec-discover -optF --module-name=Spec #-} 2 | -------------------------------------------------------------------------------- /wallet/test/Test.hs: -------------------------------------------------------------------------------- 1 | import Spec (spec) 2 | import Test.Hspec (hspec) 3 | import Universum 4 | 5 | main :: IO () 6 | main = hspec spec 7 | --------------------------------------------------------------------------------