-
Notifications
You must be signed in to change notification settings - Fork 45
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
Court: Polish main court contract functionality #103
Conversation
6a5b041
to
6618c22
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.
Looking really good so far, some minor comments
4411b03
to
d877efd
Compare
ad53add
to
99ac098
Compare
99ac098
to
5e0b779
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.
Some minor comments that I forgot to submit
Edit: moving them to #104
8629ab5
to
95124f4
Compare
b138838
to
da99eeb
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.
Still reviewing, but here you have another batch.
Before I forget, I realized there are some lint errors. I will push a small PR to add linter to CI, ok?
* @dev Tell the last ensured term identification number | ||
* @return Identification number of the last ensured term | ||
*/ | ||
function getLastEnsuredTermId() external view returns (uint64) { |
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 wouldn't call this Ensured
, as it can be misunderstood as if we somehow know that we have already called ensureTerm
and it's up to date.
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.
Not sure I follow the scenario you are describing. IMO this is what termId
actually means, it's the last ensured term since it may be outdated.
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.
Ok, again, proceed as you want, it's just a name, but to make my point clear: if termId
means "the last ensured term", I don't see the need for adding Ensured
as it would be just confusing, like there are 2 different concepts, termId
and ensuredTermId
.
But I don't think termId
is "ensured" at all, as we don't know if all needed term transitions have taken place.
Anyway, to me this is just and old plain getter:
function getLastEnsuredTermId() external view returns (uint64) {
return termId;
}
And it's a common practice to name getters as get
+ variable name. So if you really want to call this with that (IMO) unnecessary long name instead of the classic getTermId
, I would then rename the variable to lastEnsuredTermId
.
[Suggestion for our style guide, section naming conventions: plain getters are called get + variable name
]
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.
This is definitely a bit of bikeshedding at this point, but what about getLastTransitionedTermId
?
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 agree it's bikeshedding. Actually I don't think we even need this function at all, as we could have kept termId
public and use the automatically generated getter.
[Another thing to discuss for our style guide: do we use public state variables and auto-generated getters? Or do we declare them all internal and explicitly write getters?]
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 like getLastTransitionedTermId
and also agree about the getters pattern, I think the whole problem comes as a consequence of the state variable being called simply termId
which is not always up-to-date. What about renaming the variable to lastTransitionedTermId
as well?
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.
Outstanding work on this @facuspagnuolo!
Some minor comments, but good to go on my end to merge 🔥
Co-Authored-By: Jorge Izquierdo <jorge@aragon.one>
37ca5d6
to
f616da3
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
@@ -1235,6 +1235,7 @@ contract Court is IJurorsRegistryOwner, ICRVotingOwner, ISubscriptionsOwner, Tim | |||
|
|||
// Otherwise, return the times the active balance of the juror fits in the min active balance, multiplying | |||
// it by a round factor to ensure a better precision rounding. | |||
// TODO: review, we are not using the final round discount here |
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 catch. I don't think we should have it here though, but it should definitely be in settleReward
when assigning fees for coherent jurors in the final round
aragon-court/contracts/Court.sol
Line 591 in e2cac0b
accounting.assign(config.feeToken, _juror, jurorFee); |
And we should definitely have a test for it. Maybe we should work on it on a specific test file for accounting?
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.
Hm, I don't get it. round.jurorFees
already has the discount applied, right?
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.
True, I was confused. The problem was that we are not testing it 😂
Fixes #83 and #16
Lots of polishing stuff, inline documentation and bunch of new tests happening on this PR, important pieces to take a look carefully are:
Pre-Draft
andExecuted
dispute states when querying an adjudication round state (2e3cbbd#diff-4bb317b489994cf6f4c4b7ed11c18590R1362-R1371)settledJurors
even for the last batch to ensure consistency (2e3cbbd#diff-4bb317b489994cf6f4c4b7ed11c18590R1008)