Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node config bp #575

Merged
merged 3 commits into from
Apr 18, 2024
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
55 changes: 38 additions & 17 deletions cardano-lib/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,19 @@ let
wallet:
relays: [[{ host: ${relay} }]]
'';

# Changes to minimum required node version typically occur with changes to
# genesis files across all networks at once. This defn will be applied to
# all networks by default but can be overridden on a per network basis below
# as needed. Any node version string suffixes, such as `-pre`, should be
# removed from this string identifier.
minNodeVersion = { MinNodeVersion = "8.10.0"; };

environments = lib.mapAttrs (name: env: {
inherit name;
# default derived configs:
nodeConfig = defaultLogConfig // env.networkConfig;
nodeConfigBp = defaultLogConfig // env.networkConfigBp;
consensusProtocol = env.networkConfig.Protocol;
submitApiConfig = mkSubmitApiConfig name environments.${name}.nodeConfig;
dbSyncConfig = mkDbSyncConfig name environments.${name}.nodeConfig;
Expand Down Expand Up @@ -155,7 +164,8 @@ let
];
edgePort = 3001;
confKey = "mainnet_full";
networkConfig = import ./mainnet-config.nix;
networkConfig = import ./mainnet-config.nix // minNodeVersion;
networkConfigBp = import ./mainnet-config-bp.nix // minNodeVersion;
usePeersFromLedgerAfterSlot = 116812831;
};

Expand All @@ -175,7 +185,8 @@ let
}
];
edgePort = 3001;
networkConfig = import ./shelley_qa-config.nix;
networkConfig = import ./shelley_qa-config.nix // minNodeVersion;
networkConfigBp = import ./shelley_qa-config-bp.nix // minNodeVersion;
usePeersFromLedgerAfterSlot = 19252750;
};

Expand All @@ -200,7 +211,8 @@ let
}
];
edgePort = 3001;
networkConfig = import ./preprod-config.nix;
networkConfig = import ./preprod-config.nix // minNodeVersion;
networkConfigBp = import ./preprod-config-bp.nix // minNodeVersion;
usePeersFromLedgerAfterSlot = 52358331;
};

Expand All @@ -225,7 +237,8 @@ let
}
];
edgePort = 3001;
networkConfig = import ./preview-config.nix;
networkConfig = import ./preview-config.nix // minNodeVersion;
networkConfigBp = import ./preview-config-bp.nix // minNodeVersion;
usePeersFromLedgerAfterSlot = 41385503;
};

Expand All @@ -250,7 +263,8 @@ let
}
];
edgePort = 3001;
networkConfig = import ./sanchonet-config.nix;
networkConfig = import ./sanchonet-config.nix // minNodeVersion;
networkConfigBp = import ./sanchonet-config-bp.nix // minNodeVersion;
usePeersFromLedgerAfterSlot = 21599922;
};

Expand All @@ -269,7 +283,8 @@ let
}
];
edgePort = 3001;
networkConfig = import ./private-config.nix;
networkConfig = import ./private-config.nix // minNodeVersion;
networkConfigBp = import ./private-config-bp.nix // minNodeVersion;
usePeersFromLedgerAfterSlot = 10007987;
};
};
Expand All @@ -288,9 +303,11 @@ let
edgeNodes = [];
edgePort = 3001;
confKey = "testnet_full";
networkConfig = import ./testnet-config.nix;
networkConfig = import ./testnet-config.nix // minNodeVersion;
networkConfigBp = import ./testnet-config-bp.nix // minNodeVersion;
consensusProtocol = networkConfig.Protocol;
nodeConfig = defaultLogConfig // networkConfig;
nodeConfigBp = defaultLogConfig // networkConfigBp;
submitApiConfig = mkSubmitApiConfig "testnet" nodeConfig;
dbSyncConfig = mkDbSyncConfig "testnet" nodeConfig;
explorerConfig = mkExplorerConfig "testnet" nodeConfig;
Expand Down Expand Up @@ -363,6 +380,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-info" href="${env}-${protNames.${p}.n}-genesis.json">${protNames.${p}.n}Genesis</a>
${lib.optionalString (p == "Cardano") ''
<a class="button is-info" href="${env}-${protNames.${p}.shelley}-genesis.json">${protNames.${p}.shelley}Genesis</a>
Expand Down Expand Up @@ -395,19 +413,22 @@ let
cp ${writeText "config.html" (configHtml environments)} $out/index.html
${
toString (lib.mapAttrsToList (env: value:
let p = value.consensusProtocol;
let
p = value.consensusProtocol;
genesisFile = { GenesisFile = "${env}-${protNames.${p}.n}-genesis.json"; };
genesisFiles = {
ByronGenesisFile = "${env}-${protNames.${p}.n}-genesis.json";
ShelleyGenesisFile = "${env}-${protNames.${p}.shelley}-genesis.json";
AlonzoGenesisFile = "${env}-${protNames.${p}.alonzo}-genesis.json";
ConwayGenesisFile = "${env}-${protNames.${p}.conway}-genesis.json";
};
in ''
${if p != "Cardano" then ''
${jq}/bin/jq . < ${__toFile "${env}-config.json" (__toJSON (value.nodeConfig // {
GenesisFile = "${env}-${protNames.${p}.n}-genesis.json";
}))} > $out/${env}-config.json
${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
'' else ''
${jq}/bin/jq . < ${__toFile "${env}-config.json" (__toJSON (value.nodeConfig // {
ByronGenesisFile = "${env}-${protNames.${p}.n}-genesis.json";
ShelleyGenesisFile = "${env}-${protNames.${p}.shelley}-genesis.json";
AlonzoGenesisFile = "${env}-${protNames.${p}.alonzo}-genesis.json";
ConwayGenesisFile = "${env}-${protNames.${p}.conway}-genesis.json";
}))} > $out/${env}-config.json
${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
''}
${lib.optionalString (p == "RealPBFT" || p == "Byron") ''
cp ${value.nodeConfig.GenesisFile} $out/${env}-${protNames.${p}.n}-genesis.json
Expand Down
45 changes: 45 additions & 0 deletions cardano-lib/mainnet-config-bp.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
##########################################################
####### Mainnet ########
####### Cardano Node Block Producer Configuration ########
##########################################################

{
##### Locations #####

ByronGenesisFile = ./mainnet + "/byron-genesis.json";
ByronGenesisHash = "5f20df933584822601f9e3f8c024eb5eb252fe8cefb24d1317dc3d432e940ebb";
ShelleyGenesisFile = ./mainnet + "/shelley-genesis.json";
ShelleyGenesisHash = "1a3be38bcbb7911969283716ad7aa550250226b76a61fc51cc9a9a35d9276d81";
AlonzoGenesisFile = ./mainnet + "/alonzo-genesis.json";
AlonzoGenesisHash = "7e94a15f55d1e82d10f09203fa1d40f8eede58fd8066542cf6566008068ed874";
ConwayGenesisFile = ./mainnet + "/conway-genesis.json";
ConwayGenesisHash = "49ef010ff0d13b090893a919bbc22022038a8b782faa0b1561a256b781672174";

##### Core protocol parameters #####

# This is the instance of the Ouroboros family that we are running.
# The node also supports various test and mock instances.
# "RealPBFT" is the real (ie not mock) (permissive) OBFT protocol, which
# is what we use on mainnet in Byron era.
Protocol = "Cardano";

# The mainnet does not include the network magic into addresses. Testnets do.
RequiresNetworkMagic = "RequiresNoMagic";
EnableP2P = true;
PeerSharing = false;
TargetNumberOfActivePeers = 20;
TargetNumberOfEstablishedPeers = 50;
TargetNumberOfKnownPeers = 100;
TargetNumberOfRootPeers = 100;
TraceMempool = false;

MaxKnownMajorProtocolVersion = 2;

##### Update system parameters #####

# This protocol version number gets used by block producing nodes as part
# part of the system for agreeing on and synchronising protocol updates.
LastKnownBlockVersion-Major = 3;
LastKnownBlockVersion-Minor = 0;
LastKnownBlockVersion-Alt = 0;
}
3 changes: 2 additions & 1 deletion cardano-lib/mainnet-config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@
# The mainnet does not include the network magic into addresses. Testnets do.
RequiresNetworkMagic = "RequiresNoMagic";
EnableP2P = true;
PeerSharing = true;
TargetNumberOfActivePeers = 20;
TargetNumberOfEstablishedPeers = 50;
TargetNumberOfKnownPeers = 100;
TargetNumberOfRootPeers = 100;
TargetNumberOfRootPeers = 60;
TraceMempool = false;

MaxKnownMajorProtocolVersion = 2;
Expand Down
42 changes: 42 additions & 0 deletions cardano-lib/preprod-config-bp.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
##########################################################
####### Preprod ########
####### Cardano Node Block Producer Configuration ########
##########################################################

{
##### Locations #####

ByronGenesisFile = ./preprod + "/byron-genesis.json";
ByronGenesisHash = "d4b8de7a11d929a323373cbab6c1a9bdc931beffff11db111cf9d57356ee1937";
ShelleyGenesisFile = ./preprod + "/shelley-genesis.json";
ShelleyGenesisHash = "162d29c4e1cf6b8a84f2d692e67a3ac6bc7851bc3e6e4afe64d15778bed8bd86";
AlonzoGenesisFile = ./preprod + "/alonzo-genesis.json";
AlonzoGenesisHash = "7e94a15f55d1e82d10f09203fa1d40f8eede58fd8066542cf6566008068ed874";
ConwayGenesisFile = ./preprod + "/conway-genesis.json";
ConwayGenesisHash = "49ef010ff0d13b090893a919bbc22022038a8b782faa0b1561a256b781672174";

##### Core protocol parameters #####

# This is the instance of the Ouroboros family that we are running.
# The node also supports various test and mock instances.
# "RealPBFT" is the real (ie not mock) (permissive) OBFT protocol, which
# is what we use on mainnet in Byron era.
Protocol = "Cardano";

# The mainnet does not include the network magic into addresses. Testnets do.
RequiresNetworkMagic = "RequiresMagic";
EnableP2P = true;
PeerSharing = false;
TargetNumberOfActivePeers = 20;
TargetNumberOfEstablishedPeers = 50;
TargetNumberOfKnownPeers = 100;
TargetNumberOfRootPeers = 100;

##### Update system parameters #####

# This protocol version number gets used by block producing nodes as part
# part of the system for agreeing on and synchronising protocol updates.
LastKnownBlockVersion-Major = 2;
LastKnownBlockVersion-Minor = 0;
LastKnownBlockVersion-Alt = 0;
}
3 changes: 2 additions & 1 deletion cardano-lib/preprod-config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@
# The mainnet does not include the network magic into addresses. Testnets do.
RequiresNetworkMagic = "RequiresMagic";
EnableP2P = true;
PeerSharing = true;
TargetNumberOfActivePeers = 20;
TargetNumberOfEstablishedPeers = 50;
TargetNumberOfKnownPeers = 100;
TargetNumberOfRootPeers = 100;
TargetNumberOfRootPeers = 60;

##### Update system parameters #####

Expand Down
39 changes: 39 additions & 0 deletions cardano-lib/preview-config-bp.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
##########################################################
####### Preview ########
####### Cardano Node Block Producer Configuration ########
##########################################################

{
##### Locations #####

ByronGenesisFile = ./preview + "/byron-genesis.json";
ByronGenesisHash = "83de1d7302569ad56cf9139a41e2e11346d4cb4a31c00142557b6ab3fa550761";
ShelleyGenesisFile = ./preview + "/shelley-genesis.json";
ShelleyGenesisHash = "363498d1024f84bb39d3fa9593ce391483cb40d479b87233f868d6e57c3a400d";
AlonzoGenesisFile = ./preview + "/alonzo-genesis.json";
AlonzoGenesisHash = "7e94a15f55d1e82d10f09203fa1d40f8eede58fd8066542cf6566008068ed874";
ConwayGenesisFile = ./preview + "/conway-genesis.json";
ConwayGenesisHash = "49ef010ff0d13b090893a919bbc22022038a8b782faa0b1561a256b781672174";

### Core protocol parameters #####
Protocol = "Cardano";
RequiresNetworkMagic = "RequiresMagic";
EnableP2P = true;
PeerSharing = false;
TargetNumberOfActivePeers = 20;
TargetNumberOfEstablishedPeers = 50;
TargetNumberOfKnownPeers = 100;
TargetNumberOfRootPeers = 100;
ExperimentalHardForksEnabled = false;
ExperimentalProtocolsEnabled = false;
TestShelleyHardForkAtEpoch = 0;
TestAllegraHardForkAtEpoch = 0;
TestAlonzoHardForkAtEpoch = 0;
TestMaryHardForkAtEpoch = 0;

##### Update system Parameters #####

LastKnownBlockVersion-Major = 3;
LastKnownBlockVersion-Minor = 1;
LastKnownBlockVersion-Alt = 0;
}
3 changes: 2 additions & 1 deletion cardano-lib/preview-config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
Protocol = "Cardano";
RequiresNetworkMagic = "RequiresMagic";
EnableP2P = true;
PeerSharing = true;
TargetNumberOfActivePeers = 20;
TargetNumberOfEstablishedPeers = 50;
TargetNumberOfKnownPeers = 100;
TargetNumberOfRootPeers = 100;
TargetNumberOfRootPeers = 60;
ExperimentalHardForksEnabled = false;
ExperimentalProtocolsEnabled = false;
TestShelleyHardForkAtEpoch = 0;
Expand Down
38 changes: 38 additions & 0 deletions cardano-lib/private-config-bp.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
##########################################################
####### Private ########
####### Cardano Node Block Producer Configuration ########
##########################################################

{
##### Locations #####

ByronGenesisFile = ./private + "/byron-genesis.json";
ByronGenesisHash = "1c49093e43757a7f5d55791ee8682d2681e7a291b10dadc663ac1889b3f16984";
ShelleyGenesisFile = ./private + "/shelley-genesis.json";
ShelleyGenesisHash = "136177de30fc5d431cc80f5789089486c13629e589dd705aa4254f765a84582b";
AlonzoGenesisFile = ./private + "/alonzo-genesis.json";
AlonzoGenesisHash = "8bedcaea62107d8a79ed5293b0027b3f8706a4bc2422f33380cb1fd01c6fa6ec";
ConwayGenesisFile = ./private + "/conway-genesis.json";
ConwayGenesisHash = "62f6efbb658ae8725aefc535aaae82a36f2634c1a01ec6994b22d6fd19639beb";

### Core protocol parameters #####
Protocol = "Cardano";
RequiresNetworkMagic = "RequiresMagic";
EnableP2P = true;
PeerSharing = false;
TargetNumberOfActivePeers = 20;
TargetNumberOfEstablishedPeers = 50;
TargetNumberOfKnownPeers = 100;
TargetNumberOfRootPeers = 100;
ExperimentalHardForksEnabled = true;
ExperimentalProtocolsEnabled = true;
TestShelleyHardForkAtEpoch = 0;
TestAllegraHardForkAtEpoch = 0;
TestAlonzoHardForkAtEpoch = 0;
TestMaryHardForkAtEpoch = 0;

##### Update system Parameters #####
LastKnownBlockVersion-Major = 3;
LastKnownBlockVersion-Minor = 1;
LastKnownBlockVersion-Alt = 0;
}
3 changes: 2 additions & 1 deletion cardano-lib/private-config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
Protocol = "Cardano";
RequiresNetworkMagic = "RequiresMagic";
EnableP2P = true;
PeerSharing = true;
TargetNumberOfActivePeers = 20;
TargetNumberOfEstablishedPeers = 50;
TargetNumberOfKnownPeers = 100;
TargetNumberOfRootPeers = 100;
TargetNumberOfRootPeers = 60;
ExperimentalHardForksEnabled = true;
ExperimentalProtocolsEnabled = true;
TestShelleyHardForkAtEpoch = 0;
Expand Down
39 changes: 39 additions & 0 deletions cardano-lib/sanchonet-config-bp.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
##########################################################
####### Sanchonet ########
####### Cardano Node Block Producer Configuration ########
##########################################################

{
##### Locations #####

ByronGenesisFile = ./sanchonet + "/byron-genesis.json";
ByronGenesisHash = "785eb88427e136378a15b0a152a8bfbeec7a611529ccda29c43a1e60ffb48eaa";
ShelleyGenesisFile = ./sanchonet + "/shelley-genesis.json";
ShelleyGenesisHash = "f94457ec45a0c6773057a529533cf7ccf746cb44dabd56ae970e1dbfb55bfdb2";
AlonzoGenesisFile = ./sanchonet + "/alonzo-genesis.json";
AlonzoGenesisHash = "8bedcaea62107d8a79ed5293b0027b3f8706a4bc2422f33380cb1fd01c6fa6ec";
ConwayGenesisFile = ./sanchonet + "/conway-genesis.json";
ConwayGenesisHash = "49ef010ff0d13b090893a919bbc22022038a8b782faa0b1561a256b781672174";

### Core protocol parameters #####
Protocol = "Cardano";
RequiresNetworkMagic = "RequiresMagic";
EnableP2P = true;
PeerSharing = false;
TargetNumberOfActivePeers = 20;
TargetNumberOfEstablishedPeers = 50;
TargetNumberOfKnownPeers = 100;
TargetNumberOfRootPeers = 100;
ExperimentalHardForksEnabled = true;
ExperimentalProtocolsEnabled = true;
TestShelleyHardForkAtEpoch = 0;
TestAllegraHardForkAtEpoch = 0;
TestAlonzoHardForkAtEpoch = 0;
TestMaryHardForkAtEpoch = 0;

##### Update system Parameters #####

LastKnownBlockVersion-Major = 3;
LastKnownBlockVersion-Minor = 1;
LastKnownBlockVersion-Alt = 0;
}
Loading