oxen-io / eth-sn-contracts

4 stars 8 forks source link

Allow leave requests events to be repeated #95

Closed jagerman closed 5 days ago

jagerman commented 1 week ago

If a leave request gets missed (because of an exceptional circumstance on the Oxen chain) then the Oxen chain never gets the confirmed leave request, and so the node cannot complete a normal, graceful exit because the Oxen SN network will never sign a leave request. While there is a contract fallback for this, it triggers after 30 days, meaning the SN's obligations get extended by an extra 15 days, which may be undeseriable (for example, if someone has scheduled cancellation of a hosting plan).

This commit removes the revert for a repeated request so that if such a situation does occur, the operator or a contributor can submit another leave request call to attempt to propagate the event through to oxend again. Such duplicates can be helpful (as described above), but are otherwise harmless: oxend simply ignores a leave request for an already-unlocking node.

Such a subsequent request does not affect the leave request timestamp, but merely reissues a leave request event.

Doy-lee commented 6 days ago

This looks good, but I'd rate limit the amount of times this is allowed to be called as there's potential for spam. We'll need another field in the struct to track the last leave request that was sent and update that as we go as well as maintaining the original leave request timestamp.

Doy-lee commented 5 days ago

Added a rate limit in https://github.com/oxen-io/eth-sn-contracts/pull/98 didn't have permission to push to this branch. So closing this and merging in the other branch.