Git Product home page Git Product logo

cardano-node's Introduction

GitHub Actions
GitHub Workflow Status (master) GitHub Workflow Status (branch)

Contents

Overview of the cardano-node repository

Integration of the ledger, consensus, networking and node shell repositories.

Logging is provided as a feature by the node shell to the other packages.

  • The cardano-node is the top level for the node and aggregates the other components from other packages: consensus, ledger and networking, with configuration, CLI, logging and monitoring.
  • The node no longer incorporates wallet or explorer functionality. The wallet backend and explorer backend are separate components that run in separate external processes that communicate with the node via local IPC.

Network Configuration, Genesis and Topology Files

The latest supported networks can be found at https://book.world.dev.cardano.org/environments.html

Obtaining cardano-node

Building from source

Documentation for building the node can be found here.

Executables

You can download the hydra binaries of cardano-node and cardano-cli from the release notes

Running the node on Windows

The download includes cardano-node.exe and a .dll. To run the node with cardano-node run you need to reference a few files and directories as arguments. These can be copied from the cardano-node repo into the executables directory. The command to run the node on mainnet looks like this:

cardano-node.exe run --topology ./configuration/cardano/mainnet-topology.json --database-path ./state --port 3001 --config ./configuration/cardano/mainnet-config.yaml  --socket-path \\.\pipe\cardano-node

Docker image

You can pull the docker image with the latest version of cardano-node from here.

docker pull ghcr.io/intersectmbo/cardano-node:8.9.1

Using cardano-node

Command line summary: cardano-node

This refers to the client that is used for running a node.

The general synopsis is as follows:

Usage: cardano-node run [--topology FILEPATH] [--database-path FILEPATH]
                        [--socket-path FILEPATH]
                        [--byron-delegation-certificate FILEPATH]
                        [--byron-signing-key FILEPATH]
                        [--shelley-kes-key FILEPATH]
                        [--shelley-vrf-key FILEPATH]
                        [--shelley-operational-certificate FILEPATH]
                        [--start-as-non-producing-node]
                        [--host-addr IPV4-ADDRESS]
                        [--host-ipv6-addr IPV6-ADDRESS]
                        [--port PORT]
                        [--config NODE-CONFIGURATION] [--validate-db]
  Run the node.
  • --topology - Filepath to a topology file describing which peers the node should connect to.
  • --database-path - Path to the blockchain database.
  • --byron-delegation-certificate - Optional path to the Byron delegation certificate. The delegation certificate allows the delegator (the issuer of said certificate) to give his/her own block signing rights to somebody else (the delegatee). The delegatee can then sign blocks on behalf of the delegator.
  • --byron-signing-key - Optional path to the Byron signing key.
  • --shelley-signing-key - Optional path to the Shelley signing key.
  • --shelley-kes-key - Optional path to the Shelley KES signing key.
  • --shelley-vrf-key - Optional path to the Shelley VRF signing key.
  • --shelley-operational-certificate - Optional path to the Shelley operational certificate.
  • --start-as-non-producing-node - Optional flag to disable block production on node start. If credentials flags are passed the node will start block producing, however with this flag the node will only start block producing on SIGHUP (see here for more details)
  • --socket-path - Path to the socket file.
  • --host-addr - Optionally specify your node's IPv4 address.
  • --host-ipv6-addr - Optionally specify your node's IPv6 address.
  • --port - Specify which port to assign to the node.
  • --config - Specify the filepath to the config .yaml file. This file is responsible for all the other node's required settings. See examples in configuration (e.g. config-0.yaml).
  • --validate-db - Flag to revalidate all on-disk database files

Configuration

The --config flag points to a .yaml (or a structurally equivalent .json) file that is responsible to configuring the logging & other important settings for the node. E.g. see the Byron mainnet configuration in this configuration.yaml.

Some of the more important settings are as follows:

  • Protocol: RealPBFT -- Protocol the node will execute
  • RequiresNetworkMagic: RequiresNoMagic -- Used to distinguish between mainnet (RequiresNoMagic) and testnets (RequiresMagic)

Scripts

Please see scripts/README.md for information on the various scripts.

Using cardano-cli

A CLI utility to support a variety of key material operations (genesis, migration, pretty-printing..) for different system generations. Usage documentation can be found at https://github.com/input-output-hk/cardano-cli/tree/master/cardano-cli/README.md.

The general synopsis is as follows:

Usage: cardano-cli (Era based commands | Byron specific commands | Miscellaneous commands)

> NOTE: the exact invocation command depends on the environment. If you have only built cardano-cli, without installing it, then you have to prepend cabal run -- before cardano-cli. We henceforth assume that the necessary environment-specific adjustment has been made, so we only mention cardano-cli.

Command line options: cardano-cli

The subcommands are subdivided in groups, and their full list can be seen in the output of cardano-cli --help.

All subcommands have help available. For example:

cabal run -- cardano-cli -- byron key migrate-delegate-key-from --help

cardano-cli -- byron key migrate-delegate-key-from
Usage: cardano-cli byron key migrate-delegate-key-from --from FILEPATH
                                                       --to FILEPATH
  Migrate a delegate key from an older version.


Available options:
  --byron-legacy-formats   Byron/cardano-sl formats and compatibility
  --byron-formats          Byron era formats and compatibility
  --from FILEPATH          Signing key file to migrate.
  --to FILEPATH            Non-existent file to write the signing key to.
  -h,--help                Show this help text

Genesis generation

The Byron genesis generation operations will create a directory that contains:

  • genesis.json: The genesis JSON file itself.
  • avvm-seed.*.seed: Ada Voucher Vending Machine seeds (secret). Affected by --avvm-entry-count and --avvm-entry-balance.
  • delegate-keys.*.key: Delegate private keys. Affected by: --n-delegate-addresses.
  • delegation-cert.*.json: Delegation certificates. Affected by: --n-delegate-addresses.
  • genesis-keys.*.key: Genesis stake private keys. Affected by: --n-delegate-addresses, --total-balance.
  • poor-keys.*.key: Non-delegate private keys with genesis UTxO. Affected by: --n-poor-addresses, --total-balance.

More details on the Byron Genesis JSON file can be found in https://github.com/input-output-hk/cardano-node-wiki/wiki/byron-genesis

Byron genesis delegation and related concepts are described in detail in:

https://hydra.iohk.io/job/Cardano/cardano-ledger-specs/byronLedgerSpec/latest/download-by-type/doc-pdf/ledger-spec

The canned scripts/benchmarking/genesis.sh example provides a nice set of defaults and illustrates available options.

Key operations

Note that key operations do not support password-protected keys.

Signing key generation & verification key extraction

Signing keys can be generated using the keygen subcommand.

Extracting a verification key out of the signing key is performed by the to-verification subcommand.

Delegate key migration

In order to continue using a delegate key from the Byron Legacy era in the new implementation, it needs to be migrated over, which is done by the migrate-delegate-key-from subcommand:

$ cabal v2-run -- cardano-cli byron key migrate-delegate-key-from
        --from key0.sk --to key0Converted.sk

Signing key queries

One can gather information about a signing key's properties through the signing-key-public and signing-key-address subcommands (the latter requires the network magic):

$ cabal v2-run -- cardano-cli byron key signing-key-public --byron-formats --secret key0.sk

public key hash: a2b1af0df8ca764876a45608fae36cf04400ed9f413de2e37d92ce04
public key: sc4pa1pAriXO7IzMpByKo4cG90HCFD465Iad284uDYz06dHCqBwMHRukReQ90+TA/vQpj4L1YNaLHI7DS0Z2Vg==

$ cabal v2-run -- cardano-cli signing-key-address --byron-formats --secret key0.pbft --testnet-magic 42

2cWKMJemoBakxhXgZSsMteLP9TUvz7owHyEYbUDwKRLsw2UGDrG93gPqmpv1D9ohWNddx
VerKey address with root e5a3807d99a1807c3f161a1558bcbc45de8392e049682df01809c488, attributes: AddrAttributes { derivation path: {} }

Transactions

Creation

Transactions can be created via the issue-genesis-utxo-expenditure & issue-utxo-expenditure commands.

The easiest way to create a transaction is via the scripts/benchmarking/issue-genesis-utxo-expenditure.sh script as follows:

./scripts/benchmarking/issue-genesis-utxo-expenditure.sh transaction_file

NB: This by default creates a transaction based on configuration/defaults/liveview/config-0.yaml

If you do not have a genesis_file you can run scripts/benchmarking/genesis.sh which will create an example genesis_file for you. The script scripts/benchmarking/issue-genesis-utxo-expenditure.sh has defaults for all the requirements of the issue-genesis-utxo-expenditure command.

Submission

The submit-tx subcommand provides the option of submitting a pre-signed transaction, in its raw wire format (see GenTx for Byron transactions).

The canned scripts/benchmarking/submit-tx.sh script will submit the supplied transaction to a testnet launched by scripts/benchmarking/shelley-testnet-liveview.sh script.

Issuing UTxO expenditure (genesis and regular)

To make a transaction spending UTxO, you can either use the:

  • issue-genesis-utxo-expenditure, for genesis UTxO
  • issue-utxo-expenditure, for normal UTxO

subcommands directly, or, again use canned scripts that will make transactions tailored for the aforementioned testnet cluster:

  • scripts/benchmarking/issue-genesis-utxo-expenditure.sh.
  • scripts/benchmarking/issue-utxo-expenditure.sh.

The script requires the target file name to write the transaction to, input TxId (for normal UTxO), and optionally allows specifying the source txin output index, source and target signing keys and lovelace value to send.

The target address defaults to the 1-st richman key (configuration/delegate-keys.001.key) of the testnet, and lovelace amount is almost the entirety of its funds.

Local node queries

You can query the tip of your local node via the get-tip command as follows

  1. Open tmux
  2. Run cabal build cardano-node
  3. Run ./scripts/lite/shelley-testnet.sh example
  4. Run ``export CARDANO_NODE_SOCKET_PATH=/cardano-node/example/socket/node-1-socket
  5. cabal exec cardano-cli -- get-tip --testnet-magic 42

You will see output from stdout in this format:

Current tip:
Block hash: 4ab21a10e1b25e39
Slot: 6
Block number: 5

Update proposals

Update proposal creation

A Byron update proposal can be created as follows:

cardano-cli -- byron governance
               create-update-proposal
                 (--mainnet | --testnet-magic NATURAL)
                 --signing-key FILEPATH
                 --protocol-version-major WORD16
                 --protocol-version-minor WORD16
                 --protocol-version-alt WORD8
                 --application-name STRING
                 --software-version-num WORD32
                 --system-tag STRING
                 --installer-hash HASH
                 --filepath FILEPATH
               ..

The mandatory arguments are --mainnet | --testnet-magic, signing-key, protocol-version-major, protocol-version-minor, protocol-version-alt, application-name, software-version-num, system-tag, installer-hash and filepath.

The remaining arguments are optional parameters you want to update in your update proposal.

You can also check your proposal's validity using the validate-cbor command. See: Validate CBOR files.

See the Byron specification for more details on update proposals.

Update proposal submission

You can submit your proposal using the submit-update-proposal command.

Example:

cardano-cli -- byron governance
            submit-update-proposal
            --config configuration/defaults/mainnet/configuration.yaml
            (--mainnet | --testnet-magic NATURAL)
            --filepath my-update-proposal

See the Byron specification for more details on update proposals.

Update proposal voting

You can create and submit byron update proposal votes with the create-proposal-vote & submit-proposal-vote commands. The following are two example commands:

Byron vote creation:

cabal exec cardano-cli -- byron governance create-proposal-vote
                       (--mainnet | --testnet-magic NATURAL)
                       --signing-key configuration/defaults/liveview/genesis/delegate-keys.000.key
                       --proposal-filepath ProtocolUpdateProposalFile
                       --vote-yes
                       --output-filepath UpdateProposalVoteFile

Byron vote submission:

cabal exec cardano-cli -- byron governance submit-proposal-vote
                       (--mainnet | --testnet-magic NATURAL)
                       --filepath UpdateProposalVoteFile

Development

GHCID

run ghcid with: ghcid -c "cabal repl exe:cardano-node --reorder-goals"

Note: When developing locally, for any package you are working on, in cabal.project set, ghc-options to -Wwarn and set the development flag, e.g.:

package cardano-node
  ghc-options: -Wwarn
  flags: +development

Otherwise GHC might complain about unused packages.

Native Tokens

Native tokens is a new feature that enables the transacting of multi-assets on Cardano. Native tokens are now supported on mainnet and users can transact with ada, and an unlimited number of user-defined (custom) tokens natively. Note that users who do not need to create new assets (“token holders”) will be able to send and receive existing multi-asset tokens using a wallet such as Daedalus or Yoroi, and with no requirement to use any CLI commands.

To help you get started, see:

To start, please ensure that you are familiar with setting up and operating the Cardano node. Alternatively, see instructions on how to start your node to submit the commands. You will not need to set up and start a full block producing node ('stake pool'), just a much simpler relay node. This node will need to connect to a Cardano network that is capable of processing native tokens (e.g., the native token pre-production environment (PPE), or the Cardano mainnet).

API Documentation

The API documentation is published here.

The documentation is built with each push, but is only published from master branch. In order to test if the documentation is working, build the documentation locally with cabal haddock-project --local --output=./haddocks and open haddocks/index.html in the browser.

Using the cardano-node Haskell packages

If you want to use the cardano-node Haskell packages from another project, you should use CHaP to get the packages defined in this repository. Please note that you may need to use any source-repository-package stanzas defined in cabal.project, although we will endeavour to keep these to an absolute minimum.

Style guide

The style guide for can be found on the cardano-node repository's wiki.

Troubleshooting cardano-node issues

For some troubleshooting help with building or running cardano-node, the wiki has a troubleshooting page that documents some common gotchas.

cardano-node's People

Contributors

andreabedini avatar angerman avatar carbolymer avatar carloslopezdelara avatar cblp avatar codiepp avatar coot avatar dcoutts avatar deepfire avatar disassembler avatar erikd avatar fmaste avatar hamishmack avatar intricate avatar iohk-bors[bot] avatar jbgi avatar jimbo4350 avatar johnalotoski avatar jutaro avatar karknu avatar kevinhammond avatar ksaric avatar lehins avatar marcfontaine avatar mgmeier avatar mrbliss avatar nadiayvette avatar nc6 avatar newhoggy avatar smelc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cardano-node's Issues

Does not compile against latest ouroboros-consensus

When building against the latest master in ouroboros-consensus:

[ 7 of 10] Compiling TxSubmission

/home/nc/topos/iohk/cardano-node/app/TxSubmission.hs:228:27: error:
    • Could not deduce: Block.HeaderHash blk ~ Block.ChainHash block0
      from the context: (RunDemo blk, MonadST m)
        bound by the type signature for:
                   localChainSyncCodec :: forall blk (m :: * -> *).
                                          (RunDemo blk, MonadST m) =>
                                          NodeConfig (BlockProtocol blk)
                                          -> Codec
                                               (ChainSync blk (Point blk))
                                               DeserialiseFailure
                                               m
                                               ByteString
        at app/TxSubmission.hs:(219,1)-(223,42)
      Expected type: Block.HeaderHash blk -> Codec.CBOR.Encoding.Encoding
        Actual type: Block.ChainHash block0
                     -> Codec.CBOR.Encoding.Encoding
      The type variable ‘block0’ is ambiguous
    • In the first argument of ‘Block.encodePoint’, namely
        ‘(Block.encodeChainHash demoEncodeHeaderHash)’
      In the third argument of ‘codecChainSync’, namely
        ‘(Block.encodePoint (Block.encodeChainHash demoEncodeHeaderHash))’
      In the expression:
        codecChainSync
          (demoEncodeBlock pInfoConfig)
          (demoDecodeBlock pInfoConfig)
          (Block.encodePoint (Block.encodeChainHash demoEncodeHeaderHash))
          (Block.decodePoint (Block.decodeChainHash demoDecodeHeaderHash))
    • Relevant bindings include
        pInfoConfig :: NodeConfig (BlockProtocol blk)
          (bound at app/TxSubmission.hs:224:21)
        localChainSyncCodec :: NodeConfig (BlockProtocol blk)
                               -> Codec
                                    (ChainSync blk (Point blk)) DeserialiseFailure m ByteString
          (bound at app/TxSubmission.hs:224:1)
    |
228 |       (Block.encodePoint (Block.encodeChainHash demoEncodeHeaderHash))
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Stop indexing db and socket by default

As a end user, I would like to see the db dir named just db and the socket file named node.socket. Currently this is db-0 and node-core-0.socket. The only reason for running more than one node on a system is for tests and demos, so I don't see the reason for this extra addition of an index to all the directories.

Staking support in `cardano-cli`

We need to support staking-related scenarios in CLI tooling, as per Chapter 4 of https://hydra.iohk.io/build/902246/download/1/delegation_design_spec.pdf

This is part of #30

The staking scenarios

  1. Stake Pool Registration:
    • manipulation of pool metadata and stake pool registration certificate.
    • submission to the blockchain
    • status queries
  2. Querying of the active stake pools (and of their metadata).
  3. Delegation support:
    • staking key registration and delegation certificate manipulation
    • submission
    • querying the delegation status
  4. Individual staking, which seems to be a variation of the above procedures.

Implementation

Continuing with the established trend, cardano-node will be acting as a validator and the block chain agent, whereas the cardano-cli will deal with forming of the data blobs and generally the UI for the above operations.

The communication between cardano-node and cardano-cli is expected to be at least partly formulated in terms of generalised transactions, but with extensions, since the extended metadata queries, such as for state of pool/staking key/delegation.

An important parallel development is a sister update system node-to-client protocol, which is expected to share a similar structure (generalised transactions + extended status queries).

Dependencies

  1. We need proper generalised transaction support for transactions beyond just UTxO expenditures. This is being worked on in IntersectMBO/cardano-ledger#623

LiveView: stop live view & kill the node

Currently live view can be stopped by q or Q key. But after TUI thread is stopped, node continue work. We want to change this behavior, @coot said:

When one hits q to kill a node with running live view it only kills the live view, I think it's okay to just kill the node as well. Somewhat related issue: it seems that live view is capturing signals, one cannot kill it with CTRL-C.

Profiling & Performance

The node currently will take ~2 weeks to sync vs ~3 days for cardano-byron-proxy. The node needs to be profiled.

Adding proper (non-mock) Tx submission to `cardano-cli`

  1. Adding CLI for full proper Tx specification (so elaboration isn't needed) -- basically 1) source-signing key, 2) dest addresses, 3) amounts Out of scope -- we just need to submit signed Tx blobs.
  2. Input validation -- amounts matching (there is probably library code in the ledger for this?) -- nothing else? Node does validation and will respond with error.
  3. Moving some code (since tx submitter doesn't belong to the node)
  4. Tests (out of scope here). Supposed to be a separate major effort to add a full-loop integration test with cluster creation, Tx submission and ledger querying.

Part of #30

Drop dependency on pvss package

The pvss package was needed in the old codebase as part of the Ouroboros Classic implementation.

The new codebase does not implement Ouroboros Classic and thus does not use the SCRAPE VSS scheme. We still have a dependency on the pvss package however, but this should be dropped.

It is used in two places:

  1. src/Cardano/CLI/Legacy/Byron.hs where the LegacyDelegateKey contains a lrkVSSKeyPair :: Scrape.KeyPair. This key pair appears to be unused (which is good, there's no use for it). The old binary format contained these things, so we still need to be able to decode the old format, but we do not need to store the result. So we do not need the KeyPair type imported from Crypto.SCRAPE

  2. src/Cardano/CLI/Ops.hs where the only use is Scrape.keyPairGenerate which is used to fill in the lrkVSSKeyPair as part of encodeLegacyDelegateKey. But if this member is removed then it does not need to be generated. The encoder could use dummy values to keep the same legacy format because they will never be used.

Clean up

I think this repo is in dire need for some clean up. We have been focussing too much on adding as much as we can in a short time, without thinking about the long term.

Examples:

  • Most code lives in the executable folder app/ instead of the library folder cardano-node. IMO, app/ should just contain a single file Main.hs containing:
    module Main (main) where
    import  Cardano.Node.Main (main)
    The genesis-tool even lives inside this directory! I expect this is because it depends on the code in the app directory. It should live in a separate directory containing a similar Main.hs file (or only containing minimal code).
  • We should extract code in helper functions and/or separate modules, e.g., https://github.com/input-output-hk/cardano-node/blob/e42d7396f77e24b03379bc61f668ab526a0e062d/app/Run.hs#L258-L416, this is just making this file way too long and unreadable (I'm guilty of these tings myself).
  • In the scripts folder, there are too many demo scripts, some of which are not working anymore. The numbering might also make people think they match the demos that we gave, which is untrue.

Also, synching the different dependencies (cardano-ledger, ouroboros-network, ..) has been an endless time sink so far: to update the dependency on A, we often need to first get a PR updating the dependency on A merged in B before we can do it in cardano-ledger (we can't submit two PRs at once, because the hashes will change and have to be updated after the merge). These PRs quickly go stale or are stalled until someone that made some breaking change can help fix it.

Transaction generator: transactions with binary blob

Currently it's possible to generate transactions with input(s) and output(s) only, so it's the simplest case. We need to add an ability to increase the size of transactions not by increasing number of inputs/outputs, but by adding additional binary blob. This will allow us to generate really big transactions, to get more real-life benchmarking results.

Script documentation & Pruning

I think the scripts in scripts could be better documented in the README.md or maybe a separate SCRIPTS.md file. This will also help in removing scripts we no longer need.

Cluster-based tests

Context

We want cluster-based integration tests for the node.

Current scope (to be extended)

  1. Cluster consensus validation: #106
    • status: implementation mostly done
  2. Extend to mixed cluster of old and new nodes, in PBFT era/mode, both producing blocks, connected via proxies: #255
    • status: stuck debugging cardano-sl cluster startup
  3. cardano-byron-proxy test:
    1. Basic functionality
    2. Heap profiling
    3. Strictness check using @edsko 's WHNF checker.
  4. Cluster Tx submission

Implementation

NixOS tests that can run a cluster in a VM are a good foundation for many of those.

This basis functionality was merged in #177

Transaction generator: send transactions to multiple nodes

Currently tx generator is able to connect to one single node (of the cluster) and send transactions to this node only. It would be useful to be able to send transactions to multiple nodes in the cluster (because it's more real-life case).

There are two possible ways how to do it. For example, if we have a cluster from 3 nodes (a1, b1 and c1), we could:

  1. run one instance of tx generator with an ability to connect to a1, b1 and c1 and send transactions to all three nodes (sequentially or randomly).
  2. run multiple instances of tx generator, for example tx_gen_a1, tx_gen_b1 and tx_gen_c1, so tx_gen_a1 will send transactions to a1, tx_gen_b1 - to b1 and tx_gen_c1 - to c1.

AFAIU, the first way is assuming some changes in the tx generator's code. The second way is assuming some changes in cluster's configuration.

Mixed cluster in CI

Goal

This is a subgoal of #211

We want an integration test for the Legacy/OBFT to Shelley/OBFT transition phase.

This means that we want to run a cluster configuration with two segments -- nodes running cardano-sl and nodes running cardano-node -- with having a number of cardano-byron-proxy connecting those.

Implementation

The entire cluster is supposed to run in a NixOS test on a single machine, to lighten load on CI & make the test faster.

The cluster has to share the same genesis, for obvious reasons, so cardano-sl nodes must use external genesis. Preferably we should use a genesis with configuration as close to mainnet as possible (to make the testing maximally relevant).

Deliverable

The final PR that enables this functionality is #269

Drop dependency on cryptonite-openssl package

The CLI tools in this repo currently rely on the cryptonite-openssl package for getting entropy for the purpose of creating crypto key pairs. This should be replaced by the equivalent functionality from the cryptonite package.

The OpenSSL version is designed to allow a high volume of random entropy to be generated in a reasonable way (e.g. for use in TLS). This is not a requirement we have, since we only use it in CLI tools for generating key pairs, which is very low volume. So it is acceptable to use the functionality in cryptonite which just gets randomness direct from the OS (/dev/random on unix, equiv on Windows).

chain-sync for a limited number of slots

the node starts afresh and syncs blocks over the network. Once it reaches 60 minutes of CPU time the process is killed and logs analyzed.
we note:

  • the time a block is included in the immutable store ("CopiedBlockToImmDB")
    additionally, we collect counters every 30 seconds:
  • network read/write bytes
  • I/O read/write bytes
  • memory usage
  • CPU usage

CLI tooling: Byron, Shelley and onward

Context

We need means to manipulate secrets/certificates/genesis files (henceforth referred to as key material).

General scope

  1. Generation/derivation of all sorts of necessary key material.
  2. Support for all necessary iterations of the system -- Byron and Shelley for now, the former in both the Legacy and PBFT variants.
  3. Support for migration of key material between iterations of the system.
  4. Transaction manipulation and submission.
  5. Update system support.
  6. Support for delegation & staking.

Terminology: Legacy vs. PBFT

  • delegator :: Genesis keys. Referred to as delegation issuer keys in Legacy.
  • delegate :: Operational keys of core nodes used for block minting and proposal signing. Referred to as richmen keys in Legacy.
  • VSS :: Publicly Verifiable Secret Sharing Scheme algorithm used in Ouroboros Classic/Byron Legacy.

Future work

  1. More transaction-related things: creation, pretty-printing.
  2. Update system:
    • stimuli (proposals and votes): creation, pretty-printing, submission.
    • querying the node for the update system state.
  3. Staking (#139):
    • stake pool lifecycle
    • lightweight delegation

History of implementation

#28

  1. Generation of key material (genesis, keys) for new Byron Legacy clusters.
  2. Generation of key material (genesis, keys) for new Byron PBFT clusters.
  3. Migration of Byron Legacy key material (genesis, keys) to the Byron PBFT iteration. So far this appears to consist of:
    • Deserialisation of the delegate keys in the old format, as defined by the Bi instance for the legacy UserSecret data type
    • Reserialisation of the delegate keys in a new format, which, while not yet decided, has a candidate format of just a CBOR serialisation of SigningKey.
    • Cutting VSS out of the genesis file:
      • vssCerts from the top level,
      • vssMaxTTL and vssMinTTL from the protocolConsts section
  4. Pretty-printing of the key material.

#95

  1. Separate, non-genesis keypair generation for Byron/PBFT.
  2. Non-HD address printing for a given keypair.
  3. Genesis hash printing.
  4. Byron genesis delegation: generating delegation certificates for a given pair of genesis/delegate keys.

#135 & #147

  1. Raw TX submission over local node submission protocol.
  2. Genesis UTxO expenditure.

Notes

  • DELEGATE-SECRETS-INCOMPATIBLE-BYRON-LEGACY-PBFT: as @dcoutts mentioned

    VSS, the Ouroboros classic randomness MPC algorithm, is not used after the PBFT hard fork.

    Therefore, the delegate secrets will no longer contain the VSS keypair, which makes them incompatible between the Legacy and PBFT iterations of Byron. This needs to be accounted for with regards to both the generation and migration aspects.

    • The compatibility was implemented in the new codebase.
  • SECRET-SERIALISATION-INCOMPATIBLE-BYRON-LEGACY-PBFT: Byron Legacy is using cardano-binary for secret serialisation, whereas Byron PBFT uses CBOR. This needs to be accounted for with regards to both the generation and migration aspects.

    • This does no longer appear to be a problem, since the underlying encoding that cardano-binary uses in the Bi typeclass is CBOR, which means there's only a thin compatibility layer that needs to be reimplemented. The thin compatibility layer for Byron Legacy delegate key roundtripping was reimplemented.
  • GENESIS-INCOMPATIBLE-BYRON-LEGACY-PBFT: Byron Legacy carries the VSS certificates, which aren't generated by the Byron PBFT genesis generator.

Reintegrate repo-specific Nix code into `iohk-nix`

Terminology

  • iohk-nix :: The "standard library" of IOHK-specific Nix code intended to simplify usage of haskell.nix by the IOHK client repositories.
  • client repository :: repositories using the IOHK Nix infrastructure, such as cardano-ledger, ouroboros-network and cardano-node.

The problem

After the initial introduction of iohk-nix into the build machinery of IOHK's Haskell-code-carrying repositories grew, these repositories started inevitably diverging -- that is, accumulating local, repository-specific Nix changes, extending the functionality provided in iohk-nix.

Some of those extensions are truly repository-specific, but not all are -- some extensions are conceptually repetitions of the same thing from the other repository, and so they contribute to the overall complexity of the system in an excessive way.

Proposed solution

Overall, we should revisit the way how the repository-specific Nix build system extensions are defined -- with the aim of making it as minimal and declarative as possible.

To do this effectively, we would need to perform a systematic review of what Nix extensions are defined in the client repositories, for what purpose, and based on that picture, define a more declarative and comprehensive interface between iohk-nix and client repositories -- and then implement that across all of IOHK repositories.

Time frame

This is not an immediate problem, but rather one of the sort that reduces the overall efficiency of the development process.

This appears to define the planning horizon for this work as vague "middle-term".

Development resources

Due to systemic nature of the problem, one would expect that this would require dedicated expert effort the DevOps team.

Re-enable builds on Darwin

hydra failed to build the project for target OS MacOSX/Darwin.

diff --git a/release.nix b/release.nix
index ef25628..f92c98e 100644
--- a/release.nix
+++ b/release.nix
@@ -44,9 +44,9 @@ iohkLib.nix-tools.release-nix {
   required-name = "cardano-node-required-checks";
   required-targets = jobs: [
     # targets are specified using above nomenclature:
-    jobs.nix-tools.libs.cardano-node.x86_64-darwin
+    #jobs.nix-tools.libs.cardano-node.x86_64-darwin
     jobs.nix-tools.libs.cardano-node.x86_64-linux
-    jobs.nix-tools.exes.cardano-node.x86_64-darwin
+    #jobs.nix-tools.exes.cardano-node.x86_64-darwin
     jobs.nix-tools.exes.cardano-node.x86_64-linux
     jobs.nix-tools.tests.cardano-node.cardano-node-test.x86_64-linux

Chain density assumptions

the calculation of chain density (#250) makes the assumption that the length of an epoch depends on the parameter k = 2160 (10x in Byron). In case of Praos, epochs will likely be shorter.

TODO in cardano-node/src/Cardano/Tracing/Tracers.hs#L186

This is a reminder that this will not be the case in Shelley and so the code needs to be adapted.

Output of Nix build doesn't run

On commit 70ee53469b:

$ nix-build -A scripts.mainnet.node
$ ./result
cardano-node: user error ("Unspecified ccSocketPath")

Introduce conditional tracing and tracing based on verbosity level

based on new version of iohk-monitoring-framework
(epic: input-output-hk/iohk-monitoring-framework#277)

control verbosity

--tracing-verbosity-minimal
--tracing-verbosity-normal (the default)
--tracing-verbosity-maximal

switch textual representation / structured logging

by default, structured logging is turned on: the rendering of the captured observables is controlled by their ToObject instances.

--trace-chain-db turns on textual representation in the ChainDB tracer

Run a small demo cluster on CI together with chairman application

  1. Describe clusters of cardano-node as NixOS service
  2. Describe chairman as a NixOS service, so it can be integrated with the above
  3. Define a NixOS test running chairman as a check against the said cluster
  4. Tune the chairman's pass/failure criteria, so they are a useful measure of regression

1+2+3 were done in #177
4 is being worked on in #201

Cannot build `exe:cardano-node` component

I am not sure how this slipped through CI, but I get a type error in cardano-prelude. I am building current master (b9ffe10)

cabal build exe:cardano-node
Build profile: -w ghc-8.6.5 -O1
In order, the following will be built (use -v for more details):
 - cardano-prelude-test-0.1.0.0 (lib) (first run)
 - cardano-binary-test-1.3.0 (lib) (configuration changed)
 - cardano-crypto-test-1.3.0 (lib) (configuration changed)
 - cardano-ledger-test-1.3.0 (lib) (configuration changed)
 - ouroboros-consensus-0.1.0.0 (lib) (configuration changed)
 - cardano-node-3.0.1.87 (lib) (configuration changed)
 - cardano-node-3.0.1.87 (exe:cardano-node) (configuration changed)
Preprocessing library for cardano-prelude-test-0.1.0.0..
Building library for cardano-prelude-test-0.1.0.0..
[3 of 9] Compiling Test.Cardano.Prelude.Golden ( Test/Cardano/Prelude/Golden.hs, /home/marcin/r
epos/iohk/cardano-node/dist-newstyle/build/x86_64-linux/ghc-8.6.5/cardano-prelude-test-0.1.0.0/
build/Test/Cardano/Prelude/Golden.o ) [Hedgehog.Internal.TH changed]

Test/Cardano/Prelude/Golden.hs:119:15: error:
    Not in scope: ‘confTrailingNewline’
    |
119 |             , confTrailingNewline = False
    |               ^^^^^^^^^^^^^^^^^^^
cabal: Failed to build cardano-prelude-test-0.1.0.0 (which is required by
exe:cardano-node from cardano-node-3.0.1.87).

Improve the naming and comments for the CLI

We just need to improve the naming and add some comments to make this a bit more clear for others who can do the same thing on their part.
This part of the work is being done in an actual node.

Merging logging configuration into node's configuration

logging configuration has been kept in its own Yaml file.
now, we want to integrate this configuration into the node's configuration file (also Yaml format).

the key logging-config (valid name?) shall contain the logging configuration.

the iohk-monitoring framework has read the Yaml into an internediary representation: https://github.com/input-output-hk/iohk-monitoring-framework/blob/master/iohk-monitoring/src/Cardano/BM/Data/Configuration.lhs#L41
and starting from this, built up configuration: https://github.com/input-output-hk/iohk-monitoring-framework/blob/master/iohk-monitoring/src/Cardano/BM/Configuration/Model.lhs

Clean the CLI interface for tx-submission

At the moment it's not clear weather all the arguments for tx submission are really needed. If it's not possible to keep a minimal set of arguments to construct transactions for various protocols, we could submit raw transactions instead of elaborating mock transactions to real ones.

Note: this issue is just to record the problem, not to suggest the right solution.

Integrate configuration of `cardano-node` via a config file

Subtask of #255

cardano-node is being extended with configuration file support -- but that functionality is not yet complete. We'll need that at least to configure the slot length for the Mixed Cluster CI.

Once that functionality is ready in cardano-node, we'll need to integrate that mechanism into the Nix expressions defining the cardano-node service.

Update frontpage README

  • cleanup schema
  • list of commands: one per line
  • submit-tx script with correct cmd line args

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.