Skip to content

RPC Delete intent #563

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

Merged
merged 4 commits into from
May 26, 2025
Merged

RPC Delete intent #563

merged 4 commits into from
May 26, 2025

Conversation

sekulicd
Copy link
Collaborator

This adds DeleteIntent RPC.

This closes #557

@altafan please review.

Copy link
Collaborator

@altafan altafan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add DeleteIntent to the pkg/client-sdk/client service interface and related grpc and rest impls

@altafan
Copy link
Collaborator

altafan commented May 15, 2025

Let's also add the second way of deleting an intent: if the user forgot the intent id, they can provide a new bip322 proof spending any of the inputs spent by the registered intent to prove the ownership and the right to execute the operation.

@sekulicd
Copy link
Collaborator Author

Let's also add the second way of deleting an intent: if the user forgot the intent id, they can provide a new bip322 proof spending any of the inputs spent by the registered intent to prove the ownership and the right to execute the operation.

@altafan please review.

if err != nil {
return err
}
var idsToDelete []string
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be a map to prevent duplicates

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 1489 to 1491
if in.Txid == op.Hash.String() && in.VOut == op.Index {
idsToDelete = append(idsToDelete, req.Id)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the idea is to allow deleting only one intent at a time, not many. So, shall we break once we found the id to delete?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure about this, as user can craft proof with vtxos belonging to diff intents, maybe delete all? @altafan

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah

Copy link
Contributor

@Kukks Kukks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small change for the proto

@@ -119,6 +125,12 @@ message RegisterIntentResponse {
string request_id = 1;
}

message DeleteIntentRequest {
string request_id = 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these should be oneOf. EIther you provide the intentid (which is a user secret) , or you provide an input (a single input is enough) in a bip322. The reasoning is that intent id is trivial and straightforward, but in the case of a wallet recovery where you only have a private key, the bip322 option works.

requestID := req.GetRequestId()
bip322Signature := req.GetBip322Signature()

if requestID != "" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AH i see it's already in the code as I described. Just needs the proto to use the oneof style?

Copy link
Contributor

@Kukks Kukks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also please get a test added?

@altafan altafan merged commit 0fb2be3 into arkade-os:next-version May 26, 2025
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants