-
Notifications
You must be signed in to change notification settings - Fork 87
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
UTxO-HD: add tables to mock ledger #4184
Conversation
0da775b
to
bf42413
Compare
applyBlockLedgerResult _ blk st = fmap (\st' -> pureLedgerResult $ zipOverLedgerTables f (unstowLedgerTables st') (projectLedgerTablesTicked st)) . updateSimpleLedgerState blk $ TickedSimpleLedgerState $ stowLedgerTables $ getTickedSimpleLedgerState st | ||
where f :: (Ord k, Eq v) => ValuesMK k v -> ValuesMK k v -> DiffMK k v | ||
f val1 val2 = (\(ApplyTrackingMK _ d) -> ApplyDiffMK d) $ rawCalculateDifference val1 val2 |
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.
Already well known pattern of:
diff . unstow . apply . stow
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.
Good point. I find that in every instance where we have to perform stowing/unstowing, applying, and diffing it's hard to track what's going on and why. I wonder if it'd make sense to abstract this away.
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.
Looks good to me!
Note: there are some lines that exceed ~80-ish characters, I placed some suggestions to spread them out over multiple lines, but I haven't done that everywhere
ouroboros-consensus-mock-test/src/Test/Consensus/Ledger/Mock/Generators.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus-mock/src/Ouroboros/Consensus/Mock/Ledger/Block.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus-mock/src/Ouroboros/Consensus/Mock/Ledger/Block.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus-mock/src/Ouroboros/Consensus/Mock/Ledger/Block.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus-mock/src/Ouroboros/Consensus/Mock/Ledger/Block.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus-test/test-consensus/Test/Consensus/Mempool.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus-test/test-consensus/Test/Consensus/Mempool.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus-test/test-consensus/Test/Consensus/Mempool.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus-test/test-consensus/Test/Consensus/Mempool.hs
Outdated
Show resolved
Hide resolved
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.
We should probably asses the impact this has in testing time (just run the test before and after to see if there is a significant diff).
I think the changes of the mempool simplification are also here, right, so I skipped those. But let me know if I should review those.
ouroboros-consensus-byron-test/src/Ouroboros/Consensus/ByronDual/Node.hs
Outdated
Show resolved
Hide resolved
applyBlockLedgerResult _ blk st = fmap (\st' -> pureLedgerResult $ zipOverLedgerTables f (unstowLedgerTables st') (projectLedgerTablesTicked st)) . updateSimpleLedgerState blk $ TickedSimpleLedgerState $ stowLedgerTables $ getTickedSimpleLedgerState st | ||
where f :: (Ord k, Eq v) => ValuesMK k v -> ValuesMK k v -> DiffMK k v | ||
f val1 val2 = (\(ApplyTrackingMK _ d) -> ApplyDiffMK d) $ rawCalculateDifference val1 val2 |
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.
Good point. I find that in every instance where we have to perform stowing/unstowing, applying, and diffing it's hard to track what's going on and why. I wonder if it'd make sense to abstract this away.
ouroboros-consensus-mock/src/Ouroboros/Consensus/Mock/Ledger/Block.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus-test/test-consensus/Test/Consensus/Mempool.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus-test/test-consensus/Test/Consensus/Mempool.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus-test/test-consensus/Test/Consensus/Mempool.hs
Outdated
Show resolved
Hide resolved
bf42413
to
200dda1
Compare
200dda1
to
ac1e158
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.
We also need to check if there is an increase in the running time of the tests for introducing this.
ouroboros-consensus/src/Ouroboros/Consensus/Storage/LedgerDB/OnDisk.hs
Outdated
Show resolved
Hide resolved
Every test that used `SimpleBlock`s now runs with ledger tables.
ac1e158
to
571e664
Compare
|
Description
Every test that used to run with
SimpleBlock
s now uses tablesChecklist
interface-CHANGELOG.md
interface-CHANGELOG.md