diff --git a/cabal.project b/cabal.project index c3f5d12b96..a7338c1bcf 100644 --- a/cabal.project +++ b/cabal.project @@ -90,8 +90,8 @@ source-repository-package source-repository-package type: git location: https://github.com/IntersectMBO/cardano-ledger.git - tag: 7e1fb14c916e58709aa36c4b4fe0265ba537e0f0 - --sha256: sha256-nR60TiNlCaeutZNI083hdjM3HqglM9sGWqf6MFKaK1I= + tag: 0c0368ea767e0dcbe187d44a9ab2d8a16d826984 + --sha256: sha256-8gt+Y5eVmK7S/j784eXywRXkm2YR4fJyI5vz4a5Uv9g= subdir: eras/allegra/impl eras/alonzo/impl diff --git a/flake.nix b/flake.nix index 6330675940..7bb1dffe7e 100644 --- a/flake.nix +++ b/flake.nix @@ -95,10 +95,8 @@ } // leiosDemo.devShells; inherit hydraJobs; legacyPackages = pkgs; - packages = - hydraJobs.native.haskell96.exesNoAsserts.ouroboros-consensus-cardano // { - leios-mvd-test = pkgs.testers.nixosTest (import ./nix/leios-mvd/test.nix { inherit inputs pkgs; }); - }; + formatter = hydraJobs.native.formattingLinting.run; + packages = hydraJobs.native.haskell96.exesNoAsserts.ouroboros-consensus-cardano; } ); } diff --git a/nix/formatting-linting.nix b/nix/formatting-linting.nix index 65a12eee66..fa76b2c555 100644 --- a/nix/formatting-linting.nix +++ b/nix/formatting-linting.nix @@ -2,6 +2,13 @@ pkgs: let inherit (pkgs) lib; + + runFormatting = tool: script: pkgs.writeShellApplication { + name = "run-${lib.getName tool}"; + runtimeInputs = [ pkgs.bash pkgs.fd tool ]; + text = ''bash ${script}''; + }; + checkFormatting = tool: script: pkgs.runCommand "check-${lib.getName tool}" { @@ -24,7 +31,8 @@ let echo $EXIT_CODE > $out fi ''; - formattingLinting = { + + checks = { fourmolu = checkFormatting pkgs.fourmolu ../scripts/ci/run-fourmolu.sh; cabal-gild = checkFormatting pkgs.cabal-gild ../scripts/ci/run-cabal-gild.sh; nixpkgs-fmt = checkFormatting pkgs.nixpkgs-fmt ../scripts/ci/run-nixpkgs-fmt.sh; @@ -42,11 +50,32 @@ let touch $out ''; }; -in -formattingLinting // { - all = pkgs.releaseTools.aggregate { - name = "consensus-formatting"; - meta.description = "Run all formatters and linters"; - constituents = lib.collect lib.isDerivation formattingLinting; + + runs = { + fourmolu = runFormatting pkgs.fourmolu ../scripts/ci/run-fourmolu.sh; + cabal-gild = runFormatting pkgs.cabal-gild ../scripts/ci/run-cabal-gild.sh; + nixpkgs-fmt = runFormatting pkgs.nixpkgs-fmt ../scripts/ci/run-nixpkgs-fmt.sh; + dos2unix = runFormatting pkgs.dos2unix ../scripts/ci/run-dos2unix.sh; + hlint = pkgs.writeShellApplication { + name = "hlint"; + runtimeInputs = [ pkgs.hlint ]; + text = ''hlint -j .''; + }; }; + + checkAll = pkgs.releaseTools.aggregate { + name = "consensus-formatting-check"; + meta.description = "Check all formatters and linters"; + constituents = lib.collect lib.isDerivation checks; + }; + + runAll = pkgs.writeShellApplication { + name = "consensus-formatting-run"; + text = ''for prog in ${with builtins; toString (map lib.getExe (attrValues runs))}; do $prog; done''; + }; + +in +checks // { + all = checkAll; + run = runAll; } diff --git a/nix/leios-mvd/README.md b/nix/leios-mvd/README.md deleted file mode 100644 index d54a1a553c..0000000000 --- a/nix/leios-mvd/README.md +++ /dev/null @@ -1,50 +0,0 @@ -# Leios MVD - -Leios Minimum Viable Demo branch with NixOS test based setup for spawning reproducible and/or interactive demo scenarios. - -## Files and directories - -- `./test.nix` contains the NixOS test definition where we can script various scenarios. -- `./leios-node/` contains the NixOS definition for the "leios-node" that runs the "Ouroboros Leios" patched cardano-node under test. -- `./immdb-node/` contains the NixOS definition for the "immdb-node" that runs the Immutable DB server. - -## Running the test - -To run the test scenario with Nix: - -```shell -$ nix build .#leios-mvd-test -``` - -Once it finishes the `result` directory will contains the logs collected from the "leios-node": - -```shell -$ ls result -cardano-node.logs - -$ tail result/cardano-node.logs -Oct 15 14:58:07 leios-node cardano-node-start[741]: {"at":"2025-10-15T14:58:07.199318758Z","ns":"Net.ConnectionManager.Local.ConnectionManagerCounters","data":{"kind":"ConnectionManagerCounters","state":{"duplex":0,"fullDuplex":0,"inbound":1,"outbound":0,"unidirectional":1}},"sev":"Debug","thread":"42","host":"leios-node"} -... -``` - -## Interactive demo - -Fun part! To start the nodes defined by the test scenario run: - -```shell -$ nix run .#leios-mvd-test.driverInteractive -additionally exposed symbols: - immdb-node, leios-node, - vlan1, - start_all, test_script, machines, vlans, driver, log, os, create_machine, subtest, run_tests, join_all, retry, serial_stdout_off, serial_stdout_on, polling_condition, Machine ->>> -``` - -This puts you in a IPython shell. To start all nodes run: - -```python ->>> start_all() -``` - -After a bit you should see QEMU windows corresponding to each node in the test scenario. -Login as "root". diff --git a/nix/leios-mvd/genesis/genesis.alonzo.json b/nix/leios-mvd/genesis/genesis.alonzo.json deleted file mode 100644 index e13bd102bf..0000000000 --- a/nix/leios-mvd/genesis/genesis.alonzo.json +++ /dev/null @@ -1,188 +0,0 @@ -{ - "collateralPercentage": 150, - "costModels": { - "PlutusV1": [ - 197209, - 0, - 1, - 1, - 396231, - 621, - 0, - 1, - 150000, - 1000, - 0, - 1, - 150000, - 32, - 2477736, - 29175, - 4, - 29773, - 100, - 29773, - 100, - 29773, - 100, - 29773, - 100, - 29773, - 100, - 29773, - 100, - 100, - 100, - 29773, - 100, - 150000, - 32, - 150000, - 32, - 150000, - 32, - 150000, - 1000, - 0, - 1, - 150000, - 32, - 150000, - 1000, - 0, - 8, - 148000, - 425507, - 118, - 0, - 1, - 1, - 150000, - 1000, - 0, - 8, - 150000, - 112536, - 247, - 1, - 150000, - 10000, - 1, - 136542, - 1326, - 1, - 1000, - 150000, - 1000, - 1, - 150000, - 32, - 150000, - 32, - 150000, - 32, - 1, - 1, - 150000, - 1, - 150000, - 4, - 103599, - 248, - 1, - 103599, - 248, - 1, - 145276, - 1366, - 1, - 179690, - 497, - 1, - 150000, - 32, - 150000, - 32, - 150000, - 32, - 150000, - 32, - 150000, - 32, - 150000, - 32, - 148000, - 425507, - 118, - 0, - 1, - 1, - 61516, - 11218, - 0, - 1, - 150000, - 32, - 148000, - 425507, - 118, - 0, - 1, - 1, - 148000, - 425507, - 118, - 0, - 1, - 1, - 2477736, - 29175, - 4, - 0, - 82363, - 4, - 150000, - 5000, - 0, - 1, - 150000, - 32, - 197209, - 0, - 1, - 1, - 150000, - 32, - 150000, - 32, - 150000, - 32, - 150000, - 32, - 150000, - 32, - 150000, - 32, - 150000, - 32, - 3345831, - 1, - 1 - ] - }, - "executionPrices": { - "priceMemory": 0.0577, - "priceSteps": 0.0000721 - }, - "lovelacePerUTxOWord": 34482, - "maxBlockExUnits": { - "memory": 62000000, - "steps": 20000000000 - }, - "maxCollateralInputs": 3, - "maxTxExUnits": { - "memory": 14000000, - "steps": 10000000000 - }, - "maxValueSize": 5000 -} diff --git a/nix/leios-mvd/genesis/genesis.byron.json b/nix/leios-mvd/genesis/genesis.byron.json deleted file mode 100644 index e2bf95e287..0000000000 --- a/nix/leios-mvd/genesis/genesis.byron.json +++ /dev/null @@ -1,42 +0,0 @@ -{ "bootStakeholders": - { "a8f4fd08e2935ea584899dc306084595c4b9df394ea20dd855236a9d": 1 } -, "heavyDelegation": - { "a8f4fd08e2935ea584899dc306084595c4b9df394ea20dd855236a9d": - { "omega": 0 - , "issuerPk": - "JW5mw+Zo7XnJpBlqMnsrd+cfElAY8AFAWbQuF0+CqTQYgBz9eXza/EiY9sxugu/b6FwJW5fxe3rY83U7VFzEfg==" - , "delegatePk": - "zMajaA9h8Q6gUQ+y6VKHoj4Y1VBjlJyyS0v2eZn67RgNBOK63uxBdut6/1/kLaNMk+MuWB131W/abDCPs8b9og==" - , "cert": - "b12dd4d4d8c87a9af25fa6d5ee78a620573a6712fbeebfc45951d00bf4200a70cb6d4733cfddea576c4fd399e2fd6e2fd60d55f243bc6c8177ed599d699d6d06" - } } -, "startTime": 1759952614 -, "nonAvvmBalances": - { "2657WMsDfac5QzGGBef3oj7pwz4VwHCmNhkhLmN1SSs47qypuS7XQwFNCRVWansbi": - "30000" - , "2657WMsDfac6t6LUFkmDj8GCgJwUxNAPLMnionk3PbkLzVYHAiS7CpMGYUQjjhZQi": - "270000" - } -, "blockVersionData": - { "scriptVersion": 0 - , "slotDuration": "20000" - , "maxBlockSize": "641000" - , "maxHeaderSize": "200000" - , "maxTxSize": "4096" - , "maxProposalSize": "700" - , "mpcThd": "200000" - , "heavyDelThd": "300000" - , "updateVoteThd": "100000" - , "updateProposalThd": "100000" - , "updateImplicit": "10000" - , "softforkRule": - { "initThd": "900000" - , "minThd": "600000" - , "thdDecrement": "100000" - } - , "txFeePolicy": { "summand": "0" , "multiplier": "439460" } - , "unlockStakeEpoch": "184467" - } -, "protocolConsts": { "k": 3 , "protocolMagic": 42 } -, "avvmDistr": {} -} diff --git a/nix/leios-mvd/genesis/genesis.conway.json b/nix/leios-mvd/genesis/genesis.conway.json deleted file mode 100644 index 70f8103f31..0000000000 --- a/nix/leios-mvd/genesis/genesis.conway.json +++ /dev/null @@ -1,337 +0,0 @@ -{ - "committee": { - "members": {}, - "threshold": 0 - }, - "committeeMaxTermLength": 146, - "committeeMinSize": 7, - "constitution": { - "anchor": { - "dataHash": "0000000000000000000000000000000000000000000000000000000000000000", - "url": "" - } - }, - "dRepActivity": 20, - "dRepDeposit": 500000000, - "dRepVotingThresholds": { - "committeeNoConfidence": 0.6, - "committeeNormal": 0.67, - "hardForkInitiation": 0.6, - "motionNoConfidence": 0.67, - "ppEconomicGroup": 0.67, - "ppGovGroup": 0.75, - "ppNetworkGroup": 0.67, - "ppTechnicalGroup": 0.67, - "treasuryWithdrawal": 0.67, - "updateToConstitution": 0.75 - }, - "govActionDeposit": 100000000000, - "govActionLifetime": 6, - "minFeeRefScriptCostPerByte": 15, - "plutusV3CostModel": [ - 100788, - 420, - 1, - 1, - 1000, - 173, - 0, - 1, - 1000, - 59957, - 4, - 1, - 11183, - 32, - 201305, - 8356, - 4, - 16000, - 100, - 16000, - 100, - 16000, - 100, - 16000, - 100, - 16000, - 100, - 16000, - 100, - 100, - 100, - 16000, - 100, - 94375, - 32, - 132994, - 32, - 61462, - 4, - 72010, - 178, - 0, - 1, - 22151, - 32, - 91189, - 769, - 4, - 2, - 85848, - 123203, - 7305, - -900, - 1716, - 549, - 57, - 85848, - 0, - 1, - 1, - 1000, - 42921, - 4, - 2, - 24548, - 29498, - 38, - 1, - 898148, - 27279, - 1, - 51775, - 558, - 1, - 39184, - 1000, - 60594, - 1, - 141895, - 32, - 83150, - 32, - 15299, - 32, - 76049, - 1, - 13169, - 4, - 22100, - 10, - 28999, - 74, - 1, - 28999, - 74, - 1, - 43285, - 552, - 1, - 44749, - 541, - 1, - 33852, - 32, - 68246, - 32, - 72362, - 32, - 7243, - 32, - 7391, - 32, - 11546, - 32, - 85848, - 123203, - 7305, - -900, - 1716, - 549, - 57, - 85848, - 0, - 1, - 90434, - 519, - 0, - 1, - 74433, - 32, - 85848, - 123203, - 7305, - -900, - 1716, - 549, - 57, - 85848, - 0, - 1, - 1, - 85848, - 123203, - 7305, - -900, - 1716, - 549, - 57, - 85848, - 0, - 1, - 955506, - 213312, - 0, - 2, - 270652, - 22588, - 4, - 1457325, - 64566, - 4, - 20467, - 1, - 4, - 0, - 141992, - 32, - 100788, - 420, - 1, - 1, - 81663, - 32, - 59498, - 32, - 20142, - 32, - 24588, - 32, - 20744, - 32, - 25933, - 32, - 24623, - 32, - 43053543, - 10, - 53384111, - 14333, - 10, - 43574283, - 26308, - 10, - 16000, - 100, - 16000, - 100, - 962335, - 18, - 2780678, - 6, - 442008, - 1, - 52538055, - 3756, - 18, - 267929, - 18, - 76433006, - 8868, - 18, - 52948122, - 18, - 1995836, - 36, - 3227919, - 12, - 901022, - 1, - 166917843, - 4307, - 36, - 284546, - 36, - 158221314, - 26549, - 36, - 74698472, - 36, - 333849714, - 1, - 254006273, - 72, - 2174038, - 72, - 2261318, - 64571, - 4, - 207616, - 8310, - 4, - 1293828, - 28716, - 63, - 0, - 1, - 1006041, - 43623, - 251, - 0, - 1, - 100181, - 726, - 719, - 0, - 1, - 100181, - 726, - 719, - 0, - 1, - 100181, - 726, - 719, - 0, - 1, - 107878, - 680, - 0, - 1, - 95336, - 1, - 281145, - 18848, - 0, - 1, - 180194, - 159, - 1, - 1, - 158519, - 8942, - 0, - 1, - 159378, - 8813, - 0, - 1, - 107490, - 3298, - 1, - 106057, - 655, - 1, - 1964219, - 24520, - 3 - ], - "poolVotingThresholds": { - "committeeNoConfidence": 0.51, - "committeeNormal": 0.51, - "hardForkInitiation": 0.51, - "motionNoConfidence": 0.51, - "ppSecurityGroup": 0.51 - } -} diff --git a/nix/leios-mvd/genesis/genesis.shelley.json b/nix/leios-mvd/genesis/genesis.shelley.json deleted file mode 100644 index cd07b300b1..0000000000 --- a/nix/leios-mvd/genesis/genesis.shelley.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "activeSlotsCoeff": 0.050, - "epochLength": 600, - "genDelegs": {}, - "initialFunds": { - "00635eef9a08f327a0ce009466914e8f607cebf76e9f4c9f92b0a829f4eab4c172777c708cd0bcac1a16d41b513e3a0f3dff8d182c2878947c": 900000000000000, - "00f00bb672d5d2f064707e6c955234da597e9b43ed6e458a3d15870a8257ef7aac3c0f6e4fbc3e253e3f4e58039986e89492c02c812e703d69": 900000000000000, - "601c6db4e8b6b36e265b9eecba0cb9a653cdd8701f708beccd911f838b": 9000000000000 - }, - "maxKESEvolutions": 62, - "maxLovelaceSupply": 2010000000000000, - "networkId": "Testnet", - "networkMagic": 42, - "protocolParams": { - "a0": 0.3, - "decentralisationParam": 0, - "eMax": 18, - "extraEntropy": { - "tag": "NeutralNonce" - }, - "keyDeposit": 2000000, - "maxBlockBodySize": 90112, - "maxBlockHeaderSize": 1100, - "maxTxSize": 16384, - "minFeeA": 44, - "minFeeB": 155381, - "minPoolCost": 340000000, - "minUTxOValue": 0, - "nOpt": 500, - "poolDeposit": 500000000, - "protocolVersion": { - "major": 10, - "minor": 0 - }, - "rho": 0.0030, - "tau": 0.2 - }, - "securityParam": 3, - "slotLength": 1, - "slotsPerKESPeriod": 129600, - "staking": { - "pools": { - "4c26da5ee3f61915d2df4167a53394b1f033623042a8d26ab7af5ef7": { - "cost": 0, - "margin": 0, - "metadata": null, - "owners": [], - "pledge": 0, - "publicKey": "4c26da5ee3f61915d2df4167a53394b1f033623042a8d26ab7af5ef7", - "relays": [ - { - "single host name": { - "dnsName": "node-0", - "port": 30000 - } - } - ], - "rewardAccount": { - "credential": { - "keyHash": "48d482deb658ae1aaa522a365e68f9747da98015500e1c260dca3c73" - }, - "network": "Testnet" - }, - "vrf": "03670fa208cb10b3452f04be890c931e4f34eff777dec589f1631d66c971c40c" - }, - "68b23036da5530e5853357a8dc9d03dd8e851b0e29a3eaf61b55b6cc": { - "cost": 0, - "margin": 0, - "metadata": null, - "owners": [], - "pledge": 0, - "publicKey": "68b23036da5530e5853357a8dc9d03dd8e851b0e29a3eaf61b55b6cc", - "relays": [ - { - "single host name": { - "dnsName": "node-1", - "port": 30001 - } - } - ], - "rewardAccount": { - "credential": { - "keyHash": "df587edcea6b53ed8bdc416be16f00beaaef18b5c6b25294275bf117" - }, - "network": "Testnet" - }, - "vrf": "0a570d439272a91eca089a9d04d9a94f11bb86c8daa3991fa67b35468049d60e" - } - }, - "stake": { - "57ef7aac3c0f6e4fbc3e253e3f4e58039986e89492c02c812e703d69": "4c26da5ee3f61915d2df4167a53394b1f033623042a8d26ab7af5ef7", - "eab4c172777c708cd0bcac1a16d41b513e3a0f3dff8d182c2878947c": "68b23036da5530e5853357a8dc9d03dd8e851b0e29a3eaf61b55b6cc" - } - }, - "systemStart": "2025-10-08T19:43:34Z", - "updateQuorum": 5 -} diff --git a/nix/leios-mvd/immdb-node/config.json b/nix/leios-mvd/immdb-node/config.json deleted file mode 100644 index d536475cd6..0000000000 --- a/nix/leios-mvd/immdb-node/config.json +++ /dev/null @@ -1,283 +0,0 @@ -{ - "AlonzoGenesisFile": "genesis-alonzo.json", - "ByronGenesisFile": "genesis-byron.json", - "ConwayGenesisFile": "genesis-conway.json", - "ShelleyGenesisFile": "genesis-shelley.json", - "ChainSyncIdleTimeout": 0, - "EnableP2P": true, - "ExperimentalHardForksEnabled": true, - "ExperimentalProtocolsEnabled": true, - "LastKnownBlockVersion-Alt": 0, - "LastKnownBlockVersion-Major": 3, - "LastKnownBlockVersion-Minor": 0, - "PeerSharing": false, - "Protocol": "Cardano", - "RequiresNetworkMagic": "RequiresMagic", - "SnapshotInterval": 4230, - "SyncTargetNumberOfActivePeers": 15, - "SyncTargetNumberOfEstablishedPeers": 40, - "TargetNumberOfActivePeers": 15, - "TargetNumberOfEstablishedPeers": 40, - "TestAllegraHardForkAtEpoch": 0, - "TestAlonzoHardForkAtEpoch": 0, - "TestBabbageHardForkAtEpoch": 0, - "TestConwayHardForkAtEpoch": 0, - "TestMaryHardForkAtEpoch": 0, - "TestShelleyHardForkAtEpoch": 0, - "TraceOptionForwarder": { - "connQueueSize": 64, - "disconnQueueSize": 128, - "maxReconnectDelay": 30 - }, - "TraceOptionMetricsPrefix": "cardano.node.metrics.", - "TraceOptionNodeName": "immdb-node", - "TraceOptionPeerFrequency": 2000, - "TraceOptionResourceFrequency": 1000, - "TraceOptions": { - "": { - "backends": [ - "Stdout MachineFormat", - "EKGBackend", - "Forwarder" - ], - "detail": "DNormal", - "severity": "Notice" - }, - "BlockFetch.Client": { - "severity": "Debug" - }, - "BlockFetch.Client.CompletedBlockFetch": { - "maxFrequency": 2.0 - }, - "BlockFetch.Decision": { - "severity": "Notice" - }, - "BlockFetch.Remote": { - "severity": "Notice" - }, - "BlockFetch.Remote.Serialised": { - "severity": "Notice" - }, - "BlockFetch.Server": { - "severity": "Debug" - }, - "BlockchainTime": { - "severity": "Notice" - }, - "ChainDB": { - "severity": "Debug" - }, - "ChainDB.AddBlockEvent.AddBlockValidation": { - "severity": "Silence" - }, - "ChainDB.AddBlockEvent.AddBlockValidation.ValidCandidate": { - "maxFrequency": 2.0 - }, - "ChainDB.AddBlockEvent.AddedBlockToQueue": { - "maxFrequency": 2.0 - }, - "ChainDB.AddBlockEvent.AddedBlockToVolatileDB": { - "maxFrequency": 2.0 - }, - "ChainDB.CopyToImmutableDBEvent.CopiedBlockToImmutableDB": { - "maxFrequency": 2.0 - }, - "ChainDB.LedgerEvent.Flavor.V1.OnDisk.BackingStoreEvent": { - "severity": "Silence" - }, - "ChainDB.LedgerEvent.Forker": { - "severity": "Silence" - }, - "ChainDB.ReplayBlock.LedgerReplay": { - "severity": "Notice" - }, - "ChainSync.Client": { - "severity": "Debug" - }, - "ChainSync.Local": { - "severity": "Notice" - }, - "ChainSync.Remote": { - "severity": "Notice" - }, - "ChainSync.Remote.Serialised": { - "severity": "Notice" - }, - "ChainSync.ServerBlock": { - "severity": "Notice" - }, - "ChainSync.ServerHeader": { - "severity": "Debug" - }, - "Consensus.GSM": { - "severity": "Info" - }, - "Forge.Loop": { - "severity": "Debug" - }, - "Forge.StateInfo": { - "severity": "Debug" - }, - "LedgerMetrics": { - "severity": "Info" - }, - "Mempool": { - "severity": "Debug" - }, - "Mempool.AttemptAdd": { - "severity": "Silence" - }, - "Mempool.LedgerFound": { - "severity": "Silence" - }, - "Mempool.LedgerNotFound": { - "severity": "Silence" - }, - "Mempool.SyncNotNeeded": { - "severity": "Silence" - }, - "Mempool.Synced": { - "severity": "Silence" - }, - "Net": { - "severity": "Notice" - }, - "Net.AcceptPolicy": { - "severity": "Debug" - }, - "Net.ConnectionManager.Local": { - "severity": "Debug" - }, - "Net.ConnectionManager.Remote": { - "severity": "Debug" - }, - "Net.ConnectionManager.Remote.ConnectionManagerCounters": { - "severity": "Silence" - }, - "Net.DNSResolver": { - "severity": "Notice" - }, - "Net.ErrorPolicy": { - "severity": "Info" - }, - "Net.ErrorPolicy.Local": { - "severity": "Debug" - }, - "Net.ErrorPolicy.Remote": { - "severity": "Debug" - }, - "Net.Handshake.Local": { - "severity": "Debug" - }, - "Net.Handshake.Remote": { - "severity": "Debug" - }, - "Net.InboundGovernor": { - "severity": "Warning" - }, - "Net.InboundGovernor.Local": { - "severity": "Debug" - }, - "Net.InboundGovernor.Remote": { - "severity": "Debug" - }, - "Net.InboundGovernor.Transition": { - "severity": "Debug" - }, - "Net.Mux.Local": { - "severity": "Notice" - }, - "Net.Mux.Remote": { - "severity": "Notice" - }, - "Net.PeerSelection": { - "severity": "Silence" - }, - "Net.PeerSelection.Actions": { - "severity": "Debug" - }, - "Net.PeerSelection.Counters": { - "detail": "DMinimal", - "severity": "Debug" - }, - "Net.PeerSelection.Initiator": { - "severity": "Notice" - }, - "Net.PeerSelection.Responder": { - "severity": "Notice" - }, - "Net.PeerSelection.Selection": { - "severity": "Debug" - }, - "Net.Peers.Ledger": { - "severity": "Debug" - }, - "Net.Peers.List": { - "severity": "Notice" - }, - "Net.Peers.LocalRoot": { - "severity": "Debug" - }, - "Net.Peers.PublicRoot": { - "severity": "Debug" - }, - "Net.Server.Local": { - "severity": "Debug" - }, - "Net.Server.Remote": { - "severity": "Debug" - }, - "Net.Subscription.DNS": { - "severity": "Debug" - }, - "Net.Subscription.IP": { - "severity": "Debug" - }, - "NodeState": { - "severity": "Notice" - }, - "Resources": { - "severity": "Debug" - }, - "Shutdown": { - "severity": "Notice" - }, - "Startup": { - "severity": "Notice" - }, - "Startup.DiffusionInit": { - "severity": "Debug" - }, - "StateQueryServer": { - "severity": "Notice" - }, - "TxSubmission.Local": { - "severity": "Notice" - }, - "TxSubmission.LocalServer": { - "severity": "Notice" - }, - "TxSubmission.MonitorClient": { - "severity": "Notice" - }, - "TxSubmission.Remote": { - "severity": "Notice" - }, - "TxSubmission.TxInbound": { - "severity": "Debug" - }, - "TxSubmission.TxOutbound": { - "severity": "Notice" - }, - "LeiosNotify.Remote": { "severity": "Debug" }, - "LeiosFetch.Remote": { "severity": "Debug" }, - "Consensus.LeiosKernel": { "severity": "Debug" }, - "Consensus.LeiosPeer": { "severity": "Debug" }, - "Version.NodeVersion": { - "severity": "Info" - } - }, - "TurnOnLogMetrics": true, - "TurnOnLogging": true, - "UseTraceDispatcher": true -} diff --git a/nix/leios-mvd/immdb-node/immutable/00000.chunk b/nix/leios-mvd/immdb-node/immutable/00000.chunk deleted file mode 100644 index 0b766c8ee4..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00000.chunk and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00000.primary b/nix/leios-mvd/immdb-node/immutable/00000.primary deleted file mode 100644 index 9dffe10d00..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00000.primary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00000.secondary b/nix/leios-mvd/immdb-node/immutable/00000.secondary deleted file mode 100644 index b6572daf26..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00000.secondary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00001.chunk b/nix/leios-mvd/immdb-node/immutable/00001.chunk deleted file mode 100644 index d38df30fe5..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00001.chunk and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00001.primary b/nix/leios-mvd/immdb-node/immutable/00001.primary deleted file mode 100644 index a37df378c9..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00001.primary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00001.secondary b/nix/leios-mvd/immdb-node/immutable/00001.secondary deleted file mode 100644 index 8a8988e7db..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00001.secondary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00002.chunk b/nix/leios-mvd/immdb-node/immutable/00002.chunk deleted file mode 100644 index c621457caa..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00002.chunk and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00002.primary b/nix/leios-mvd/immdb-node/immutable/00002.primary deleted file mode 100644 index 3dd3ca8e9b..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00002.primary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00002.secondary b/nix/leios-mvd/immdb-node/immutable/00002.secondary deleted file mode 100644 index 06acc09aca..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00002.secondary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00003.chunk b/nix/leios-mvd/immdb-node/immutable/00003.chunk deleted file mode 100644 index 2016ff4c7f..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00003.chunk and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00003.primary b/nix/leios-mvd/immdb-node/immutable/00003.primary deleted file mode 100644 index 31a0a654e4..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00003.primary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00003.secondary b/nix/leios-mvd/immdb-node/immutable/00003.secondary deleted file mode 100644 index b7e6e3e3c1..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00003.secondary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00004.chunk b/nix/leios-mvd/immdb-node/immutable/00004.chunk deleted file mode 100644 index a5e1addf78..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00004.chunk and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00004.primary b/nix/leios-mvd/immdb-node/immutable/00004.primary deleted file mode 100644 index 6ca64bb570..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00004.primary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00004.secondary b/nix/leios-mvd/immdb-node/immutable/00004.secondary deleted file mode 100644 index 012a281382..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00004.secondary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00005.chunk b/nix/leios-mvd/immdb-node/immutable/00005.chunk deleted file mode 100644 index 90e8154d3f..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00005.chunk and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00005.primary b/nix/leios-mvd/immdb-node/immutable/00005.primary deleted file mode 100644 index 109ab6cb9c..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00005.primary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00005.secondary b/nix/leios-mvd/immdb-node/immutable/00005.secondary deleted file mode 100644 index e48e95f518..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00005.secondary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00006.chunk b/nix/leios-mvd/immdb-node/immutable/00006.chunk deleted file mode 100644 index 205ba06889..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00006.chunk and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00006.primary b/nix/leios-mvd/immdb-node/immutable/00006.primary deleted file mode 100644 index 4394437a9c..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00006.primary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00006.secondary b/nix/leios-mvd/immdb-node/immutable/00006.secondary deleted file mode 100644 index 63e547138a..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00006.secondary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00007.chunk b/nix/leios-mvd/immdb-node/immutable/00007.chunk deleted file mode 100644 index dcb034716b..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00007.chunk and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00007.primary b/nix/leios-mvd/immdb-node/immutable/00007.primary deleted file mode 100644 index c8b6673f19..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00007.primary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00007.secondary b/nix/leios-mvd/immdb-node/immutable/00007.secondary deleted file mode 100644 index 64dda915a3..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00007.secondary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00008.chunk b/nix/leios-mvd/immdb-node/immutable/00008.chunk deleted file mode 100644 index b28ee948c7..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00008.chunk and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00008.primary b/nix/leios-mvd/immdb-node/immutable/00008.primary deleted file mode 100644 index 6e677301ff..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00008.primary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00008.secondary b/nix/leios-mvd/immdb-node/immutable/00008.secondary deleted file mode 100644 index 9c60085f24..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00008.secondary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00009.chunk b/nix/leios-mvd/immdb-node/immutable/00009.chunk deleted file mode 100644 index 7dec69aef1..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00009.chunk and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00009.primary b/nix/leios-mvd/immdb-node/immutable/00009.primary deleted file mode 100644 index 35ef5387f6..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00009.primary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00009.secondary b/nix/leios-mvd/immdb-node/immutable/00009.secondary deleted file mode 100644 index 9d0bf59bae..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00009.secondary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00010.chunk b/nix/leios-mvd/immdb-node/immutable/00010.chunk deleted file mode 100644 index b7a1377e14..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00010.chunk and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00010.primary b/nix/leios-mvd/immdb-node/immutable/00010.primary deleted file mode 100644 index 8708dcc33b..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00010.primary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00010.secondary b/nix/leios-mvd/immdb-node/immutable/00010.secondary deleted file mode 100644 index 20b628ca46..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00010.secondary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00011.chunk b/nix/leios-mvd/immdb-node/immutable/00011.chunk deleted file mode 100644 index 748e7d1411..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00011.chunk and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00011.primary b/nix/leios-mvd/immdb-node/immutable/00011.primary deleted file mode 100644 index 2d580b8992..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00011.primary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00011.secondary b/nix/leios-mvd/immdb-node/immutable/00011.secondary deleted file mode 100644 index 6a9c01a7dc..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00011.secondary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00012.chunk b/nix/leios-mvd/immdb-node/immutable/00012.chunk deleted file mode 100644 index f3603b1c97..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00012.chunk and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00012.primary b/nix/leios-mvd/immdb-node/immutable/00012.primary deleted file mode 100644 index 7e672d3832..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00012.primary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00012.secondary b/nix/leios-mvd/immdb-node/immutable/00012.secondary deleted file mode 100644 index 685cedd0b2..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00012.secondary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00013.chunk b/nix/leios-mvd/immdb-node/immutable/00013.chunk deleted file mode 100644 index 02a7f83178..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00013.chunk and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00013.primary b/nix/leios-mvd/immdb-node/immutable/00013.primary deleted file mode 100644 index 52b97f6988..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00013.primary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00013.secondary b/nix/leios-mvd/immdb-node/immutable/00013.secondary deleted file mode 100644 index 6c69482841..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00013.secondary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00014.chunk b/nix/leios-mvd/immdb-node/immutable/00014.chunk deleted file mode 100644 index 7301adec21..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00014.chunk and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00014.primary b/nix/leios-mvd/immdb-node/immutable/00014.primary deleted file mode 100644 index bf89ed50d3..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00014.primary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00014.secondary b/nix/leios-mvd/immdb-node/immutable/00014.secondary deleted file mode 100644 index 7a3ddbbddb..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00014.secondary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00015.chunk b/nix/leios-mvd/immdb-node/immutable/00015.chunk deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/nix/leios-mvd/immdb-node/immutable/00015.primary b/nix/leios-mvd/immdb-node/immutable/00015.primary deleted file mode 100644 index 48e4f424ba..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00015.primary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00015.secondary b/nix/leios-mvd/immdb-node/immutable/00015.secondary deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/nix/leios-mvd/immdb-node/immutable/00016.chunk b/nix/leios-mvd/immdb-node/immutable/00016.chunk deleted file mode 100644 index 422c3ca80a..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00016.chunk and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00016.primary b/nix/leios-mvd/immdb-node/immutable/00016.primary deleted file mode 100644 index 51ba2b4ce9..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00016.primary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00016.secondary b/nix/leios-mvd/immdb-node/immutable/00016.secondary deleted file mode 100644 index 4a371d489d..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00016.secondary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00017.chunk b/nix/leios-mvd/immdb-node/immutable/00017.chunk deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/nix/leios-mvd/immdb-node/immutable/00017.primary b/nix/leios-mvd/immdb-node/immutable/00017.primary deleted file mode 100644 index 48e4f424ba..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00017.primary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00017.secondary b/nix/leios-mvd/immdb-node/immutable/00017.secondary deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/nix/leios-mvd/immdb-node/immutable/00018.chunk b/nix/leios-mvd/immdb-node/immutable/00018.chunk deleted file mode 100644 index c2b08706b0..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00018.chunk and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00018.primary b/nix/leios-mvd/immdb-node/immutable/00018.primary deleted file mode 100644 index bb11205b29..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00018.primary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00018.secondary b/nix/leios-mvd/immdb-node/immutable/00018.secondary deleted file mode 100644 index d0a247f158..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00018.secondary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00019.chunk b/nix/leios-mvd/immdb-node/immutable/00019.chunk deleted file mode 100644 index 0e5a782546..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00019.chunk and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00019.primary b/nix/leios-mvd/immdb-node/immutable/00019.primary deleted file mode 100644 index 163f0d09a4..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00019.primary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00019.secondary b/nix/leios-mvd/immdb-node/immutable/00019.secondary deleted file mode 100644 index 43a1b63d39..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00019.secondary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00020.chunk b/nix/leios-mvd/immdb-node/immutable/00020.chunk deleted file mode 100644 index 86dc1f03e6..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00020.chunk and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00020.primary b/nix/leios-mvd/immdb-node/immutable/00020.primary deleted file mode 100644 index 9dffe10d00..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00020.primary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00020.secondary b/nix/leios-mvd/immdb-node/immutable/00020.secondary deleted file mode 100644 index 6f9f4b5e3b..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00020.secondary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00021.chunk b/nix/leios-mvd/immdb-node/immutable/00021.chunk deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/nix/leios-mvd/immdb-node/immutable/00021.primary b/nix/leios-mvd/immdb-node/immutable/00021.primary deleted file mode 100644 index 48e4f424ba..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00021.primary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00021.secondary b/nix/leios-mvd/immdb-node/immutable/00021.secondary deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/nix/leios-mvd/immdb-node/immutable/00022.chunk b/nix/leios-mvd/immdb-node/immutable/00022.chunk deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/nix/leios-mvd/immdb-node/immutable/00022.primary b/nix/leios-mvd/immdb-node/immutable/00022.primary deleted file mode 100644 index 48e4f424ba..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00022.primary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00022.secondary b/nix/leios-mvd/immdb-node/immutable/00022.secondary deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/nix/leios-mvd/immdb-node/immutable/00023.chunk b/nix/leios-mvd/immdb-node/immutable/00023.chunk deleted file mode 100644 index 4c3ed055d6..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00023.chunk and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00023.primary b/nix/leios-mvd/immdb-node/immutable/00023.primary deleted file mode 100644 index 3dd3ca8e9b..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00023.primary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00023.secondary b/nix/leios-mvd/immdb-node/immutable/00023.secondary deleted file mode 100644 index efe594a131..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00023.secondary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00024.chunk b/nix/leios-mvd/immdb-node/immutable/00024.chunk deleted file mode 100644 index 53c872f6fc..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00024.chunk and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00024.primary b/nix/leios-mvd/immdb-node/immutable/00024.primary deleted file mode 100644 index 0f3c169240..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00024.primary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00024.secondary b/nix/leios-mvd/immdb-node/immutable/00024.secondary deleted file mode 100644 index 65804de2f0..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00024.secondary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00025.chunk b/nix/leios-mvd/immdb-node/immutable/00025.chunk deleted file mode 100644 index 7ff8f1eafb..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00025.chunk and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00025.primary b/nix/leios-mvd/immdb-node/immutable/00025.primary deleted file mode 100644 index b38afad2c5..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00025.primary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00025.secondary b/nix/leios-mvd/immdb-node/immutable/00025.secondary deleted file mode 100644 index 654d5435cb..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00025.secondary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00026.chunk b/nix/leios-mvd/immdb-node/immutable/00026.chunk deleted file mode 100644 index ec89ec9329..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00026.chunk and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00026.primary b/nix/leios-mvd/immdb-node/immutable/00026.primary deleted file mode 100644 index e142b39935..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00026.primary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00026.secondary b/nix/leios-mvd/immdb-node/immutable/00026.secondary deleted file mode 100644 index 615bafffef..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00026.secondary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00027.chunk b/nix/leios-mvd/immdb-node/immutable/00027.chunk deleted file mode 100644 index ec4d2a34d7..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00027.chunk and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00027.primary b/nix/leios-mvd/immdb-node/immutable/00027.primary deleted file mode 100644 index 0cbb476875..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00027.primary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00027.secondary b/nix/leios-mvd/immdb-node/immutable/00027.secondary deleted file mode 100644 index 850d3070d0..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00027.secondary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00028.chunk b/nix/leios-mvd/immdb-node/immutable/00028.chunk deleted file mode 100644 index e78a08bd61..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00028.chunk and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00028.primary b/nix/leios-mvd/immdb-node/immutable/00028.primary deleted file mode 100644 index 0ffe1bf259..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00028.primary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00028.secondary b/nix/leios-mvd/immdb-node/immutable/00028.secondary deleted file mode 100644 index 79862e0ca7..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00028.secondary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00029.chunk b/nix/leios-mvd/immdb-node/immutable/00029.chunk deleted file mode 100644 index 7d4eab3c1c..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00029.chunk and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00029.primary b/nix/leios-mvd/immdb-node/immutable/00029.primary deleted file mode 100644 index 30f45b3e3e..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00029.primary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00029.secondary b/nix/leios-mvd/immdb-node/immutable/00029.secondary deleted file mode 100644 index 8b674ff078..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00029.secondary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00030.chunk b/nix/leios-mvd/immdb-node/immutable/00030.chunk deleted file mode 100644 index 0ccfdda5c1..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00030.chunk and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00030.primary b/nix/leios-mvd/immdb-node/immutable/00030.primary deleted file mode 100644 index 6e677301ff..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00030.primary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00030.secondary b/nix/leios-mvd/immdb-node/immutable/00030.secondary deleted file mode 100644 index d1f5038484..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00030.secondary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00031.chunk b/nix/leios-mvd/immdb-node/immutable/00031.chunk deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/nix/leios-mvd/immdb-node/immutable/00031.primary b/nix/leios-mvd/immdb-node/immutable/00031.primary deleted file mode 100644 index 48e4f424ba..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00031.primary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00031.secondary b/nix/leios-mvd/immdb-node/immutable/00031.secondary deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/nix/leios-mvd/immdb-node/immutable/00032.chunk b/nix/leios-mvd/immdb-node/immutable/00032.chunk deleted file mode 100644 index 5ae3066c42..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00032.chunk and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00032.primary b/nix/leios-mvd/immdb-node/immutable/00032.primary deleted file mode 100644 index bf89ed50d3..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00032.primary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00032.secondary b/nix/leios-mvd/immdb-node/immutable/00032.secondary deleted file mode 100644 index 2c083834ce..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00032.secondary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00033.chunk b/nix/leios-mvd/immdb-node/immutable/00033.chunk deleted file mode 100644 index 2f88e7d005..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00033.chunk and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00033.primary b/nix/leios-mvd/immdb-node/immutable/00033.primary deleted file mode 100644 index 4c8c64f175..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00033.primary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/immutable/00033.secondary b/nix/leios-mvd/immdb-node/immutable/00033.secondary deleted file mode 100644 index ac158489b4..0000000000 Binary files a/nix/leios-mvd/immdb-node/immutable/00033.secondary and /dev/null differ diff --git a/nix/leios-mvd/immdb-node/os.nix b/nix/leios-mvd/immdb-node/os.nix deleted file mode 100644 index cbec8e7861..0000000000 --- a/nix/leios-mvd/immdb-node/os.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ immdb-server, ... }: { - imports = [ - (import ./service.nix { inherit immdb-server; }) - ]; - - cardano.immdb-server.enable = true; - cardano.immdb-server.initialSlot = 500; -} diff --git a/nix/leios-mvd/immdb-node/service.nix b/nix/leios-mvd/immdb-node/service.nix deleted file mode 100644 index b1c8aed659..0000000000 --- a/nix/leios-mvd/immdb-node/service.nix +++ /dev/null @@ -1,171 +0,0 @@ -{ immdb-server, ... }: -{ config -, lib -, pkgs -, ... -}: -let - cfg = config.cardano.immdb-server; -in -{ - - imports = [ - ]; - - options.cardano.immdb-server = { - enable = lib.mkEnableOption ''Run ourborous-consensus's immdb-server as a service''; - - db = lib.mkOption { - type = lib.types.path; - description = "Path to the ImmutableDB"; - default = ./immutable; - }; - - config = lib.mkOption { - type = lib.types.path; - description = "Path to config file, in the same format as for the node or db-analyser"; - default = ./config.json; - }; - - genesisAlonzo = lib.mkOption { - type = lib.types.path; - default = ../genesis/genesis.alonzo.json; - }; - - genesisConway = lib.mkOption { - type = lib.types.path; - default = ../genesis/genesis.conway.json; - }; - - genesisByron = lib.mkOption { - type = lib.types.path; - default = ../genesis/genesis.byron.json; - }; - - genesisShelley = lib.mkOption { - type = lib.types.path; - default = ../genesis/genesis.shelley.json; - }; - - address = lib.mkOption { - type = lib.types.str; - description = "Address to serve on"; - default = "0.0.0.0"; - }; - - port = lib.mkOption { - type = lib.types.port; - description = "Port to serve on"; - default = 3001; - }; - - initialSlot = lib.mkOption { - type = lib.types.int; - description = "Reference slot number (SlotNo). This, together with the initial-time will be used for time translations."; - default = 0; - }; - - initialTime = lib.mkOption { - type = lib.types.nullOr lib.types.int; - description = "UTC time for the reference slot, provided as POSIX seconds (Unix timestamp)"; - default = null; - }; - - user = lib.mkOption { - type = lib.types.str; - default = "immdb-server"; - description = ''User to run immdb-server service as.''; - }; - - group = lib.mkOption { - type = lib.types.str; - default = "immdb-server"; - description = ''Group to run immdb-server service as.''; - }; - - }; - - config = lib.mkIf cfg.enable { - users = { - users = { - ${cfg.user} = { - description = "User to run immdb-server service"; - inherit (cfg) group; - createHome = false; - isSystemUser = true; - }; - }; - - groups = { - ${cfg.group} = { - members = [ cfg.user ]; - }; - }; - }; - - networking.firewall.allowedTCPPorts = [ cfg.port ]; - - environment.etc = { - "immdb-server/config.json" = { - user = cfg.user; - group = cfg.group; - source = cfg.config; - }; - "immdb-server/genesis-alonzo.json" = { - user = cfg.user; - group = cfg.group; - source = cfg.genesisAlonzo; - }; - "immdb-server/genesis-conway.json" = { - user = cfg.user; - group = cfg.group; - source = cfg.genesisConway; - }; - "immdb-server/genesis-byron.json" = { - user = cfg.user; - group = cfg.group; - source = cfg.genesisByron; - }; - "immdb-server/genesis-shelley.json" = { - user = cfg.user; - group = cfg.group; - source = cfg.genesisShelley; - }; - - }; - - systemd.services.immdb-server = { - enable = true; - after = [ "network.target" ]; - wantedBy = [ "multi-user.target" ]; - serviceConfig = { - Restart = "on-failure"; - RemainAfterExit = true; - User = "immdb-server"; - Group = "immdb-server"; - ConfigurationDirectory = [ "immdb-server" ]; - StateDirectory = [ "immdb-server" ]; - }; - - path = [ immdb-server ]; - - script = '' - echo "Starting Immutable DB server with ${builtins.toJSON cfg}"; - - mkdir $STATE_DIRECTORY/immutable; - cp -r ${cfg.db}/* $STATE_DIRECTORY/immutable; - chmod +rw $STATE_DIRECTORY/immutable/*; - - immdb-server \ - --db $STATE_DIRECTORY/immutable \ - --config $CONFIGURATION_DIRECTORY/config.json \ - --address ${cfg.address} \ - --port ${builtins.toString cfg.port} \ - --initial-slot ${builtins.toString cfg.initialSlot} \ - --initial-time ${if cfg.initialTime == null then "$(date +%s)" else builtins.toString cfg.initialTime}; - ''; - }; - - }; - -} diff --git a/nix/leios-mvd/leios-node/config.json b/nix/leios-mvd/leios-node/config.json deleted file mode 100644 index f415c4d7e5..0000000000 --- a/nix/leios-mvd/leios-node/config.json +++ /dev/null @@ -1,290 +0,0 @@ -{ - "AlonzoGenesisFile": "genesis-alonzo.json", - "ByronGenesisFile": "genesis-byron.json", - "ConwayGenesisFile": "genesis-conway.json", - "ShelleyGenesisFile": "genesis-shelley.json", - "ChainSyncIdleTimeout": 0, - "EnableP2P": true, - "ExperimentalHardForksEnabled": true, - "ExperimentalProtocolsEnabled": true, - "LastKnownBlockVersion-Alt": 0, - "LastKnownBlockVersion-Major": 3, - "LastKnownBlockVersion-Minor": 0, - "PeerSharing": false, - "Protocol": "Cardano", - "RequiresNetworkMagic": "RequiresMagic", - "SnapshotInterval": 4230, - "SyncTargetNumberOfActivePeers": 15, - "SyncTargetNumberOfEstablishedPeers": 40, - "TargetNumberOfActivePeers": 15, - "TargetNumberOfEstablishedPeers": 40, - "TestAllegraHardForkAtEpoch": 0, - "TestAlonzoHardForkAtEpoch": 0, - "TestBabbageHardForkAtEpoch": 0, - "TestConwayHardForkAtEpoch": 0, - "TestMaryHardForkAtEpoch": 0, - "TestShelleyHardForkAtEpoch": 0, - "TraceOptionForwarder": { - "connQueueSize": 64, - "disconnQueueSize": 128, - "maxReconnectDelay": 30 - }, - "TraceOptionMetricsPrefix": "cardano.node.metrics.", - "TraceOptionNodeName": "leios-node", - "TraceOptionPeerFrequency": 2000, - "TraceOptionResourceFrequency": 1000, - "TraceOptions": { - "": { - "backends": [ - "Stdout MachineFormat", - "EKGBackend", - "Forwarder" - ], - "detail": "DNormal", - "severity": "Notice" - }, - "BlockFetch.Client": { - "severity": "Debug" - }, - "BlockFetch.Client.CompletedBlockFetch": { - }, - "BlockFetch.Decision": { - "severity": "Notice" - }, - "BlockFetch.Remote": { - "severity": "Debug", - "detail": "DMinimal", - "maxFrequency": 0 - }, - "BlockFetch.Remote.Serialised": { - "severity": "Debug", - "detail": "DMinimal", - "maxFrequency": 0 - }, - "BlockFetch.Server": { - "severity": "Debug" - }, - "BlockchainTime": { - "severity": "Notice" - }, - "ChainDB": { - "severity": "Debug" - }, - "ChainDB.AddBlockEvent.AddBlockValidation": { - "severity": "Silence" - }, - "ChainDB.AddBlockEvent.AddBlockValidation.ValidCandidate": { - "maxFrequency": 2.0 - }, - "ChainDB.AddBlockEvent.AddedBlockToQueue": { - "maxFrequency": 2.0 - }, - "ChainDB.AddBlockEvent.AddedBlockToVolatileDB": { - "maxFrequency": 2.0 - }, - "ChainDB.CopyToImmutableDBEvent.CopiedBlockToImmutableDB": { - "maxFrequency": 2.0 - }, - "ChainDB.LedgerEvent.Flavor.V1.OnDisk.BackingStoreEvent": { - "severity": "Silence" - }, - "ChainDB.LedgerEvent.Forker": { - "severity": "Silence" - }, - "ChainDB.ReplayBlock.LedgerReplay": { - "severity": "Notice" - }, - "ChainSync.Client": { - "severity": "Debug" - }, - "ChainSync.Local": { - "severity": "Notice" - }, - "ChainSync.Remote": { - "severity": "Debug", - "detail": "DMinimal", - "maxFrequency": 0 - }, - "ChainSync.Remote.Serialised": { - "severity": "Debug", - "detail": "DMinimal", - "maxFrequency": 0 - }, - "ChainSync.ServerBlock": { - "severity": "Notice" - }, - "ChainSync.ServerHeader": { - "severity": "Debug" - }, - "Consensus.GSM": { - "severity": "Info" - }, - "Forge.Loop": { - "severity": "Debug" - }, - "Forge.StateInfo": { - "severity": "Debug" - }, - "LedgerMetrics": { - "severity": "Info" - }, - "Mempool": { - "severity": "Debug" - }, - "Mempool.AttemptAdd": { - "severity": "Silence" - }, - "Mempool.LedgerFound": { - "severity": "Silence" - }, - "Mempool.LedgerNotFound": { - "severity": "Silence" - }, - "Mempool.SyncNotNeeded": { - "severity": "Silence" - }, - "Mempool.Synced": { - "severity": "Silence" - }, - "Net": { - "severity": "Notice" - }, - "Net.AcceptPolicy": { - "severity": "Debug" - }, - "Net.ConnectionManager.Local": { - "severity": "Debug" - }, - "Net.ConnectionManager.Remote": { - "severity": "Debug" - }, - "Net.ConnectionManager.Remote.ConnectionManagerCounters": { - "severity": "Silence" - }, - "Net.DNSResolver": { - "severity": "Notice" - }, - "Net.ErrorPolicy": { - "severity": "Info" - }, - "Net.ErrorPolicy.Local": { - "severity": "Debug" - }, - "Net.ErrorPolicy.Remote": { - "severity": "Debug" - }, - "Net.Handshake.Local": { - "severity": "Debug" - }, - "Net.Handshake.Remote": { - "severity": "Debug" - }, - "Net.InboundGovernor": { - "severity": "Warning" - }, - "Net.InboundGovernor.Local": { - "severity": "Debug" - }, - "Net.InboundGovernor.Remote": { - "severity": "Debug" - }, - "Net.InboundGovernor.Transition": { - "severity": "Debug" - }, - "Net.Mux.Local": { - "severity": "Notice" - }, - "Net.Mux.Remote": { - "severity": "Debug" - }, - "Net.PeerSelection": { - "severity": "Silence" - }, - "Net.PeerSelection.Actions": { - "severity": "Debug" - }, - "Net.PeerSelection.Counters": { - "detail": "DMinimal", - "severity": "Debug" - }, - "Net.PeerSelection.Initiator": { - "severity": "Notice" - }, - "Net.PeerSelection.Responder": { - "severity": "Notice" - }, - "Net.PeerSelection.Selection": { - "severity": "Debug" - }, - "Net.Peers.Ledger": { - "severity": "Debug" - }, - "Net.Peers.List": { - "severity": "Notice" - }, - "Net.Peers.LocalRoot": { - "severity": "Debug" - }, - "Net.Peers.PublicRoot": { - "severity": "Debug" - }, - "Net.Server.Local": { - "severity": "Debug" - }, - "Net.Server.Remote": { - "severity": "Debug" - }, - "Net.Subscription.DNS": { - "severity": "Debug" - }, - "Net.Subscription.IP": { - "severity": "Debug" - }, - "NodeState": { - "severity": "Notice" - }, - "Resources": { - "severity": "Debug" - }, - "Shutdown": { - "severity": "Notice" - }, - "Startup": { - "severity": "Notice" - }, - "Startup.DiffusionInit": { - "severity": "Debug" - }, - "StateQueryServer": { - "severity": "Notice" - }, - "TxSubmission.Local": { - "severity": "Notice" - }, - "TxSubmission.LocalServer": { - "severity": "Notice" - }, - "TxSubmission.MonitorClient": { - "severity": "Notice" - }, - "TxSubmission.Remote": { - "severity": "Notice" - }, - "TxSubmission.TxInbound": { - "severity": "Debug" - }, - "TxSubmission.TxOutbound": { - "severity": "Notice" - }, - "LeiosNotify.Remote": { "severity": "Debug", "maxFrequency": 0 }, - "LeiosFetch.Remote": { "severity": "Debug", "maxFrequency": 0 }, - "Consensus.LeiosKernel": { "severity": "Debug", "maxFrequency": 0 }, - "Consensus.LeiosPeer": { "severity": "Debug", "maxFrequency": 0 }, - "Version.NodeVersion": { - "severity": "Info" - } - }, - "TurnOnLogMetrics": true, - "TurnOnLogging": true, - "UseTraceDispatcher": true -} diff --git a/nix/leios-mvd/leios-node/delegate.key b/nix/leios-mvd/leios-node/delegate.key deleted file mode 100644 index b9deddfbc3..0000000000 --- a/nix/leios-mvd/leios-node/delegate.key +++ /dev/null @@ -1 +0,0 @@ -X+~u[~vsI 5LrPMVKMot !;[N[ӏ#LסeƣhaQR>PcKKy Avz_-L.Xwol0 \ No newline at end of file diff --git a/nix/leios-mvd/leios-node/delegation-cert.json b/nix/leios-mvd/leios-node/delegation-cert.json deleted file mode 100644 index b76371e83b..0000000000 --- a/nix/leios-mvd/leios-node/delegation-cert.json +++ /dev/null @@ -1,8 +0,0 @@ -{ "omega": 0 -, "issuerPk": - "JW5mw+Zo7XnJpBlqMnsrd+cfElAY8AFAWbQuF0+CqTQYgBz9eXza/EiY9sxugu/b6FwJW5fxe3rY83U7VFzEfg==" -, "delegatePk": - "zMajaA9h8Q6gUQ+y6VKHoj4Y1VBjlJyyS0v2eZn67RgNBOK63uxBdut6/1/kLaNMk+MuWB131W/abDCPs8b9og==" -, "cert": - "b12dd4d4d8c87a9af25fa6d5ee78a620573a6712fbeebfc45951d00bf4200a70cb6d4733cfddea576c4fd399e2fd6e2fd60d55f243bc6c8177ed599d699d6d06" -} \ No newline at end of file diff --git a/nix/leios-mvd/leios-node/kes.skey b/nix/leios-mvd/leios-node/kes.skey deleted file mode 100755 index 92f1c55ec5..0000000000 --- a/nix/leios-mvd/leios-node/kes.skey +++ /dev/null @@ -1,5 +0,0 @@ -{ - "type": "KesSigningKey_ed25519_kes_2^6", - "description": "KES Signing Key", - "cborHex": "590260011faaf560676abd9c02c262a77040b224d5196ac05a4f21ee11b25ecc312efbac8a39fecde32833653ba0f1a0bf52ec00eba4829baa6502e33c105008ef014e698b666bb24f2560234a567cb616debc47da8aa0f1581eae5eb856074246097f03f4bed1947c66d1879cadde323a6e1db4e3531b2ff31cf7f3c18c448d51d45c31ba4dc912b198464d75b1ff9641f95d38d00050c55a35026bb09339e80acecf0e2f75dbee68eca3b0b61490331b43ace53656a651b67fbe044e0955cdba7164f92a06d98b36400c5202ac42bff07fb4f6ccccfb84c0d388699cbe2293fc9461be34f439971e7a7cb8fa671528c536d05e0c265c20e4a9a9b543d16e543abaa32fa06489eaaa9373103d9fa459fe7d30e97278759ca46ae9e255737008f0931e3f9c5fba1857769da5d294a8cd4655f7d439edb7a174b09c1609017994dcddb46b0d9c2f156eb28ebd58ec290a36868ec0935108acae6fc11b4127b1619d1310e05603a28969958f2995c5cbdc45b8d95188885079e4d9bd0c7f08fa80edf1cceb851ee037dfebb80277336fc254aa9b0d42cedf53cd6a8fc312071fd8eba8dd0527e39dde8593653d64efc23fef04549f7606c07f6bce1d5d41aa46f4d57e48cfb2c7eda5fcc41254155f739e00ee763c29dbdd19b8d1e95110999693179f3e0f9ec71edc46576768f81e11c7feddef75de2656b3f1245711a166b6f4671ef4c0e60993cde87be49bbeab378db5ac844783c5baaabb26f62d1e14d9f7a2ce9c5608ac133eb356f5e865fb5cbb3ec879a0e8a747e4bdc62a78e72e8f79d197052ba6f11a005791177cd75836adffec022f16178ddd70b52fbd9d66f277b9a31a" -} diff --git a/nix/leios-mvd/leios-node/kes.vkey b/nix/leios-mvd/leios-node/kes.vkey deleted file mode 100644 index 80d1cc9a3c..0000000000 --- a/nix/leios-mvd/leios-node/kes.vkey +++ /dev/null @@ -1,5 +0,0 @@ -{ - "type": "KesVerificationKey_ed25519_kes_2^6", - "description": "KES Verification Key", - "cborHex": "5820dc7d3718e179dcf42925b3f000582bd1d5b590fe4828bbf5b7725885dd0b6716" -} diff --git a/nix/leios-mvd/leios-node/opcert b/nix/leios-mvd/leios-node/opcert deleted file mode 100644 index 1ba028131c..0000000000 --- a/nix/leios-mvd/leios-node/opcert +++ /dev/null @@ -1,5 +0,0 @@ -{ - "type": "NodeOperationalCertificate", - "description": "", - "cborHex": "82845820dc7d3718e179dcf42925b3f000582bd1d5b590fe4828bbf5b7725885dd0b67160000584010d761a13b5609068d8d852d4cf83de4c3d20272e1234fea74c46657c60a59b01ad6fe8fb92d833338351423f0cb9a361636831393127fb63e5c6f2ab1a3bf0b58206b134e73ed0cd24f68c8a0ed08fd24dddfbcaa364563af3480a527f749752cb9" -} diff --git a/nix/leios-mvd/leios-node/os.nix b/nix/leios-mvd/leios-node/os.nix deleted file mode 100644 index 821fc728a2..0000000000 --- a/nix/leios-mvd/leios-node/os.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ inputs, ... }: { - imports = [ - inputs.cardano-nix.nixosModules.default - ]; - cardano = { - networkNumber = 42; - private-testnet-node = { - enable = true; - nodeConfigFile = ./config.json; - - genesisAlonzo = ../genesis/genesis.alonzo.json; - genesisConway = ../genesis/genesis.conway.json; - genesisShelley = ../genesis/genesis.shelley.json; - genesisByron = ../genesis/genesis.byron.json; - - topology = ./topology.json; - - vrfKey = ./vrf.skey; - kesKey = ./kes.skey; - operationalCertificate = ./opcert; - delegationCertificate = ./delegation-cert.json; - signingKey = ./delegate.key; - - updateSystemStartTime = false; - }; - }; -} diff --git a/nix/leios-mvd/leios-node/topology.json b/nix/leios-mvd/leios-node/topology.json deleted file mode 100644 index ddd7b0e98c..0000000000 --- a/nix/leios-mvd/leios-node/topology.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "bootstrapPeers": null, - "localRoots": [ - { - "accessPoints": [ - { - "address": "immdb-node.local", - "port": 3001 - } - ], - "advertise": false, - "trustable": true, - "valency": 1 - } - ], - "publicRoots": [], - "useLedgerAfterSlot": -1 -} diff --git a/nix/leios-mvd/leios-node/vrf.skey b/nix/leios-mvd/leios-node/vrf.skey deleted file mode 100755 index 2f45bf176a..0000000000 --- a/nix/leios-mvd/leios-node/vrf.skey +++ /dev/null @@ -1,5 +0,0 @@ -{ - "type": "VrfSigningKey_PraosVRF", - "description": "VRF Signing Key", - "cborHex": "58409c0a6066829b1979048d611268dbffb49633738f3ba542fb90279a1b789fdcf9ad1b97904ad19d7083a217f2385e891189fe054641e52880d5d1d680aa453898" -} diff --git a/nix/leios-mvd/leios-node/vrf.vkey b/nix/leios-mvd/leios-node/vrf.vkey deleted file mode 100644 index 1110d66588..0000000000 --- a/nix/leios-mvd/leios-node/vrf.vkey +++ /dev/null @@ -1,5 +0,0 @@ -{ - "type": "VrfVerificationKey_PraosVRF", - "description": "VRF Verification Key", - "cborHex": "5820ad1b97904ad19d7083a217f2385e891189fe054641e52880d5d1d680aa453898" -} diff --git a/nix/leios-mvd/test.nix b/nix/leios-mvd/test.nix deleted file mode 100644 index e4ac28f855..0000000000 --- a/nix/leios-mvd/test.nix +++ /dev/null @@ -1,42 +0,0 @@ -{ inputs, pkgs, ... }: -{ - name = "Leios MVD NixOS test"; - - nodes = { - immdb-node = { - imports = [ - (import ./immdb-node/os.nix { - immdb-server = pkgs.hsPkgs.ouroboros-consensus-cardano.getComponent "exe:immdb-server"; - }) - ]; - networking.domain = "local"; - }; - leios-node = { - imports = [ - (import ./leios-node/os.nix { inherit inputs; }) - ]; - networking.domain = "local"; - environment.systemPackages = [ pkgs.dnsutils ]; - services.resolved.enable = true; - }; - }; - - testScript = '' - start_all() - - # Wait until the respective services are up - immdb_node.wait_for_unit("immdb-server.service") - leios_node.wait_for_unit("cardano-node.service") - - # Wait until leios-node synced with immdb-node - # NOTE(bladyjoker): Block 51 is the tip - # [0.139717s] BlockNo 51 SlotNo 994 6685f44f32433d0817b6edf5f9e00aaaa3c4986524b8b453a620825747a936cc - leios_node.wait_until_succeeds("cardano-cli query tip | grep hash | grep -q '6685f4'") - - # Collect logs from leios-node (read them in result/cardano.logs) - leios_node.execute("journalctl -u cardano-node --no-pager > cardano-node.logs") - leios_node.execute("journalctl -u cardano-node --output json > cardano-node.logs.json") - leios_node.copy_from_vm("cardano-node.logs", "") - leios_node.copy_from_vm("cardano-node.logs.json", "") - ''; -} diff --git a/ouroboros-consensus-cardano/ouroboros-consensus-cardano.cabal b/ouroboros-consensus-cardano/ouroboros-consensus-cardano.cabal index 954c0845e7..0f3459be9a 100644 --- a/ouroboros-consensus-cardano/ouroboros-consensus-cardano.cabal +++ b/ouroboros-consensus-cardano/ouroboros-consensus-cardano.cabal @@ -149,6 +149,7 @@ library cardano-strict-containers, cborg ^>=0.2.2, containers >=0.5 && <0.8, + contra-tracer, crypton, deepseq, formatting >=6.3 && <7.3, diff --git a/ouroboros-consensus-cardano/src/byron/Ouroboros/Consensus/Byron/Node.hs b/ouroboros-consensus-cardano/src/byron/Ouroboros/Consensus/Byron/Node.hs index 168837a279..907018d9f1 100644 --- a/ouroboros-consensus-cardano/src/byron/Ouroboros/Consensus/Byron/Node.hs +++ b/ouroboros-consensus-cardano/src/byron/Ouroboros/Consensus/Byron/Node.hs @@ -141,11 +141,12 @@ byronBlockForging creds = canBeLeader slot tickedPBftState - , forgeBlock = \_leiosDb cfg blkNo slotNo ledgerState rbTxs _ebTxs isLeader -> + , forgeBlock = \_forgeType cfg blkNo slotNo ledgerState rbTxs _ebTxs isLeader -> let byronBlock = forgeByronBlock cfg blkNo slotNo ledgerState rbTxs isLeader in return (byronBlock, Nothing) + , leiosDecideForgeType = \_ -> return ForgeTxsRb } where canBeLeader = mkPBftCanBeLeader creds diff --git a/ouroboros-consensus-cardano/src/ouroboros-consensus-cardano/Ouroboros/Consensus/Cardano/Block.hs b/ouroboros-consensus-cardano/src/ouroboros-consensus-cardano/Ouroboros/Consensus/Cardano/Block.hs index e2a5ea5264..a0cb55e32a 100644 --- a/ouroboros-consensus-cardano/src/ouroboros-consensus-cardano/Ouroboros/Consensus/Cardano/Block.hs +++ b/ouroboros-consensus-cardano/src/ouroboros-consensus-cardano/Ouroboros/Consensus/Cardano/Block.hs @@ -183,6 +183,7 @@ module Ouroboros.Consensus.Cardano.Block -- * EraMismatch , EraMismatch (..) + , pattern ExtLedgerStateConway ) where import Data.Kind @@ -190,7 +191,7 @@ import Data.SOP.BasicFunctors import Data.SOP.Functors import Data.SOP.Strict import LeiosDemoDb (LeiosDbHandle) -import Ouroboros.Consensus.Block (BlockProtocol) +import Ouroboros.Consensus.Block (BlockProtocol, WithOrigin (NotOrigin, Origin)) import Ouroboros.Consensus.Byron.Ledger.Block (ByronBlock) import Ouroboros.Consensus.HardFork.Combinator import Ouroboros.Consensus.HardFork.Combinator.AcrossEras @@ -210,7 +211,7 @@ import Ouroboros.Consensus.Ledger.SupportsMempool ) import Ouroboros.Consensus.Ledger.SupportsProtocol (LedgerSupportsProtocol) import Ouroboros.Consensus.Protocol.Abstract (ChainDepState) -import Ouroboros.Consensus.Protocol.Praos (Praos) +import Ouroboros.Consensus.Protocol.Praos (Praos, PraosCrypto) import Ouroboros.Consensus.Protocol.TPraos (TPraos) import Ouroboros.Consensus.Shelley.Eras import Ouroboros.Consensus.Shelley.Ledger (ShelleyBlock, ShelleyCompatible) @@ -1336,15 +1337,30 @@ pattern ExtLedgerStateConway conwayExtLedgerSt <- conwayExtLedgerSt ) +pattern ConwayHeaderState :: + HeaderState (ShelleyBlock (Praos c) ConwayEra) -> + HeaderState (CardanoBlock c) +pattern ConwayHeaderState conwayHeaderState <- (toConwayHeaderState -> conwayHeaderState) + toConwayHeaderState :: HeaderState (CardanoBlock c) -> HeaderState (ShelleyBlock (Praos c) ConwayEra) -toConwayHeaderState (HeaderState headerStateTip (ChainDepStateConway conwayHeaderStateChainDep)) = +toConwayHeaderState (HeaderState (NotOrigin (ConwayAnnTip conwayAnnTip)) (ChainDepStateConway conwayHeaderStateChainDep)) = HeaderState - { headerStateTip = toConwayAnnTip <$> headerStateTip + { headerStateTip = NotOrigin conwayAnnTip + , headerStateChainDep = conwayHeaderStateChainDep + } +toConwayHeaderState (HeaderState Origin (ChainDepStateConway conwayHeaderStateChainDep)) = + HeaderState + { headerStateTip = Origin , headerStateChainDep = conwayHeaderStateChainDep } toConwayHeaderState _ = error "Must be in Conway" +pattern ConwayAnnTip :: + AnnTip (ShelleyBlock (Praos c) ConwayEra) -> + AnnTip (CardanoBlock c) +pattern ConwayAnnTip conwayAnnTip <- (toConwayAnnTip -> conwayAnnTip) + toConwayAnnTip :: AnnTip (CardanoBlock c) -> AnnTip (ShelleyBlock (Praos c) ConwayEra) toConwayAnnTip AnnTip{annTipSlotNo, annTipBlockNo, annTipInfo = TipInfoConway tipInfo} = AnnTip @@ -1370,17 +1386,20 @@ injectConwayBlock :: ShelleyBlock (Praos c) ConwayEra -> CardanoBlock c injectConwayBlock = HardForkBlock . OneEraBlock . TagConway . I instance - (ShelleyCompatible (Praos c) ConwayEra, LedgerSupportsProtocol (ShelleyBlock (Praos c) ConwayEra)) => + ( PraosCrypto c + , ShelleyCompatible (Praos c) ConwayEra + , LedgerSupportsProtocol (ShelleyBlock (Praos c) ConwayEra) + ) => ResolveLeiosBlock (CardanoBlock c) where resolveLeiosBlock :: - forall m mk. + forall m. Monad m => LeiosDbHandle m -> - ExtLedgerState (CardanoBlock c) mk -> + HeaderState (CardanoBlock c) -> CardanoBlock c -> m (CardanoBlock c) - resolveLeiosBlock db (ExtLedgerStateConway conwayExtLedgerSt) (BlockConway conwayBlk) = + resolveLeiosBlock db (ConwayHeaderState conwayHdrSt) (BlockConway conwayBlk) = injectConwayBlock - <$> resolveLeiosBlock db conwayExtLedgerSt conwayBlk + <$> resolveLeiosBlock db conwayHdrSt conwayBlk resolveLeiosBlock _ _ blk = return blk diff --git a/ouroboros-consensus-cardano/src/ouroboros-consensus-cardano/Ouroboros/Consensus/Cardano/CanHardFork.hs b/ouroboros-consensus-cardano/src/ouroboros-consensus-cardano/Ouroboros/Consensus/Cardano/CanHardFork.hs index cc010e9127..583e33a5f4 100644 --- a/ouroboros-consensus-cardano/src/ouroboros-consensus-cardano/Ouroboros/Consensus/Cardano/CanHardFork.hs +++ b/ouroboros-consensus-cardano/src/ouroboros-consensus-cardano/Ouroboros/Consensus/Cardano/CanHardFork.hs @@ -297,7 +297,6 @@ translateLedgerStateByronToShelleyWrapper = , shelleyLedgerTransition = ShelleyTransitionInfo{shelleyAfterVoting = 0} , shelleyLedgerTables = emptyLedgerTables - , shelleyLedgerLeiosState = initShelleyLedgerLeiosState } } @@ -631,13 +630,12 @@ translateLedgerStateAlonzoToBabbageWrapper = transPraosLS :: LedgerState (ShelleyBlock (TPraos c) AlonzoEra) mk -> LedgerState (ShelleyBlock (Praos c) AlonzoEra) mk - transPraosLS (ShelleyLedgerState wo nes st tb l) = + transPraosLS (ShelleyLedgerState wo nes st tb) = ShelleyLedgerState { shelleyLedgerTip = fmap castShelleyTip wo , shelleyLedgerState = nes , shelleyLedgerTransition = st , shelleyLedgerTables = coerce tb - , shelleyLedgerLeiosState = l } translateLedgerTablesAlonzoToBabbageWrapper :: diff --git a/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Ledger.hs b/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Ledger.hs index 29923f8c83..2ce41d12a4 100644 --- a/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Ledger.hs +++ b/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Ledger.hs @@ -11,7 +11,6 @@ {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RankNTypes #-} -{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TupleSections #-} @@ -56,8 +55,6 @@ module Ouroboros.Consensus.Shelley.Ledger.Ledger , slUtxoL -- * Leios - , ShelleyLedgerLeiosState (..) - , initShelleyLedgerLeiosState , deserialiseShelleyTx , toTxSeq ) where @@ -118,11 +115,9 @@ import Data.Word import GHC.Generics (Generic) import LeiosDemoDb (LeiosDbHandle (leiosDbQueryCompletedEbByPoint)) import LeiosDemoTypes - ( EbHash (MkEbHash) - , LeiosPoint (MkLeiosPoint) + ( LeiosPoint (MkLeiosPoint) , TxHash - , decodeLeiosPoint - , encodeLeiosPoint + , pointEbHash , pointSlotNo ) import Lens.Micro @@ -134,6 +129,7 @@ import Ouroboros.Consensus.Config import Ouroboros.Consensus.HardFork.Abstract import Ouroboros.Consensus.HardFork.Combinator.PartialConfig import qualified Ouroboros.Consensus.HardFork.History as HardFork +import Ouroboros.Consensus.HardFork.History.EraParams (EraParams (..)) import Ouroboros.Consensus.HardFork.History.Util import Ouroboros.Consensus.HardFork.Simple import Ouroboros.Consensus.HeaderValidation @@ -142,6 +138,14 @@ import Ouroboros.Consensus.Ledger.CommonProtocolParams import Ouroboros.Consensus.Ledger.Extended import Ouroboros.Consensus.Ledger.Tables.Utils import Ouroboros.Consensus.Protocol.Ledger.Util (isNewEpoch) +import Ouroboros.Consensus.Protocol.Praos + ( LeiosState (leiosStatePreviousAnnouncement) + , Praos + , PraosCrypto + , PraosState (praosStateLastSlot, praosStateLeios) + , withOriginToSlotNo + ) +import Ouroboros.Consensus.Protocol.TPraos (TPraos) import Ouroboros.Consensus.Shelley.Ledger.Block import Ouroboros.Consensus.Shelley.Ledger.Config import Ouroboros.Consensus.Shelley.Ledger.Protocol () @@ -288,58 +292,11 @@ castShelleyTip (ShelleyTip sn bn hh) = , shelleyTipHash = coerce hh } -data ShelleyLedgerLeiosState = ShelleyLedgerLeiosState - { sllsMaybeAnnouncedEb :: Maybe LeiosPoint - , sllsTooSoonToCertify :: Bool - , sllsApplyTickCount :: Int - , sllsApplyBlockCount :: Int - , sllsApplyTickLastAt :: SlotNo - , sllsApplyBlockLastAt :: SlotNo - } - deriving stock (Show, Eq, Generic) - deriving anyclass NoThunks - -initShelleyLedgerLeiosState :: ShelleyLedgerLeiosState -initShelleyLedgerLeiosState = ShelleyLedgerLeiosState Nothing True 0 0 (SlotNo 0) (SlotNo 0) - -applyTickShelleyLedgerLeiosState :: ShelleyLedgerLeiosState -> SlotNo -> ShelleyLedgerLeiosState -applyTickShelleyLedgerLeiosState leiosSt currSlotNo = - leiosSt - { sllsApplyTickCount = sllsApplyTickCount leiosSt + 1 - , sllsApplyTickLastAt = currSlotNo - , sllsTooSoonToCertify = predTooSoonToCertify leiosSt currSlotNo - } - -predTooSoonToCertify :: ShelleyLedgerLeiosState -> SlotNo -> Bool -predTooSoonToCertify leiosSt currSlotNo = - maybe - True - (\annEbPoint -> unSlotNo currSlotNo - (unSlotNo . pointSlotNo $ annEbPoint) <= certifyMinDuration) - (sllsMaybeAnnouncedEb leiosSt) - where - certifyMinDuration = 10 -- FIXME(bladyjoker): Hardcore real value or wire in through config - -applyBlockShelleyLedgerLeiosState :: - ShelleyCompatible proto era => - ShelleyBlock proto era -> ShelleyLedgerLeiosState -> ShelleyLedgerLeiosState -applyBlockShelleyLedgerLeiosState blk leiosSt = - leiosSt - { sllsApplyBlockCount = sllsApplyBlockCount leiosSt + 1 - , sllsApplyBlockLastAt = blockSlot blk - , sllsMaybeAnnouncedEb = - MkLeiosPoint (blockSlot blk) . fromLedgerEbHash <$> SL.blockMayAnnouncedEb (shelleyBlockRaw blk) - } - --- -.- -fromLedgerEbHash :: SL.EbHash -> EbHash -fromLedgerEbHash = MkEbHash . BL.toStrict . SL.unEbHash - data instance LedgerState (ShelleyBlock proto era) mk = ShelleyLedgerState { shelleyLedgerTip :: !(WithOrigin (ShelleyTip proto era)) , shelleyLedgerState :: !(SL.NewEpochState era) , shelleyLedgerTransition :: !ShelleyTransition , shelleyLedgerTables :: !(LedgerTables (LedgerState (ShelleyBlock proto era)) mk) - , shelleyLedgerLeiosState :: ShelleyLedgerLeiosState } deriving Generic @@ -353,39 +310,52 @@ deriving instance (ShelleyBasedEra era, ShowMK mk) => Show (LedgerState (ShelleyBlock proto era) mk) +instance + ShelleyCompatible (TPraos c) era => + ResolveLeiosBlock (ShelleyBlock (TPraos c) era) + where + resolveLeiosBlock _ _ blk = return blk + -- NOTE(bladyjoker): Here because cyclic dep if in Block module instance - ShelleyCompatible proto era => - ResolveLeiosBlock (ShelleyBlock proto era) + (ShelleyCompatible (Praos c) era, PraosCrypto c) => + ResolveLeiosBlock (ShelleyBlock (Praos c) era) where resolveLeiosBlock leiosDb - extLedgerSt - blk@(ShelleyBlock{shelleyBlockRaw = lblk@(SL.Block _ (SL.BodyCertificate cert Nothing) _ certifiesEb)}) - | certifiesEb = do - let - mayAnnouncedEbPoint = sllsMaybeAnnouncedEb . shelleyLedgerLeiosState . ledgerState $ extLedgerSt - case mayAnnouncedEbPoint of + hdrSt + blk@(ShelleyBlock{shelleyBlockRaw = lblk@(SL.Block _ (SL.BodyCertificate cert Nothing))}) = do + let + mayPreviousEbAnnouncement = leiosStatePreviousAnnouncement . praosStateLeios . headerStateChainDep $ hdrSt + previousSlot = praosStateLastSlot . headerStateChainDep $ hdrSt + case mayPreviousEbAnnouncement of + Nothing -> + error $ + "FIXME(bladyjoker): Certifying but not previously announced EB! Whai would you do that!? " + <> show cert + Just previousEbAnnouncement -> do + mayAnnouncedEb <- + leiosDbQueryCompletedEbByPoint + leiosDb + ( MkLeiosPoint + { pointSlotNo = withOriginToSlotNo previousSlot + , pointEbHash = previousEbAnnouncement + } + ) + case mayAnnouncedEb of Nothing -> error $ - "FIXME(bladyjoker): Certifying but not previously announced EB! Whai would you do that!? " + "FIXME(bladyjoker): What exactly does this mean? Announced EB is being certified by the current chain but it's not available?" <> show cert - Just announcedEbPoint -> do - mayAnnouncedEb <- leiosDbQueryCompletedEbByPoint leiosDb announcedEbPoint - case mayAnnouncedEb of - Nothing -> - error $ - "FIXME(bladyjoker): What exactly does this mean? Announced EB is being certified by the current chain but it's not available?" - <> show cert - Just announcedEb -> - return $ - blk - { shelleyBlockRaw = - lblk - { blockBody = SL.BodyCertificate cert (Just (toTxSeq announcedEb)) - } - } - resolveLeiosBlock _leiosDb _extLedgerSt blk = return blk + Just announcedEb -> + return $ + blk + { shelleyBlockRaw = + lblk + { blockBody = SL.BodyCertificate cert (Just (toTxSeq announcedEb)) + } + } + resolveLeiosBlock _leiosDb _hdrSt blk = return blk deserialiseShelleyTx :: forall era. ShelleyBasedEra era => BS.ByteString -> Core.Tx era deserialiseShelleyTx bs = case CB.decodeFullAnnotator (Core.eraProtVerLow @era) "Leios Tx" CB.decCBOR (BL.fromStrict bs) of @@ -556,7 +526,6 @@ data instance Ticked (LedgerState (ShelleyBlock proto era)) mk = TickedShelleyLe , tickedShelleyLedgerState :: !(SL.NewEpochState era) , tickedShelleyLedgerTables :: !(LedgerTables (LedgerState (ShelleyBlock proto era)) mk) - , tickedShelleyLedgerLeiosState :: ShelleyLedgerLeiosState } deriving Generic @@ -578,7 +547,6 @@ instance ShelleyBasedEra era => IsLedger (LedgerState (ShelleyBlock proto era)) { shelleyLedgerTip , shelleyLedgerState , shelleyLedgerTransition - , shelleyLedgerLeiosState } = appTick globals shelleyLedgerState slotNo <&> \l' -> TickedShelleyLedgerState @@ -594,7 +562,6 @@ instance ShelleyBasedEra era => IsLedger (LedgerState (ShelleyBlock proto era)) , -- The UTxO set is only mutated by block/transaction execution and -- era translations, that is why we put empty tables here. tickedShelleyLedgerTables = emptyLedgerTables - , tickedShelleyLedgerLeiosState = applyTickShelleyLedgerLeiosState shelleyLedgerLeiosState slotNo } where globals = shelleyLedgerGlobals cfg @@ -735,8 +702,6 @@ applyHelper f cfg blk stBefore = do shelleyAfterVoting tickedShelleyLedgerTransition } , shelleyLedgerTables = emptyLedgerTables - , shelleyLedgerLeiosState = - applyBlockShelleyLedgerLeiosState blk (tickedShelleyLedgerLeiosState stBefore) } where globals = shelleyLedgerGlobals cfg @@ -871,15 +836,13 @@ encodeShelleyLedgerState { shelleyLedgerTip , shelleyLedgerState , shelleyLedgerTransition - , shelleyLedgerLeiosState } = encodeVersion serialisationFormatVersion2 $ mconcat - [ CBOR.encodeListLen 4 + [ CBOR.encodeListLen 3 , encodeWithOrigin encodeShelleyTip shelleyLedgerTip , toCBOR shelleyLedgerState , encodeShelleyTransition shelleyLedgerTransition - , encodeShelleyLedgerLeiosState shelleyLedgerLeiosState ] decodeShelleyLedgerState :: @@ -893,59 +856,17 @@ decodeShelleyLedgerState = where decodeShelleyLedgerState2 :: Decoder s' (LedgerState (ShelleyBlock proto era) EmptyMK) decodeShelleyLedgerState2 = do - enforceSize "LedgerState ShelleyBlock" 4 + enforceSize "LedgerState ShelleyBlock" 3 shelleyLedgerTip <- decodeWithOrigin decodeShelleyTip shelleyLedgerState <- fromCBOR shelleyLedgerTransition <- decodeShelleyTransition - shelleyLedgerLeiosState <- decodeShelleyLedgerLeiosState return ShelleyLedgerState { shelleyLedgerTip , shelleyLedgerState , shelleyLedgerTransition , shelleyLedgerTables = emptyLedgerTables - , shelleyLedgerLeiosState } instance CanUpgradeLedgerTables (LedgerState (ShelleyBlock proto era)) where upgradeTables _ _ = id - -encodeShelleyLedgerLeiosState :: ShelleyLedgerLeiosState -> Encoding -encodeShelleyLedgerLeiosState = toCBOR - -instance ToCBOR ShelleyLedgerLeiosState where - toCBOR ShelleyLedgerLeiosState{..} = - mconcat - [ CBOR.encodeListLen 6 - , toCBOR sllsMaybeAnnouncedEb - , toCBOR sllsTooSoonToCertify - , toCBOR sllsApplyTickCount - , toCBOR sllsApplyBlockCount - , toCBOR sllsApplyTickLastAt - , toCBOR sllsApplyBlockLastAt - ] - -instance ToCBOR LeiosPoint where - toCBOR = encodeLeiosPoint - -instance FromCBOR LeiosPoint where - fromCBOR = decodeLeiosPoint - -decodeShelleyLedgerLeiosState :: forall s. Decoder s ShelleyLedgerLeiosState -decodeShelleyLedgerLeiosState = do - enforceSize "ShelleyLedgerLeiosState" 6 - sllsMaybeAnnouncedEb <- fromCBOR - sllsTooSoonToCertify <- fromCBOR - sllsApplyTickCount <- fromCBOR - sllsApplyBlockCount <- fromCBOR - sllsApplyTickLastAt <- fromCBOR - sllsApplyBlockLastAt <- fromCBOR - return - ShelleyLedgerLeiosState - { sllsMaybeAnnouncedEb - , sllsTooSoonToCertify - , sllsApplyTickCount - , sllsApplyBlockCount - , sllsApplyTickLastAt - , sllsApplyBlockLastAt - } diff --git a/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/SupportsProtocol.hs b/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/SupportsProtocol.hs index 9b9b3db8a4..ef2215b417 100644 --- a/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/SupportsProtocol.hs +++ b/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/SupportsProtocol.hs @@ -119,6 +119,5 @@ instance , shelleyLedgerState = shelleyLedgerState st , shelleyLedgerTransition = shelleyLedgerTransition st , shelleyLedgerTables = emptyLedgerTables - , shelleyLedgerLeiosState = shelleyLedgerLeiosState st } coerceTip (ShelleyTip slot block hash) = ShelleyTip slot block (coerce hash) diff --git a/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Node.hs b/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Node.hs index ac9256e7cc..ae50fb6ee5 100644 --- a/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Node.hs +++ b/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Node.hs @@ -50,6 +50,7 @@ import Ouroboros.Consensus.Shelley.Protocol.Abstract ( ProtoCrypto , pHeaderIssuer ) +import Ouroboros.Consensus.Storage.LedgerDB.Forker (ResolveLeiosBlock) {------------------------------------------------------------------------------- ProtocolInfo @@ -116,6 +117,7 @@ instance ConsensusProtocol proto => BlockSupportsSanityCheck (ShelleyBlock proto instance ( ShelleyCompatible proto era + , ResolveLeiosBlock (ShelleyBlock proto era) , LedgerSupportsProtocol (ShelleyBlock proto era) , BlockSupportsSanityCheck (ShelleyBlock proto era) , TxLimits (ShelleyBlock proto era) diff --git a/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Node/Praos.hs b/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Node/Praos.hs index a5fee62d9b..e4aae870f4 100644 --- a/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Node/Praos.hs +++ b/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Node/Praos.hs @@ -5,6 +5,7 @@ {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RankNTypes #-} +{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeApplications #-} {-# LANGUAGE TypeFamilies #-} @@ -19,15 +20,21 @@ module Ouroboros.Consensus.Shelley.Node.Praos import qualified Cardano.Ledger.Api.Era as L import qualified Cardano.Protocol.TPraos.OCert as Absolute import qualified Cardano.Protocol.TPraos.OCert as SL +import Control.Tracer (traceWith) import qualified Data.Text as T +import LeiosDemoDb (LeiosDbHandle (leiosDbQueryCertificateByPoint, leiosDbQueryCompletedEbByPoint)) +import LeiosDemoTypes (EbHash, LeiosPoint (..), TraceLeiosKernel (MkTraceLeiosKernel)) import Ouroboros.Consensus.Block import Ouroboros.Consensus.Config (configConsensus) import qualified Ouroboros.Consensus.Ledger.SupportsMempool as Mempool import qualified Ouroboros.Consensus.Protocol.Ledger.HotKey as HotKey import Ouroboros.Consensus.Protocol.Praos - ( Praos + ( LeiosState (LeiosState, leiosStateCanCertify, leiosStatePreviousAnnouncement) + , Praos , PraosParams (..) + , PraosState (praosStateLastSlot, praosStateLeios) , praosCheckCanForge + , withOriginToSlotNo ) import Ouroboros.Consensus.Protocol.Praos.Common ( PraosCanBeLeader (praosCanBeLeaderOpCert) @@ -106,9 +113,9 @@ praosSharedBlockForging praosCheckCanForge (configConsensus cfg) curSlot - , forgeBlock = \leiosDb cfg blkNo slotNo ledgerState rbTxs ebTxs isLeader -> + , forgeBlock = \forgeType cfg blkNo slotNo ledgerState rbTxs ebTxs isLeader -> forgeShelleyBlock - leiosDb + forgeType hotKey canBeLeader cfg @@ -118,4 +125,49 @@ praosSharedBlockForging rbTxs ebTxs isLeader + , leiosDecideForgeType = leiosDecideForgeTypePraos } + +leiosDecideForgeTypePraos :: + Monad m => LeiosDecideForgeTypeArgs m (ShelleyBlock (Praos c) era) -> m ForgeType +leiosDecideForgeTypePraos args = do + let + leiosDb = ldftaLeiosDb args + traceLeios = traceWith (ldftaLeiosTracer args) + praosState = ldftaChainDepState args + LeiosState{..} = praosStateLeios praosState + traceLeios $ MkTraceLeiosKernel $ "leiosDecideForgeTypePraos called with: " <> show praosState + case leiosStatePreviousAnnouncement of + Nothing -> do + traceLeios $ MkTraceLeiosKernel $ "leiosDecideForgeTypePraos: No previous EB announcement" + return ForgeTxsRb + Just (ebHash :: EbHash) -> + if leiosStateCanCertify + then do + let ebPoint = + MkLeiosPoint + { pointSlotNo = withOriginToSlotNo . praosStateLastSlot $ praosState -- NOTE(bladyjoker): We're using previous slot no (as in of the previous block) + , pointEbHash = ebHash + } + mayEbClosure <- leiosDbQueryCompletedEbByPoint leiosDb ebPoint + case mayEbClosure of + Nothing -> do + traceLeios $ MkTraceLeiosKernel $ "leiosDecideForgeTypePraos: EB not downloaded " <> show ebPoint -- TODO(bladyjoker): Structure message + return ForgeTxsRb + Just ebClosure -> do + mayCert <- leiosDbQueryCertificateByPoint leiosDb ebPoint + case mayCert of + Nothing -> do + traceLeios $ + MkTraceLeiosKernel $ + "leiosDecideForgeTypePraos: EB downloaded but no certificate (voting not finished?) " + <> show ebPoint -- TODO(bladyjoker): Structure message + return ForgeTxsRb + Just cert -> do + traceLeios $ + MkTraceLeiosKernel $ + "leiosDecideForgeTypePraos: EB downloaded " <> show ebPoint <> " and certified " <> show cert -- TODO(bladyjoker): Structure message + return $ ForgeCertRb cert ebClosure + else do + traceLeios $ MkTraceLeiosKernel $ "leiosDecideForgeTypePraos: Can't certify yet" + return ForgeTxsRb diff --git a/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Node/TPraos.hs b/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Node/TPraos.hs index f9077669e3..7b22a1f234 100644 --- a/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Node/TPraos.hs +++ b/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Node/TPraos.hs @@ -136,9 +136,9 @@ shelleySharedBlockForging hotKey slotToPeriod credentials = (configConsensus cfg) forgingVRFHash curSlot - , forgeBlock = \leiosDb cfg blkNo slotNo ledgerState rbTxs ebTxs isLeader -> + , forgeBlock = \forgeType cfg blkNo slotNo ledgerState rbTxs ebTxs isLeader -> forgeShelleyBlock - leiosDb + forgeType hotKey canBeLeader cfg @@ -148,6 +148,7 @@ shelleySharedBlockForging hotKey slotToPeriod credentials = rbTxs ebTxs isLeader + , leiosDecideForgeType = \_ -> return ForgeTxsRb } where ShelleyLeaderCredentials @@ -292,7 +293,6 @@ protocolInfoTPraosShelleyBased L.createInitialState transitionCfg , shelleyLedgerTransition = ShelleyTransitionInfo{shelleyAfterVoting = 0} , shelleyLedgerTables = emptyLedgerTables - , shelleyLedgerLeiosState = initShelleyLedgerLeiosState } initChainDepState :: TPraosState diff --git a/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Protocol/Abstract.hs b/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Protocol/Abstract.hs index 3ea381eb63..98431ca088 100644 --- a/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Protocol/Abstract.hs +++ b/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Protocol/Abstract.hs @@ -48,6 +48,7 @@ import Data.Kind (Type) import Data.Typeable (Typeable) import Data.Word (Word64) import GHC.Generics (Generic) +import LeiosDemoTypes (EbHash) import NoThunks.Class (NoThunks) import Numeric.Natural (Natural) import Ouroboros.Consensus.Protocol.Abstract @@ -60,6 +61,7 @@ import Ouroboros.Consensus.Protocol.Abstract , ValidateView ) import Ouroboros.Consensus.Protocol.Ledger.HotKey (HotKey) +import Ouroboros.Consensus.Protocol.Praos.Header (BodyType) import Ouroboros.Consensus.Protocol.Signed (SignedHeader) import Ouroboros.Consensus.Util.Condense (Condense (..)) @@ -160,8 +162,12 @@ class ProtocolHeaderSupportsKES proto where Hash.Hash HASH EraIndependentBlockBody -> -- | Size of the block body Int -> + -- | Type of the block body + BodyType -> -- | Protocol version ProtVer -> + -- | Leios EB announcement + Maybe EbHash -> m (ShelleyProtocolHeader proto) -- | ProtocolHeaderSupportsProtocol` provides support for the concrete diff --git a/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Protocol/Praos.hs b/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Protocol/Praos.hs index 4d8744ed93..e8efc49f52 100644 --- a/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Protocol/Praos.hs +++ b/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Protocol/Praos.hs @@ -144,7 +144,7 @@ instance PraosCrypto c => ProtocolHeaderSupportsKES (Praos c) where currentKesPeriod - startOfKesPeriod | otherwise = 0 - mkHeader hk cbl il slotNo blockNo prevHash bbHash sz protVer = do + mkHeader hk cbl il slotNo blockNo prevHash bodyHash bodySize bodyType protVer mayEbAnnouncement = do PraosFields{praosSignature, praosToSign} <- forgePraosFields hk cbl il mkBhBodyBytes pure $ Header praosToSign praosSignature where @@ -162,10 +162,12 @@ instance PraosCrypto c => ProtocolHeaderSupportsKES (Praos c) where , hbVk = praosToSignIssuerVK , hbVrfVk = praosToSignVrfVK , hbVrfRes = praosToSignVrfRes - , hbBodySize = fromIntegral sz - , hbBodyHash = bbHash + , hbBodySize = fromIntegral bodySize + , hbBodyHash = bodyHash + , hbBodyType = bodyType , hbOCert = praosToSignOCert , hbProtVer = protVer + , hbMayEbAnnouncement = mayEbAnnouncement } instance PraosCrypto c => ProtocolHeaderSupportsProtocol (Praos c) where @@ -180,6 +182,7 @@ instance PraosCrypto c => ProtocolHeaderSupportsProtocol (Praos c) where , hvSlotNo = hbSlotNo headerBody , hvSigned = headerBody , hvSignature = headerSig + , hvMayEbAnnouncement = hbMayEbAnnouncement headerBody } pHeaderIssuer = hbVk . headerBody pHeaderIssueNo = SL.ocertN . hbOCert . headerBody diff --git a/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Protocol/TPraos.hs b/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Protocol/TPraos.hs index 369eaf0389..e5cbf58ce0 100644 --- a/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Protocol/TPraos.hs +++ b/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Protocol/TPraos.hs @@ -90,7 +90,7 @@ instance PraosCrypto c => ProtocolHeaderSupportsKES (TPraos c) where currentKesPeriod - startOfKesPeriod | otherwise = 0 - mkHeader hotKey canBeLeader isLeader curSlot curNo prevHash bbHash actualBodySize protVer = do + mkHeader hotKey canBeLeader isLeader curSlot curNo prevHash bbHash actualBodySize _bodyType protVer _mayEbAnnouncement = do TPraosFields{tpraosSignature, tpraosToSign} <- forgeTPraosFields hotKey canBeLeader isLeader mkBhBody pure $ SL.BHeader tpraosToSign tpraosSignature diff --git a/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/ShelleyHFC.hs b/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/ShelleyHFC.hs index 17ddbbdf1f..5e1a12d0fe 100644 --- a/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/ShelleyHFC.hs +++ b/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/ShelleyHFC.hs @@ -369,7 +369,7 @@ instance ) => SL.TranslateEra era (Flip LedgerState mk :.: ShelleyBlock proto) where - translateEra ctxt (Comp (Flip (ShelleyLedgerState tip state _transition tables leios))) = do + translateEra ctxt (Comp (Flip (ShelleyLedgerState tip state _transition tables))) = do tip' <- mapM (SL.translateEra ctxt) tip state' <- SL.translateEra ctxt state return $ @@ -380,7 +380,6 @@ instance , shelleyLedgerState = state' , shelleyLedgerTransition = ShelleyTransitionInfo 0 , shelleyLedgerTables = translateShelleyTables tables - , shelleyLedgerLeiosState = leios } translateShelleyTables :: diff --git a/ouroboros-consensus-cardano/src/unstable-byron-testlib/Ouroboros/Consensus/ByronDual/Node.hs b/ouroboros-consensus-cardano/src/unstable-byron-testlib/Ouroboros/Consensus/ByronDual/Node.hs index b24ff90ac9..5c33f049af 100644 --- a/ouroboros-consensus-cardano/src/unstable-byron-testlib/Ouroboros/Consensus/ByronDual/Node.hs +++ b/ouroboros-consensus-cardano/src/unstable-byron-testlib/Ouroboros/Consensus/ByronDual/Node.hs @@ -66,10 +66,11 @@ dualByronBlockForging creds = , updateForgeState = \cfg -> fmap castForgeStateUpdateInfo .: updateForgeState (dualTopLevelConfigMain cfg) , checkCanForge = checkCanForge . dualTopLevelConfigMain - , forgeBlock = \_leiosDb cfg b s ls txs _ebTxs isLeader -> + , forgeBlock = \_ cfg b s ls txs _ebTxs isLeader -> -- XXX: Adding Leios EB support here feels so wrong return . (,Nothing) $ forgeDualByronBlock cfg b s ls txs isLeader + , leiosDecideForgeType = \_ -> return ForgeTxsRb } where BlockForging{..} = byronBlockForging creds diff --git a/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/DBAnalyser/Block/Shelley.hs b/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/DBAnalyser/Block/Shelley.hs index c63d0de6ed..35bfeb2337 100644 --- a/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/DBAnalyser/Block/Shelley.hs +++ b/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/DBAnalyser/Block/Shelley.hs @@ -62,13 +62,13 @@ instance HasAnalysis (ShelleyBlock proto era) where countTxOutputs blk = case Shelley.shelleyBlockRaw blk of - SL.Block _ body _ _ -> sum $ fmap countOutputs (Core.fromTxSeq @era $ L.bodyTxs body) + SL.Block _ body -> sum $ fmap countOutputs (Core.fromTxSeq @era $ L.bodyTxs body) where countOutputs :: Core.Tx era -> Int countOutputs tx = length $ tx ^. Core.bodyTxL . Core.outputsTxBodyL blockTxSizes blk = case Shelley.shelleyBlockRaw blk of - SL.Block _ body _ _ -> + SL.Block _ body -> toList $ fmap (fromIntegral . view Core.sizeTxF) (Core.fromTxSeq @era $ L.bodyTxs body) @@ -101,7 +101,7 @@ instance where txs :: StrictSeq (Core.Tx era) txs = case Shelley.shelleyBlockRaw blk of - SL.Block _ body _ _ -> Core.fromTxSeq @era $ L.bodyTxs body + SL.Block _ body -> Core.fromTxSeq @era $ L.bodyTxs body -- For the time being we do not support any block application -- metrics for Shelley-only eras. diff --git a/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/ThreadNet/Run.hs b/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/ThreadNet/Run.hs index 73767c150f..24eea095dd 100644 --- a/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/ThreadNet/Run.hs +++ b/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/ThreadNet/Run.hs @@ -127,12 +127,14 @@ run Opts{..} = do putStrLn "*** Leios" - print $ - ("eb-slotno", imEbSlots . runIdentity . lsLeiosDb . nodeLeiosState <$> testOutputNodes testOutput) - print $ - ("eb-points", imEbPoints . runIdentity . lsLeiosDb . nodeLeiosState <$> testOutputNodes testOutput) - print $ - ("eb-txs", length . imTxs . runIdentity . lsLeiosDb . nodeLeiosState <$> testOutputNodes testOutput) + forM_ (Map.toList . testOutputNodes $ testOutput) $ \(nodeId, nodeOut) -> do + print $ "Node " <> show nodeId + print $ + ("> eb-slotno", imEbSlots . runIdentity . lsLeiosDb . nodeLeiosState $ nodeOut) + print $ + ("> eb-points", imEbPoints . runIdentity . lsLeiosDb . nodeLeiosState $ nodeOut) + print $ + ("> eb-txs", length . imTxs . runIdentity . lsLeiosDb . nodeLeiosState $ nodeOut) putStrLn "*** Outputting log files" @@ -434,7 +436,7 @@ instance TxGen (CardanoBlock StandardCrypto) where utxos = getUTxOs st in return $ - Debug.trace (show ("Node", coreNodeId, "current slot", slotNo, shelleyLedgerLeiosState st)) $ + Debug.trace (show ("Node", coreNodeId, "current slot", slotNo)) $ -- Interleave transactions produced by each generator and take `rtnaTxsPerSlot` of them take (fromIntegral rtnaTxsPerSlot) . interleave $ do diff --git a/ouroboros-consensus-cardano/src/unstable-shelley-testlib/Test/Consensus/Shelley/Examples.hs b/ouroboros-consensus-cardano/src/unstable-shelley-testlib/Test/Consensus/Shelley/Examples.hs index 3b51f8c38c..ea46453a53 100644 --- a/ouroboros-consensus-cardano/src/unstable-shelley-testlib/Test/Consensus/Shelley/Examples.hs +++ b/ouroboros-consensus-cardano/src/unstable-shelley-testlib/Test/Consensus/Shelley/Examples.hs @@ -44,7 +44,8 @@ import Ouroboros.Consensus.Ledger.Tables.Utils import Ouroboros.Consensus.Protocol.Abstract (translateChainDepState) import Ouroboros.Consensus.Protocol.Praos (Praos) import Ouroboros.Consensus.Protocol.Praos.Header - ( HeaderBody (HeaderBody) + ( BodyType (LedgerBlock) + , HeaderBody (HeaderBody) ) import qualified Ouroboros.Consensus.Protocol.Praos.Header as Praos import Ouroboros.Consensus.Protocol.TPraos @@ -220,7 +221,6 @@ fromShelleyLedgerExamples , shelleyLedgerState = sleNewEpochState , shelleyLedgerTransition = ShelleyTransitionInfo{shelleyAfterVoting = 0} , shelleyLedgerTables = LedgerTables EmptyMK - , shelleyLedgerLeiosState = initShelleyLedgerLeiosState } chainDepState = TPraosState (NotOrigin 1) sleChainDepState extLedgerState = @@ -263,8 +263,8 @@ fromShelleyLedgerExamplesPraos where blk = mkShelleyBlock $ - let SL.Block hdr1 bdy mayAnnEb mayCertEb = sleBlock - in SL.Block (translateHeader hdr1) bdy mayAnnEb mayCertEb + let SL.Block hdr1 bdy = sleBlock + in SL.Block (translateHeader hdr1) bdy translateHeader :: SL.BHeader StandardCrypto -> Praos.Header StandardCrypto translateHeader (SL.BHeader bhBody bhSig) = @@ -280,8 +280,10 @@ fromShelleyLedgerExamplesPraos , hbVrfRes = coerce $ SL.bheaderEta bhBody , hbBodySize = SL.bsize bhBody , hbBodyHash = SL.bhash bhBody + , hbBodyType = LedgerBlock , hbOCert = SL.bheaderOCert bhBody , hbProtVer = SL.bprotver bhBody + , hbMayEbAnnouncement = Nothing } hSig = coerce bhSig hash = ShelleyHash $ SL.unHashHeader sleHashHeader @@ -331,7 +333,6 @@ fromShelleyLedgerExamplesPraos , shelleyLedgerState = sleNewEpochState , shelleyLedgerTransition = ShelleyTransitionInfo{shelleyAfterVoting = 0} , shelleyLedgerTables = emptyLedgerTables - , shelleyLedgerLeiosState = initShelleyLedgerLeiosState } chainDepState = translateChainDepState (Proxy @(TPraos StandardCrypto, Praos StandardCrypto)) $ diff --git a/ouroboros-consensus-cardano/src/unstable-shelley-testlib/Test/Consensus/Shelley/Generators.hs b/ouroboros-consensus-cardano/src/unstable-shelley-testlib/Test/Consensus/Shelley/Generators.hs index 00d5e4b6b2..9606d1ed2b 100644 --- a/ouroboros-consensus-cardano/src/unstable-shelley-testlib/Test/Consensus/Shelley/Generators.hs +++ b/ouroboros-consensus-cardano/src/unstable-shelley-testlib/Test/Consensus/Shelley/Generators.hs @@ -31,6 +31,7 @@ import Ouroboros.Consensus.Ledger.Query import Ouroboros.Consensus.Ledger.SupportsMempool import Ouroboros.Consensus.Protocol.Praos (Praos) import qualified Ouroboros.Consensus.Protocol.Praos as Praos +import Ouroboros.Consensus.Protocol.Praos.Header (BodyType (LedgerBlock)) import qualified Ouroboros.Consensus.Protocol.Praos.Header as Praos import Ouroboros.Consensus.Protocol.TPraos (TPraos, TPraosState (..)) import Ouroboros.Consensus.Shelley.Eras @@ -93,8 +94,6 @@ instance SL.Block <$> arbitrary <*> (L.BodyInline . L.toTxSeq @era <$> arbitrary) - <*> pure Nothing - <*> pure False -- FIXME(bladyjoker) -- | This uses a different upstream generator to ensure the header and block -- body relate as expected. @@ -126,9 +125,9 @@ instance mkBlk sleBlock = mkShelleyBlock $ let - SL.Block hdr1 bdy mayAnnEb mayCertEb = sleBlock + SL.Block hdr1 bdy = sleBlock in - SL.Block (translateHeader hdr1) bdy mayAnnEb mayCertEb + SL.Block (translateHeader hdr1) bdy translateHeader :: Crypto c => SL.BHeader c -> Praos.Header c translateHeader (SL.BHeader bhBody bhSig) = @@ -144,8 +143,10 @@ instance , Praos.hbVrfRes = coerce $ SL.bheaderEta bhBody , Praos.hbBodySize = SL.bsize bhBody , Praos.hbBodyHash = SL.bhash bhBody + , Praos.hbBodyType = LedgerBlock , Praos.hbOCert = SL.bheaderOCert bhBody , Praos.hbProtVer = SL.bprotver bhBody + , Praos.hbMayEbAnnouncement = Nothing } hSig = coerce bhSig @@ -240,7 +241,6 @@ instance <*> arbitrary <*> arbitrary <*> pure (LedgerTables EmptyMK) - <*> pure initShelleyLedgerLeiosState instance (Arbitrary (InstantStake era), CanMock proto era) => @@ -252,7 +252,6 @@ instance <*> arbitrary <*> arbitrary <*> (LedgerTables . ValuesMK <$> arbitrary) - <*> pure initShelleyLedgerLeiosState instance CanMock proto era => Arbitrary (AnnTip (ShelleyBlock proto era)) where arbitrary = diff --git a/ouroboros-consensus-diffusion/src/ouroboros-consensus-diffusion/Ouroboros/Consensus/NodeKernel.hs b/ouroboros-consensus-diffusion/src/ouroboros-consensus-diffusion/Ouroboros/Consensus/NodeKernel.hs index 0d33cb550e..302a7ccd51 100644 --- a/ouroboros-consensus-diffusion/src/ouroboros-consensus-diffusion/Ouroboros/Consensus/NodeKernel.hs +++ b/ouroboros-consensus-diffusion/src/ouroboros-consensus-diffusion/Ouroboros/Consensus/NodeKernel.hs @@ -700,6 +700,16 @@ forkBlockForging IS{..} blockForging = -- At this point we have established that we are indeed slot leader trace $ TraceNodeIsLeader currentSlot + -- Leios: decide if we're forging an CertRb or a TxsRb + forgeType <- + lift $ + leiosDecideForgeType blockForging $ + LeiosDecideForgeTypeArgs + { ldftaChainDepState = headerStateChainDep (headerState unticked) + , ldftaLeiosTracer = leiosKernelTracer tracers + , ldftaLeiosDb = leiosDB + } + -- Tick the ledger state for the 'SlotNo' we're producing a block for let tickedLedgerState :: Ticked (LedgerState blk) DiffMK tickedLedgerState = @@ -768,7 +778,7 @@ forkBlockForging IS{..} blockForging = lift $ Block.forgeBlock blockForging - leiosDB + forgeType cfg bcBlockNo currentSlot diff --git a/ouroboros-consensus-diffusion/src/unstable-diffusion-testlib/Test/ThreadNet/Network.hs b/ouroboros-consensus-diffusion/src/unstable-diffusion-testlib/Test/ThreadNet/Network.hs index 3b5684df7d..5ed6c33905 100644 --- a/ouroboros-consensus-diffusion/src/unstable-diffusion-testlib/Test/ThreadNet/Network.hs +++ b/ouroboros-consensus-diffusion/src/unstable-diffusion-testlib/Test/ThreadNet/Network.hs @@ -77,7 +77,6 @@ import GHC.Generics (Generic) import GHC.Stack import LeiosDemoDb ( InMemoryLeiosDb - , LeiosDbHandle , emptyInMemoryLeiosDb , newLeiosDBInMemoryWith ) @@ -1203,7 +1202,7 @@ customForgeBlock :: ) => CustomForgeBlockArgs m blk -> BlockForging m blk -> - LeiosDbHandle m -> + ForgeType -> TopLevelConfig blk -> BlockNo -> SlotNo -> @@ -1212,7 +1211,7 @@ customForgeBlock :: [Validated (GenTx blk)] -> IsLeader (BlockProtocol blk) -> m (blk, Maybe ForgedLeiosEb) -customForgeBlock CustomForgeBlockArgs{..} origBlockForging leiosDb cfg' currentBno currentSlot tickedLdgSt txs ebTxs prf = do +customForgeBlock CustomForgeBlockArgs{..} origBlockForging forgeType cfg' currentBno currentSlot tickedLdgSt txs ebTxs prf = do let currentEpoch = HFF.futureSlotToEpoch cfbaFuture currentSlot -- EBBs are only ever possible in the first era @@ -1233,7 +1232,7 @@ customForgeBlock CustomForgeBlockArgs{..} origBlockForging leiosDb cfg' currentB -- no EBB needed, forge without making one forgeBlock origBlockForging - leiosDb + forgeType cfg' currentBno currentSlot @@ -1281,7 +1280,7 @@ customForgeBlock CustomForgeBlockArgs{..} origBlockForging leiosDb cfg' currentB (blk, mayEb) <- forgeBlock origBlockForging - leiosDb + forgeType cfg' currentBno currentSlot diff --git a/ouroboros-consensus-diffusion/test/consensus-test/Test/Consensus/HardFork/Combinator/A.hs b/ouroboros-consensus-diffusion/test/consensus-test/Test/Consensus/HardFork/Combinator/A.hs index 1a1f586458..7dd8bc737c 100644 --- a/ouroboros-consensus-diffusion/test/consensus-test/Test/Consensus/HardFork/Combinator/A.hs +++ b/ouroboros-consensus-diffusion/test/consensus-test/Test/Consensus/HardFork/Combinator/A.hs @@ -356,9 +356,10 @@ blockForgingA = , canBeLeader = () , updateForgeState = \_ _ _ -> return $ ForgeStateUpdated () , checkCanForge = \_ _ _ _ _ -> return () - , forgeBlock = \_leiosDb cfg bno slot st txs _ebTxs proof -> + , forgeBlock = \_forgeType cfg bno slot st txs _ebTxs proof -> return . (,Nothing) $ forgeBlockA cfg bno slot st (fmap txForgetValidated txs) proof + , leiosDecideForgeType = \_ -> return ForgeTxsRb } -- | See 'Ouroboros.Consensus.HardFork.History.EraParams.safeFromTip' diff --git a/ouroboros-consensus-diffusion/test/consensus-test/Test/Consensus/HardFork/Combinator/B.hs b/ouroboros-consensus-diffusion/test/consensus-test/Test/Consensus/HardFork/Combinator/B.hs index 59e282b5fa..e2868a9c62 100644 --- a/ouroboros-consensus-diffusion/test/consensus-test/Test/Consensus/HardFork/Combinator/B.hs +++ b/ouroboros-consensus-diffusion/test/consensus-test/Test/Consensus/HardFork/Combinator/B.hs @@ -45,7 +45,6 @@ import Data.Set (Set) import qualified Data.Set as Set import Data.Void import GHC.Generics (Generic) -import LeiosDemoDb (LeiosDbHandle) import NoThunks.Class (NoThunks, OnlyCheckWhnfNamed (..)) import Ouroboros.Consensus.Block import Ouroboros.Consensus.BlockchainTime @@ -271,7 +270,7 @@ type instance ForgeStateInfo BlockB = () type instance ForgeStateUpdateError BlockB = Void forgeBlockB :: - LeiosDbHandle m -> + ForgeType -> TopLevelConfig BlockB -> BlockNo -> SlotNo -> @@ -300,9 +299,10 @@ blockForgingB = , canBeLeader = () , updateForgeState = \_ _ _ -> return $ ForgeStateUpdated () , checkCanForge = \_ _ _ _ _ -> return () - , forgeBlock = \leiosDb cfg bno slot st txs _ebTxs proof -> + , forgeBlock = \forgeType cfg bno slot st txs _ebTxs proof -> return . (,Nothing) $ - forgeBlockB leiosDb cfg bno slot st (fmap txForgetValidated txs) proof + forgeBlockB forgeType cfg bno slot st (fmap txForgetValidated txs) proof + , leiosDecideForgeType = \_ -> return ForgeTxsRb } -- | A basic 'History.SafeZone' diff --git a/ouroboros-consensus-protocol/ouroboros-consensus-protocol.cabal b/ouroboros-consensus-protocol/ouroboros-consensus-protocol.cabal index 1a1906df4f..c5d57e1b78 100644 --- a/ouroboros-consensus-protocol/ouroboros-consensus-protocol.cabal +++ b/ouroboros-consensus-protocol/ouroboros-consensus-protocol.cabal @@ -103,6 +103,7 @@ library unstable-protocol-testlib cardano-protocol-tpraos, cardano-slotting, containers, + ouroboros-consensus, ouroboros-consensus-protocol, text, diff --git a/ouroboros-consensus-protocol/src/ouroboros-consensus-protocol/Ouroboros/Consensus/Protocol/Praos.hs b/ouroboros-consensus-protocol/src/ouroboros-consensus-protocol/Ouroboros/Consensus/Protocol/Praos.hs index 2133430136..4f89f70c18 100644 --- a/ouroboros-consensus-protocol/src/ouroboros-consensus-protocol/Ouroboros/Consensus/Protocol/Praos.hs +++ b/ouroboros-consensus-protocol/src/ouroboros-consensus-protocol/Ouroboros/Consensus/Protocol/Praos.hs @@ -1,11 +1,13 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RankNTypes #-} +{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TypeApplications #-} @@ -26,8 +28,10 @@ module Ouroboros.Consensus.Protocol.Praos , PraosToSign (..) , PraosValidationErr (..) , Ticked (..) + , LeiosState (..) , forgePraosFields , praosCheckCanForge + , withOriginToSlotNo -- * For testing purposes , doValidateKESSignature @@ -78,7 +82,7 @@ import Cardano.Slotting.EpochInfo import Cardano.Slotting.Slot ( EpochNo (EpochNo) , SlotNo (SlotNo) - , WithOrigin + , WithOrigin (Origin) , unSlotNo ) import qualified Codec.CBOR.Encoding as CBOR @@ -94,6 +98,7 @@ import Data.Proxy (Proxy (Proxy)) import qualified Data.Set as Set import Data.Word (Word64) import GHC.Generics (Generic) +import LeiosDemoTypes (EbHash) import NoThunks.Class (NoThunks) import Numeric.Natural (Natural) import Ouroboros.Consensus.Block (WithOrigin (NotOrigin)) @@ -284,6 +289,7 @@ data PraosState = PraosState , praosStateLastEpochBlockNonce :: !Nonce -- ^ Nonce corresponding to the LAB nonce of the last block of the previous -- epoch + , praosStateLeios :: !LeiosState } deriving (Generic, Show, Eq) @@ -305,10 +311,11 @@ instance Serialise PraosState where , praosStateEpochNonce , praosStateLabNonce , praosStateLastEpochBlockNonce + , praosStateLeios } = encodeVersion 0 $ mconcat - [ CBOR.encodeListLen 7 + [ CBOR.encodeListLen 8 , toCBOR praosStateLastSlot , toCBOR praosStateOCertCounters , toCBOR praosStateEvolvingNonce @@ -316,6 +323,7 @@ instance Serialise PraosState where , toCBOR praosStateEpochNonce , toCBOR praosStateLabNonce , toCBOR praosStateLastEpochBlockNonce + , toCBOR praosStateLeios ] decode = @@ -323,7 +331,7 @@ instance Serialise PraosState where [(0, Decode decodePraosState)] where decodePraosState = do - enforceSize "PraosState" 7 + enforceSize "PraosState" 8 PraosState <$> fromCBOR <*> fromCBOR @@ -332,12 +340,61 @@ instance Serialise PraosState where <*> fromCBOR <*> fromCBOR <*> fromCBOR + <*> fromCBOR data instance Ticked PraosState = TickedPraosState { tickedPraosStateChainDepState :: PraosState , tickedPraosStateLedgerView :: Views.LedgerView } +data LeiosState = LeiosState + { leiosStatePreviousAnnouncement :: Maybe EbHash + , leiosStateCanCertify :: Bool + } + deriving stock (Show, Eq, Generic) + deriving anyclass NoThunks + +initLeiosState :: LeiosState +initLeiosState = LeiosState Nothing False + +instance ToCBOR LeiosState where + toCBOR LeiosState{..} = + mconcat + [ CBOR.encodeListLen 2 + , toCBOR leiosStatePreviousAnnouncement + , toCBOR leiosStateCanCertify + ] + +instance FromCBOR LeiosState where + fromCBOR = LeiosState <$> fromCBOR <*> fromCBOR + +tickChainDepStateLeios :: LeiosState -> WithOrigin SlotNo -> SlotNo -> LeiosState +tickChainDepStateLeios leiosSt prevSlotNo currSlotNo = + leiosSt + { leiosStateCanCertify = not (leiosTooSoonToCertify leiosSt prevSlotNo currSlotNo) + } + +leiosTooSoonToCertify :: LeiosState -> WithOrigin SlotNo -> SlotNo -> Bool +leiosTooSoonToCertify leiosSt prevSlotNo currSlotNo = + maybe + True + ( \_annEbHash -> + unSlotNo currSlotNo - unSlotNo (withOriginToSlotNo prevSlotNo) <= certifyMinDuration + ) + (leiosStatePreviousAnnouncement leiosSt) + where + certifyMinDuration = 10 -- FIXME(bladyjoker): Hardcore real value or wire in through config + +withOriginToSlotNo :: WithOrigin SlotNo -> SlotNo +withOriginToSlotNo Origin = SlotNo 0 -- FIXME(bladyjoker): Is this correct? +withOriginToSlotNo (NotOrigin slotNo) = slotNo + +reupdateChainDepStateLeios :: Views.HeaderView c -> LeiosState -> LeiosState +reupdateChainDepStateLeios hdr leiosState = + leiosState + { leiosStatePreviousAnnouncement = Views.hvMayEbAnnouncement hdr + } + -- | Errors which we might encounter data PraosValidationErr c = VRFKeyUnknown @@ -422,8 +479,8 @@ instance PraosCrypto c => ConsensusProtocol (Praos c) where -- Updating the chain dependent state for Praos. -- - -- If we are not in a new epoch, then nothing happens. If we are in a new - -- epoch, we do two things: + -- If we are not in a new epoch, then we update the Leios state. If we are in a new + -- epoch, we update the Leios state AND we do two things: -- - Update the epoch nonce to the combination of the candidate nonce and the -- nonce derived from the last block of the previous epoch. -- - Update the "last block of previous epoch" nonce to the nonce derived from @@ -434,7 +491,7 @@ instance PraosCrypto c => ConsensusProtocol (Praos c) where slot st = TickedPraosState - { tickedPraosStateChainDepState = st' + { tickedPraosStateChainDepState = st'' , tickedPraosStateLedgerView = lv } where @@ -453,6 +510,10 @@ instance PraosCrypto c => ConsensusProtocol (Praos c) where , praosStateLastEpochBlockNonce = praosStateLabNonce st } else st + st'' = + st' + { praosStateLeios = tickChainDepStateLeios (praosStateLeios st') (praosStateLastSlot st) slot + } -- Validate and update the chain dependent state as a result of processing a -- new header. @@ -507,6 +568,7 @@ instance PraosCrypto c => ConsensusProtocol (Praos c) where else praosStateCandidateNonce cs , praosStateOCertCounters = Map.insert hk n $ praosStateOCertCounters cs + , praosStateLeios = reupdateChainDepStateLeios b (praosStateLeios cs) } where epochInfoWithErr = @@ -759,6 +821,7 @@ instance TranslateProto (TPraos c) (Praos c) where , praosStateEpochNonce = SL.ticknStateEpochNonce csTickn , praosStateLabNonce = csLabNonce , praosStateLastEpochBlockNonce = SL.ticknStatePrevHashNonce csTickn + , praosStateLeios = initLeiosState } where SL.ChainDepState{SL.csProtocol, SL.csTickn, SL.csLabNonce} = diff --git a/ouroboros-consensus-protocol/src/ouroboros-consensus-protocol/Ouroboros/Consensus/Protocol/Praos/Header.hs b/ouroboros-consensus-protocol/src/ouroboros-consensus-protocol/Ouroboros/Consensus/Protocol/Praos/Header.hs index dbb2318056..145b21cb1e 100644 --- a/ouroboros-consensus-protocol/src/ouroboros-consensus-protocol/Ouroboros/Consensus/Protocol/Praos/Header.hs +++ b/ouroboros-consensus-protocol/src/ouroboros-consensus-protocol/Ouroboros/Consensus/Protocol/Praos/Header.hs @@ -1,7 +1,9 @@ {-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DerivingVia #-} {-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE LambdaCase #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE StandaloneDeriving #-} @@ -25,6 +27,7 @@ module Ouroboros.Consensus.Protocol.Praos.Header , HeaderBody (..) , headerHash , headerSize + , BodyType (..) ) where import qualified Cardano.Crypto.Hash as Hash @@ -39,6 +42,7 @@ import Cardano.Ledger.Binary , DecCBOR (decCBOR) , EncCBOR (..) , ToCBOR (..) + , decodeInt8 , encodedSigKESSizeExpr , serialize' , unCBORGroup @@ -51,6 +55,7 @@ import Cardano.Ledger.Binary.Crypto , encodeSignedKES , encodeVerKeyVRF ) +import Cardano.Ledger.Binary.Encoding (encodeInt8) import qualified Cardano.Ledger.Binary.Plain as Plain import Cardano.Ledger.Hashes ( EraIndependentBlockBody @@ -67,6 +72,7 @@ import qualified Data.ByteString as BS import qualified Data.ByteString.Lazy as BSL import Data.Word (Word32) import GHC.Generics (Generic) +import LeiosDemoTypes (EbHash) import NoThunks.Class (AllowThunksIn (..), NoThunks (..)) import Ouroboros.Consensus.Protocol.Praos.VRF (InputVRF) @@ -89,10 +95,14 @@ data HeaderBody crypto = HeaderBody -- ^ Size of the block body , hbBodyHash :: !(Hash.Hash HASH EraIndependentBlockBody) -- ^ Hash of block body + , hbBodyType :: !BodyType + -- ^ Type of the block body , hbOCert :: !(OCert crypto) -- ^ operational certificate , hbProtVer :: !ProtVer -- ^ protocol version + , hbMayEbAnnouncement :: Maybe EbHash + -- ^ Leios EB announcement } deriving Generic @@ -192,8 +202,10 @@ instance Crypto crypto => EncCBOR (HeaderBody crypto) where , hbVrfRes , hbBodySize , hbBodyHash + , hbBodyType , hbOCert , hbProtVer + , hbMayEbAnnouncement } = encode $ Rec HeaderBody @@ -205,8 +217,10 @@ instance Crypto crypto => EncCBOR (HeaderBody crypto) where !> To hbVrfRes !> To hbBodySize !> To hbBodyHash + !> To hbBodyType !> To hbOCert !> To hbProtVer + !> To hbMayEbAnnouncement instance Crypto crypto => DecCBOR (HeaderBody crypto) where decCBOR = @@ -220,8 +234,10 @@ instance Crypto crypto => DecCBOR (HeaderBody crypto) where @@ -252,3 +268,18 @@ instance Crypto c => DecCBOR (Annotator (Header c)) where decCBOR = do (Annotator getT, Annotator getBytes) <- withSlice decCBOR pure (Annotator (\fullbytes -> HeaderConstr (getT fullbytes) (BSL.toStrict (getBytes fullbytes)))) + +data BodyType = LedgerBlock | LeiosCertificate + deriving stock (Generic, Show, Eq, Ord) + deriving anyclass NoThunks + +instance EncCBOR BodyType where + encCBOR LedgerBlock = encodeInt8 0 + encCBOR LeiosCertificate = encodeInt8 1 + +instance DecCBOR BodyType where + decCBOR = + decodeInt8 >>= \case + 0 -> return LedgerBlock + 1 -> return LeiosCertificate + tag -> fail $ "Invalid BodyType with tag " <> show tag diff --git a/ouroboros-consensus-protocol/src/ouroboros-consensus-protocol/Ouroboros/Consensus/Protocol/Praos/Views.hs b/ouroboros-consensus-protocol/src/ouroboros-consensus-protocol/Ouroboros/Consensus/Protocol/Praos/Views.hs index 3c0e8c8594..afc27f7d82 100644 --- a/ouroboros-consensus-protocol/src/ouroboros-consensus-protocol/Ouroboros/Consensus/Protocol/Praos/Views.hs +++ b/ouroboros-consensus-protocol/src/ouroboros-consensus-protocol/Ouroboros/Consensus/Protocol/Praos/Views.hs @@ -15,6 +15,7 @@ import Cardano.Protocol.TPraos.BHeader (PrevHash) import Cardano.Protocol.TPraos.OCert (OCert) import Cardano.Slotting.Slot (SlotNo) import Data.Word (Word16, Word32) +import LeiosDemoTypes (EbHash) import Ouroboros.Consensus.Protocol.Praos.Header (HeaderBody) import Ouroboros.Consensus.Protocol.Praos.VRF (InputVRF) @@ -36,6 +37,7 @@ data HeaderView crypto = HeaderView -- ^ Header which must be signed , hvSignature :: !(SignedKES (KES crypto) (HeaderBody crypto)) -- ^ KES Signature of the header + , hvMayEbAnnouncement :: !(Maybe EbHash) } data LedgerView = LedgerView diff --git a/ouroboros-consensus-protocol/src/unstable-protocol-testlib/Test/Consensus/Protocol/Serialisation/Generators.hs b/ouroboros-consensus-protocol/src/unstable-protocol-testlib/Test/Consensus/Protocol/Serialisation/Generators.hs index a88e986783..70a2fc85c3 100644 --- a/ouroboros-consensus-protocol/src/unstable-protocol-testlib/Test/Consensus/Protocol/Serialisation/Generators.hs +++ b/ouroboros-consensus-protocol/src/unstable-protocol-testlib/Test/Consensus/Protocol/Serialisation/Generators.hs @@ -17,10 +17,12 @@ import Cardano.Slotting.Slot ( SlotNo (SlotNo) , WithOrigin (At, Origin) ) -import Ouroboros.Consensus.Protocol.Praos (PraosState (PraosState)) +import LeiosDemoTypes (EbHash (MkEbHash)) +import Ouroboros.Consensus.Protocol.Praos (LeiosState (LeiosState), PraosState (PraosState)) import qualified Ouroboros.Consensus.Protocol.Praos as Praos import Ouroboros.Consensus.Protocol.Praos.Header - ( Header (Header) + ( BodyType (LedgerBlock, LeiosCertificate) + , Header (Header) , HeaderBody (HeaderBody) ) import Ouroboros.Consensus.Protocol.Praos.VRF (InputVRF, mkInputVRF) @@ -57,8 +59,10 @@ instance Praos.PraosCrypto c => Arbitrary (HeaderBody c) where <*> certVrf <*> arbitrary <*> arbitrary + <*> arbitrary <*> ocert <*> arbitrary + <*> arbitrary instance Praos.PraosCrypto c => Arbitrary (Header c) where arbitrary = do @@ -81,3 +85,13 @@ instance Arbitrary PraosState where <*> arbitrary <*> arbitrary <*> arbitrary + <*> arbitrary + +instance Arbitrary EbHash where + arbitrary = MkEbHash <$> arbitrary -- FIXME(bladyjoker): hash size + +instance Arbitrary BodyType where + arbitrary = oneof [pure LeiosCertificate, pure LedgerBlock] + +instance Arbitrary LeiosState where + arbitrary = pure $ LeiosState Nothing False diff --git a/ouroboros-consensus-protocol/src/unstable-protocol-testlib/Test/Ouroboros/Consensus/Protocol/Praos/Header.hs b/ouroboros-consensus-protocol/src/unstable-protocol-testlib/Test/Ouroboros/Consensus/Protocol/Praos/Header.hs index 5a2a114a13..14c65611e8 100644 --- a/ouroboros-consensus-protocol/src/unstable-protocol-testlib/Test/Ouroboros/Consensus/Protocol/Praos/Header.hs +++ b/ouroboros-consensus-protocol/src/unstable-protocol-testlib/Test/Ouroboros/Consensus/Protocol/Praos/Header.hs @@ -98,7 +98,8 @@ import Data.Word (Word64) import GHC.Generics (Generic) import Ouroboros.Consensus.Protocol.Praos (PraosValidationErr (..)) import Ouroboros.Consensus.Protocol.Praos.Header - ( Header + ( BodyType (LedgerBlock) + , Header , HeaderBody (..) , pattern Header ) @@ -445,6 +446,8 @@ genHeaderBody context = do hbBodySize <- choose (1000, 90000) hbBodyHash <- genHash (hbOCert, kesPeriod) <- genCert hbSlotNo context + let hbMayEbAnnouncement = Nothing + hbBodyType = LedgerBlock let hbProtVer = protocolVersionZero headerBody = HeaderBody{..} pure $ (headerBody, kesPeriod) diff --git a/ouroboros-consensus/ouroboros-consensus.cabal b/ouroboros-consensus/ouroboros-consensus.cabal index 95bf6893a2..48a341311b 100644 --- a/ouroboros-consensus/ouroboros-consensus.cabal +++ b/ouroboros-consensus/ouroboros-consensus.cabal @@ -310,6 +310,7 @@ library bytestring >=0.10 && <0.13, cardano-binary, cardano-crypto-class, + cardano-ledger-binary, cardano-ledger-core ^>=1.17, cardano-lmdb >=0.4, cardano-lmdb-simple ^>=0.8, diff --git a/ouroboros-consensus/src/ouroboros-consensus/LeiosDemoTypes.hs b/ouroboros-consensus/src/ouroboros-consensus/LeiosDemoTypes.hs index 5d29f597d9..98e904ed09 100644 --- a/ouroboros-consensus/src/ouroboros-consensus/LeiosDemoTypes.hs +++ b/ouroboros-consensus/src/ouroboros-consensus/LeiosDemoTypes.hs @@ -15,8 +15,9 @@ module LeiosDemoTypes (module LeiosDemoTypes) where -import Cardano.Binary (enforceSize, serialize', toCBOR) +import Cardano.Binary (FromCBOR, ToCBOR, enforceSize, serialize', toCBOR) import qualified Cardano.Crypto.Hash as Hash +import Cardano.Ledger.Binary (DecCBOR, EncCBOR) import Cardano.Ledger.Core (EraTx, Tx) import Cardano.Prelude (NFData, NonEmpty, toList, toString, (&)) import Cardano.Slotting.Slot (SlotNo (SlotNo)) @@ -24,7 +25,7 @@ import Codec.CBOR.Decoding (Decoder) import qualified Codec.CBOR.Decoding as CBOR import Codec.CBOR.Encoding (Encoding) import qualified Codec.CBOR.Encoding as CBOR -import Codec.Serialise (decode, encode) +import Codec.Serialise (Serialise, decode, encode) import Control.Concurrent.Class.MonadMVar (MVar) import qualified Control.Concurrent.Class.MonadMVar as MVar import Control.Concurrent.Class.MonadSTM.Strict (StrictTVar) @@ -70,15 +71,22 @@ newtype PeerId a = MkPeerId a type HASH = Hash.Blake2b_256 newtype EbHash = MkEbHash {ebHashBytes :: ByteString} - deriving newtype (Eq, Ord, Show, NoThunks) + deriving newtype (Eq, Ord, NoThunks, Serialise, DecCBOR, EncCBOR, ToCBOR, FromCBOR) + deriving stock Generic + +instance Show EbHash where + show = prettyEbHash prettyEbHash :: EbHash -> String prettyEbHash (MkEbHash bytes) = BS8.unpack (BS16.encode bytes) newtype TxHash = MkTxHash ByteString - deriving stock (Eq, Ord, Show, Generic) + deriving stock (Eq, Ord, Generic) deriving anyclass (NFData, NoThunks) +instance Show TxHash where + show = prettyTxHash + prettyTxHash :: TxHash -> String prettyTxHash (MkTxHash bytes) = BS8.unpack (BS16.encode bytes) @@ -98,12 +106,12 @@ encodeLeiosPoint :: LeiosPoint -> Encoding encodeLeiosPoint (MkLeiosPoint ebSlot (MkEbHash ebHash)) = CBOR.encodeListLen 2 <> encode ebSlot - <> CBOR.encodeBytes ebHash + <> encode ebHash decodeLeiosPoint :: Decoder s LeiosPoint decodeLeiosPoint = do enforceSize (fromString "LeiosPoint") 2 - MkLeiosPoint <$> decode <*> (MkEbHash <$> decode) + MkLeiosPoint <$> decode <*> decode ----- diff --git a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Block/Forging.hs b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Block/Forging.hs index 72db869f1e..785f21e39c 100644 --- a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Block/Forging.hs +++ b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Block/Forging.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE RankNTypes #-} @@ -14,21 +15,24 @@ module Ouroboros.Consensus.Block.Forging , ForgeStateInfo , ForgeStateUpdateError , ForgeStateUpdateInfo (..) + , ForgeType (..) , ShouldForge (..) , castForgeStateUpdateInfo , checkShouldForge , forgeStateUpdateInfoFromUpdateInfo + , LeiosDecideForgeTypeArgs (..) -- * 'UpdateInfo' , UpdateInfo (..) ) where import Control.Tracer (Tracer, traceWith) +import Data.ByteString (ByteString) import Data.Kind (Type) import Data.Text (Text) import GHC.Stack import LeiosDemoDb (LeiosDbHandle) -import LeiosDemoTypes (ForgedLeiosEb) +import LeiosDemoTypes (ForgedLeiosEb, LeiosCertificate, TraceLeiosKernel, TxHash) import Ouroboros.Consensus.Block.Abstract import Ouroboros.Consensus.Config import Ouroboros.Consensus.Ledger.Abstract @@ -121,13 +125,13 @@ data BlockForging m blk = BlockForging -- -- When 'CannotForge' is returned, we don't call 'forgeBlock'. , forgeBlock :: - LeiosDbHandle m -> + ForgeType -> TopLevelConfig blk -> BlockNo -> -- Current block number SlotNo -> -- Current slot number TickedLedgerState blk EmptyMK -> -- Current ledger state - [Validated (GenTx blk)] -> -- Transactions to include in the Ranking Block - [Validated (GenTx blk)] -> -- Transaction to include in the EndorserBlock + [Validated (GenTx blk)] -> -- Transactions to include in the TxsRb + [Validated (GenTx blk)] -> -- Transaction to include in the Eb IsLeader (BlockProtocol blk) -> -- Proof we are leader m (blk, Maybe ForgedLeiosEb) -- ^ Forge a block @@ -145,6 +149,16 @@ data BlockForging m blk = BlockForging -- even when used as part of the hard fork combinator. -- -- PRECONDITION: 'checkCanForge' returned @Right ()@. + , leiosDecideForgeType :: Monad m => LeiosDecideForgeTypeArgs m blk -> m ForgeType + } + +data ForgeType = ForgeTxsRb | ForgeCertRb LeiosCertificate [(TxHash, ByteString)] + deriving stock (Show, Eq) + +data LeiosDecideForgeTypeArgs m blk = LeiosDecideForgeTypeArgs + { ldftaLeiosDb :: LeiosDbHandle m + , ldftaLeiosTracer :: Tracer m TraceLeiosKernel + , ldftaChainDepState :: ChainDepState (BlockProtocol blk) } data ShouldForge blk diff --git a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/HardFork/Combinator/Embed/Unary.hs b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/HardFork/Combinator/Embed/Unary.hs index 900b91d3d9..9bb6374134 100644 --- a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/HardFork/Combinator/Embed/Unary.hs +++ b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/HardFork/Combinator/Embed/Unary.hs @@ -454,14 +454,14 @@ instance Functor m => Isomorphic (BlockForging m) where ) (inject' (Proxy @(WrapIsLeader blk)) isLeader) (inject' (Proxy @(WrapForgeStateInfo blk)) forgeStateInfo) - , forgeBlock = \leiosDb cfg bno sno tickedLgrSt rbTxs ebTxs isLeader -> + , forgeBlock = \forgeType cfg bno sno tickedLgrSt rbTxs ebTxs isLeader -> ( \(hfRb :: HardForkBlock '[blk], mayEb) -> ( project' (Proxy @(I blk)) hfRb , mayEb ) ) <$> forgeBlock - leiosDb + forgeType (inject cfg) bno sno @@ -469,6 +469,7 @@ instance Functor m => Isomorphic (BlockForging m) where (inject' (Proxy @(WrapValidatedGenTx blk)) <$> rbTxs) (inject' (Proxy @(WrapValidatedGenTx blk)) <$> ebTxs) (inject' (Proxy @(WrapIsLeader blk)) isLeader) + , leiosDecideForgeType = \_args -> return ForgeTxsRb } where injTickedChainDepSt :: @@ -505,14 +506,14 @@ instance Functor m => Isomorphic (BlockForging m) where (projTickedChainDepSt tickedChainDepSt) (project' (Proxy @(WrapIsLeader blk)) isLeader) (project' (Proxy @(WrapForgeStateInfo blk)) forgeStateInfo) - , forgeBlock = \leiosDb cfg bno sno tickedLgrSt rbTxs ebTxs isLeader -> + , forgeBlock = \forgeType cfg bno sno tickedLgrSt rbTxs ebTxs isLeader -> ( \(hfRb :: blk, mayEb) -> ( inject' (Proxy @(I blk)) hfRb , mayEb ) ) <$> forgeBlock - leiosDb + forgeType (project cfg) bno sno @@ -520,6 +521,7 @@ instance Functor m => Isomorphic (BlockForging m) where (project' (Proxy @(WrapValidatedGenTx blk)) <$> rbTxs) (project' (Proxy @(WrapValidatedGenTx blk)) <$> ebTxs) (project' (Proxy @(WrapIsLeader blk)) isLeader) + , leiosDecideForgeType = \_args -> return ForgeTxsRb } where projTickedChainDepSt :: diff --git a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/HardFork/Combinator/Forging.hs b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/HardFork/Combinator/Forging.hs index 2fa530ffad..dd9c288f74 100644 --- a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/HardFork/Combinator/Forging.hs +++ b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/HardFork/Combinator/Forging.hs @@ -1,6 +1,7 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GADTs #-} +{-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TypeFamilies #-} @@ -27,7 +28,6 @@ import Data.SOP.OptNP (NonEmptyOptNP, OptNP, ViewOptNP (..)) import qualified Data.SOP.OptNP as OptNP import Data.SOP.Strict import Data.Text (Text) -import LeiosDemoDb (LeiosDbHandle) import LeiosDemoTypes (ForgedLeiosEb) import Ouroboros.Consensus.Block import Ouroboros.Consensus.Config @@ -92,8 +92,41 @@ hardForkBlockForging label blockForging = , updateForgeState = hardForkUpdateForgeState blockForging , checkCanForge = hardForkCheckCanForge blockForging , forgeBlock = hardForkForgeBlock blockForging + , leiosDecideForgeType = hardForkLeiosDecideForgeType blockForging } +hardForkLeiosDecideForgeType :: + forall m xs. + (CanHardFork xs, Monad m) => + NonEmptyOptNP (BlockForging m) xs -> LeiosDecideForgeTypeArgs m (HardForkBlock xs) -> m ForgeType +hardForkLeiosDecideForgeType + blockForging + LeiosDecideForgeTypeArgs + { ldftaLeiosTracer + , ldftaLeiosDb + , ldftaChainDepState = ldftaChainDepStateHfc + } = + hcollapse $ + hzipWith + decideForEra + (OptNP.toNP blockForging) + (State.tip ldftaChainDepStateHfc) + where + decideForEra :: + forall blk. + (Maybe :.: BlockForging m) blk -> + WrapChainDepState blk -> + K (m ForgeType) blk + decideForEra (Comp Nothing) _ = K (return ForgeTxsRb) + decideForEra (Comp (Just bf)) (WrapChainDepState cds) = + K $ + leiosDecideForgeType bf $ + LeiosDecideForgeTypeArgs + { ldftaLeiosTracer + , ldftaLeiosDb + , ldftaChainDepState = cds + } + hardForkCanBeLeader :: CanHardFork xs => NonEmptyOptNP (BlockForging m) xs -> HardForkCanBeLeader xs @@ -300,7 +333,7 @@ hardForkForgeBlock :: forall m xs empty. (CanHardFork xs, Monad m) => OptNP empty (BlockForging m) xs -> - LeiosDbHandle m -> + ForgeType -> TopLevelConfig (HardForkBlock xs) -> BlockNo -> SlotNo -> diff --git a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/Forker.hs b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/Forker.hs index 47ef7c9032..873d4c18ad 100644 --- a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/Forker.hs +++ b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/Forker.hs @@ -77,6 +77,7 @@ import LeiosDemoDb (LeiosDbHandle) import NoThunks.Class import Ouroboros.Consensus.Block import Ouroboros.Consensus.Config +import Ouroboros.Consensus.HeaderValidation (HeaderState) import Ouroboros.Consensus.Ledger.Abstract import Ouroboros.Consensus.Ledger.Extended import Ouroboros.Consensus.Ledger.SupportsProtocol @@ -431,9 +432,13 @@ toRealPoint (ReapplyRef rp) = rp toRealPoint (ApplyRef rp) = rp toRealPoint (Weaken ap) = toRealPoint ap +-- FIXME(bladyjoker): This is a hack that works! We're blindly guessing that `blk` might contain +-- something that can be resolved like a LeiosCertificate and it returns a `blk` that hopefully has +-- a fully resolved `blk` that can be applied. +-- Imo a morally correct approach would to have `data RankingBlock blk = LedgerRb blk | CertRb LeiosCertificate` which we can use to make such distincion and manage the resolution process here and elsewhere in the abstract code base. class ResolveLeiosBlock blk where resolveLeiosBlock :: - (IsLedger (ExtLedgerState blk), Monad m) => LeiosDbHandle m -> ExtLedgerState blk mk -> blk -> m blk + Monad m => LeiosDbHandle m -> HeaderState blk -> blk -> m blk resolveLeiosBlock _ _ blk = return blk -- | Apply blocks to the given forker @@ -455,17 +460,17 @@ applyBlock :: applyBlock leiosDb evs cfg ap fo = case ap of ReapplyVal b -> do l <- liftBase $ atomically $ forkerGetLedgerState fo - b' <- liftBase $ resolveLeiosBlock leiosDb l b + b' <- liftBase $ resolveLeiosBlock leiosDb (headerState l) b vs <- withLedgerTables l <$> liftBase (forkerReadTables fo (getBlockKeySets b')) - ValidLedgerState <$> (return . tickThenReapply evs cfg b') vs + ValidLedgerState <$> (return . tickThenReapply evs cfg b') vs -- FIXME(bladyjoker): This is incorrect, if b' was a Certificate the it is based on the previous Ledger state ApplyVal b -> do l <- liftBase $ atomically $ forkerGetLedgerState fo - b' <- liftBase $ resolveLeiosBlock leiosDb l b + b' <- liftBase $ resolveLeiosBlock leiosDb (headerState l) b vs <- withLedgerTables l <$> liftBase (forkerReadTables fo (getBlockKeySets b')) ValidLedgerState <$> ( either (throwLedgerError fo (blockRealPoint b')) return . runExcept - . tickThenApply evs cfg b' + . tickThenApply evs cfg b' -- FIXME(bladyjoker): This is incorrect, if b' was a Certificate the it is based on the previous Ledger state ) vs ReapplyRef r -> do diff --git a/ouroboros-consensus/src/unstable-mock-block/Ouroboros/Consensus/Mock/Node.hs b/ouroboros-consensus/src/unstable-mock-block/Ouroboros/Consensus/Mock/Node.hs index 9609fe1796..d51a99764c 100644 --- a/ouroboros-consensus/src/unstable-mock-block/Ouroboros/Consensus/Mock/Node.hs +++ b/ouroboros-consensus/src/unstable-mock-block/Ouroboros/Consensus/Mock/Node.hs @@ -101,7 +101,7 @@ simpleBlockForging aCanBeLeader aForgeExt = , canBeLeader = aCanBeLeader , updateForgeState = \_ _ _ -> return $ ForgeStateUpdated () , checkCanForge = \_ _ _ _ _ -> return () - , forgeBlock = \_leiosDb cfg bno slot lst txs _ebtxs proof -> + , forgeBlock = \_ cfg bno slot lst txs _ebtxs proof -> return . (,Nothing) $ forgeSimple aForgeExt @@ -111,6 +111,7 @@ simpleBlockForging aCanBeLeader aForgeExt = lst (map txForgetValidated txs) proof + , leiosDecideForgeType = \_ -> return ForgeTxsRb } where _ = keepRedundantConstraint (Proxy @(ForgeStateUpdateError (SimpleBlock c ext) ~ Void)) diff --git a/ouroboros-consensus/src/unstable-mock-block/Ouroboros/Consensus/Mock/Node/PBFT.hs b/ouroboros-consensus/src/unstable-mock-block/Ouroboros/Consensus/Mock/Node/PBFT.hs index 83cefc44c0..997ea47636 100644 --- a/ouroboros-consensus/src/unstable-mock-block/Ouroboros/Consensus/Mock/Node/PBFT.hs +++ b/ouroboros-consensus/src/unstable-mock-block/Ouroboros/Consensus/Mock/Node/PBFT.hs @@ -109,7 +109,7 @@ pbftBlockForging canBeLeader = canBeLeader slot tickedPBftState - , forgeBlock = \_leiosDb cfg slot bno lst txs _ebtxs proof -> + , forgeBlock = \_ cfg slot bno lst txs _ebtxs proof -> return . (,Nothing) $ forgeSimple forgePBftExt @@ -119,4 +119,5 @@ pbftBlockForging canBeLeader = lst (map txForgetValidated txs) proof + , leiosDecideForgeType = \_ -> return ForgeTxsRb } diff --git a/ouroboros-consensus/src/unstable-mock-block/Ouroboros/Consensus/Mock/Node/Praos.hs b/ouroboros-consensus/src/unstable-mock-block/Ouroboros/Consensus/Mock/Node/Praos.hs index 54f56c661d..623f8e37aa 100644 --- a/ouroboros-consensus/src/unstable-mock-block/Ouroboros/Consensus/Mock/Node/Praos.hs +++ b/ouroboros-consensus/src/unstable-mock-block/Ouroboros/Consensus/Mock/Node/Praos.hs @@ -135,7 +135,7 @@ praosBlockForging cid initHotKey = do . second forgeStateUpdateInfoFromUpdateInfo . evolveKey sno , checkCanForge = \_ _ _ _ _ -> return () - , forgeBlock = \_leiosDb cfg bno sno tickedLedgerSt txs _ebtxs isLeader -> do + , forgeBlock = \_ cfg bno sno tickedLedgerSt txs _ebtxs isLeader -> do hotKey <- readMVar varHotKey return . (,Nothing) $ forgeSimple @@ -146,4 +146,5 @@ praosBlockForging cid initHotKey = do tickedLedgerSt (map txForgetValidated txs) isLeader + , leiosDecideForgeType = \_ -> return ForgeTxsRb }