-
Notifications
You must be signed in to change notification settings - Fork 23
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
Integrate ouroboros-network
and cardano-ledger
#1314
base: main
Are you sure you want to change the base?
Conversation
9efce6b
to
c27d199
Compare
36b2b58
to
e6ab67b
Compare
FYI, the cardano-ledger commit in the SRP is gone. I suspect the new one is IntersectMBO/cardano-ledger@3fe0221 or IntersectMBO/cardano-ledger@12f6aa6 (the merge commit of the PR). |
7cbd3f8
to
ef51726
Compare
ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Query/Types.hs
Show resolved
Hide resolved
ouroboros-consensus-cardano/src/unstable-shelley-testlib/Test/ThreadNet/TxGen/Shelley.hs
Outdated
Show resolved
Hide resolved
let (ys, zs) = splitAt i xs | ||
in ys ++ dropElemsAt (drop 1 zs) is | ||
dropElemsAt xs is' = | ||
let is = Set.fromList is' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IntSet
is more efficient at handling Set of Int
s
let is = Set.fromList is' | |
let is = IntSet.fromList is' |
, gcfBlockFetchGracePeriod :: Maybe Integer | ||
, gcfBucketCapacity :: Maybe Integer | ||
, gcfBucketRate :: Maybe Integer | ||
, gcfCSJJumpSize :: Maybe Integer | ||
, gcfGDDRateLimit :: Maybe DiffTime |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Configuration should always try and use the types that will be used in the end. This way we can protect against invalid values when parsing the config instead of allowing for dangerous values that can lead to overflows. For example, by using SlotNo
, we here we can protect against a very large value being placed in the config that will end up overflowing
, gcfBlockFetchGracePeriod :: Maybe Integer | |
, gcfBucketCapacity :: Maybe Integer | |
, gcfBucketRate :: Maybe Integer | |
, gcfCSJJumpSize :: Maybe Integer | |
, gcfGDDRateLimit :: Maybe DiffTime | |
, gcfBlockFetchGracePeriod :: Maybe DiffTime | |
, gcfBucketCapacity :: Maybe Integer | |
, gcfBucketRate :: Maybe Integer | |
, gcfCSJJumpSize :: Maybe SlotNo | |
, gcfGDDRateLimit :: Maybe DiffTime |
gbfcGracePeriod = fromInteger $ fromMaybe defaultBlockFetchGracePeriod gcfBlockFetchGracePeriod | ||
csbcCapacity = fromInteger $ fromMaybe defaultCapacity gcfBucketCapacity | ||
csbcRate = fromInteger $ fromMaybe defaultRate gcfBucketRate | ||
csjcJumpSize = fromInteger $ fromMaybe defaultCSJJumpSize gcfCSJJumpSize |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@facundominguez I have a couple of suggestions and some minor concerns about this:
csbcCapacity
is already anInteger
, sofromInteger
is redundant- using
maybe
instead offromMaybe
allows for default values to have the expected type. - All conversions with
to/fromInteger
andfromIntegral
should have type annotations, because that way it is easier to spot dangers of overflow SlotNo
is backed byWord64
, so there is danger of overflow here, so it would be better to use that type instead ingcfCSJJumpSize
, as I suggested above.
gbfcGracePeriod = fromInteger $ fromMaybe defaultBlockFetchGracePeriod gcfBlockFetchGracePeriod | |
csbcCapacity = fromInteger $ fromMaybe defaultCapacity gcfBucketCapacity | |
csbcRate = fromInteger $ fromMaybe defaultRate gcfBucketRate | |
csjcJumpSize = fromInteger $ fromMaybe defaultCSJJumpSize gcfCSJJumpSize | |
gbfcGracePeriod = maybe defaultBlockFetchGracePeriod (fromInteger @DiffTime) gcfBlockFetchGracePeriod | |
csbcCapacity = fromMaybe defaultCapacity gcfBucketCapacity | |
csbcRate = maybe defaultRate (fromInteger @Rational) gcfBucketRate | |
csjcJumpSize = maybe defaultCSJJumpSize (fromInteger @SlotNo) gcfCSJJumpSize |
let is = Set.fromList is' | ||
in map fst $ filter (\(_, i) -> not $ i `Set.member` is) (zip xs [0..]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nbacquey List comprehensions seem to be more readable, more compact and won't rely on list fusion to be efficient.
Also switching to IntSet
will be more efficient and there are special functions in containers notMember x s
, that can be used instead of not $ member x s
let is = Set.fromList is' | |
in map fst $ filter (\(_, i) -> not $ i `Set.member` is) (zip xs [0..]) | |
let is = IntSet.fromList is' | |
in [x | (x, i) <- zip xs [0..], i `IntSet.notMember` is] |
ef51726
to
9d27b2e
Compare
…kFetchConsensusInterface
* Addition of ChainSyncClientHandleCollection, grace period, and starvation event in BlockFetch * Plug `rotateDynamo` into `BlockFetchConsensusInterface` * Removal of `bfcMaxConcurrencyBulkSync` * Changes in blockfetch decision tracing
Port of IntersectMBO/ouroboros-network#2721 Co-authored-by: Thomas Winant <thomas@well-typed.com> Co-authored-by: Alexander Esgen <alexander.esgen@iohk.io>
* Move Genesis-specific BlockFetch config to GenesisConfig * Introduce GenesisConfigFlags for interaction with config files/CLI * Add missing instances for Genesis configuration
* Mention that the objector also gets demoted * Edit note on Interactions with the BlockFetch logic * Expand the comments motivating DynamoInitState and ObjectorInitState Co-authored-by: Nicolas “Niols” Jeannerod <nicolas.jeannerod@tweag.io>
* Run more repetitions of LoE, LoP, CSJ, and gdd tests * Print timestamps for node restarts * Disable boring timeouts in the node restart test * Wait sufficiently long at the end of tests * Expect CandidateTooSparse in gdd tests * Add a notice about untracked delays in the node restart test * Set the GDD rate limit to 0 in the peer simulator * Have the peer simulator use the default grace period for chainsel starvations * Relax expectations of test blockFetch in the BulkSync case * Allow to run the decision logic once after the last tick in the blockfetch leashing attack * Shift point schedule times before giving the schedules to tests * Accomodate for separate decision loop intervals for fetch modes * Accomodate for timer added in blockFetchLogic * Switch peer simulator to `FetchModeBulkSync` * Allow parameterizing whether chainsel starvation is handled * Add some wiggle room for duplicate headers in CSJ tests * Disable chainsel starvation in CSJ test
Co-authored-by: Nicolas Bacquey <nicolas.bacquey@tweag.io>
9d27b2e
to
038f9d6
Compare
Description
Integrate
ouroboros-network
andcardano-ledger
in preparation forcardano-node
release10.2.0
See IntersectMBO/cardano-node#6040 for overall progress