-
Notifications
You must be signed in to change notification settings - Fork 156
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
Made MEMPOOL call LEDGER #4880
Made MEMPOOL call LEDGER #4880
Conversation
b71a576
to
45c690e
Compare
45c690e
to
afba950
Compare
@@ -84,7 +84,6 @@ instance RuleListEra ConwayEra where | |||
, "GOV" | |||
, "LEDGER" | |||
, "LEDGERS" | |||
, "MEMPOOL" |
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.
If I leave this here, I get a compiler error that says that it can't find an EraRuleFailure
instance for the MEMPOOL predicate failures. However I can't add EraRuleFailure
type instance for MEMPOOL
because that violates type injectivity since MEMPOOL
shares the predicate failure with LEDGER
.
c9901fd
to
fb73f98
Compare
fb73f98
to
02dba29
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.
I understand that applyTxOpts
calls directly MEMPOOL rule, which calls LEDGER.
Some things I don't understand:
- Is it necessary to stop emitting events from the MEMPOOL rule? If yes, then probably the mempoolevents-related tests in
LedgerSpec
should be deleted - Why do we need the
ApplyTxRule
associated type inApplyTx
?
I'm sure it's because I'm missing some details, we can discuss it in the meeting if it's easier!
@@ -256,7 +254,7 @@ spec = do | |||
Left e -> | |||
assertFailure $ "Unexpected failure while applyingTx: " <> show tx <> ": " <> show e | |||
Right (_, evs) -> | |||
length [ev | ev@(MempoolEvent (ConwayMempoolEvent _)) <- evs] `shouldBe` 1 | |||
length [ev | ev <- evs] `shouldBe` 1 |
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.
I think the list comprehension is unnecessary
length [ev | ev <- evs] `shouldBe` 1 | |
length evs `shouldBe` 1 |
) => | ||
ApplyTx era | ||
where | ||
type ApplyTxRule era :: Type |
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.
Does this associated type improve on the version without it, or is it necessary for the solution to work?
@@ -235,7 +233,7 @@ spec = do | |||
(LedgersEnv slotNo epochNo pp account) | |||
ls | |||
(Seq.singleton tx) | |||
let mempoolEvents = [ev | LedgerEvent ev@(MempoolEvent (ConwayMempoolEvent _)) <- evs] | |||
let mempoolEvents = [ev | LedgerEvent ev <- evs] |
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.
If Mempool is no longer emitting events, then I'm not sure if Mempool events
test makes sense at all? It just counts all the events emitted from Ledger, nothing to do with the Mempool rule. The count is also wrong right now and the tests should be failing
@@ -286,22 +281,19 @@ data ConwayLedgerEvent era | |||
= UtxowEvent (Event (EraRule "UTXOW" era)) | |||
| CertsEvent (Event (EraRule "CERTS" era)) | |||
| GovEvent (Event (EraRule "GOV" era)) | |||
| MempoolEvent (Event (EraRule "MEMPOOL" era)) |
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.
Can we remove this without breaking node-to-client protocol?
If so, we should probably reflect it in the CHANGELOG
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.
Yeah we can, ledger events aren't part of the node-to-client protocol.
However, after giving more thought to how actual mempool uses ledger, made me realize there is no point in making events available in ApplyTx
, since they will never be used.
Adding a changelog about it the removal is a good idea.
, BaseM (someLEDGER era) ~ ShelleyBase | ||
, STS (someLEDGER era) | ||
) => | ||
TransitionRule (someLEDGER era) | ||
ledgerTransition = do | ||
TRC | ||
( le@(LedgerEnv slot mbCurEpochNo _txIx pp account mempool) | ||
, ls@(LedgerState utxoState certState) | ||
( LedgerEnv slot mbCurEpochNo _txIx pp account _mempool |
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.
There is no point to keep this ledgerMempool
Bool around in LedgerEnv
, no?
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.
Indeed there is no point.
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.
Fixed in #4890
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.
As I've mentioned in the meeting on Monday, I didn't think that we need this whole complication with a type family. I went ahead and experimented with it today and indeed I converged on a much simpler approach that avoids whole lot of unnecessary nonsense that didn't need to be there to begin with.
See my PR #4890 It uses the first commit from this PR.
@@ -286,22 +281,19 @@ data ConwayLedgerEvent era | |||
= UtxowEvent (Event (EraRule "UTXOW" era)) | |||
| CertsEvent (Event (EraRule "CERTS" era)) | |||
| GovEvent (Event (EraRule "GOV" era)) | |||
| MempoolEvent (Event (EraRule "MEMPOOL" era)) |
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.
Yeah we can, ledger events aren't part of the node-to-client protocol.
However, after giving more thought to how actual mempool uses ledger, made me realize there is no point in making events available in ApplyTx
, since they will never be used.
Adding a changelog about it the removal is a good idea.
, BaseM (someLEDGER era) ~ ShelleyBase | ||
, STS (someLEDGER era) | ||
) => | ||
TransitionRule (someLEDGER era) | ||
ledgerTransition = do | ||
TRC | ||
( le@(LedgerEnv slot mbCurEpochNo _txIx pp account mempool) | ||
, ls@(LedgerState utxoState certState) | ||
( LedgerEnv slot mbCurEpochNo _txIx pp account _mempool |
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.
Indeed there is no point.
Closing in favor of #4890 |
Description
closes #4864
Checklist
CHANGELOG.md
files updated for packages with externally visible changesNew section is never added with the code changes. (See RELEASING.md)
.cabal
andCHANGELOG.md
files when necessary, according to theversioning process.
.cabal
files updated when necessaryIf you change the bounds in a cabal file, that package itself must have a version increase. (See RELEASING.md)
scripts/fourmolize.sh
)scripts/cabal-format.sh
)hie.yaml
updated (usescripts/gen-hie.sh
)