-
Notifications
You must be signed in to change notification settings - Fork 157
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
Introduced IncrementalStake, for all Eras #2538
Conversation
eras/shelley-ma/impl/src/Cardano/Ledger/ShelleyMA/Rules/Utxo.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.
@TimSheard overall this is really awesome!! I made some minor comments.
e81788c
to
fc9c609
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 don't know enough about the staking logic to comment on the implementation, but here are my comments with respect to Haskell.
eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Rules/TestChain.hs
Outdated
Show resolved
Hide resolved
eras/shelley-ma/impl/src/Cardano/Ledger/ShelleyMA/Rules/Utxo.hs
Outdated
Show resolved
Hide resolved
8b7c7d0
to
81abe93
Compare
81abe93
to
6900bf2
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.
Just marking this as request changes so we don't accidentally merge - this branch is known to cause problems during benchmark run.
c3ef302
to
c37360d
Compare
eras/shelley/impl/src/Cardano/Ledger/Shelley/API/ByronTranslation.hs
Outdated
Show resolved
Hide resolved
c37360d
to
a107301
Compare
a107301
to
bb7e7eb
Compare
@nc6, this is green from benchmarking standpoint. |
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.
Left a bunch of comments, which I think it would be good to address. However, since this PR has been open for so long, happy for them to be addressed in a separate PR if that's easier.
eras/shelley-ma/impl/src/Cardano/Ledger/ShelleyMA/Rules/Utxo.hs
Outdated
Show resolved
Hide resolved
-- and combining them with the ordinary stake. Zero out the Ptr indexed stake in the result. | ||
-- This function is meant to only be called at the Epoch boundary in the Snap Rule. It is not meant | ||
-- to be used to transform the IncrementalStake. | ||
resolveIncrementalPtrs :: Map Ptr (Credential 'Staking (Crypto era)) -> IncrementalStake (Crypto era) -> IncrementalStake (Crypto 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.
Is there a reason in this case for returning IncrementalStake
rather than simply Map Credential Coin
? I assume we zero out the incremental stuff at the epoch boundary anyway?
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.
Alternatively, just move this function inside of incrementalStakeDistr
, which is the only thing to use it anyway.
-- the _utxo. This is aways safe to do, but if the _utxo field is big, this can be very expensive, | ||
-- which defeats the purpose of memoizing the _stakeDistro field. So use of this function should be | ||
-- restricted to tests and initializations, where the invariant should be maintained. | ||
smartUTxOState :: |
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.
Better name? Not that I have any good ideas...
eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Address/Bootstrap.hs
Outdated
Show resolved
Hide resolved
eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Address/Bootstrap.hs
Show resolved
Hide resolved
eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/BenchmarkFunctions.hs
Outdated
Show resolved
Hide resolved
eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Examples/Consensus.hs
Outdated
Show resolved
Hide resolved
bb7e7eb
to
3e387a3
Compare
Incrementally maintains the raw stake distributiona as well as the UTxO
3e387a3
to
247e7f0
Compare
incrementally maintains the raw stake distribution as well as the UTxO.
Adds InrementalStake field to UTxOState
Utxo rule (Utxos rule in Alonzo) and the Snap rule are modified to use this new state
Added a property test that computes both ways at every Epoch Boundary.