defi-wonderland / aztec-private-oracle

9 stars 1 forks source link

Requester can cancel answered note #8

Open spalladino opened 1 year ago

spalladino commented 1 year ago

I may be missing something, but since answer is not emitting a nullifier, the user is allowed to cancel a note already answered, right?

https://github.com/defi-wonderland/aztec-private-oracle/blob/afe8cb4e3bc34219f925859790be56c79fb0188c/src/main.nr#L221-L237

skeletor-spaceman commented 1 year ago

you are correct, but I think the main difference is that we only pay for canceled questions, answers cannot be cancelled. does this make sense? feel free to close if so :)

spalladino commented 1 year ago

I think this will be clear when fees are added, right? The issue would be if the user can get a refund for cancelling a question that was already answered.

skeletor-spaceman commented 1 year ago

I see what you mean. And yes, this will be way clearer when we add fees. Also, even when a question has previously been answered. The flow for creating a new "instance" of that same questions is the same. The divinity will still get a new Question Note liked into the same nullifier as the Users Question Note. The only difference in the flow is when the Divinity answers, it will need to provide both that newly created Question note and the original Answer Note. This makes it so that the Answers are always the same, and then it nullifies the User Question Note & creates a new Answer Note for that User.

On this flow, the User, after creating the Question Note, can still nullify it to get the funds back, and in turn it will nullify the Question Note that the Divinity should use to replicate the Answer.