Skip to content
This repository has been archived by the owner on Feb 28, 2023. It is now read-only.

Commit

Permalink
obft: fix mantis jobset
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Fellinger <michael.fellinger@iohk.io>
  • Loading branch information
picnoir and manveru committed Dec 3, 2020
1 parent c3f8308 commit 9eaaaa9
Showing 1 changed file with 37 additions and 48 deletions.
85 changes: 37 additions & 48 deletions jobs/mantis.nix
Expand Up @@ -73,7 +73,7 @@ let

mkMorpho = { name, nodeNumber, nbNodes }: {
services = {
"${namespace}-${name}" = {
"${namespace}-morpho-node" = {
addressMode = "host";
portLabel = "morpho";

Expand Down Expand Up @@ -105,11 +105,23 @@ let
templates = [
{
data = ''
NodeId: {{ index (split "-" "${name}") 2 }}
ApplicationName: morpho-checkpoint
ApplicationVersion: 1
CheckpointInterval: 4
LastKnownBlockVersion-Major: 0
LastKnownBlockVersion-Minor: 2
LastKnownBlockVersion-Alt: 0
NetworkMagic: 12345
NodeId: ${builtins.toString nodeNumber}
FedPubKeys:
{{- range service "${namespace}-morpho-node" -}}
{{- with secret (printf "kv/data/nomad-cluster/${namespace}/%s/obft-public-key" .ServiceMeta.Name) }}
- {{ .Data.data.value -}}
{{- end -}}
{{- end }}
Protocol: MockedBFT
NumCoreNodes: {{ len (service "${namespace}-morpho-node") }}
RequiresNetworkMagic: RequiresMagic
NetworkMagic: 12345
SystemStart: "2020-11-17T00:00:00Z"
SecurityParam: 5
TurnOnLogging: True
Expand All @@ -121,50 +133,26 @@ let
PoWBlockFetchInterval: 5000000
PoWNodeRpcUrl: http://{{ env "NOMAD_ADDR_rpc" }}
PrometheusPort: {{ env "NOMAD_PORT_morphoPrometheus" }}
CheckpointInterval: 4
RequiredMajority: {{ len (service "${namespace}-morpho-node") | divide 2 | add 1 }}
FedPubKeys:
{{- range service "${namespace}-morpho-node" -}}
{{- with secret (printf "kv/data/nomad-cluster/${namespace}/%s/obft-public-key") .ServiceMeta.Name }}
- {{ .Data.data.value -}}
{{- end -}}
{{- end }}
NodePrivKeyFile: {{ env "NOMAD_SECRETS_DIR" }}/morpho-private-key
ApplicationName: morpho-checkpoint
ApplicationVersion: 1
LastKnownBlockVersion-Major: 0
LastKnownBlockVersion-Minor: 2
LastKnownBlockVersion-Alt: 0
TracingVerbosity: NormalVerbosity
TraceBlockFetchClient: True
TraceBlockFetchDecisions: True
TraceBlockFetchProtocol: True
TraceBlockFetchProtocolSerialised: False
TraceBlockFetchServer: True
TraceChainDb: True
TraceChainSyncClient: True
TraceChainSyncBlockServer: True
TraceChainSyncHeaderServer: True
TraceChainSyncProtocol: True
TraceDNSResolver: False
TraceDNSSubscription: False
TraceErrorPolicy: False
TraceForge: True
TraceIpSubscription: False
TraceLocalChainSyncProtocol: True
TraceLocalTxSubmissionProtocol: True
TraceLocalTxSubmissionServer: True
TraceMempool: True
TraceMux: False
TraceTxInbound: True
TraceTxOutbound: True
TraceTxSubmissionProtocol: True
# MinSeverity: Debug
setupScribes:
- scKind: StdoutSk
scName: "stdout"
scFormat: ScText
defaultScribes:
- - StdoutSk
- "stdout"
setupBackends:
- KatipBK
defaultBackends:
- KatipBK
'';
destination = "local/morpho-config.yaml";
}
{
data = ''
{{- with secret "kv/data/nomad-cluster/${namespace}/${name}/obft-private-key" -}}
{{- with secret "kv/data/nomad-cluster/${namespace}/${name}/obft-secret-key" -}}
{{- .Data.data.value -}}
{{- end -}}
'';
Expand All @@ -173,20 +161,21 @@ let
{
data = ''
[
{{- range service "${namespace}-morpho-node" -}}
{{- range $index1, $service1 := service "${namespace}-morpho-node" -}}
{{ if ne $index1 0 }},{{ end }}
{
"nodeAddress": {
"addr": "{{ .Address }}",
"port": 3001,
"port": {{ .Port }},
"valency": 1
},
"nodeId": {{- index (split "-" .ServiceMeta.Name) 2 -}},
"producers": [
{{- range $index, $service := service "${namespace}-morpho-node" -}}
{{ if ne $index 0 }},{{ end }}
{{- range $index2, $service2 := service "${namespace}-morpho-node" -}}
{{ if ne $index2 0 }},{{ end }}
{
"addr": "{{ .Address }}",
"port": 3001,
"port": {{ .Port }},
"valency": 1
}
{{- end -}}
Expand Down Expand Up @@ -279,8 +268,8 @@ let
};

mkMantis = { name, resources, count ? 1, templates, serviceName, tags ? [ ]
, meta ? { }, constraints ? [ ], requiredPeerCount, services ? { } }: {
inherit count constraints;
, meta ? { }, requiredPeerCount, services ? { } }: {
inherit count;

networks = [{
ports = {
Expand Down Expand Up @@ -1098,7 +1087,7 @@ in {

taskGroups = let
minerTaskGroups = lib.listToAttrs (map mkMiner miners);
passiveTaskGroups = mkPassive 3;
passiveTaskGroups = { passive = mkPassive 3; };
in minerTaskGroups // passiveTaskGroups;
};

Expand Down

0 comments on commit 9eaaaa9

Please sign in to comment.