Skip to content

Commit 897de0f

Browse files
committed
nodeNixosSvc: rm useNewTopology w/ p2p as the only networking mode
1 parent ecbf8fc commit 897de0f

1 file changed

Lines changed: 19 additions & 74 deletions

File tree

nix/nixos/cardano-node-service.nix

Lines changed: 19 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,6 @@ let
3232
peerSnapshotFile = cfg.peerSnapshotFile i;
3333
};
3434

35-
oldTopology = i: {
36-
Producers = concatMap (g: map (a: {
37-
addr = a.address;
38-
inherit (a) port;
39-
valency = a.valency or 1;
40-
}) g.accessPoints) (
41-
cfg.producers ++ (cfg.instanceProducers i) ++ cfg.publicProducers ++ (cfg.instancePublicProducers i)
42-
);
43-
};
44-
4535
assertNewTopology = i:
4636
let
4737
checkEval = tryEval (
@@ -58,7 +48,7 @@ let
5848
selectTopology = i:
5949
if cfg.topology != null
6050
then cfg.topology
61-
else toFile "topology.json" (toJSON (if (cfg.useNewTopology != false) then assertNewTopology i else oldTopology i));
51+
else toFile "topology.json" (toJSON (assertNewTopology i));
6252

6353
topology = i:
6454
if cfg.useSystemdReload
@@ -72,27 +62,17 @@ let
7262
// (mapAttrs' (era: epoch:
7363
nameValuePair "Test${era}HardForkAtEpoch" epoch
7464
) cfg.forceHardForks)
75-
// (optionalAttrs (cfg.useNewTopology != false) (
76-
{
77-
MaxConcurrencyBulkSync = 2;
78-
} // optionalAttrs (cfg.useNewTopology == true) {
79-
# Starting with node 10.6.0, p2p is the only network
80-
# operating mode and EnableP2P becomes a no-op and is not
81-
# declared by default.
82-
#
83-
# Older node versions which still require an explicit
84-
# declaration can set useNewTopology true.
85-
EnableP2P = true;
86-
} // optionalAttrs (cfg.targetNumberOfRootPeers != null) {
87-
TargetNumberOfRootPeers = cfg.targetNumberOfRootPeers;
88-
} // optionalAttrs (cfg.targetNumberOfKnownPeers != null) {
89-
TargetNumberOfKnownPeers = cfg.targetNumberOfKnownPeers;
90-
} // optionalAttrs (cfg.targetNumberOfEstablishedPeers != null) {
91-
TargetNumberOfEstablishedPeers = cfg.targetNumberOfEstablishedPeers;
92-
} // optionalAttrs (cfg.targetNumberOfActivePeers != null) {
93-
TargetNumberOfActivePeers = cfg.targetNumberOfActivePeers;
94-
})
95-
)
65+
// {
66+
MaxConcurrencyBulkSync = 2;
67+
} // optionalAttrs (cfg.targetNumberOfRootPeers != null) {
68+
TargetNumberOfRootPeers = cfg.targetNumberOfRootPeers;
69+
} // optionalAttrs (cfg.targetNumberOfKnownPeers != null) {
70+
TargetNumberOfKnownPeers = cfg.targetNumberOfKnownPeers;
71+
} // optionalAttrs (cfg.targetNumberOfEstablishedPeers != null) {
72+
TargetNumberOfEstablishedPeers = cfg.targetNumberOfEstablishedPeers;
73+
} // optionalAttrs (cfg.targetNumberOfActivePeers != null) {
74+
TargetNumberOfActivePeers = cfg.targetNumberOfActivePeers;
75+
}
9676
) cfg.extraNodeConfig;
9777
baseInstanceConfig =
9878
i:
@@ -635,31 +615,6 @@ in {
635615
'';
636616
};
637617

638-
useNewTopology = mkOption {
639-
type = nullOr bool;
640-
default = cfg.nodeConfig.EnableP2P or null;
641-
description = ''
642-
Use new, p2p and ledger peers compatible topology.
643-
644-
The useNewTopology option is deprecated and will be removed in the
645-
future. As of cardano-node 10.6.0, this option should remain null.
646-
For older node versions, a bool value can be set, but this will only
647-
be supported until the Dijkstra hard fork at which point all
648-
cardano-node versions will be compelled to upgrade and the
649-
useNewTopology option will be removed.
650-
651-
For node version < 10.6.0, useNewTopology will need to be explicitly
652-
declared true or false to behave accordingly. If left null while
653-
also using the auto-generated p2p topology, node will fail to start.
654-
655-
For node version >= 10.6.0, useNewTopology should be left as null
656-
until the option is removed after the Dijkstra hard fork. If
657-
explicitly declared true, node will continue to work, but if declared
658-
false while using the auto-generated legacy topology, node will fail to
659-
start.
660-
'';
661-
};
662-
663618
useLegacyTracing = mkOption {
664619
type = bool;
665620
default = false;
@@ -877,12 +832,9 @@ in {
877832
#
878833
# Mainnet does not yet require it, but declaring it will also
879834
# facilitate testing.
880-
if (cfg.useNewTopology != false)
881-
then
882-
if cfg.useSystemdReload
883-
then "peer-snapshot-${toString i}.json"
884-
else toFile "peer-snapshot.json" (toJSON (envConfig.peerSnapshot))
885-
else null;
835+
if cfg.useSystemdReload
836+
then "peer-snapshot-${toString i}.json"
837+
else toFile "peer-snapshot.json" (toJSON (envConfig.peerSnapshot));
886838
example = i: "/etc/cardano-node/peer-snapshot-${toString i}.json";
887839
apply = x: if lib.isFunction x then x else _: x;
888840
description = ''
@@ -926,7 +878,7 @@ in {
926878
(acc: i: recursiveUpdate acc {"cardano-node/topology-${toString i}.json".source = selectTopology i;}) {}
927879
(range 0 (cfg.instances - 1)))
928880
)
929-
(mkIf ((cfg.useNewTopology != false) && cfg.useSystemdReload)
881+
(mkIf cfg.useSystemdReload
930882
(foldl'
931883
(acc: i: recursiveUpdate acc (
932884
optionalAttrs (cfg.peerSnapshotFile i != null) {
@@ -950,12 +902,12 @@ in {
950902
wants = [ "network-online.target" ];
951903
wantedBy = [ "multi-user.target" ];
952904
partOf = mkIf (cfg.instances > 1) ["cardano-node.service"];
953-
reloadTriggers = mkIf (cfg.useSystemdReload && (cfg.useNewTopology != false)) [ (selectTopology i) ];
905+
reloadTriggers = mkIf cfg.useSystemdReload [ (selectTopology i) ];
954906
script = mkScript cfg i;
955907
serviceConfig = {
956908
User = "cardano-node";
957909
Group = "cardano-node";
958-
ExecReload = mkIf (cfg.useSystemdReload && (cfg.useNewTopology != false)) "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
910+
ExecReload = mkIf cfg.useSystemdReload "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
959911
Restart = "always";
960912
RuntimeDirectory = mkIf (!cfg.systemdSocketActivation)
961913
(removePrefix cfg.runDirBase (runtimeDir i));
@@ -1033,7 +985,7 @@ in {
1033985
'';
1034986
}
1035987
{
1036-
assertion = !(cfg.systemdSocketActivation && (cfg.useNewTopology != false));
988+
assertion = !cfg.systemdSocketActivation;
1037989
message = "Systemd socket activation cannot be used with p2p topology due to a systemd socket re-use issue.";
1038990
}
1039991
{
@@ -1058,13 +1010,6 @@ in {
10581010
message = "Only one option of services.cardano-node.tracerSocket(PathAccept|PathConnect|NetworkAccept|NetworkConnect) can be declared.";
10591011
}
10601012
];
1061-
1062-
warnings = optional (cfg.useNewTopology != null) ''
1063-
The useNewTopology option is deprecated and will be removed in the future. As of cardano-node 10.6.0, this option should remain null.
1064-
For older node versions, a bool value can be set, but this will only be supported until the Dijkstra hard fork at which point all
1065-
cardano-node versions will be compelled to upgrade and the useNewTopology option will be removed. See the services.cardano-node.useNewTopology
1066-
option description for further details.
1067-
'';
10681013
}
10691014
]);
10701015
}

0 commit comments

Comments
 (0)