-
Notifications
You must be signed in to change notification settings - Fork 5
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
Implement ScorchedEarth Mechanics Using ForceMove Protocol #8
base: master
Are you sure you want to change the base?
Conversation
* Ensures that React Phases have a Reaction while Suggest Phases do not * Ensure React Phases do not have a suggestion URL while Suggest Phases do.
Whent the Suggester signs a Suggest phase, they configure all allocations as if the user will choose the Burn reaction, thus committing themselves to the possibility of this negative action. The User, subsequently, has the ability to undo this fund burn and instead Reward the user if they choose.
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.
Hey @apbendi this looks great to me! I'm not sure I know enough about your application to comment on how well it covers what you want, but I have posted a couple of questions above and will try and dig in some more.
chain/contracts/ScorchedEarth.sol
Outdated
require(bytes(_data.suggestion).length == 0, | ||
'ScorchedEarth: React Phase must not have suggestion'); | ||
} else { | ||
require(false, 'ScorchedEarth: Invalid Phase'); |
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 revert('msg')
be a minor improvement to require(false,'msg')
?
require( | ||
allocation.length == 3, | ||
'ScorchedEarth: Allocation length must be 3 (Suggester, Sender, Burner)' | ||
); |
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.
To be clear: I assume nParticipants=2
, despite there being 3 destinations in the outcome? It might be worth requiring
that.
Have you thought about the implications of this? I may have misunderstood, but if 2 out of 3 beneficiaries are in the channel and the remaining one is not, those two could collude to conclude the channel with whatever outcome they wished, say to cut out the 3rd beneficiary (and the rules in this contract can't prevent that, since no app logic is evaluated during a conclude). Would that be a problem, do you think?
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.
To be clear: I assume nParticipants=2, despite there being 3 destinations in the outcome?
Correct. The third address is the beneficiary of any funds that are "burned" in the course of the User & Suggester's interactions.
It might be worth requiring that.
I considered this, but wasn't sure if it was critical. As long as the clients refuse to sign a state with more than 2, is there a potential for abuse here I'm not considering? Might be worth it regardless, as gas would be minimal.
if 2 out of 3 beneficiaries are in the channel and the remaining one is not, those two could collude to conclude the channel with whatever outcome they wished, say to cut out the 3rd beneficiary
Yes, this is definitely the case, and we are ok with it. Note the last line in this section of the spec. We figured that, while the two participants can always collude to unburn their funds, the very fact we're operating under the assumption of a behavioral "resentment" assumption makes this unlikely to happen. It's also not a big deal if it does, as they're not stealing funds from the Burner (the burner's initial balance is always 0).
Thanks so much for the thoughtful review @geoknee. Much appreciated! |
Question from an out of band conversation with @barryWhiteHat: Could we remove the requirement that the core parameters (payment, userBurn, and suggesterBurn) remain the same for the length of the channel? This would allow future client implementations to implement negotiation of new params within the lifecycle of the client, though for now, the clients could just hardcode that they wouldn't sign a subsequent state if their counterparty changes this state in theirs. Thinking through this question. If we remove the check in the contract, but enforce it in the clients, then the What happens, though, in the theoretical future when clients allow these parameters to change during the lifecycle of a channel?
There's a mirror version of this problem if the User proposes the change and the Suggester accepts them. I don't see a clear fix for this that doesn't add significant complexity. Obviously we could add a new set of Phases (Propose, Reject, Accept) and specific rules around those, but this is a considerable expansion of scope. Thoughts @barryWhiteHat? Am I missing an easy resolution? |
So the problem is that N to N+1 is correct but N-1 to N is not correct. And this problem would only present itself when someone tried to exit with the transition from N-1 to N. During the dispute resolution how do we ensure that the dispute is not happening with an old state? The attempt to exit with transition from state N-1 would mean that we are in an old state ? |
I'll let @geoknee weigh in here, but my current reading of the way the protocol works would suggest that it would never be a good idea to have users sign back-to-back states that don't pass the The state needs to be supported by further signatures, so I believe at the Nth state, the (N-1)th state would be the last supported state a participant could use to close the channel. |
I think that any parameter that we want to users to be able to update as long as they agree should not be part of the transition check. There must be some space in this framework for users to cahnge this. For example when generating a random number while playing games of chance. |
My thoughts:
This isn't strictly true, although I can appreciate why you might have gotten that impression. Buried deep in the notes you'll find the idea of a null app. We rely on this idea heavily when updating "ledger" (i.e. non-application) channels. The relevant point here, though, is that state channel participants can escape from the strict turn-taking and In your example of the suggester changing the channel parameters at turn Does that make sense? |
I haven't dug into understanding how virtually funded channels work. Do they require an on-chain operation?
Cool, this could work too, it sounds like. So if you have a state that's supported because it's signed by both parties, can you call |
No, they don't; but they do require a state channel "hub" to be running as well as a more complicated sequence of operations to safely fund and defund the application you want to fund. It's actually a lot simpler to think about "ledger" or "indirect" funding, which would give the same benefits here, and no hub required. Essentially, User + Suggester directly fund a special "ledger" channel in the usual way, with enough money to cover several different ScorchedEarth instances. Then, they can spin up and fund, complete and defund those several instances off-chain.
Exactly! |
Seems like we don't need to validate the transition at all. I think forcing transitions is for games and things like that. In our usecase we just want to exit from the latest valid state. If users refuse to sign a state we just exit from the one before. |
I think it's still worthwhile to ensure the asset allocations transition according to the agreed upon parameters in the normal case. But having both parties sign the same state does give us a way to "negotiate" new rates in a future version of the clients, without updating this contract code at all. Virtual channels sound like they'd do so as well, though I don't claim to have my head around those yet. Regardless, it seems we can likely proceed without any changes to this contract. |
Implements the transition mechanics of the ScorchedEarth system so as to be compatible with
ForceMoveApp
in the Nitro Protocol, with a full test suite covering all critical rules.Specific rules which are implemented: