Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
2f9b26d
Scaffolding for Peras certs and PerasCertDB
amesgen Jul 3, 2025
d41124b
[WIP] set structure for model-based testing for PerasCertDB
tbagrel1 Jul 7, 2025
ba2b453
Fix missing instances
tbagrel1 Jul 8, 2025
616776a
Pairing
amesgen Jul 8, 2025
0b8746e
Minor polishing
amesgen Jul 9, 2025
d7afcad
PerasCertDB: implement garbage collection
amesgen Jul 9, 2025
f32763a
Re-add how-to guide for micro-benchmarks
geo2a Jul 7, 2025
54e41bc
ouroboros-consensus: add Peras chain weight benchmark
geo2a Jul 7, 2025
5cd4c37
ChainDB: expose PerasCertDB functionality
amesgen Jul 17, 2025
1d24821
ChainDB: invoke PerasCertDB GC
amesgen Jul 17, 2025
391f420
Move `PerasWeightSnapshot` to separate module
amesgen Jul 17, 2025
2797c54
PerasCertDB.getWeightSnapshot: add `Fingerprint`
amesgen Jul 21, 2025
43d0232
PerasCertDB.addCert: return whether we added the cert
amesgen Jul 21, 2025
644cb18
Peras: minor tweaks
amesgen Jul 23, 2025
52d7741
Make `PerasWeightSnapshot` opaque
amesgen Jul 24, 2025
8886d71
Nomenclature: "weight boost" instead of "boosted weight"
amesgen Jul 28, 2025
91a5cc9
Glossary: add Peras weight-related terms
amesgen Jul 28, 2025
337558e
PerasWeightSnapshot: minimize API
amesgen Jul 28, 2025
a5456d9
PerasRoundNo/PerasWeight: terse output
amesgen Jul 28, 2025
facb6b7
O.C.Peras.Weight: add haddocks
amesgen Jul 28, 2025
bdb6189
`SecurityParam`: mention weighted nature
amesgen Jul 28, 2025
d8cbdeb
`PerasRoundNo`/`PerasWeight`: add `Condense` instances
amesgen Jul 29, 2025
2323685
O.C.Peras.Weight: add `totalWeightForFragment`/`takeVolatileSuffix`
amesgen Jul 28, 2025
cb0877b
Add test for `PerasWeightSnapshot`
amesgen Jul 29, 2025
fe3c154
ChainDB.StateMachine: check immutable tip monotonicity
amesgen Jul 30, 2025
e6aa0ae
ChainDB: define `getCurrentChain` in terms of weight
amesgen Jul 28, 2025
d9a542f
GSM: allow `candidateOverSelection` to be stateful
amesgen Jul 17, 2025
c5759cd
Add `WeightedSelectView`
amesgen Jul 28, 2025
37f9ae9
ChainSel: make `rollbackExceedsSuffix` weight-aware
amesgen Jul 23, 2025
0912d45
Introduce weighted chain comparisons
amesgen Jul 17, 2025
7cd188c
Integrate weighted BlockFetch decision logic
amesgen Jul 21, 2025
4037e12
ChainDB: implement chain selection for certificates
amesgen Jul 21, 2025
8192a51
MockChainSel: switch to weighted chain selection
amesgen Jul 24, 2025
5b61869
ChainDB q-s-m: test weighted chain selection
amesgen Jul 24, 2025
6739048
Fix cabal-docspec
amesgen Aug 13, 2025
82d9ba2
Modify PerasCertDB (and to some extent, ChainDB) to allow snapshot of…
amesgen Aug 6, 2025
acdf1e9
Replace hardcoded miniprotocol parameters by default ones in unstable…
tbagrel1 Aug 6, 2025
c6a470c
Introduce the (generic) ObjectDiffusion protocol, ObjectPool, and the…
tbagrel1 Aug 6, 2025
12b73ad
Introduce the PerasCertDiffusion protocol (instance of ObjectDiffusio…
tbagrel1 Aug 6, 2025
bf9d848
Wire-in the PerasCertDiffusion protocol in NodeToNode
tbagrel1 Aug 6, 2025
64548be
Change signature of `opwHasObject` to use `STM m` instead of `m`
tbagrel1 Sep 2, 2025
6c4d5c4
Add module docstring to ObjectPool API
tbagrel1 Sep 2, 2025
2501277
Add codec for PerasCert and PerasCertDiffusion
tbagrel1 Sep 2, 2025
1f1bdeb
Integrate `NodeToNodeV_16`
amesgen Sep 4, 2025
43bdef4
Peras: add a few `ShowProxy` instances
amesgen Sep 3, 2025
d0799c8
Adapt to removal of `initAgency`
amesgen Sep 4, 2025
5d82e49
Adapt to changed agency of `MsgDone`
amesgen Sep 4, 2025
935525d
`O.C.Network.NodeToNode`: plumbing for Peras cert diffusion
amesgen Sep 3, 2025
a930796
Adapt tests
amesgen Sep 4, 2025
233f1b2
Add basic API for certificate validation
amesgen Sep 2, 2025
36d8f01
Adapt the HFC time translation layer for Peras
geo2a Jul 22, 2025
591445e
Peras.SelectView: use fragment length instead of tip `BlockNo`
amesgen Sep 9, 2025
e99d251
Avoid exposing Peras boostPerCert in tests
agustinmista Sep 10, 2025
283fcfd
Refactor ChainDB q-s-m test to carry gap blocks between commands
agustinmista Sep 10, 2025
495247e
Tweak generation frequencies in ChainDB q-s-m tests
agustinmista Sep 12, 2025
17b9132
Generate security parameter for ChainDB q-s-m test on the fly
agustinmista Sep 15, 2025
5fad777
Propagate feature flags down to NodeKernelArgs
agustinmista Oct 9, 2025
69d709d
Bump ouroboros-network to match peras-staging/pr-5202
agustinmista Oct 13, 2025
3170661
Break Idling into its own module
agustinmista Oct 6, 2025
df386c5
Introduce O.C.MiniProtocol.ObjectDiffusion.Inbound.State
agustinmista Oct 6, 2025
46451bb
Introduce PerasCertDiffusion type synonyms
agustinmista Oct 13, 2025
587c566
Generalize chainSyncState to peerState in the GSM
agustinmista Oct 9, 2025
78f7e5c
Store NodeToNodeVersion in GSM peer state components
agustinmista Oct 9, 2025
7ca058f
Introduce O.C.Node.GSM.PeerState
agustinmista Oct 13, 2025
4e3115c
Enhance GSM view with PerasCertDiffusion information
agustinmista Oct 13, 2025
a14fed3
Define WithArrivalTime combinator
agustinmista Oct 15, 2025
e0288d4
Tweak and extend Peras cert field projection typeclasses
agustinmista Oct 15, 2025
a909419
Wrap validated Peras certificates with arrival time
agustinmista Oct 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ index-state:
-- Bump this if you need newer packages from Hackage
, hackage.haskell.org 2025-07-22T09:13:54Z
-- Bump this if you need newer packages from CHaP
, cardano-haskell-packages 2025-08-21T09:41:03Z
, cardano-haskell-packages 2025-10-07T11:20:00Z

packages:
ouroboros-consensus
Expand Down Expand Up @@ -56,6 +56,17 @@ allow-newer:
, fin:QuickCheck
, bin:QuickCheck

source-repository-package
type: git
location: https://github.com/IntersectMBO/ouroboros-network
tag: peras-staging/pr-5202
--sha256: sha256-nTbjunQaqt6/syzSKw24Lne50083dI2SZFirG2/1T9U=
subdir:
ouroboros-network
ouroboros-network-protocols
ouroboros-network-api
ouroboros-network

source-repository-package
type: git
location: https://github.com/IntersectMBO/cardano-ledger
Expand Down
32 changes: 32 additions & 0 deletions docs/website/contents/howtos/benchmarks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Consensus benchmarks

We are in the process of adding component level microbenchmarks for Consensus.

We check for regressions in performance on CI.

## Mempool Benchmark

We started with microbenchmarks for adding transactions to the mempool. The
mempool benchmarks can be run using the following command.

```sh
cabal new-run ouroboros-consensus:mempool-bench
```

## ChainSync Client Benchmark

To aid the refactoring of the ChainSync client, we added a benchmark for it in [PR#823](https://github.com/IntersectMBO/ouroboros-consensus/pull/823). The benchmark could be invoked as follows:

```sh
cabal new-run ouroboros-consensus:ChainSync-client-bench -- 10 10
```

## PerasCertDB Benchmark

We have a microbenchmark for the boosted chain fragment weight calculation, which could be run as follows:

```sh
cabal run ouroboros-consensus:PerasCertDB-bench -- +RTS -T -A32m -RTS
```

We request GHC runtime system statistics with `-T` to get a memory usage estimate, and also request a large nursery with `-A32m` to minimise garbage collection. See `tasty-bench` [documentation](https://github.com/Bodigrim/tasty-bench?tab=readme-ov-file#troubleshooting) for more tips.
13 changes: 13 additions & 0 deletions docs/website/contents/references/glossary.md
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,19 @@ These kinds are maintained by the Networking layer:
- [Public root peers](#public-root-peers).
- [Shared peers](#shared-peers).

## ;Peras ;weight ;boost

Peras is an extension of Praos enabling faster settlement under optimistic conditions.
To this end, Peras can result in a block `B` receiving a *boost*, which means that any chain containing `B` gets additional weight when being compared to other chains.

Consider a chain fragment `F`:

- Its ;*weight boost* is the sum of all boosts received by points on this fragment (excluding the anchor). Note that the same point can be boosted multiple times.

- Its ;*total weight* is its tip block number plus its weight boost.

Note that these notions are always relative to a particular anchor, so different chain fragments must have the same anchor when their total weight is to be compared.

## ;Phases

Byron, Shelley, Goguen (current one as of August 2023), Basho, Voltaire.
Expand Down
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ byronEraParams genesis =
, eraSlotLength = fromByronSlotLength $ genesisSlotLength genesis
, eraSafeZone = HardFork.StandardSafeZone (2 * k)
, eraGenesisWin = GenesisWindow (2 * k)
, eraPerasRoundLength = HardFork.NoPerasEnabled
}
where
k = unNonZero $ maxRollbacks $ genesisSecurityParam genesis
Expand All @@ -345,6 +346,7 @@ byronEraParamsNeverHardForks genesis =
, eraSlotLength = fromByronSlotLength $ genesisSlotLength genesis
, eraSafeZone = HardFork.UnsafeIndefiniteSafeZone
, eraGenesisWin = GenesisWindow (2 * Gen.unBlockCount (Gen.configK genesis))
, eraPerasRoundLength = HardFork.NoPerasEnabled
}

instance HasHardForkHistory ByronBlock where
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ instance
Map.fromList $
[ (NodeToNodeV_14, CardanoNodeToNodeVersion2)
, (NodeToNodeV_15, CardanoNodeToNodeVersion2)
, (NodeToNodeV_16, CardanoNodeToNodeVersion2)
]

supportedNodeToClientVersions _ =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,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
Expand Down Expand Up @@ -168,6 +169,8 @@ shelleyEraParams genesis =
, eraSlotLength = mkSlotLength $ SL.fromNominalDiffTimeMicro $ SL.sgSlotLength genesis
, eraSafeZone = HardFork.StandardSafeZone stabilityWindow
, eraGenesisWin = GenesisWindow stabilityWindow
, -- TODO(geo2a): enabled Peras conditionally in the Dijkstra era
eraPerasRoundLength = HardFork.NoPerasEnabled
}
where
stabilityWindow =
Expand All @@ -183,6 +186,7 @@ shelleyEraParamsNeverHardForks genesis =
, eraSlotLength = mkSlotLength $ SL.fromNominalDiffTimeMicro $ SL.sgSlotLength genesis
, eraSafeZone = HardFork.UnsafeIndefiniteSafeZone
, eraGenesisWin = GenesisWindow stabilityWindow
, eraPerasRoundLength = HardFork.NoPerasEnabled
}
where
stabilityWindow =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ instance SupportedNetworkProtocolVersion (ShelleyBlock proto era) where
Map.fromList
[ (NodeToNodeV_14, ShelleyNodeToNodeVersion1)
, (NodeToNodeV_15, ShelleyNodeToNodeVersion1)
, (NodeToNodeV_16, ShelleyNodeToNodeVersion1)
]
supportedNodeToClientVersions _ =
Map.fromList
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -993,11 +993,11 @@ instance Arbitrary History.EraEnd where
]

instance Arbitrary History.EraSummary where
arbitrary =
History.EraSummary
<$> arbitrary
<*> arbitrary
<*> arbitrary
-- Note: this generator may produce EraSummary with nonsensical bounds,
-- i.e. with existing PerasRoundNo at era start and Nothing for it at the end.
-- However, we only use this generator to check that the serialisation roundtrips,
-- and the internal structure of EraSummary is irrelevant for that.
arbitrary = History.EraSummary <$> arbitrary <*> arbitrary <*> arbitrary

instance (Arbitrary a, SListI xs) => Arbitrary (NonEmpty xs a) where
arbitrary = do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ library
Ouroboros.Consensus.Node.Exit
Ouroboros.Consensus.Node.ExitPolicy
Ouroboros.Consensus.Node.GSM
Ouroboros.Consensus.Node.GSM.PeerState
Ouroboros.Consensus.Node.Genesis
Ouroboros.Consensus.Node.Recovery
Ouroboros.Consensus.Node.RethrowPolicy
Expand All @@ -77,6 +78,7 @@ library
build-depends:
base >=4.14 && <4.22,
bytestring >=0.10 && <0.13,
cardano-base,
cardano-slotting,
cborg ^>=0.2.2,
containers >=0.5 && <0.8,
Expand All @@ -96,8 +98,10 @@ library
random,
resource-registry ^>=0.1,
safe-wild-cards ^>=1.0,
semialign,
serialise ^>=0.2,
text,
these,
time,
transformers,
typed-protocols:{stateful, typed-protocols},
Expand Down
Loading