-
Notifications
You must be signed in to change notification settings - Fork 155
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
Imptests - treasury withdrawals #4189
Conversation
c516b95
to
7d1c912
Compare
c9ed97a
to
46f7f22
Compare
46f7f22
to
97b20cd
Compare
Sorry, the last two commits were already reviewed as part of #4201, but the base branch was this one instead of master. |
I'm currently reviewing this and I intend to finish the review later today. I have some questions and minor suggestions. |
eras/conway/impl/testlib/Test/Cardano/Ledger/Conway/Imp/EnactSpec.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.
Sorry, it took me long enough! 😬 Overall, I quite like it but since I'm new to the codebase, I felt that some more comments and assertions could improve the readability of the tests. However, my additions might be a bit too verbose so feel free to change or ignore them. Especially, if I didn't get the jargon right. :)
I mainly looked at the Treasury withdrawals
spec, here is the gist of my suggestions:
I felt that it might be useful to also assert for the presence/absence of both the current proposals and previous ones (so the ones that are in the pulser
), so I added those assertions as suggestions and also added an expectNoChange
assertion that checks multiple things when a Treasury Withdrawal
governance action's pre-condition is not met and hence the proposal will not be enacted as a result. Hopefully, I did not misunderstand the state changes and my suggestions are indeed helpful rather than misleading.
It seems like GitHub doesn't support suggestions over deleted lines so sometimes I had to separate suggestions into Step 1
and Step 2
.
I was thinking about reorganising and rewording the it
s and describe
s as I would have preferred something along the lines of this:
describe "Treasury withdrawals"
it "modify EnactState as expected"
describe "in a single proposal"
it "should only be enacted when treasury has sufficient funds"
it "should not exceed maxBound Word64"
describe "in several proposals within the same epoch"
it "should only be enacted until treasury has sufficient funds"
However, it seems like we don't really use this style throughout the codebase, so I opted to leave things intact and I also try to avoid too many nested describe
s.
eras/conway/impl/testlib/Test/Cardano/Ledger/Conway/Imp/EnactSpec.hs
Outdated
Show resolved
Hide resolved
eras/conway/impl/testlib/Test/Cardano/Ledger/Conway/Imp/EnactSpec.hs
Outdated
Show resolved
Hide resolved
eras/conway/impl/testlib/Test/Cardano/Ledger/Conway/Imp/EnactSpec.hs
Outdated
Show resolved
Hide resolved
eras/conway/impl/testlib/Test/Cardano/Ledger/Conway/Imp/EnactSpec.hs
Outdated
Show resolved
Hide resolved
eras/conway/impl/testlib/Test/Cardano/Ledger/Conway/Imp/EnactSpec.hs
Outdated
Show resolved
Hide resolved
eras/conway/impl/testlib/Test/Cardano/Ledger/Conway/Imp/EnactSpec.hs
Outdated
Show resolved
Hide resolved
eras/conway/impl/testlib/Test/Cardano/Ledger/Conway/Imp/EnactSpec.hs
Outdated
Show resolved
Hide resolved
eras/conway/impl/testlib/Test/Cardano/Ledger/Conway/Imp/EnactSpec.hs
Outdated
Show resolved
Hide resolved
eras/conway/impl/testlib/Test/Cardano/Ledger/Conway/Imp/EnactSpec.hs
Outdated
Show resolved
Hide resolved
@Lucsanszky Sorry I'm a bit lost about your comments with Step 1 and Step 2.
|
Yes, exactly. I added it because I also added the proposal assertions and at that point I thought that it might worth extracting the whole thing. |
97b20cd
to
0307419
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 a few suggestions for better test-naming than I originally thought.
eras/conway/impl/testlib/Test/Cardano/Ledger/Conway/Imp/EnactSpec.hs
Outdated
Show resolved
Hide resolved
eras/conway/impl/testlib/Test/Cardano/Ledger/Conway/Imp/EnactSpec.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.
Looks good overall. Just needs to be finished up and comments need to be addressed
eras/conway/impl/testlib/Test/Cardano/Ledger/Conway/Imp/EnactSpec.hs
Outdated
Show resolved
Hide resolved
eras/conway/impl/testlib/Test/Cardano/Ledger/Conway/Imp/EnactSpec.hs
Outdated
Show resolved
Hide resolved
eras/conway/impl/testlib/Test/Cardano/Ledger/Conway/Imp/EnactSpec.hs
Outdated
Show resolved
Hide resolved
eras/conway/impl/testlib/Test/Cardano/Ledger/Conway/Imp/EnactSpec.hs
Outdated
Show resolved
Hide resolved
0307419
to
36da6ef
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.
Looks great. Thank you!
I made a minor suggestion, but feel free to ignore it
eras/conway/impl/testlib/Test/Cardano/Ledger/Conway/Imp/EnactSpec.hs
Outdated
Show resolved
Hide resolved
36da6ef
to
9ba9078
Compare
9ba9078
to
8467b66
Compare
and remove unnecessary `ConwayGovState` constraint
* don't change the treasury state manually, but via a donation * generate random number of withdrawals whose sum exceed the treasury (or maxBound)
8467b66
to
c57a6da
Compare
Description
This is the first part of @aniketd 's PR: https://github.com/IntersectMBO/cardano-ledger/pull/4179/commits, closing: #4133
I have re-arranged the test a little bit and added his commit that is actually adding the tests, and improved the tests with the comments from the review.
Checklist
.cabal
andCHANGELOG.md
files according to theversioning process.
.cabal
files for all affected packages are updated. If you change the bounds in a cabal file, that package itself must have a version increase. (See RELEASING.md)CHANGELOG.md
for the affected packages. New section is never added with the code changes. (See RELEASING.md)fourmolu
(usescripts/fourmolize.sh
)scripts/cabal-format.sh
)hie.yaml
has been updated (usescripts/gen-hie.sh
)