Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not even propagate future headers #525

Merged
merged 4 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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).
-->

<!--
### Patch
- A bullet item for the Patch category.
-->
<!--
### Non-Breaking
- A bullet item for the Non-Breaking category.
-->

### Breaking

- Integrate the new `InFutureCheck` in the ChainSync client, which requires new
fields in `NodeKernalArgs`.
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ mkHandlers
-- ^ Peer Sharing result computation callback
-> Handlers m addrNTN blk
mkHandlers
NodeKernelArgs {keepAliveRng, miniProtocolParameters}
NodeKernelArgs {chainSyncFutureCheck, keepAliveRng, miniProtocolParameters}
NodeKernel {getChainDB, getMempool, getTopLevelConfig, getTracers = tracers}
computePeers =
Handlers {
Expand All @@ -224,6 +224,7 @@ mkHandlers
(chainSyncPipeliningHighMark miniProtocolParameters))
(contramap (TraceLabelPeer peer) (Node.chainSyncClientTracer tracers))
getTopLevelConfig
chainSyncFutureCheck
(defaultChainDbView getChainDB)
, hChainSyncServer = \peer _version ->
chainSyncHeadersServer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ import Ouroboros.Consensus.Fragment.InFuture (CheckInFuture,
ClockSkew)
import qualified Ouroboros.Consensus.Fragment.InFuture as InFuture
import Ouroboros.Consensus.Ledger.Extended (ExtLedgerState (..))
import qualified Ouroboros.Consensus.MiniProtocol.ChainSync.Client.InFutureCheck as InFutureCheck
import qualified Ouroboros.Consensus.Network.NodeToClient as NTC
import qualified Ouroboros.Consensus.Network.NodeToNode as NTN
import Ouroboros.Consensus.Node.DbLock
Expand Down Expand Up @@ -392,6 +393,7 @@ runWith RunNodeArgs{..} encAddrNtN decAddrNtN LowLevelRunNodeArgs{..} =
cfg
rnTraceConsensus
btime
(InFutureCheck.realHeaderInFutureCheck llrnMaxClockSkew systemTime)
chainDB
nodeKernel <- initNodeKernel nodeKernelArgs
rnNodeKernelHook registry nodeKernel
Expand Down Expand Up @@ -639,6 +641,7 @@ mkNodeKernelArgs
-> TopLevelConfig blk
-> Tracers m (ConnectionId addrNTN) (ConnectionId addrNTC) blk
-> BlockchainTime m
-> InFutureCheck.HeaderInFutureCheck m blk
-> ChainDB m blk
-> m (NodeKernelArgs m addrNTN (ConnectionId addrNTC) blk)
mkNodeKernelArgs
Expand All @@ -648,6 +651,7 @@ mkNodeKernelArgs
cfg
tracers
btime
chainSyncFutureCheck
chainDB
= do
return NodeKernelArgs
Expand All @@ -657,6 +661,7 @@ mkNodeKernelArgs
, btime
, chainDB
, initChainDB = nodeInitChainDB
, chainSyncFutureCheck
, blockFetchSize = estimateBlockSize
, mempoolCapacityOverride = NoMempoolCapacityBytesOverride
, miniProtocolParameters = defaultMiniProtocolParameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ import Ouroboros.Consensus.Ledger.SupportsPeerSelection
import Ouroboros.Consensus.Ledger.SupportsProtocol
import Ouroboros.Consensus.Mempool
import qualified Ouroboros.Consensus.MiniProtocol.BlockFetch.ClientInterface as BlockFetchClientInterface
import Ouroboros.Consensus.MiniProtocol.ChainSync.Client.InFutureCheck
(HeaderInFutureCheck)
import Ouroboros.Consensus.Node.Run
import Ouroboros.Consensus.Node.Tracers
import Ouroboros.Consensus.Protocol.Abstract
Expand Down Expand Up @@ -132,6 +134,7 @@ data NodeKernelArgs m addrNTN addrNTC blk = NodeKernelArgs {
, btime :: BlockchainTime m
, chainDB :: ChainDB m blk
, initChainDB :: StorageConfig blk -> InitChainDB m blk -> m ()
, chainSyncFutureCheck :: HeaderInFutureCheck m blk
, blockFetchSize :: Header blk -> SizeInBytes
, mempoolCapacityOverride :: MempoolCapacityBytesOverride
, miniProtocolParameters :: MiniProtocolParameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ import Ouroboros.Consensus.Ledger.SupportsMempool
import Ouroboros.Consensus.Ledger.SupportsProtocol
import Ouroboros.Consensus.Mempool
import qualified Ouroboros.Consensus.MiniProtocol.ChainSync.Client as CSClient
import qualified Ouroboros.Consensus.MiniProtocol.ChainSync.Client.InFutureCheck as InFutureCheck
import qualified Ouroboros.Consensus.Network.NodeToNode as NTN
import Ouroboros.Consensus.Node.ExitPolicy
import Ouroboros.Consensus.Node.InitStorage
Expand Down Expand Up @@ -974,6 +975,10 @@ runThreadNetwork systemTime ThreadNetworkArgs
, btime
, chainDB
, initChainDB = nodeInitChainDB
, chainSyncFutureCheck =
InFutureCheck.realHeaderInFutureCheck
InFuture.defaultClockSkew
(OracularClock.finiteSystemTime clock)
, blockFetchSize = estimateBlockSize
, mempoolCapacityOverride = NoMempoolCapacityBytesOverride
, keepAliveRng = kaRng
Expand Down
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).
-->

<!--
### Patch
- A bullet item for the Patch category.
-->
<!--
### Non-Breaking
- A bullet item for the Non-Breaking category.
-->
### Breaking

- Added a new `InFutureCheck` to the ChainSync client, which requires
additional arguments to the 'chainSyncClient' definition. The node no longer
propagates headers/blocks from the future: a ChainSync client thread now
sleeps until the received header is no longer from the future.
3 changes: 3 additions & 0 deletions ouroboros-consensus/ouroboros-consensus.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ library
Ouroboros.Consensus.MiniProtocol.BlockFetch.ClientInterface
Ouroboros.Consensus.MiniProtocol.BlockFetch.Server
Ouroboros.Consensus.MiniProtocol.ChainSync.Client
Ouroboros.Consensus.MiniProtocol.ChainSync.Client.InFutureCheck
Ouroboros.Consensus.MiniProtocol.ChainSync.Server
Ouroboros.Consensus.MiniProtocol.LocalStateQuery.Server
Ouroboros.Consensus.MiniProtocol.LocalTxMonitor.Server
Expand Down Expand Up @@ -483,6 +484,7 @@ test-suite consensus-test
build-depends:
, async
, base
, base-deriving-via
, cardano-binary
, cardano-crypto-class
, cardano-slotting
Expand All @@ -504,6 +506,7 @@ test-suite consensus-test
, ouroboros-network-protocols:{ouroboros-network-protocols, testlib}
, QuickCheck
, quickcheck-state-machine
, quiet
, random
, serialise
, si-timers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ module Ouroboros.Consensus.Fragment.InFuture (
-- * Clock skew
, clockSkewInSeconds
, defaultClockSkew
-- ** opaque
-- ** not exporting the constructor
, ClockSkew
, unClockSkew
-- * Testing
, dontCheck
, miracle
Expand Down
Loading