Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
b27c72e
Basic Peras types: `PerasCert`, `PerasWeightSnapshot`
tbagrel1 Sep 11, 2025
c723d72
Add tests for `PerasWeightSnapshot`
tbagrel1 Sep 11, 2025
5a96655
Add microbenchmarks for `PerasWeightSnapshot`
tbagrel1 Sep 11, 2025
01e1c69
Add changelog entry
tbagrel1 Sep 16, 2025
13c6bcc
Introduce `PerasCertDB` and related types
tbagrel1 Sep 11, 2025
042378e
Add q-s-m tests for `PerasCertDB`
tbagrel1 Sep 11, 2025
6649e71
Add changelog entry
tbagrel1 Sep 17, 2025
03f4f2f
ChainDB: expose PerasCertDB functionality
amesgen Jul 17, 2025
dc340fc
ChainDB: invoke PerasCertDB GC
amesgen Jul 17, 2025
3c74a90
`SecurityParam`: mention weighted nature
amesgen Jul 28, 2025
24aba2b
O.C.Peras.Weight: add `takeVolatileSuffix`
amesgen Jul 28, 2025
40c1756
ChainDB.StateMachine: check immutable tip monotonicity
amesgen Jul 30, 2025
392eb5d
ChainDB: define `getCurrentChain` in terms of weight
amesgen Jul 28, 2025
717f130
GSM: allow `candidateOverSelection` to be stateful
amesgen Jul 17, 2025
1f75990
ChainSel: make `rollbackExceedsSuffix` weight-aware
amesgen Jul 23, 2025
5f40179
Introduce weighted chain comparisons
amesgen Jul 17, 2025
206fbef
Integrate weighted BlockFetch decision logic
amesgen Jul 21, 2025
23288cc
ChainDB: implement chain selection for certificates
amesgen Jul 21, 2025
daf4de3
MockChainSel: switch to weighted chain selection
amesgen Jul 24, 2025
4c84737
ChainDB q-s-m: test weighted chain selection
amesgen Jul 24, 2025
bc16328
Modify PerasCertDB (and to some extent, ChainDB) to allow snapshot of…
amesgen Aug 6, 2025
7a8205b
Add basic API for certificate validation
amesgen Sep 2, 2025
15669b7
Peras.SelectView: use fragment length instead of tip `BlockNo`
amesgen Sep 9, 2025
d4d5ca0
Finish plugging PerasCertDB and PerasWeightSnapshot with CertDB
tbagrel1 Sep 11, 2025
0c0438a
Fix TODOs or add link to issue
nbacquey Sep 16, 2025
f1158c0
Add changelog entry
nbacquey Sep 17, 2025
2d9eb41
Change s-r-p for `ouroboros-network` to add ObjectDiffusion support
tbagrel1 Sep 12, 2025
2676153
Implement general ObjectDiffusion protocol, and related `ObjectPool{R…
tbagrel1 Sep 12, 2025
25f658d
Add smoke tests for generic ObjectDiffusion
tbagrel1 Sep 12, 2025
7be6c52
Add definitions and codec for `PerasCert` diffusion through ObjectDif…
tbagrel1 Sep 12, 2025
bd0378f
Add smoke tests for PerasCertDiffusion
tbagrel1 Sep 12, 2025
93a5016
Register and wire-in PerasCertDiffusion in the network layer
tbagrel1 Sep 12, 2025
d47c331
Add changelog entry
tbagrel1 Sep 18, 2025
ab2c6b5
Adapt the HFC time translation layer for Peras
geo2a Jul 22, 2025
66e4657
Add changelog entry
tbagrel1 Sep 18, 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
17 changes: 17 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,20 @@ if impl (ghc >= 9.12)
allow-newer:
-- https://github.com/kapralVV/Unique/issues/11
, Unique:hashable

allow-newer:
-- https://github.com/phadej/vec/issues/121
, ral:QuickCheck
, fin:QuickCheck
, bin:QuickCheck

source-repository-package
type: git
location: https://github.com/IntersectMBO/ouroboros-network
tag: 8dfff7b8916f7a56b2a3773438d5e5530c780710
--sha256: sha256-wMDq19G1SW4+puuQUUjgaULSou4+r7wJj6evnWoW/Xk=
subdir:
ouroboros-network
ouroboros-network-protocols
ouroboros-network-api
ouroboros-network
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!--
A new scriv changelog fragment.

Uncomment the section that is right (remove the HTML comment wrapper).
For top level release notes, leave all the headers commented out.
-->

<!--
### Patch

- A bullet item for the Patch category.

-->
<!--
### Non-Breaking

- A bullet item for the Non-Breaking category.

-->

### Breaking

- Added support for `NodeToNodeV_16`
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!--
A new scriv changelog fragment.

Uncomment the section that is right (remove the HTML comment wrapper).
For top level release notes, leave all the headers commented out.
-->

<!--
### Patch

- A bullet item for the Patch category.

-->
<!--
### Non-Breaking

- A bullet item for the Non-Breaking category.

-->

### Breaking

- Add `eraPerasRoundLength` parameters to `{Byron,Shelley}EraParams` structs.


### Non-Breaking

- The `EraSummary`, while not modified directly, is now Peras-aware via `EraParams`
- in a valid summary, Peras round length must divide the epoch size.
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 @@ -430,6 +430,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,9 @@ 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
-- see https://github.com/tweag/cardano-peras/issues/112
eraPerasRoundLength = HardFork.NoPerasEnabled
}
where
stabilityWindow =
Expand All @@ -183,6 +187,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
@@ -0,0 +1,23 @@
<!--
A new scriv changelog fragment.

Uncomment the section that is right (remove the HTML comment wrapper).
For top level release notes, leave all the headers commented out.
-->

<!--
### Patch

- A bullet item for the Patch category.

-->
<!--
### Non-Breaking

- A bullet item for the Non-Breaking category.

-->

### Breaking

- In module `Ouroboros.Consensus.Node.GSM`, `GSMView` now has a monadic `getCandidateOverSelection :: STM m ( selection -> chainSyncState -> CandidateVersusSelection)` instead of the previous pure `candidateOverSelection`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!--
A new scriv changelog fragment.

Uncomment the section that is right (remove the HTML comment wrapper).
For top level release notes, leave all the headers commented out.
-->

<!--
### Patch

- A bullet item for the Patch category.

-->
<!--
### Non-Breaking

- A bullet item for the Non-Breaking category.

-->

### Breaking

- Modify `Ouroboros.Consensus{.Node,.Node.Tracer,.Network.NodeToNode}` to wire-in PerasCertDiffusion similarly to other mini-protocols (e.g. TX-submission)

### Non-Breaking

- Update `Test.ThreadNet.Network` in `unstable-diffusion-testlib` accordingly to the changes made in `Ouroboros.Consensus.Network.NodeToNode`
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!--
A new scriv changelog fragment.

Uncomment the section that is right (remove the HTML comment wrapper).
For top level release notes, leave all the headers commented out.
-->

<!--
### Patch

- A bullet item for the Patch category.

-->

### Non-Breaking

- Update code using `EraParams` now that it has a new field `eraPerasRoundLength` for Byron and Shelley eras.

<!--
### Breaking

- A bullet item for the Breaking category.

-->
Loading