Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions bors.toml

This file was deleted.

67 changes: 43 additions & 24 deletions cardano-lib/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{lib, writeText, runCommand, jq}:
let
inherit (builtins) attrNames elem fromJSON getAttr readFile toFile toJSON;
inherit (builtins) attrNames fromJSON getAttr readFile toFile toJSON;
inherit (lib) filterAttrs flip forEach listToAttrs mapAttrs mapAttrsToList optionalAttrs optionalString pipe;

mkEdgeTopology = {
Expand Down Expand Up @@ -68,17 +68,36 @@ let
p2pTopology = mkEdgeTopologyP2P {
inherit (env) edgeNodes;

bootstrapPeers = map (e: {address = e.addr; inherit (e) port;}) env.edgeNodes;

# If an address is provided without a port or a port set to null within
# the attrs, the address will be interpreted as an SRV record.
bootstrapPeers = map (e:
{address = e.addr;}
// optionalAttrs (e ? port && e.port != null) {inherit (e) port;})
env.edgeNodes;

useLedgerAfterSlot = env.useLedgerAfterSlot;

# Genesis mode is now default for preview and preprod as of node 10.5
peerSnapshotFile =
if elem env.name ["preview" "preprod"]
then "peer-snapshot.json"
else null;
# Genesis mode is now default for preview and preprod as of node 10.5.0.
#
# As of node 10.5.0, the peer snapshot file can be added to the
# topology file with a relative path to itself making the packaging
# cleaner.
#
# As of node 10.6.0, the peer snapshot file can be added to the
# topology file and not be fatal if missing while in PraosMode.
#
# Given that the peer snapshot file will be required as soon as genesis
# mode is default, and migration to genesis mode for all networks is
# coming soon, the snapshot will be declared in all network topologies
# which also makes genesis testing a bit easier.
peerSnapshotFile = "${env.name}-peer-snapshot.json";
};
in
if (env.nodeConfig.EnableP2P or false)
# As of node 10.6.0 only p2p networking mode is available. Code supporting
# legacy networking will remain until the Dijkstra hard fork compels an
# upgrade.
if (env.nodeConfig.EnableP2P or true)
then p2pTopology
else legacyTopology;

Expand Down Expand Up @@ -114,6 +133,14 @@ let
mkSubmitApiConfig = name: nodeConfig: (filterAttrs (k: v: v != null) {
GenesisHash = nodeConfig.ByronGenesisHash;
inherit (nodeConfig) RequiresNetworkMagic;
TraceOptions."" = {
backends = [
"EKGBackend"
"Stdout HumanFormatColoured"
];
detail = "DNormal";
severity = "Info";
};
})
// defaultExplorerLogConfig;

Expand All @@ -128,8 +155,11 @@ let
# as needed. Any node version string suffixes, such as `-pre`, should be
# removed from this string identifier.
#
# Min currently 10.4.0 for `LedgerDB` config support.
minNodeVersion = { MinNodeVersion = "10.4.0"; };
# Min is currently 10.6.0 for proper default handling of PeerSharing,
# TargetNumberOfKnownPeers and TargetNumberOfRootPeers parameters depending
# on whether node is a forger or not, as well as removal of legacy
# networking mode.
minNodeVersion = { MinNodeVersion = "10.6.0"; };

mergeTraceOpts = cfg: traceOpts: cfg // {TraceOptions = getAttr "TraceOptions" cfg // traceOpts;};

Expand All @@ -138,8 +168,6 @@ let
# default derived configs:
nodeConfig = mergeTraceOpts (defaultLogConfig // env.networkConfig) (env.extraTracerConfig or {});
nodeConfigLegacy = defaultLogConfigLegacy // env.networkConfig // (env.extraTracerConfigLegacy or {});
nodeConfigBp = mergeTraceOpts (defaultLogConfig // env.networkConfigBp) (env.extraTracerConfig or {});
nodeConfigBpLegacy = defaultLogConfigLegacy // env.networkConfigBp // (env.extraTracerConfigLegacy or {});
tracerConfig = defaultTracerConfig // {inherit (fromJSON (readFile ./${name}/shelley-genesis.json)) networkMagic;};
consensusProtocol = env.networkConfig.Protocol;
submitApiConfig = mkSubmitApiConfig name environments.${name}.nodeConfig;
Expand Down Expand Up @@ -181,8 +209,7 @@ let
edgePort = 3001;
confKey = "mainnet_full";
networkConfig = import ./mainnet-config.nix // minNodeVersion;
networkConfigBp = import ./mainnet-config-bp.nix // minNodeVersion;
useLedgerAfterSlot = 157852837;
useLedgerAfterSlot = 171244716;
extraDbSyncConfig = {
enableFutureGenesis = true;
};
Expand Down Expand Up @@ -215,8 +242,7 @@ let
];
edgePort = 3001;
networkConfig = import ./preprod-config.nix // minNodeVersion;
networkConfigBp = import ./preprod-config-bp.nix // minNodeVersion;
useLedgerAfterSlot = 93830456;
useLedgerAfterSlot = 107222389;
extraDbSyncConfig = {
enableFutureGenesis = true;
};
Expand Down Expand Up @@ -245,8 +271,7 @@ let
];
edgePort = 3001;
networkConfig = import ./preview-config.nix // minNodeVersion;
networkConfigBp = import ./preview-config-bp.nix // minNodeVersion;
useLedgerAfterSlot = 83116868;
useLedgerAfterSlot = 96249565;
extraDbSyncConfig = {
enableFutureGenesis = true;
};
Expand Down Expand Up @@ -321,9 +346,7 @@ let
<td>
<div class="buttons has-addons">
<a class="button is-primary" href="${env}-config.json">config</a>
<a class="button is-primary" href="${env}-config-bp.json">block-producer config</a>
<a class="button is-primary" href="${env}-config-legacy.json">config (legacy)</a>
<a class="button is-primary" href="${env}-config-bp-legacy.json">block-producer config (legacy)</a>
<a class="button is-info" href="${env}-${protNames.${p}.n}-genesis.json">${protNames.${p}.n}Genesis</a>
${optionalString (p == "Cardano") ''
<a class="button is-info" href="${env}-${protNames.${p}.shelley}-genesis.json">${protNames.${p}.shelley}Genesis</a>
Expand Down Expand Up @@ -375,14 +398,10 @@ let
in ''
${if p != "Cardano" then ''
${jq}/bin/jq . < ${toFile "${env}-config.json" (toJSON (value.nodeConfig // genesisFile))} > $out/${env}-config.json
${jq}/bin/jq . < ${toFile "${env}-config-bp.json" (toJSON (value.nodeConfigBp // genesisFile))} > $out/${env}-config-bp.json
${jq}/bin/jq . < ${toFile "${env}-config-legacy.json" (toJSON (value.nodeConfigLegacy // genesisFile))} > $out/${env}-config-legacy.json
${jq}/bin/jq . < ${toFile "${env}-config-bp-legacy.json" (toJSON (value.nodeConfigBpLegacy // genesisFile))} > $out/${env}-config-bp-legacy.json
'' else ''
${jq}/bin/jq . < ${toFile "${env}-config.json" (toJSON (value.nodeConfig // genesisFiles))} > $out/${env}-config.json
${jq}/bin/jq . < ${toFile "${env}-config-bp.json" (toJSON (value.nodeConfigBp // genesisFiles))} > $out/${env}-config-bp.json
${jq}/bin/jq . < ${toFile "${env}-config-legacy.json" (toJSON (value.nodeConfigLegacy // genesisFiles))} > $out/${env}-config-legacy.json
${jq}/bin/jq . < ${toFile "${env}-config-bp-legacy.json" (toJSON (value.nodeConfigBpLegacy // genesisFiles))} > $out/${env}-config-bp-legacy.json
''}
${optionalString (p == "RealPBFT" || p == "Byron") ''
cp ${value.nodeConfig.GenesisFile} $out/${env}-${protNames.${p}.n}-genesis.json
Expand Down
6 changes: 0 additions & 6 deletions cardano-lib/generic-log-config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,10 @@
"Mempool".severity = "Info";
"Net.ConnectionManager.Remote.ConnectionManagerCounters".severity = "Silence";
"Net.ConnectionManager.Remote".severity = "Info";
"Net.ErrorPolicy.Local".severity = "Info";
"Net.ErrorPolicy".severity = "Info";
"Net.InboundGovernor.Remote".severity = "Info";
"Net.InboundGovernor".severity = "Warning";
"Net.Mux.Remote".severity = "Info";
"Net.PeerSelection".severity = "Silence";
"Net.Subscription.DNS".severity = "Info";
"Net.Subscription.IP".severity = "Info";
"Resources".severity = "Silence";
"Startup.DiffusionInit".severity = "Info";

Expand All @@ -119,8 +115,6 @@
# severity is switched away from silence.
"ChainDB.LedgerEvent.Forker".severity = "Silence";
"Mempool.AttemptAdd".severity = "Silence";
"Mempool.LedgerFound".severity = "Silence";
"Mempool.LedgerNotFound".severity = "Silence";
"Mempool.SyncNotNeeded".severity = "Silence";

# Enable this to investigate transaction validation errors.
Expand Down
11 changes: 0 additions & 11 deletions cardano-lib/mainnet-config-bp.nix

This file was deleted.

41 changes: 23 additions & 18 deletions cardano-lib/mainnet-config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ with builtins; {

# The mainnet does not include the network magic into addresses. Testnets do.
RequiresNetworkMagic = "RequiresNoMagic";
EnableP2P = true;
PeerSharing = true;

MaxKnownMajorProtocolVersion = 2;

Expand All @@ -38,26 +36,33 @@ with builtins; {
# `peerSnapshotFile`.
ConsensusMode = "PraosMode";

# Network Deadline and Sync Target Configuration
# Peer Sharing Mode, Network Deadline and Sync Target Configuration
# To avoid config drift these will use ouroboros-network defaults which may change over time.
# The values shown below are examples.
# See: https://developers.cardano.org/docs/get-started/cardano-node/p2p
#
# MinBigLedgerPeersForTrustedState: 5
# SyncTargetNumberOfActiveBigLedgerPeers: 30
# SyncTargetNumberOfActivePeers: 5
# SyncTargetNumberOfEstablishedBigLedgerPeers: 40
# SyncTargetNumberOfEstablishedPeers: 10
# SyncTargetNumberOfKnownBigLedgerPeers: 100
# SyncTargetNumberOfKnownPeers: 150
# SyncTargetNumberOfRootPeers: 0
# TargetNumberOfActiveBigLedgerPeers: 5
# TargetNumberOfActivePeers: 20
# TargetNumberOfEstablishedBigLedgerPeers: 10
# TargetNumberOfEstablishedPeers: 30
# TargetNumberOfKnownBigLedgerPeers: 15
# TargetNumberOfKnownPeers: 150
# TargetNumberOfRootPeers: 60
# MinBigLedgerPeersForTrustedState = 5;
# SyncTargetNumberOfActiveBigLedgerPeers = 30;
# SyncTargetNumberOfActivePeers = 5;
# SyncTargetNumberOfEstablishedBigLedgerPeers = 40;
# SyncTargetNumberOfEstablishedPeers = 10;
# SyncTargetNumberOfKnownBigLedgerPeers = 100;
# SyncTargetNumberOfKnownPeers = 150;
# SyncTargetNumberOfRootPeers = 0;
# TargetNumberOfActiveBigLedgerPeers = 5;
# TargetNumberOfActivePeers = 20;
# TargetNumberOfEstablishedBigLedgerPeers = 10;
# TargetNumberOfEstablishedPeers = 30;
# TargetNumberOfKnownBigLedgerPeers = 15;
#
# Additionally, as of ouroboros-network `0.22.2` with cardano-node `10.6.0`,
# the following three node config parameters which previously required
# explicit configuration depending on whether the node is a forger are now
# handled automatically.
#
# PeerSharing: false for forgers, true for non-forgers
# TargetNumberOfKnownPeers: set according to forging status
# TargetNumberOfRootPeers: set according to forging status

# Default Ledger Configuration
# Additional configuration options can be found at:
Expand Down
Loading
Loading