MostroP2P / mostro

Lightning Network peer-to-peer exchange platform on Nostr
https://mostro.network
MIT License
189 stars 32 forks source link

bug: two admins can take the same dispute #264

Closed Catrya closed 6 months ago

Catrya commented 6 months ago

I took a dispute using 2 admin users. The buyer and seller received 2 messages that their dispute had been accepted.

When an administrator accepts a dispute, Mostro must not allow another administrator to accept it, to avoid contradictions.

that It's not a priority

Mostro sent you this message:

{"order":{"version":1,"id":"ea84da8c-8048-4061-80f0-78907b0b0f11","pubkey":null,"action":"admin-took-dispute","content":{"peer":{"pubkey":"00000018............................................................05"}}}}

Mostro sent you this message:

{"order":{"version":1,"id":"ea84da8c-8048-4061-80f0-78907b0b0f11","pubkey":null,"action":"admin-took-dispute","content":{"peer":{"pubkey":"000000909........................................................10"}}}}

Bye Bye!
arkanoider commented 6 months ago

Hi @Catrya ,

clear! In your experience if a solver ( not the admin ) takes a dispute an admin could take it too or we should think about only one operator assigned to a single dispute?

In this case I can fix just checking the state of the dispute is different from initiated.

Let me know your opinion!

Catrya commented 6 months ago

Hi @arkanoider Well, first I had thought that if a solver took the dispute no one else could do it (not even the admin). But @grunch is right when he says that all the powers must be maintained to the admin.

So now I think it would be better if:

arkanoider commented 6 months ago

I agree with this solution

arkanoider commented 6 months ago

Hi @Catrya ,

question for @grunch , I was looking to fix this and I have a doubt:

Dispute open --> A solver takes it and dispute goes inProgressstatus --> if an admin takes over the solver than the solver won't be able to close it right?

Dispute open --> A solver takes it and dispute goes inProgressstatus : at this stage is it possible that the admin takes the dispute in another status without closing it? Lookin to code it seems that all next step are conclusive for the dispute, but my doubt is just if there is another state after InProgress that could be, let me say a wait state. Then an admin takes over the solver in this state...what happens to dispute status...now it will be resetted to inProgress, and sounds right to me, but I am just asking if it's correct!

grunch commented 6 months ago

Dispute open --> A solver takes it and dispute goes inProgressstatus --> if an admin takes over the solver than the solver won't be able to close it right?

Correct, only the admin can take a dispute with status = in-progress, so no other solver can take a dispute from another solver

Dispute open --> A solver takes it and dispute goes inProgressstatus : at this stage is it possible that the admin takes the dispute in another status without closing it? Lookin to code it seems that all next step are conclusive for the dispute, but my doubt is just if there is another state after InProgress that could be, let me say a wait state. Then an admin takes over the solver in this state...what happens to dispute status...now it will be resetted to inProgress, and sounds right to me, but I am just asking if it's correct!

I'm not sure if I understand correctly, tell me more about this wait state? I was thinking when an admin take a dispute previously taken by a solver just to keep the in-progress state, do you think is necessary to add a new status to clarify what happened in this case?

arkanoider commented 6 months ago

I'm not sure if I understand correctly, tell me more about this wait state? I was thinking when an admin take a dispute previously taken by a solver just to keep the in-progress state, do you think is necessary to add a new status to clarify what happened in this case?

I was just thinking if any of the other states apart from in-progress state allow the admin to take the dispute in charge, but probably you yet answered to me @grunch , only if dispute is in-progress admin can take the dispute over the solver.

grunch commented 6 months ago

I was just thinking if any of the other states apart from in-progress state allow the admin to take the dispute in charge, but probably you yet answered to me @grunch , only if dispute is in-progress admin can take the dispute over the solver.

exactly because the other statuses mean that the solver already solved the dispute

arkanoider commented 6 months ago

First idea for closure with #277

grunch commented 6 months ago

closing it via #277