-
Notifications
You must be signed in to change notification settings - Fork 86
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
Move override support for max tx capacities into the ProtocolInfo constructors #3261
Move override support for max tx capacities into the ProtocolInfo constructors #3261
Conversation
608b566
to
946a93c
Compare
@jasagredo This is ready for review now. The first 5 commits are as before, the remaining commits are a bit of a departure. It's something Pawel and I had discussed before, and once I got my hands in here, it seemed worthwhile. The commit message on I would understand if this feels like too much. The reason I've left it in one PR is because the downstream interface is different as of the last commit. I don't like merging work that is known to be incomplete, so I'd like to review these commits together. On that note, I've left it as a Draft PR after all, since I'll want to squash these commits down once we're happy with them; the first commit goes one way (introduces Also, if the |
946a93c
to
b5ec9cd
Compare
We discussed this in the Planning Meeting; Consensus Team + @nc6
We also spent a couple hours (by now) discussing what the right interface is for these lattice concepts we're invoking. This question remains unanswered. But here are some remarks.
Then we questioned if we definitely want to disallow relaxing the ledger limit -- eg maybe benchmarking team would do that to every node on a testnet. But in that case they should just change the limit in the ledger state so that the largest block they'd want to create is valid on every node. They could still use the restriction (ie meet) in order to have some nodes create smaller-than-necessary blocks, if they're going for a mixture. Ultimately, though, we're wondering who really needs this --- maybe we should rip it out, the ultimate simplification :D I've asked on the Node Team slack channel for clarification regarding this, included pinging Benchmarking Team lead. |
@njd42 and I discussed it. He pointed out that honest SPOs being able to quickly restrict the size of blocks they forge could help us avoid potential disaster scenarios. And some honest SPOs may (currently?) need this to make-up for limited CPU/Mem/etc resources. So we should include it. (Even if we excluded it, it'd be easy enough for some one intent on this to patch it into their fork of the code.) |
These current definitions will be used to simplify eg PR IntersectMBO/ouroboros-network#3261
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.
In general, and provided that the Semilattice machinery is moved to cardano-base
, this PR looks really good.
ouroboros-consensus/src/Ouroboros/Consensus/Mempool/TxLimits.hs
Outdated
Show resolved
Hide resolved
b5ec9cd
to
c29cf3b
Compare
@EncodePanda -- as has become par for the course, I'm surprised that I didn't get this merged during your vacation week. I'll Slack you some details, but please focus on Genesis. I expect we can review this on a quick phone call sometime early this week. |
788ee0f
to
8cecb3c
Compare
ouroboros-consensus-shelley/src/Ouroboros/Consensus/Shelley/Ledger/Mempool.hs
Outdated
Show resolved
Hide resolved
Significant changes since that Approval
5b49d04
to
e595200
Compare
e595200
to
7f58409
Compare
ouroboros-consensus/src/Ouroboros/Consensus/Mempool/TxLimits.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/src/Ouroboros/Consensus/Mempool/TxLimits.hs
Outdated
Show resolved
Hide resolved
7f58409
to
2ef5ba7
Compare
@EncodePanda I'll resolve the two open Comments today (comments on Would you review the rest of the PR around those? Those two will be straight forward for me, so please feel free to Approve before I upload fixes for those. Edit: I resolved them and rebased onto |
2ef5ba7
to
5f4a264
Compare
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.
LGTM, minor comments
ouroboros-consensus-shelley/src/Ouroboros/Consensus/Shelley/Ledger/Mempool.hs
Outdated
Show resolved
Hide resolved
A couple weeks ago, Edsko's insight set us on the path: the abstract Consensus layer need not know about the limits on the size of block. That is ledger specific; so only the atomic ledgers' (Byron, Shelley, etc -- not the HardForkBlock) forge functions needed to query and enforce that limit. We later realized that this same insight applies to the user-submitted overrides of the ledger limits: the abstract Consensus layer receives a `ProtocolInfo` structure from the downstream user. That includes `BlockForging` structures, which include partial applications of the atomic forge functions. When the downstream user builds the `ProtocolInfo`, they can supply the user's overrides there, so that the abstract layer is never involved. As a result, the `maxTxCapacityOverride` field is now vestigial. This may seem like splitting hairs, since we _also_ provide a convenience interface for creating `ProtocolInfo` (and hence `BlockForging`) values. But it'll pay off to keep the separable concern separated. EG The abstract Consensus layer interface works only at the top-level `blk` type, which meant we would have needed a representation of overrides for `HardForkBlock`. The `ProtocolInfo` convenience interface, however, is not abstract, and so it can pass the right overrides to the right atomic forge functions as its building up the inputs (eg `NP` values) for the abstract interface. So now the `HardForkBlock` logic need not include anything at all about overrides (it simply knows how to combine lists of `BlockForging`, which now handles everything appropriately). Co-authored-by: Pawel Szulc <paul.szulc@gmail.com>
This avoids confusion with `maxCapacity` from the `TxLimits` type class. enter the commit message for your changes. Lines starting
The previous commit was a renamed that enabled simpler local names; no longer need to avoid shadowing.
This is important because it is an accumulator.
This has a few small benefits * define's TxMeasure `leq` via the pointwise minimum * removes the redundancy of specifying the `pointwiseMin` method per ledger instead of per 'Measure' * avoids the need for type applications, which let's us re-use the <= operator and two large benefits * creates an opportunity for more use of deriving * the top-bounded meet-semilattice foundation means that `noOverrides` can be implemented as `top`; we don't need it to be a function from the (dynamic!) ledger limits anymore. We had previously decided on a function because it made it trivial to override only parts of the ledger-derived capacity. However, we simplified the override representation (no more `NP`) and a interface that uses the static `top` instead of the dynamic "current ledger capacity" is more appropriate for a interface used for static configuration. In other words, the function space was "too big" for the following reasons. * in practice, these values are parsed from a file, and I doubt the Node Team wants to parse functions anytime soon * we do not anticipate the node operator wanting to vary their override depending on the ledger capacity The 'Measure' class's lattice semantics let us remove the function space without losing any convenience. Co-authored-by: Pawel Szulc <paul.szulc@gmail.com>
5f4a264
to
af456b6
Compare
Thank you @EncodePanda. I rebased just now; automatic, no conflicts 👍 |
bors r+ |
Build succeeded: |
Fixes #3235 (again).
See the individual commit messages, some of which are extensive.