-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat: shed: FIP0036 post poll result processing #9387
Conversation
e303661
to
7f1302a
Compare
7f1302a
to
87597cb
Compare
Take out the emoji please 😜😜 let’s not make sentimental suggestion a😜😜 |
cmd/lotus-shed/fip-0036.go
Outdated
} | ||
|
||
//process msigs | ||
// TODO: Oh god, oh god, there's a possibility that a multisig has voted in both directions |
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.
lets add the ID from https://api.filpoll.io/api/polls/16/view-votes to Vote
- and which can be used to indicate which option reaches threshold first
cmd/lotus-shed/fip-0036.go
Outdated
|
||
if v == APPROVE { | ||
approveBalance = types.BigAdd(approveBalance, accountActor.Balance) | ||
votesIncludingMsigs[signerId] = APPROVE |
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.
why adding 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.
oka after figuring out the intention of this map I think this should be removed
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.
@jennijuju You're gonna have to say more than that :P
Why should it be removed?
(The purpose is just to have a map that includes votes from msigs for the purpose of checking owner addresses in the next loop)
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.
maybe answer to my q is here: #9387 (comment)?
cmd/lotus-shed/fip-0036.go
Outdated
clientApproveBytes = big.Add(clientApproveBytes, clientBytes) | ||
} else { | ||
rejectionBalance = types.BigAdd(rejectionBalance, accountActor.Balance) | ||
votesIncludingMsigs[signerId] = Reject |
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.
why adding here?
minerVotes := make(map[address.Address]uint64) | ||
fmt.Println("counting miner votes") | ||
for s, v := range votes { | ||
if minerInfos, found := ownerMap[s]; found { |
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.
for s is msig - this is not checking against whether the music mets the threshold, add a voteMsig found check?
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.
oops! that's supposed to be iterating over votesIncludingMsigs -- are you proposing just doing this loop twice, once for votes and once for votedMsigs? I do like that more.
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.
im confused - then where is the miner balance when the owner is not msig accounted?
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.
oh here
lotus/cmd/lotus-shed/fip-0036.go
Line 353 in 9928c1a
if minerInfos, found := ownerMap[signerId]; found { |
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.
Initial pass. Mostly nits but it would be easier to review if we reduced code duplication and added some comments on the vote tallying strategy.
cmd/lotus-shed/fip-0036.go
Outdated
return idAddr | ||
} | ||
|
||
panic("didn't find addr") |
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.
Can someone not vote with a bogus ID? (I assume we should just skip 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.
I don't believe FilPoll allows that (with the possible exception of certain Core Devs who submitted newly created IDs for the core devs portion of the vote).
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.
You already have an instance:
2022/09/28 22:01:40 ignoring ballot {49 t1giru42mia2x27svolr3n7vth7byb77eshpc77iq 2022-09-28 18:12:09.179 +0000 UTC}: unknown robust address
This one was ID-ed way after 2162760
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.
Yeah i wound up having to handle it lol -- only for vote signer resolution, though, the rest are panics.
workerMap := make(map[address.Address][]address.Address) | ||
// a map of miners to some info aboout them for quick lookup | ||
minerActorsInfo := make(map[address.Address]minerBriefInfo) | ||
// a map of client addresses to deal data stored in proposals |
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.
multisigs?
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.
For which one? I don't think so? Workers are BLS addresses, clients are either secp or bls?
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.
Ah, sorry, I forgot that these needed to be key addresses.
Technically, we also need to handle the case where a multisig owns a multisig, which requires either multiple passes or a dependency graph. But I'm not sure how important that is.
cmd/lotus-shed/fip-0036.go
Outdated
//process msigs | ||
// TODO: Oh god, oh god, there's a possibility that a multisig has voted in both directions | ||
// and we'll pick a winner non-deterministically as we iterate... | ||
// We need to factor in vote time if that happens and pick whoever went first |
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.
(IMO, just pick the direction with more votes and drop the vote on tie)
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 do think it's correcter to pick the first vote that crossed the threshold -- that's how msigs operate on chain.
(gonna do that for now, and log how many instances of this we have... @ribasushi already has this info too).
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.
@arajasek on my side I am not coming up with any instances of this, aside from the mega-msig
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 agree that it's correcter to pick the first vote that crosses the threshold. That incentivizes a race as soon as the poll opens. We should want people to take as much time as they need before the poll closes to gather and weigh information.
I agree with @Stebalien's idea as the most straightforward solution.
// msig has already voted, skip | ||
continue | ||
} | ||
if mpv, found := msigPendingVotes[ms]; found { //other signers of the multisig have voted, yet the threshold has not met |
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.
So... we can simplify this code by always incrementing, then checking. I.e., don't special-case a threshold of one, etc.
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.
You're right, i'll maybe get to that ;P
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 YOUR PRIO
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.
It'll make it a lot easier to reason about and review.
cmd/lotus-shed/fip-0036.go
Outdated
|
||
fmt.Println("iterating over proposals") | ||
dps, _ := marketState.Proposals() | ||
if err := dps.ForEach(func(dealID abi.DealID, d market.DealProposal) error { |
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.
@arajasek considering every deal as "legit" is not accurate. This is the filtering I do on my end:
... d.sector_activation_epoch IS NOT NULL AND d.deal_slash_epoch IS NULL and d.end_epoch > 2162760
It doesn't affect the result much at all, but still...
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.
Yeah, there's some nitpicking to do here. I'm not convinced that your approach is correcter (we should clarify all of this for future polls).
- A Deal in the
Proposals
already has is "accepted" by both parties and has collateral locked, so I'm not sure we should checkd.sector_activation_epoch IS NOT NULL
? - A slashed deal is still a deal that a client made (and SP accepted) and both put up collateral for, so should it not be counted?
d.end_epoch > 2162760
excludes deals that have expired but cron hasn't GCed yet...that's probably a better definition of "active deals" but it's a narrow boundary?
I definitely don't think any of your suggestions are "wrong", just...not clearly correcter?
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.
(would be easy to adopt any subset of your suggestions, though)
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.
@arajasek answering in the same order
- The reason I always do this when parsing the state, is because we have deal Proposals that are slated to start far in the future, some in the next millennium
Expand for urgh
deal_id | status | deal_start_time | start_epoch
----------+-----------+------------------------+-------------
311683 | published | 3534-01-31 14:40:00+00 | 1591979600
219097 | published | 3390-03-05 22:00:00+00 | 1440604800
218449 | published | 3389-10-06 22:00:00+00 | 1440172800
166347 | published | 3279-01-31 22:00:00+00 | 1323748800
165999 | published | 3272-04-27 22:00:00+00 | 1316635200
165922 | published | 3270-07-02 22:00:00+00 | 1314720000
165919 | published | 3270-06-27 22:00:00+00 | 1314705600
165917 | published | 3270-06-27 22:00:00+00 | 1314705600
165921 | published | 3270-06-27 22:00:00+00 | 1314705600
165918 | published | 3270-06-27 22:00:00+00 | 1314705600
165912 | published | 3270-06-22 22:00:00+00 | 1314691200
165916 | published | 3270-06-22 22:00:00+00 | 1314691200
165911 | published | 3270-06-22 22:00:00+00 | 1314691200
165915 | published | 3270-06-22 22:00:00+00 | 1314691200
165914 | published | 3270-06-22 22:00:00+00 | 1314691200
165908 | published | 3270-06-17 22:00:00+00 | 1314676800
165909 | published | 3270-06-17 22:00:00+00 | 1314676800
165905 | published | 3270-06-17 22:00:00+00 | 1314676800
165910 | published | 3270-06-17 22:00:00+00 | 1314676800
165907 | published | 3270-06-17 22:00:00+00 | 1314676800
165904 | published | 3270-06-12 22:00:00+00 | 1314662400
165903 | published | 3270-06-12 22:00:00+00 | 1314662400
165902 | published | 3270-06-12 22:00:00+00 | 1314662400
159205 | published | 3240-01-31 22:00:00+00 | 1282723200
159203 | published | 3240-01-26 22:00:00+00 | 1282708800
159200 | published | 3240-01-26 22:00:00+00 | 1282708800
159204 | published | 3240-01-26 22:00:00+00 | 1282708800
159202 | published | 3240-01-26 22:00:00+00 | 1282708800
159201 | published | 3240-01-26 22:00:00+00 | 1282708800
159197 | published | 3240-01-21 22:00:00+00 | 1282694400
159195 | published | 3240-01-21 22:00:00+00 | 1282694400
159196 | published | 3240-01-21 22:00:00+00 | 1282694400
159193 | published | 3240-01-21 22:00:00+00 | 1282694400
159194 | published | 3240-01-21 22:00:00+00 | 1282694400
159190 | published | 3240-01-16 22:00:00+00 | 1282680000
159191 | published | 3240-01-16 22:00:00+00 | 1282680000
159192 | published | 3240-01-16 22:00:00+00 | 1282680000
159188 | published | 3240-01-16 22:00:00+00 | 1282680000
159189 | published | 3240-01-16 22:00:00+00 | 1282680000
159183 | published | 3239-12-22 22:00:00+00 | 1282608000
159181 | published | 3239-12-22 22:00:00+00 | 1282608000
159170 | published | 3239-06-10 22:00:00+00 | 1282046400
159155 | published | 3239-01-21 22:00:00+00 | 1281643200
192728 | published | 2959-10-11 20:08:30+00 | 987868577
2768016 | published | 2033-01-30 16:31:30+00 | 13080303
2768015 | published | 2033-01-30 16:31:00+00 | 13080302
2768014 | published | 2033-01-30 16:30:30+00 | 13080301
11512152 | published | 2022-10-16 09:14:00+00 | 2253508
11458042 | published | 2022-10-16 09:13:30+00 | 2253507
11464093 | published | 2022-10-16 09:13:30+00 | 2253507
11512158 | published | 2022-10-16 09:13:00+00 | 2253506
...
-
"Slashed deal" is a misnomer: it means the underlying sector is gone for good and the deal has entered cron cleanup. I did confirm this with @ZenGround0 at multiple points.
-
No strong feelings about this one, though note that cron cleanup is sometimes up to 24h
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.
The reason I always do this when parsing the state, is because we have deal Proposals that are slated to start far in the future, some in the next millennium
Persuaded, adding that check.
"Slashed deal" is a misnomer: it means the underlying sector is gone for good and the deal has entered cron cleanup. I did confirm this with @ZenGround0 at multiple points.
Yeah, you're right, but it's another 24 hour issue...I don't care enough for that ;)
d6e47f8
to
2b08ed9
Compare
Related Issues and Proposed Changes
This is a shed command that tabulates the results of FIP-0036. It is fed in votes from FilPoll, along with the state root and height (for this poll bafy2bzacebdnzh43hw66bmvguk65wiwr5ssaejlq44fpdei2ysfh3eefpdlqs and 2162760). See #9375 for more, this is a slight reworking of that.
Additional Info
lotus-shed fip36poll results --repo=/mnt/oldnet bafy2bzacebdnzh43hw66bmvguk65wiwr5ssaejlq44fpdei2ysfh3eefpdlqs 2162760 ~/Downloads/votes.json
Sample output:
Checklist
Before you mark the PR ready for review, please make sure that:
<PR type>: <area>: <change being made>
fix: mempool: Introduce a cache for valid signatures
PR type
: fix, feat, INTERFACE BREAKING CHANGE, CONSENSUS BREAKING, build, chore, ci, docs,perf, refactor, revert, style, testarea
: api, chain, state, vm, data transfer, market, mempool, message, block production, multisig, networking, paychan, proving, sealing, wallet, deps