-
Notifications
You must be signed in to change notification settings - Fork 112
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
Delegated mining #1011
Delegated mining #1011
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.
Interesting, when we discussed this earlier it seemed like we'd need two mappings, but you've done it with one -- using the miner address to look up the delegator during the mining process, and requiring the delegator to pass the mining address explicitly while setting.
contracts/reputationMiningCycle/ReputationMiningCycleCommon.sol
Outdated
Show resolved
Hide resolved
905732c
to
f217f97
Compare
So I've added restrictions that mean that anyone doing any sort of mining must either have tokens staked, or be a delegate miner for another address. If they have both, the former takes priority. This is to avoid the possibility that existed in the original implementation of 'stealing' miners by naming them as your delegate. In this implementation, you still can, but it has no effect (while they have tokens staked). Previously, There were a good number of knock-on effects in the tests, unfortunately, but I think broadly speaking this is better. I don't think it presents a risk of getting in to issues either. |
2b7570c
to
2ddf7db
Compare
2ddf7db
to
586308a
Compare
contracts/reputationMiningCycle/ReputationMiningCycleCommon.sol
Outdated
Show resolved
Hide resolved
contracts/reputationMiningCycle/ReputationMiningCycleCommon.sol
Outdated
Show resolved
Hide resolved
What was the reason for restricting |
So it originally came up because we call
By requiring this function call to be made by someone with tokens staked, we guarantee at least one person is able to continue the mining cycle. If the only person with tokens staked is malicious, then they're still able to break things (by unstaking after calling |
Closes #1002
Draft status, as not ready to merge, but after feedback.
Implements what Daniel and I vaguely talked about a while ago. Basically, everything stays the same, but instead of using
msg.sender
during mining, we instead call a function that either returnsmsg.sender
(i.e. the fallback case should be the existing functionality) or, if a delegation has been awarded tomsg.sender
, returns the address they are allowed to mine on behalf of.