-
Notifications
You must be signed in to change notification settings - Fork 0
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
Philipp #1
Philipp #1
Conversation
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.
Very nice work, I'm super eager to see how Crem
fares with modelling the payoutPool functionality!
| registeredProposer == True = [NoPenalty, Penalty Kicked] | ||
| otherwise = [NoPenalty] | ||
|
||
-- Submit on-chain report | ||
actionsOnChainReport penalty = [NoReport, SubmitReport Validator, SubmitReport Builder, SubmitReport ValidatorKicked] | ||
actionsOnChainReport penaltyValidator penaltyBuilder penaltyValidatorKicking (_,slot,proposerAddr,builderAddr,_,_) = [NoReport, SubmitReport report1, SubmitReport report2, SubmitReport report3] |
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.
Here three different record for three different types of penalty have been instantiated on the fly, 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.
Yes. The general idea is that the reporter before follows a certain logic, where exactly to identify a problem. That ends with a report. After that there is an explicit decision where this can be overruled. The idea being that in this way, we can in principle model different players doing different parts of the reporting. Not needed now but it would be a pain to add this later.
preconditions | ||
:: State -> ProposerAddr -> BuilderAddr -> SlotID -> Bool | ||
preconditions state proposerAddr builderAddr slot | ||
| checkReportInterval state slot == False = False |
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 find this syntax a bit difficult to parse, but maybe it's just me!
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 a bit dirty to me too. We're just checking that checkReportInterval state slot
is True
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's several instances of this. I don't know if @philipp-zahn prefers it that way but I can give it a quick pass and commit a cleaner version
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 I tried to follow the logic in the docs. But if both of you feel this is confusing it is a sign we should do it differently. @dpl0a do you wanna take that over?
| slotInPast == True | ||
&& registeredProposer == True | ||
&& missedPayment == True | ||
&& demand == True = [NoPenalty, Penalty Grieving] |
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.
These == True
are redundant (there's several instances of that in the repo), IDK if it makes the code more readable for non-haskell people but let's keep that in mind
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.
Yes, my intention was to make it more readable. Also: the semantics of these bool conditions is not always clear, I fear. That's why I explicitly commented on them where I defined them.
checkPayment :: State -> SlotID -> BuilderAddr -> Bool | ||
checkPayment (State StateOnChain{..} StatePoNOnChain{..} _) slot builder = | ||
let payment = M.lookup (slot,builder) paidInSlot | ||
in if payment == Nothing |
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.
Lots of redundant if's in this module.
e.g. we can substitute this with isJust payment
after importing Data.Maybe
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.
Yes that is a good point. I spend zero time on refactoring. @dpl0a can you take the lead on this?
checkDemand :: State -> SlotID -> Bool | ||
checkDemand (State StateOnChain{..} StatePoNOnChain{..} (_,auction)) slot = | ||
let bids = auction M.! slot | ||
in if bids == [] |
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.
Another example: here we can use bids /= []
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.
Same as above. @dpl0a again, wanna take over here?
Main reporter functionality; state definition; and parts of payout pool